EDIT execute FLOW EDIT execute FLOW Author: David Leigh of Unipac Service Corp. formatted on 1995/04/01 06:54 for assistance contact: D. McRitchie DMcRitchie@hotmail.com -------------------------------------------------------------------------------- REXX execute name. FLOW users. PDF EDIT users particularly SCRIPT and text writers type. Edit Macro resides in SYS1.TSOCLIST, and in IS03.SPF2.MACROS for use on SPF/PC -------------------------------------------------------------------------------- FLOW Shift lines left or right and FLOW lines -------------------------------------------------------------------------------- related edit line commands SHIFT and FLOW -------------------------------------------------------------------------------- This somewhat unusual execute was provided as an example in issue No. 5, published by Chicago-Soft Ltd. and was written by David Leigh at Unipac service corporation. Changes have been made to make it move text left as well as right. Additional modification provides for lim- iting last line involved when a "C" is placed on the last line to be involved (original had PROCESS on MACRO line but was not used). Lim- iting the right extent of the columns is now also provided for (ori- ginal had OPT1 on MACRO line but was not used. -------------------------------------------------------------------------------- Since square brackets are not available, optional material is enclosed in European brackets <...>. ISREDIT FLOW -------------------------------------------------------------------------------- right-limit (optional) A number to be used by the Text Flow (:TF) line command, to determine the number of columns to be involved in the formatting. C line-command (optional) A "C" can be placed on the last line number of the line to be involved where text flow would not have otherwise stopped. Examples By placing the cursor as indicated below, the text will be moved to the right and flowed through 25 columns as seen in the following example (shown before/after). COMMAND ===> FLOW 25 COMMAND ===> =COLS> ----|----1----|----2----| =COLS> ----|----1----|----2--- 000001 Flow _ 000001 Flow columns 000002 columns together 000002 together within 000003 within same paragraph. 000003 same paragraph. 000004 Next 000004 Next 000005 paragraph 000005 paragraph 000006 is not 000006 is not 000007 affected. 000007 affected. The second example moves text left to the cursor position and flows text through 25 columns (shown before and after). This example include a line command of "C" which actually had no effect since FLOW is stopped by the differing indentation of the next paragraph. COMMAND ===> FLOW 25 COMMAND ===> =COLS> ----+----1----+----2----| =COLS> ----+----1----+----2--- 000001 _ Flow columns 000001 Flow columns together 000002 together within 000002 within same 000003 same paragraph. 000003 paragraph. 000004 Next 000004 Next C 0005 paragraph 000005 paragraph Internal Aspects Provides for use with RECFM = B or V, and for sequence columns with either. If BOUNDS have been set a warning message will appear (ZEDLMSG). Since this was obtained as an example, the entire text of the execute is shown below. /* REXX FLOW edit macro modified from -- TSO TIMES */ /* issue No. 5 --published by chicago-Soft Ltd., contest winner */ /* written by David Leigh at Unipac service corporation. Entered */ /* as a short macro clist of 14 lines, changes have been made to */ /* make it a REXX execute, make it move text left as well as well as */ /* right, and specify right column boundary. David McRitchie 1992/01/10*/ /* TFLOW can receive without problem a higher number than it can act-*/ /* ually use, so only reason to limit is to avoid right truncation */ /* */ /* Usage MOVE text left or right to CURSOR position and TFLOW lines. */ /* Optional use of PROCESS C line command as bottom limit of FLOW. */ /* */ Address "ISREDIT" blanks = ' ' "MACRO NOPROCESS (OPT1)" Address "ISPEXEC" "control errors return" "(SLINE,SCOL) = cursor" /* retain cursor info at Start */ if sline = 000 | scol = 000 then do ZEDSMSG = "CURSOR POS." ZEDLMSG = "CURSOR not placed within a line of text/data" Address "ISPEXEC" "SETMSG MSG(ISRZ000)" RETURN 0 end "PROCESS RANGE C" /* obtain C-range */ process = rc /* check if a C-range exits */ IF process = 0 THEN DO "(ZFRANGE) = LINENUM .ZFRANGE" /* will only use ZLRANGE */ "(ZLRANGE) = LINENUM .ZLRANGE" /* will only use ZLRANGE */ If zfrange \= zlrange then do ZEDSMSG = "CC Invalid" ZEDLMSG = "CC line range invalid, the C line command is optional" call removal end "LINE_AFTER " .zlrange "= DATALINE '.REMOV'" remov = zlrange + 1 "LABEL " remov "= .remov 0" /* create a FLOW proof line */ END else zlrange = 0 "find first p'ª' .zcsr .zcsr" /* find first non-blank on line*/ "(LN,CL) = cursor" "LABEL .zcsr = .curr " "(LBND,RBND) = BOUNDS" "BOUNDS" "(LCCC,RCCC) = BOUNDS" if lbnd \= lccc | rbnd \= rccc then do zedlmsg = "Warning in use BOUNDS" LBND RBND||", ", ||"default is" LCCC RCCC "(RECFM) = RECFM" IF left(RECFM,1) = "V" then zedlmsg = zedlmsg ||", RECFM="||RECFM" adds +8 to each" end "BOUNDS" LBND RBND if opt1 = '' then opt2 = RBND; else opt2 = opt1 if scol = cl then do "TFLOW .ZCSR" opt2 call removal /* and exits */ end if scol > cl then do sright = scol - cl /* calculate shift right amt */ flowcols = opt2 - sright "TFLOW .zcsr " flowcols "(X,Y) = FLOW_COUNTS" /* how many lines BEFORE,AFT */ y = y - 1; do i = 0 to y; /* y+1 is new lines involved */ csrat = sline + i /* add 1 to move cursor down */ "cursor = " csrat 1 /* a line and over to col 1 */ "shift ) .zcsr " sright /* shift right */ end call removal /* and exits */ end if scol < cl then do /* make sure, even if redundant*/ sleft = cl - scol /* calculate shift left amt */ csrp = sline + 1 if zlrange \= sline then do "LABEL " csrp "= .csrp 1" /* next line down */ "SEEK '"||left(blanks,sleft)||"' 1 first .csrp .csrp" if rc \= 0 then do ZEDSMSG = "Can't move" ZEDLMSG = "Insufficient blanks on left side of ", ||"next line to shift left by " sleft "columns" Address "ISPEXEC" "SETMSG MSG(ISRZ000)" call removal /* and exit */ end end "cursor = " sline scol /* after SEEK put back cursor */ flowcols = opt2 + sleft "TFLOW .zcsr " flowcols "(X,Y) = FLOW_COUNTS" /* how many lines BEFORE,AFT */ y = y - 1 do i = 0 to y; /* y+1 is new lines involved */ csrat = sline + i /* add 1 to move cursor down */ "cursor = " csrat 1 /* a line and over to col 1 */ "shift ( .zcsr " sleft end "LINE_AFTER " csrat "= DATALINE '.remvx'" csrat = csrat + 1 "LABEL " csrat "= .remvx 0" /* create a FLOW proof line */ "cursor = " sline scol /* a line and over to col 1 */ "TFLOW .zcsr " opt2 "(X,Y) = FLOW_COUNTS" /* how many lines BEFORE,AFT */ "del .remvx .remvx all" call removal /* and exits */ end return REMOVAL: procedure expose zedsmsg zedlmsg sline scol; "del .remov .remov all" "cursor = " sline scol /* a line and over to col 1 */ Address "ISPEXEC" "SETMSG MSG(ISRZ000)" exit 0 end n FLOW on