/* Rexx - pretty up jcl */ /* */ /* Supply a parameter to separate individual parts of each statement */ /* */ /* */ Address "ISREDIT " "ISREDIT MACRO (PARM)" "ISREDIT (US) = USER_STATE" "ISREDIT (NUM) = NUMBER" If num = "ON" Then "ISREDIT UNN" 'ISREDIT FIND "//" 1 FIRST' findrc = rc Do While findrc = 0 "ISREDIT (LINE) = LINE .ZCSR" If substr(line,3,1) <> "*" Then Do comma_pos = find_comma() If parm <> "" & comma_pos > 0 Then Do remain = delstr(line,1,comma_pos) line = substr(line,1,comma_pos) If remain <> "" Then Do nextline = "// "remain "ISREDIT LINE_AFTER .ZCSR = (NEXTLINE)" End End Parse Var line label keyword args comment 72 cont 73 . If 0 < pos(keyword,"EXEC DD PROC PEND JOB SET") Then Do lastchar = substr(reverse(strip(args)),1,1) Parse Var args "DSN=" dsn ",DISP=" disp " " If substr(disp,1,1) = "(" Then Do Parse Var disp disp ")" rest disp = disp")" If rest <> "" & substr(rest,1,1) = "," Then rest = delstr(rest,1,1) End Else Parse Var disp disp ","rest disp = strip(disp) dsn = strip(dsn) If disp <> "" & dsn <> "" Then Do args = "DISP="disp",DSN="dsn If rest <> "" Then args = args","rest Else If lastchar = "," Then args = args"," args = strip(args) End lc = length(comment) /* Original comment length */ comment = strip(comment,"T") newline = left(label,max(length(label),10))" " newline = newline || left(keyword,max(length(keyword),3)) newline = newline strip(args) Call setcomment newline = strip(newline comment,"T") End Else /* There is no keyword here */ Do Parse Var line label keyword comment 72 cont 73 . newline = left(label,15)strip(keyword) Call setcomment newline = strip(newline comment) End If length(newline) > 71 Then Do zerrsm = "Format error" zerrlm = "One or more lines could not be formatted." zerrlm = left(zerrlm,80)newline zerrhm = "*" zerralrm = "YES" Address "ISPEXEC" "ISPEXEC SETMSG MSG(ISRZ002) COND" End Else line = left(newline,71)cont "ISREDIT LINE .ZCSR = (LINE)" End "ISREDIT RFIND" findrc = rc End "ISREDIT USER_STATE = (US)" Exit 1 find_comma: Procedure Expose line paren = 0 last_comma = 0 Do a = 1 to length(line) If substr(line,a,1) = "(" Then paren = paren + 1 Else If substr(line,a,1) = ")" Then paren = paren - 1 Else If paren <= 0 & substr(line,a,1) = "," Then Return a End Return 0 setcomment: If "" <> strip(comment) Then If length(comment) > 70 - length(newline) Then Do /* Say '['line']' */ /* Say length(Comment) '<'comment'>' */ mx = 70 - length(newline) comment = reverse(comment) comment = substr(comment,1,mx) comment = reverse(comment) End Return