Page 2 of 3

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 1:20 am
by Akatsukami
An S913 abend (or completion code) is a RACF error; your ID doesn't have access to some resource, usually a data set. I would have to see the sysout or terminal to be sure, however; a S913 abend is a system[/ii] completion code, not a [i]user completion code.

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 6:05 am
by steve-myers
Akatsukami wrote:... (Incidentally: is IDCAMS integrated into your TSO environment? At my last client, it was a separate environment; IDCAMS commands had to be preceded by an ADDRESS instruction.)

As far as I know, all the common IDCAMS commands are implemented as TSO commands in all TSO environments. In other words, you specify TSO REPRO ... in a Rexx script you will get the TSO command version of the IDCAMS REPRO command.

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 10:56 am
by arya_starc
Hi Steve
But by Repro shall I copy the single member at a time.As below code may be not working for copy the specific member as it is copy the whole pds member to another pds

if (x="OK") then
do
  say "Yes!"
  "REPRO INFILE(INDD) OUTFILE(OUTDD) REPLACE"
  "FREE F(INDD, OUTDD)"
end
else
  say "No :("
 

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 1:43 pm
by NicC
In the code snippets shown you do not appear to have allocated a data set(member) to INDD (or any other allocation of INDD).

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 3:03 pm
by arya_starc
NicC wrote:In the code snippets shown you do not appear to have allocated a data set(member) to INDD (or any other allocation of INDD).


Hi NicC,

I allocated the pds in the same by this below code

"ALLOC F(INDD) DSN('VM.PDS.D10.PF.JCLLIB') SHR REU"
"ALLOC F(OUTDD) DSN('VM.PDS.D10.PF.JCLLIB2') SHR REU"
 

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 3:20 pm
by willy jensen
I will offer the following alternative. It uses the member list as a sort of check variable list, it copies using REPRO which replaces members, and it it uses LISTDS in stead of SYSDSN. I will leave the details as an exercise for the OP.

/* Rexx */                                          
 Address TSO                                        
 cmbr.=''                                          
 cds  = 'a.lib.list'   /* dataset with member list */        
 sds  = 'a.lib.data'   /* srclib          */        
 td1  = 'a.lib.out1'   /* target lib 1    */        
                                                   
 /* load member control stem */                    
 zz=Bpxwdyn('alloc da('cds') shr rtddn(cdsdd)')    
 "execio * diskr" cdsdd "(stem cds. finis)"        
 zz=Bpxwdyn('free dd('cdsdd') ')                    
 do i=1 to cds.0                                    
   name=word(cds.i,1)                              
   cmbr.name='X'   /* mark in use */                
 end                                                
                                                   
 /* load source member list */                      
 zz=outtrap('smbr.')                                
 "listds '"sds"' members"                          
 zz=outtrap('off')                                  
 do n=7 to smbr.0                                  
   say 'Source member:' smbr.n                      
   sm=word(smbr.n,1)                                
   if cmbr.sm='' then iterate     /* member not in check-list */                  
   say 'Copy member' sm                            
   "repro inda('"sds"("sm")') outda('"td1"("sm")')"
 end                                                
 

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 3:33 pm
by willy jensen
Just remembered that the REPRO will only work if the datasets are not in use. Replace the copy section with the following to handle allocated datasets.

do n=7 to smbr.0                                        
  say 'Source member:' smbr.n                          
  sm=word(smbr.n,1)                                    
  if cmbr.sm='' then iterate                            
  say 'Copy member' sm                                  
  zz=Bpxwdyn('alloc da('sds'('sm')) dd(sds) shr reuse')
  zz=bpxwdyn('alloc da('td1'('sm')) dd(td1) shr reuse')
  "repro infile(sds) outfile(td1)"                      
end                                                    
"free dd(sds td1)"                                      
 

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 10:35 pm
by arya_starc
the below code is working fine when I execute this rexx by giving EX coomand in front of the member.

/* REXX   */

"ALLOC F(INFILE) DSN('AVPS.PS.FILE') SHR REU"
"EXECIO * DISKR INFILE( FINIS STEM MYFILE."
"FREE F(INFILE)
Address 'ISPEXEC'
ARG INDD OUTDD NFLAG
OUTDD = "
"AVPS.PDS.TEST""
INDD = "
"AVPS.PDS.TEST1""
ADDRESS 'TSO'"
ALLOC DA("OUTDD")NEW LIKE("INDD")"
 I = 1
DO WHILE I <= MYFILE.0
MEMBER = FILE.I
LOOKFOR = "
'AVPS.PDS.TEST1("MEMBER")'"
X = SYSDSN(LOOKFOR)
IF X = 'OK' THEN DO
    "
LMINIT DATAID("DATA1")DATASET("INDD")ENQ(SHR)"
    "
LMINIT DATAID("DATA2")DATASET("OUTDD")ENQ(SHR)"
    "
LMCOPY FROMID("DATA1")FROMMEM("MYFILE.I")TODATAID("DATA2")"
END
ELSE
SAY NO
I = I + 1
END
EXIT


But it is not executed when I run the below rexx by pass the parameters thru the below jcl

rexx code

/* REXX   */

"ALLOC F(INFILE) DSN('AVPS.PS.FILE') SHR REU"
"EXECIO * DISKR INFILE( FINIS STEM MYFILE."
"FREE F(INFILE)
Address 'ISPEXEC'
ARG INDD OUTDD NFLAG
DO WHILE I <= MYFILE.0
MEMBER = FILE.I
LOOKFOR = "
'AVPS.PDS.TEST1("MEMBER")'"
X = SYSDSN(LOOKFOR)
IF X = 'OK' THEN DO
    "
LMINIT DATAID("DATA1")DATASET("INDD")ENQ(SHR)"
    "
LMINIT DATAID("DATA2")DATASET("OUTDD")ENQ(SHR)"
    "
LMCOPY FROMID("DATA1")FROMMEM("MYFILE.I")TODATAID("DATA2")"
END
ELSE
SAY NO
I = I + 1
END
EXIT


JCL code

//step30  exec pgm=IKJEFT01,PARM='REXXJCL5'
//SYSEXEC  DD  DSN=TS.PAC9.PDS.REXX,DISP=SHR
//INDD     DD  DSN=AVPS.PDS.TEST1,DISP=SHR
//OUTDD    DD  DSN=AVPS.PDS.TEST,DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSTSPRT DD  SYSOUT=*
//SYSTSIN  DD  DUMMY
 


Can anyone help me to build the correct JCL.

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 10:42 pm
by Akatsukami
Remember, Arya-chan that you must help us help you. Show us a trace of the script's execution, and the JES message sysout.

Re: Read PDS member in array

PostPosted: Thu Jan 05, 2017 10:44 pm
by willy jensen
First of all I think this should be a new subject.
Next you fail to tell us what's not working, but from your post I assume that you get a JCL error because you have lowercase data in the JCL:
//step30 exec pgm=