I have a set of JCLs in a library
I need to get a list of PROCs executed in these JCLS ( EXEC statements)
Not all members in the library need to be searched.
Is there a way using REXX routine I can give the library and list of membrs and search for EXEC statement in the JCLs and create an output file
That is a good exercise for learning Rexx... there are many ways to do this. Here is an example (with one impossible to read, but commented trick but I felt like adding it). Enrico is correct though - doing it completely is very difficult. This example won't know if it is searching in-line data (//XXX DD * or //XXX DD DATA,DLM=yy) for example. Other comments left out on purpose since it is a short learning exercise. Error checking left out for brevity.
/* Rexx */
pdsdsn = "DSN910.SVSC.CNTL"
outdsn = "ABCDE.OUTPUT.REPORT"
Call outtrap "stem."
"LISTD '" || pdsdsn || "' MEMBERS"
Call outtrap "OFF"
output.0 = 0
Do a = 7 to stem.0
stem.a = strip(stem.a)
"ALLOC REUSE SHR F(A) DA('" || pdsdsn || "(" || stem.a || ")'"
If rc <> 0 Then
Say "Alloc error... Bye!"
"EXECIO * DISKR A (STEM LINES. FINIS"
Do c = 1 to lines.0
Parse Var lines.c op verb rest .
Parse Var rest rest "," .
If substr(op,1,2) = "//" & ,
substr(op,3,1) <> "*" & ,
verb == "EXEC" & ,
substr(rest,1,4) <> "PGM=" Then
outline = left(stem.a,8) rest
Parse value 1 + output.0 outline With i output.i 1 output.0 .
/* Previous line is same as the following but more fun */
/* i=output.0 + 1 */
/* output.0 = i */
/* output.i = outline */
"ALLOC REUSE OLD F(A) DA('" || outdsn || "')"
"EXECIO" output.0 "DISKW A (STEM OUTPUT. FINIS"
Address ispexec "EDIT DATASET('"outdsn"')"