Page 1 of 1

REXX query

PostPosted: Thu Nov 15, 2018 10:30 am
by kbkanade
Hi Experts,
I need some help for REXX on below topics. Can i get some high level logic for below on how we can do this.
1. By giving “DB2 Tables”as an input, REXX should show all Cobol programs using that DB2 table.
2. By giving JCL name as input, REXX should show all the programs executed by that JCL.

Re: REXX query

PostPosted: Thu Nov 15, 2018 12:26 pm
by prino
You should find another job.

Re: REXX query

PostPosted: Thu Nov 15, 2018 12:33 pm
by kbkanade
Thanks but I am new to REXX just learning from last month.

Re: REXX query

PostPosted: Thu Nov 15, 2018 12:42 pm
by expat
Click HERE to see if this helps you find what you need.

Once you know what to do, then you can try and code it in REXX

Re: REXX query

PostPosted: Fri Nov 16, 2018 12:49 am
by Pedro
I recommend using the SRCHFOR utility of ISPF to search for text in a PDS. It will write a file that shows which members refer to the text.

You need to figure out how to build and submit the job from rexx.

Re: REXX query

PostPosted: Fri Nov 16, 2018 3:19 pm
by willy jensen
Something of a mouthfull for a newbie.
I dont know much about DB2 tables, so I will comment on item 2 " By giving JCL name as input, REXX should show all the programs executed by that JCL"
Reading a JCL, if stored in a PDS, is trivial. The traditional method is using TSO commands ALLOCATE and FREE, and REXX command EXECIO.
Alternatively you can use the TSO PRINT command as follows:
zz=outtrap('lst.')                                
 "print indataset('datasetname') char"  
 zz=outtrap('off')                                  
 do n=2 to lst.0 by 2                              
   say lst.n                                      
 end

Then it is up you you to scan the result and extract the program names. Hint, lookup REXX commands POS and SUBSTR. Though of course some of the steps in the JCL could be procedures.