REXX Code to find if PDS JCL member has how many DD



IBM's Command List programming language & Restructured Extended Executor

REXX Code to find if PDS JCL member has how many DD

Postby abhilashanaik » Tue Sep 14, 2021 11:17 am

Hi All,

I have a requirement where I need to code REXX program giving input as PDS library(which will be JCLlib) and for each member how many DD statement it has
and there corresponding file names and for each step which program is used . I need output report. Can someone help.?

Thank you
abhilashanaik
 
Posts: 2
Joined: Tue Sep 14, 2021 10:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: REXX Code to find if PDS JCL member has how many DD

Postby willy jensen » Tue Sep 14, 2021 2:51 pm

I choose to assume that your problem is with reading the members..
A couple of possibilities springs to mind.
- combine all members to one sequential dataset using i.e. program PDSPRINT from file 316 at http://www.cbttape.org, then parse the dataset.
- do a TSO LISTDS .. MEMBERS then do your own ALLOCATE and EXECIO to read each member for parsing.
- use the following REXX pgm DOALL to run an edit macro to do the actual parse.
/*                                                               rexx  
  Run an edit macro against all members of a library                    
  Adapted from DOALL from Lionel B. Dyck                                
 */                                                                    
                                                                       
 arg dsn exec . /* libraryname and editmacro name                     */
                /* libname must be the full name, quotes are optional */
 dsn=requote(dsn)                                                      
                                                                       
 x = outtrap("lm.","*")                                                
 "LISTD" dsn "MEMBERS"                                                  
 x = outtrap("off")                                                    
                                                                       
 do i = 1 to lm.0 while lm.i<>'--MEMBERS--'                            
 end                                                                    
 dsn=unquote(dsn)                                                      
 do n = i+1 to lm.0                                                    
   parse value lm.n with mem .                                          
   Address ISPEXEC "EDIT DATASET('"dsn"("mem")') MACRO("exec")"        
 end                                                                    
 exit                                                                  
Requote: if arg(1)='' then return '';else return "'"Unquote(arg(1))"'"  
Unquote: return strip(space(translate(arg(1)," ","'")))                
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: REXX Code to find if PDS JCL member has how many DD

Postby abhilashanaik » Tue Sep 14, 2021 3:25 pm

My requirement is :

I need to fetch below details for each JCL in pds member.
For each step
Program
DD name
Dataset
abhilashanaik
 
Posts: 2
Joined: Tue Sep 14, 2021 10:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: REXX Code to find if PDS JCL member has how many DD

Postby willy jensen » Tue Sep 14, 2021 4:01 pm

I see, so are new to REXX and don't know how to parse a text?
You have to read the manual, specifically the POS and SUBSTR functions, and the PARSE command for starters.
What have you done so far?
I'll give you a sample, looking for a DDname in string text.n:
if left(text.n,2)='//' & word(text.n,2)='DD' then ddname=substr(word(text.n,1),3)
willy jensen
 
Posts: 465
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: REXX Code to find if PDS JCL member has how many DD

Postby sergeyken » Tue Sep 14, 2021 6:09 pm

You also need to take into account:

0) maybe, some members are not JCL at all?
1) either a member has JOB statement(s) in it, or not?
2) maybe, a single member has multiple JOBs inside of it? (This is possible, though not used too often)
3) maybe, there are internal JCL PROCedures as part of any job?
4) maybe, the member itself is an external JCL procedure?
5) maybe, some JOB/EXEC/DD/PROC statements are obsolete, and just commented out with //*?
6) maybe, there are concatenated DD statements (e.g. formal DD looking as no-name statements)?
7) maybe, some good-looking JCL sequences are coded as input stream, e.g. between // DD DATA, and /* ?
8) many other tricks and gimmicks are possible.

As for myself, I would create a flat listing of the library (using an utility like IEBPTPCH, or SUPERC, or any other available), end then would produce a regular report grouped by member/job/step/DD - using one of SORT utilities. The creation of a correct hierarchical report in REXX would require some experience in programming. While using SORT utility, much less experience may be needed.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 436
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: REXX Code to find if PDS JCL member has how many DD

Postby sergeyken » Wed Sep 15, 2021 6:02 am

abhilashanaik wrote:My requirement is :

I need to fetch below details for each JCL in pds member.
For each step
Program
DD name
Dataset

Don’t be so rude re-assigning to others the task you are supposed to do, and which you are (highly likely) paid for?

Demonstrate that you are able to do at least a minor first step by yourself, before begging for help.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 436
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post