REXX – READ THE DSN PROVIDED AS DD IN JCL
When you execute your REXX EXEC in batch mode, suppose you want to use the file already created in the EXEC by passing it using the JCL (Not through Arguments, but by DD DSN), you can make use of below JCL.
//STEP02 EXEC PGM=IKJEFT01,PARM=(‘%READFL2’)
//SYSPROC DD DSN=YOUR.REXX.EXEC,DISP=SHR
//DD1 DD DSN=YOUR.INPUT.FILE,DISP=SHR
//SYSTSPRT DD SYSOUT=A
//SYSTSIN DD DUMMY
Here READFL2 is your EXEC which will read the dataset YOUR.INPUT.FILE using the DD name provided DD1.
Below I have provided the code for the EXEC READFL2. This EXEC reads the file and displays all the lines in the FILE.
/** REXX **/
“EXECIO * DISKR DD1(STEM AR. FINIS”
DO I = 1 TO AR.0
SAY AR.I
END
EXIT
——————————————————————————————————–
In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog
——————————————————————————————————–
You may also like to look at:
Working on Mainframes – Is Change to a different technology necessary |
hi,
when I am using above code , m getting
DATA SET FILE1 NOT IN CATALOG OR CATALOG CAN NOT BE ACCESSED
The input or output file INDD is not allocated. It cannot be opened for I/O.
EXECIO error while trying to GET or PUT a record.
FILE INDD NOT FREED, IS NOT ALLOCATED
READY
END
Please help me here
Hello,
Thanks for the question. I have made a correction to the blog post. As the dataset is already allocated the DD “DD1”, we can directly read the file using DD1. There is no need for ALLOC command. I have updated the same in the post.