/* REXX -- #MAKEMAC -- create REXX edit macro from commands */ /* */ /* The MAIN PURPOSE of this clist is to convert a copy of the edit */ /* commands that you did to an edit macro so that you can repeat */ /* the same commands later. */ /* */ /* Related clists: CUT PASTE APPEND, #P #MAKEMAC, REFORMAT */ /* */ /* All cards are assumed to be edit commands. This macro adds */ /* double quotes at beginning and end of each line so edit macro */ /* lines are generated. Special provision has been made to cover */ /* &edit-command so that they are repeated until they no longer */ /* give RC=0. If the next line is also an &edit-command, you */ /* should check to see if the two DO FOREVER loops should be */ /* combined. Provision is also made for :TS (text split) and :TF */ /* (text flow). A | in column one will be used as an escape to */ /* copy a REXX command or other line unchanged .e.g |DO|END. */ /* */ /* Author: (do not change the original author thank you) */ /* F. David McRitchie, "The REXX Macros Toolbox", July 29, 1992 20:50 */ /*********************************************************************/ Address "ISREDIT" "MACRO (TOKEN)" "(MEMBERX) = MEMBER " "(DSNX) = DATASET" if memberx /= "" then dsnxx=dsnx"("memberx")";else dsnxx=dsnx CNT = 1 blank = substr(' ',1,120) i=1;last=20 "(LAST) = LINENUM .ZLAST" last = last + 0 do i = 1 to last by 1 "(LINE) = line " i j = index(line,'&&') if j /=0 then line = " "line l = index(line||blank,blank) lineu=translate(line) /* LABEL .A ----------------> LABEL .ZCSR = .A 0 */ /* LABEL .zcsr = .point 0 --> (no changes made)*/ if substr(lineu,1,7) = 'LABEL .' then do n = index(lineu,'=') if n = 0 then do line = "LABEL .ZCSR = "||substr(line,7,L-6)||" 0" l = l + 10 end end /* | is used as an excape to put out REXX commands*/ if substr(line,1,1)='|' then line = substr(line,2) else line = """"||substr(line,1,l)||"""" "line "i" = (line)" end lastcc = 0 "find first '&&'" lastcc = rc do while (lastcc=0) "line_before .zcsr = dataline 'Do forever'" "line_after .zcsr = dataline 'End'" "line_after .zcsr = dataline ' if rc /= 0 then leave'" "f last p'^' .zcsr .zcsr" "(C1) = LINENUM .zcsr" "f next '&&'" lastcc = rc if lastcc /= 0 then leave c1 = c1 + 3 /* two lines added, and next line makes 3 */ "(C2) = LINENUM .zcsr" c2 = c2 + 0 if c1 = c2 then do "LINE_BEFORE .zcsr = DATALINE ""/"||"* ...check for ", "possibly combining prev/next do/end group ......*"||"/""" "Label .zcsr = .warn 0" end end "c all ':tf' 'TFLOW .ZCSR '" /* :tf20 --> TFLOW .ZCSR 20 */ "c all ':ts' 'TSPLIT '" /* :TS14 --> TSPLIT 14 */ "c all 1 '""&&' ' ""'" "LABEL .zfirst = .start 0" CBS = "LINE_BEFORE .start = DATALINE ""/"||"*" CEND = "*"||"/""" CBS " REXX -- .................................................." CEND "LINE_BEFORE .start = DATALINE 'Address ""ISREDIT""'" "LINE_BEFORE .start = DATALINE '""MACRO (TOKEN)""'" CBS "This edit macro was ......................................." CEND CBS " created by #MAKEMAC macro from list of macro commands " CEND CBS " in card image form" , date('j') "--" date('u') time('n') SYSVAR('sysuid') CEND CBS " while editing" dsnxx cend CBS "It is your responsibility to verify #MAKEMAC conversion. .." cend return