/*ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿*/ /*³ Copyright (c) 1992 by Command Technology Corporation ³*/ /*ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´*/ /*³ ³*/ /*³ SPF/PC macro: NEXTWORD.SPF ³*/ /*³ ³*/ /*³ purpose: This macro finds the next occurrence of ³*/ /*³ the word at the current cursor position. ³*/ /*³ This elimiates the need to enter a find ³*/ /*³ command on the command line when you wish ³*/ /*³ to find other occurrences of a program ³*/ /*³ variable. ³*/ /*³ ³*/ /*³ operation: This macro should be assigned to a function ³*/ /*³ key (eg. Alt-F5). After the first search ³*/ /*³ via this macro, use RFIND (F5) to continue ³*/ /*³ searching. ³*/ /*³ ³*/ /*³ written: September 11, 1991 by SWB. ³*/ /*³ ³*/ /*ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ*/ 'ISREDIT MACRO' /*------------------------------------------------------------*/ /* get cursor position and line data. */ /*------------------------------------------------------------*/ 'isredit (line, column) = cursor' 'isredit (text) = line .zcsr' 'isredit (lrecl) = lrecl' /*------------------------------------------------------------*/ /* if cursor is not on a data line, then exit with a message. */ /*------------------------------------------------------------*/ if (column = 0) | (column > lrecl) then do ZEDSMSG = "PUT CURSOR ON A DATA LINE" ZEDLMSG = "THE NEXT OCCURRENCE OF THE GIVEN WORD WILL BE FOUND." 'ISPEXEC SETMSG MSG(ISRZ001)' exit end /*------------------------------------------------------------*/ /* get first previous text position. */ /*------------------------------------------------------------*/ TableYes = '_' || xrange('0','9') || xrange('A','Z') || xrange('a','z'); TableNo = translate(xrange(),,TableYes,' ') wordmask = translate(text,,TableNo, ' '); wordmask = translate(wordmask,,TableYes,'*'); /*------------------------------------------------------------*/ /* get the wordindex for the cursor position. */ /*------------------------------------------------------------*/ n = 1; Wi = 0 Wn = 0 do FOREVER; i = wordindex(wordmask,n); if (i = 0) then leave; if (i <= column) then do Wi = i; Wn = n; end; else leave; n = n+1; end; /*------------------------------------------------------------*/ /* if no word found, exit with a message. */ /*------------------------------------------------------------*/ if (Wi = 0) then do ZEDSMSG = "PUT CURSOR ON WORD" ZEDLMSG = "THE NEXT OCCURRENCE OF THE GIVEN WORD WILL BE FOUND." 'ISPEXEC SETMSG MSG(ISRZ001)' exit end /*------------------------------------------------------------*/ /* get word text. */ /*------------------------------------------------------------*/ Wm = word(wordmask,Wn); Wt = substr(text,Wi,length(Wm)); /*------------------------------------------------------------*/ /* position the cursor. */ /*------------------------------------------------------------*/ ('ISREDIT FIND "' || Wt || '" WORD NEXT') FindRc = rc /*------------------------------------------------------------*/ /* check return code. */ /*------------------------------------------------------------*/ if (FindRc = 4) then do ZEDSMSG = "BOTTOM OF DATA" ZEDLMSG = "CHARS '" || Wt || "' - NOT FOUND. PRESS RFIND TO CONTINUE FROM TOP." 'ISPEXEC SETMSG MSG(ISRZ001)' exit end