MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
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.
Code: |
/* 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
Do
Say "Alloc error... Bye!"
Exit
End
"EXECIO * DISKR A (STEM LINES. FINIS"
"FREE F(A)"
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
Do
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 */
End
End
End
"ALLOC REUSE OLD F(A) DA('" || outdsn || "')"
"EXECIO" output.0 "DISKW A (STEM OUTPUT. FINIS"
"FREE F(A)"
Address ispexec "EDIT DATASET('"outdsn"')" |
|
|