View previous topic :: View next topic |
Author |
Message |
Srishti Rawat Beginner
Joined: 03 Nov 2021 Posts: 20 Topics: 6
|
Posted: Sat Jun 03, 2023 9:04 am Post subject: Skipping records from input file and writing into output fil |
|
|
I am reading the output file which is a PDS member and writing the records into output pds member which we are creating in the REXX itself and doing some processing.
Here, I want to read the input file and skip the first three records of input file and add some hardcoded value in it. Please find below the ex for your reference:
/*input file
test record 1
test record 2
test record 3*/
/*output pds member
rec 1
rec 2
rec 3*/
Could you please help me out to achieve this. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Sat Jun 03, 2023 5:15 pm Post subject: |
|
|
Srishti Rawat,
Why do you want to use REXX ? Even if you want to use, what is the problem you are having to create a new member with the desired information?
Assuming your PDS members have an LRECL of 80 and RECFM=FB, the following untested JCL will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=Your.pds.name(memname)
//SORTOUT DD DISP=SHR,DSN=Your.pds.name(newname)
//SYSIN DD *
OPTION COPY,SKIPREC=3
INREC BUILD=(06,03,
12,69,
80:X)
/* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Srishti Rawat Beginner
Joined: 03 Nov 2021 Posts: 20 Topics: 6
|
Posted: Sun Jun 04, 2023 1:54 am Post subject: |
|
|
Hi Kolusu,
With DFSORT its quite easy.
I am working on an automation in REXX where we are converting the PROD JCLs into TEST JCLs. So we are taking the existing prod jcl as input and creating a personal library creating a new member every time anyone wants to create a test jcl of prod version. I have replaced all the symbolic parameters but for JOB CARD I need to delete the prod job card and insert our test job card. For this I am trying to use ISREDIT in REXX which is not working. Also I tried to read records sequentially and than writing the records after 4th line into the output member but that is also not working properly for me.
Could you please help me out with the code to delete first three lines of a file and than insert hardcoded values and write rest of the records into output file. |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Tue Jul 25, 2023 2:15 am Post subject: |
|
|
If you're doing it in Rexx, in my mind, you can do it it one of 2 ways.
Either read in the whole PDS member via EXECIO and simply ignore the first 3 records, or .....
edit the file using whatever tool you want and run a Rexx script similar to this
Code: |
Address ISPEXEC 'CONTROL ERRORS RETURN' /* We handle any errors */
Address ISREDIT
'MACRO (PARMS) NOPROCESS'
"locate 1"
"delete 1 3"
/* Insert your new code lines here */
|
But this is so trivial, I'm guessing I'm missing something. _________________ Michael |
|
Back to top |
|
|
|
|