/* TIDY UP YOUR JCL REXX */ /* OBTAINED FROM CBT TAPE #9102 -- FILE095 MEMBER FIXJCL*/ /********************************************************************/ address "ISREDIT";"macro (help) NOPROCESS" started = date('n') time('n') help = translate(help) if help = "?" | help = "HELP" then do; address "tso" "clist fixjcl help" /* --- help information*/ /*address "ispexec" "display panel(fixjcl)" */ exit end; /* */ /* Align jcl JOB, EXEC, and DD statements on standard boundaries */ /* T. M. Hanes, ASYST Inc. 1988/02/01 */ /* D.E.M.I., 1988/03/01 */ /* D.McRitchie, 1993/06/14 converted to rexx */ /* D.McRitchie, 1993/12/16 much faster, less compression */ /* very little, if any, resemblence to the original */ /* */ /* site dependent definitions: */ /* alignment columns for card types */ /* */ /* preserve continuation characters in 72 */ "process range j" if rc = 0 then do; "(rcmd) = range_cmd" "(jzf) = linenum .zfrange" "(jzl) = linenum .zlrange" end; else do; "(jzf) = linenum .zfirst" "find last '//' 1" if rc \= 0 then do ZEDSMSG = "NO JCL" ZEDLMSG = 'Immediate EXIT, because no JCL to fix' ADDRESS "ISPEXEC" "SETMSG MSG(ISRZ000)" exit 1 end "(jzl) = linenum .zcsr" end; "label" jzf "= .jzf 1" "label" jzl "= .jzl 1" ljzf = ".jzf" ljzl = ".jzl" if jzf = jzl then ljzf = ".jzl" "(cl,cr) = cursor" "(lb,rb) = bounds"; "(caps) = caps" "bounds = 1 71" /* JOB, PROC, EXEC, DD and PEND; conversion */ call process_keywd( 'OUTPUT') call process_keywd( 'PROC' ) call process_keywd( 'EXEC' ) call process_keywd( 'DD' ) call process_keywd( 'PEND' ) call process_keywd( 'JOB' ) call continuations; "bounds =" lb rb; "caps =" caps "left max" "reset x" "cursor =" cl cr zfnote = "line_before .zfirst = noteline" ended = time('n') zfnote "'"sysvar("sysicmd") "start:" started", end:" ended"'" zfnote "' after fixjcl recommend use of compare *, and !edchek'" exit 0 /* -------------- subroutines ------------------------- */ process_keywd: arg keywd "x all" ljzf ljzl "f ' "keywd" ' 3 25 all" ljzf ljzl /* fix common mistake where keyword begins column 13-15*/ "c ' "keywd" ' ' "keywd" ' 11 all nx" ljzf ljzl "c ' "keywd" ' ' "keywd" ' 11 all nx" ljzf ljzl "c ' "keywd" ' ' "keywd" ' 11 all nx" ljzf ljzl if keywd = 'DD' then do "x ' DD ' 11 all" ljzf ljzl "c ' DD ' ' DD ' 11 all nx" ljzf ljzl end "x ' "keywd" ' all 11" ljzf ljzl /* insure we have JCL without being able to do a find */ /* exclude non-JCL and JCL comment cards. */ "x 1 2 ' ' all" LJZF LJZL "x 1 2 p'#' all" LJZF LJZL "x 1 2 p'@' all" LJZF LJZL "x 1 '//"||"*' all" LJZF LJZL "x 1 '/"||"*' all" LJZF LJZL do forever; /* rigorous check make sure jcl continuation*/ "find p'^' 1 next" LJZF LJZL if rc \= 0 then leave "(line) = line .zcsr" if substr(line,1,2) \= '//' then "x all .zcsr .zcsr" end /* I think spaces could lurk in quotes */ "x ""'"" all " ljzf ljzl /*'*/ "x '""' all " ljzf ljzl "f ' "keywd" ' 3 25 first nx " ljzf ljzl if rc /=0 then return /* let ispf remove extra spaces as needed */ do i = 3 to 10 /* must begin 3 for dd continuations*/ "c" i "' "keywd" ' ' "keywd" ' all nx" ljzf ljzl if keywd = 'DD' then do "x ' DD ' 11 all" ljzf ljzl "c ' DD ' ' DD ' 11 all nx" ljzf ljzl end "x 11 ' "keywd" ' all " ljzf ljzl end return; continuations: /* continuation card conversion */ "x all" ljzf ljzl "f '// ' 1 all" ljzf ljzl /* fix common mistake where continued in column 17 */ "c '// ' all '// ' nx" ljzf ljzl /* //34567890123456 //3456789012345 */ /* do not work with continuations that are done*/ "x '// ' all" ljzf ljzl "x ' OUTPUT ' 3 22 all" ljzf ljzl "x ' PROC ' 3 20 all" ljzf ljzl "x ' EXEC ' 3 20 all" ljzf ljzl "x ' DD ' 3 20 all" ljzf ljzl "x ' PEND ' 3 20 all" ljzf ljzl "x ' JOB ' 3 20 all" ljzf ljzl do i = 3 to 14 "c" i " ' ' ' ' all nx" ljzf ljzl "x '// ' all" ljzf ljzl end return