Read PDS member in array



IBM's Command List programming language & Restructured Extended Executor

Re: Read PDS member in array

Postby Akatsukami » Thu Jan 05, 2017 1:20 am

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Read PDS member in array

Postby steve-myers » Thu Jan 05, 2017 6:05 am

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.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Read PDS member in array

Postby arya_starc » Thu Jan 05, 2017 10:56 am

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

Re: Read PDS member in array

Postby NicC » Thu Jan 05, 2017 1:43 pm

In the code snippets shown you do not appear to have allocated a data set(member) to INDD (or any other allocation of INDD).
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: Read PDS member in array

Postby arya_starc » Thu Jan 05, 2017 3:03 pm

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

Re: Read PDS member in array

Postby willy jensen » Thu Jan 05, 2017 3:20 pm

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

Re: Read PDS member in array

Postby willy jensen » Thu Jan 05, 2017 3:33 pm

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)"                                      
 
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Read PDS member in array

Postby arya_starc » Thu Jan 05, 2017 10:35 pm

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

Re: Read PDS member in array

Postby Akatsukami » Thu Jan 05, 2017 10:42 pm

Remember, Arya-chan that you must help us help you. Show us a trace of the script's execution, and the JES message sysout.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Read PDS member in array

Postby willy jensen » Thu Jan 05, 2017 10:44 pm

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

PreviousNext

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post