Reading and updating the member of a pds using rexx



IBM's Command List programming language & Restructured Extended Executor

Re: Reading and updating the member of a pds using rexx

Postby prino » Wed Jan 25, 2017 4:42 pm

PDS86 or IPOUPDTE are the ways to go!
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: Reading and updating the member of a pds using rexx

Postby willy jensen » Wed Jan 25, 2017 4:55 pm

For this kind of change I fully agree, but as an exercise it might be useful.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: Reading and updating the member of a pds using rexx

Postby NicC » Wed Jan 25, 2017 5:09 pm

You realise that the CHANGESTR statement is trying to find the string "SSIDCAMS" within the string "TAB.J" - not within the string contained in the variable TAB.J?

You still have not explained what DISPLAY is - it is not a Rexx keyword or function so this is probably the cause of thr "ROUTINE NOT FOUND" message. Do not post your interpretation of the trace but post the actual trace - the error messages and a few lines before the point of failure.
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: Reading and updating the member of a pds using rexx

Postby prino » Wed Jan 25, 2017 5:59 pm

CHANGESTR is not a REXX function on z/OS!
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: Reading and updating the member of a pds using rexx

Postby NicC » Wed Jan 25, 2017 6:10 pm

Thanks, Prino. I was using my OS/2 Rexx information as my external hard drive with all my work related stuff is "offline" at the moment (and I was too lazy to Google for the z/OS version - which is now book-marked!).
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: Reading and updating the member of a pds using rexx

Postby arya_starc » Wed Jan 25, 2017 6:46 pm

Hi
Now i am doing different approach for updating the pds member.
As I would like to remove a specific line from a file and each string is different in a member.So i am using the array approach to verify which line has a specific string.
So I would like replaced the particular line string( that had this specific string) .

I tried to code that rexx but it I am not getting how to copy line by line to the output pds member.
As some lines have that specific string and some lines has not.

Below is the rexx code that I write

/*REXX*/                                                                
 TRACE I                                                                
 SAY HI                                                                  
 ADDRESS TSO                                                            
 LIBI = 'VM.LAT.D10A010.PF.JCLLIB.FB.SASH1'                              
 LIBO = 'VM.LAT.D10A010.PF.JCLLIB.FB.SASH2'                              
 "ALLOC F(INFILE) DSN('VM.LAT.D10A010.PF.SCHED3') SHR REU"              
 "EXECIO * DISKR INFILE( FINIS STEM MYFILE."                            
 "FREE F(INFILE)"                                                        
 "ALLOC F(INFILE1) DSN('VM.LAT.D10A010.PF.JCLLIB.FB.SASH1') SHR REU"    
 "EXECIO * DISKW INFILE1( FINIS STEM MYFILE1."                          
 "FREE F(INFILE1)"                                                      
 "ALLOC F(OUTFILE) DSN('VM.LAT.D10A010.PF.JCLLIB.FB.SASH2') SHR REU"    
 "EXECIO * DISKW INFILE( FINIS STEM MYFILE2."                            
 "FREE F(OUTFILE)"                                                      
 "LISTDS'"LIBI"'MEMBER"                                                  
  DO I=1 TO  MYFILE.0                                                    
   SAY ' LINE ' I ':' MYFILE.I                                          

   MEMBER = STRIP(MYFILE.I)                                              
    MEM = LIBI || "(" || MEMBER || ")"                                    
    SAY 'JOBNAME :' MEMBER                                                
    "ALLOC FI(IN) DA('"MEM"') SHR REUSE"                                  
    "EXECIO * DISKR IN (STEM TAB. FINIS"                                  
    "FREE F(IN)"                                                          
    Address 'ISPEXEC'                                                    
    "LMINIT DATAID("DATA1")DATASET("LIBI")ENQ(SHR)"                      
    "LMINIT DATAID("DATA2")DATASET("LIBO")ENQ(SHR)"                      
    "LMCOPY FROMID("DATA1")FROMMEM("MEMBER")TODATAID("DATA2")"            
          DO J = 1 TO TAB.0                                              
             SAY TAB.J                                                    
             IF LENGTH(TAB.J) > 0 THEN DO                                
                TAB.I = OVERLAY('SSIDCAMS','VDIDCAMS',14)                
                SAY 'HERE1' MEMBER                                        
                MEM1 = LIBO || "(" || MEMBER || ")"                      
                DO K =  TAB1.0 TO 1                                      
                ADDRESS TSO "ALLOC FI(IN) DA('"MEM1"') SHR REUSE"        
                ADDRESS TSO "EXECIO "TAB1.0" DISKW IN (STEM TAB1. FINIS"  

              ADDRESS  TSO "FREE F(IN)"                                
               END                                                      
         END                                                            
 END                                                                    
 EXIT                        

 
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: Reading and updating the member of a pds using rexx

Postby NicC » Wed Jan 25, 2017 8:12 pm

There are no arrays in z/OS rexx - you are using stems.

You can use EXECIO to read 1 or many or all lines at a time. The same with writing.

There are several approaches to doing what you want. For example:
. read/write line by line
.read into a stem and copy the lines that you want to another stem and write that.
.have a mixture of the first two e.g. bulk read/write by line

This makes no sense:
DO K =  TAB1.0 TO 1                                      
ADDRESS TSO "ALLOC FI(IN) DA('"MEM1"') SHR REUSE"        
ADDRESS TSO "EXECIO "TAB1.0" DISKW IN (STEM TAB1. FINIS"  

 ADDRESS  TSO "FREE F(IN)"                                
 END  

I do not know what you are intending to do here but it is probably not doing what you want.

Your process should be:
.get a list of members and store in stem - let's call it members.
.loop through each member
.allocate the member
.read it into a stem - let's call it memb_lines.
.loop through each line
.if the line is required:
.change line if a change is required
.write line to output stem - lt us call it lines_out.
.end loop through memb_lines
.write the output stem - lines_out.
.free the member
.end loop through member. stem
.end program
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: Reading and updating the member of a pds using rexx

Postby arya_starc » Thu Jan 26, 2017 3:55 pm

NicC wrote:There are no arrays in z/OS rexx - you are using stems.

You can use EXECIO to read 1 or many or all lines at a time. The same with writing.

There are several approaches to doing what you want. For example:
. read/write line by line
.read into a stem and copy the lines that you want to another stem and write that.
.have a mixture of the first two e.g. bulk read/write by line

This makes no sense:
DO K =  TAB1.0 TO 1                                      
ADDRESS TSO "ALLOC FI(IN) DA('"MEM1"') SHR REUSE"        
ADDRESS TSO "EXECIO "TAB1.0" DISKW IN (STEM TAB1. FINIS"  

 ADDRESS  TSO "FREE F(IN)"                                
 END  

I do not know what you are intending to do here but it is probably not doing what you want.

Your process should be:
.get a list of members and store in stem - let's call it members.
.loop through each member
.allocate the member
.read it into a stem - let's call it memb_lines.
.loop through each line
.if the line is required:
.change line if a change is required
.write line to output stem - lt us call it lines_out.
.end loop through memb_lines
.write the output stem - lines_out.
.free the member
.end loop through member. stem
.end program


Thanks a lot NicC. yes this is my requirement.
I am writing code as per your pseudo code.
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: Reading and updating the member of a pds using rexx

Postby enrico-sorichetti » Thu Jan 26, 2017 4:25 pm

see here for a TESTED snippet
( how to apply a macro to all the members of a pds )

http://ibmmainframes.com/viewtopic.php? ... ight=apply
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: Reading and updating the member of a pds using rexx

Postby arya_starc » Thu Jan 26, 2017 5:02 pm

prino wrote:CHANGESTR is not a REXX function on z/OS!

As here I see the function
http://www.rexxinfo.org/html/functions.html#changestr

then which function can we use for changing the string.
Any alternative for changestr?
arya_starc
 
Posts: 136
Joined: Mon Sep 21, 2015 1:39 pm
Has thanked: 5 times
Been thanked: 0 time

PreviousNext

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post