Page 1 of 1

Need to edit a member in multiple PDS.

PostPosted: Tue Mar 25, 2014 4:14 pm
by samurai
Hello,

i have a new requirement in which the datasets with the naming convention "RESETDB.*.*.AUDB41" has multiple PDS and in it we have to edit a member with same name DELdsn as C all Notify =jjjj to aaaa.

Re: Need to edit a member in multiple PDS.

PostPosted: Tue Mar 25, 2014 4:22 pm
by enrico-sorichetti
thank You for telling us :mrgreen:

Re: Need to edit a member in multiple PDS.

PostPosted: Tue Mar 25, 2014 7:29 pm
by samurai
can someone let me know how to read all the Datasets stored in a PS and reading it one by one.

Re: Need to edit a member in multiple PDS.

PostPosted: Tue Mar 25, 2014 8:58 pm
by Pedro
Use the ALLOC statement, EXECIO statement, and PARSE instruction.

For details about the first, see the TSO Command Reference. For details about the second two, see the TSO REXX Reference.

Re: Need to edit a member in multiple PDS.

PostPosted: Tue Mar 25, 2014 8:59 pm
by NicC
And what is wrong with post that is currently 2 positions below yours? Did you search before posting?

Re: Need to edit a member in multiple PDS.

PostPosted: Tue Mar 25, 2014 9:23 pm
by samurai
Hello pedro,

Thanks for the info, i can read all the data inside ps using ALLOC and EXECIO as below code:

"ALLOC F(IN) DS('MX9C.SAMPLE.JCL')SHR"
"EXECIO * DISKR IN(FINIS STEM INP."
"FREE F(IN)"
DO I = 1 TO INP.0
SAY INP.I
END
"ALLOC F(OUT) DS('MX9C.SAMPLE.JCL')SHR"
"EXECIO * DISKW OUT(FINIS STEM OUT."
"FREE F(OUT)"


Can you tell me how to edit the PDS inside a PS that i have mentioned in ALLOC

my ps contains 2 pds as shown below

MX9C.SAMPLEF.JCL ----> PS

MX9C.SAMPLE1.JCL
MX9C.SAMPLE2.JCL

the above is the PDS inside PS

and each pds has SAM1 as member name in which i need to apply c all xxxx to yyyy


FYI: i have written the below code to change in a member of a single PDS:

"ALLOC F(INFILE) SHR DS('MX9C.SAMPLE1.JCL(SAM1)')"
"EXECIO * DISKR INFILE (STEM RECD. FINIS"
HOW_MANY = RECD.0
DO C = 1 TO HOW_MANY
STRT = POS('NOTIFY=&SYSUID,',RECD.C)
SAY STRT ' STRT POS'
DO WHILE STRT > 0
SAY RECD.C
LN = LEFT(RECD.C,STRT-1)||'USER =RU99,NOTIFY=MX9C,'
RECD.C=LN
STRT=POS(IDCAMS,RECD.C)
SAY RECD.C
END
END C
"ALLOC F(OUTFILE) SHR DS('MX9C.SAMPLE1.JCL(SAM1)')"
"EXECIO * DISKW OUTFILE (STEM RECD. FINIS"

Re: Need to edit a member in multiple PDS.

PostPosted: Wed Mar 26, 2014 12:38 am
by Pedro
the PDS inside a PS

To clarify... what you mean is that you have the names of a PDS. An important detail is 'name'. It is not possible to actually have a PDS inside a PS. (I contend it is not a PDS when it is in an unloaded form).

Re: Need to edit a member in multiple PDS.

PostPosted: Wed Mar 26, 2014 12:56 am
by Pedro
Can you tell me how to edit the PDS


I think you have a good start, but instead of explicitly specifying a data set name:
"ALLOC F(INFILE) SHR DS('MX9C.SAMPLE1.JCL(SAM1)')"
you should use a program variable instead.

Re: Need to edit a member in multiple PDS.

PostPosted: Wed Mar 26, 2014 6:34 pm
by samurai
i have completed this requirment successfully.

read the PDS from PS using EXECIO and processed each DS using the option SYSDSN("'"PDS_NAME"'").

Thanks!