File 127 at cbttape.org contains a handy macro named SYSPUT.
Just code the macro in your working storage; then when you want to write a line;
load the address of the line in R1 and BAL R14 to the macro tag.
The specified dcb (automagically defined within the macro) is opened at first 
use.
The operating system closes the file when the program ends.
There is also a SYSGET macro that works similarly.

EX.
* \---------------------------------------------------
* | \-------------------------------------------------
* | |   THIS PROGRAM WILL SEARCH SYSLOG FOR FILE NAMES
* | /-------------------------------------------------
* /---------------------------------------------------
POSLUNM  ENTER                                        
*                                                     
LOOP     BAL R14,GET1                                 
         LR  R5,R1                                    
         CLC =C'DATA SET ',57(R5)                     
         BNE CKDASH                                   
         MVC NAME1,66(R5)                             
         B   LOOP                                     
*                                                     
CKDASH   DS  0H                                       
         CLC =C'REQUESTED SPACE',57(R5)               
         BNE CKGRPS                                   
         MVC SPAC1,84(R5)                             
         B   LOOP                                     
*                                                     
CKGRPS   DS  0H                                       
         CLC =C'JOBNAME (',57(R5)                     
         BNE LOOP                                     
         MVC GRP1,66(R5)                              
*                                                     
WRI      DS  0H                                       
         MVC LINE,NAME1                               
         LA  R1,LINE                                  
         BAL R14,PUT1                                 
         B   LOOP                                     
*                                                     
ENDIT    DS  0H                                       
         LEAVE                                        
*                                                          
GET1     SYSGET EODAD=ENDIT,DDNAME=DDIN,RECFM=FB,LRECL=133 
PUT1     SYSPUT DDNAME=DDOUT,RECFM=FB,LRECL=133,BLKSIZE=0  
LINE     DC  CL133' '                                      
NAME1    DC  CL46'FIRSTONE'                                
SPAC1    DC  CL12'00000000'                                
         DC  CL2'  '                                       
GRP1     DC  CL8' '                                        
MEM      DC  CL75' '                                       
DATEC    DS  0CL8                                          
YR       DS  CL4                                           
MO       DS  CL2                                           
DY       DS  CL2                                           
         END

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to