/* REXX: flipflop -- reverse lines vertically between labels */ /* Title:*REXX* flipflop the inclusive lines between two labels */ /* Users: TSO ISPF edit users | SCRIPT users */ /* Contributed: 1990/12/27 David McRitchie */ /* */ /* Example: flipflop .zfirst .zlast */ /* */ /* Options: */ /* lptr-range | entire (required) line pointer range */ /* */ /* Requirements: */ /* two labels */ "ISREDIT MACRO (labf,labl,remain)" x2=substr(labf,1,1)||substr(labl,1,1)||remain if x2 \= '..' then do zedsmsg = '.labels' zedlmsg = 'exactly two labels are required and nothing more,', 'nothing less' /*Address*/ "ISPEXEC SETMSG MSG(ISRZ000)" Exit 12 end /*****************************************************************/ /*****************************************************************/ "ISREDIT (LABFNUM) = LINENUM " labf If RC \= 0 then Do ZEDSMSG = labf "LABEL" ZEDLMSG = ZEDSMSG "does not exist" /*address*/ "ISPEXEC SETMSG MSG(ISRZ000)" Exit 12 End "ISREDIT (LABLNUM) = LINENUM " labl If RC \= 0 then Do ZEDSMSG = labl "LABEL" ZEDLMSG = ZEDSMSG "does not exist" /*Address*/ "ISPEXEC SETMSG MSG(ISRZ000)" Exit 12 End /************** End of LABEL requirements *******************/ /******************** code for flipflop commands ************/ /******************** code for flipflop commands ************/ /******************** code for flipflop commands ************/ Address "ISREDIT" /*********************************************/ "LABEL "LABFNUM" = .sta 1" PJ = LABFNUM + 1 for = lablnum - labfnum Do J = lablnum to PJ by -1 "(MOVELINE) = LINE " lablnum "LABEL" lablnum "= .out 0" "(MOVESTAT) = XSTATUS .out" "delete .out .out all" "(moved) = LINENUM " .sta "LINE_BEFORE .sta = DATALINE (moveline)" "LABEL " moved " = .movep" If "X" = movestat then "XSTATUS .movep = X" End J /* 2 2 22 */ /* 1 1 11 */ If substr(labf,1,2) \= '.Z' then "LABEL " LABFNUM "= "labf "0" If substr(labl,1,2) \= '.Z' then "LABEL " LABLNUM "= "labl "0" "LINE_BEFORE" labfnum "= NOTELINE ' *begin of flipflop " labf labl "'" "LINE_AFTER " lablnum "= NOTELINE ' *End of flipflop " labf labl "'" Exit 1