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



IBM's Command List programming language & Restructured Extended Executor

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

Postby arya_starc » Sat Mar 16, 2019 10:07 pm

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.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

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

Postby prino » Sat Mar 16, 2019 11:34 pm

Add "trace ?r" to your code and execute it step by step!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

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

Postby arya_starc » Sun Mar 17, 2019 1:51 pm

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.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

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

Postby NicC » Sun Mar 17, 2019 4:47 pm

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...
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

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

Postby enrico-sorichetti » Sun Mar 17, 2019 6:39 pm

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 "
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

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

Postby willy jensen » Tue Mar 19, 2019 3:11 pm

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.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post