Page 1 of 1

Need to create PDS member and write the lines in each member

PostPosted: Sat Mar 16, 2019 10:07 pm
by arya_starc
Hi All,

I am writing a rexx in which new member is allocated and in each member I am writing few line of code, all this had been done in single rexx.
Issue that I am facing first member lines are being override in consecutive member, Below is the code:-


/* REXX */
PDS = "XYZ.TEST.IN"
PDS4 = "ABC.TEST.OUT"
pds1 = pds || "("||MAINPROC||")"
"ALLOC FI(PDS1) DA('"PDS1"') SHR REUSE"
"EXECIO * DISKR PDS1 (STEM PROC1. FINIS"
"FREE FI(PDS1)"
SAY 'ENTER NUMBER OF MEMBER'
PULL NOM
DO P=1 TO NOM
      SAY 'ENTER MEMBER NAME'
      PULL  NEWMWMB
      SAY 'ENTER LINES TO BE COPIED'
      PULL LINE
      pds2 = pds4 || "("||newmemb||")"
      "ALLOC FI(PDS2) DA('"PDS2"') SHR REUSE"
DO J=1 TO LINE
     PROCO.J = PROC1.J
     "execio * diskw pds2(stem proco.finis")
END
END
EXIT
 


This issue somewhere related to while allocation of new member.Kindly help me on this.
Thanks in advacnce.

Re: Need to create PDS member and write the lines in each me

PostPosted: Sat Mar 16, 2019 11:34 pm
by prino
Add "trace ?r" to your code and execute it step by step!

Re: Need to create PDS member and write the lines in each me

PostPosted: Sun Mar 17, 2019 1:51 pm
by arya_starc
Hi Prino

I tried with "trace ?r" but I can see that loop is running correctly but whwn I see the output in member the number of lines in each member is incorrectly.
Please advise on that.

Re: Need to create PDS member and write the lines in each me

PostPosted: Sun Mar 17, 2019 4:47 pm
by NicC
Why are you closing pds2 after EVERY write? Why are you creating a stem but only writing one line at a time? I could go on but...

Re: Need to create PDS member and write the lines in each me

PostPosted: Sun Mar 17, 2019 6:39 pm
by enrico-sorichetti
since You write only the first <line> lines

instead of
DO J=1 TO LINE
     PROCO.J = PROC1.J
     "execio * diskw pds2(stem proco.finis")
END
 


use
"execio" line "diskw pds2 (stem proc1. finis "

Re: Need to create PDS member and write the lines in each me

PostPosted: Tue Mar 19, 2019 3:11 pm
by willy jensen
Is MAINPROC the name of the input memer, you are using it as a ariable?
Does the input member contain null lines? That will cause EXECIO * DISKW to stop. Always use a number instead of the asterix in DISKW.