/* REXX ***************************************************************/ /* -------------------------------------------------------------------*/ /* Name: CFIND (Cursor FIND) */ /* Short: Find string under the cursor */ /* Type: REXX-macro */ /* Author: Norbert Haas */ /* Function: finds chars powered by cursorposition */ /* Syntax: CFIND (should be on a PF-Key) */ /* Parameter: none */ /* Remarks: - The string is limited by blanks (left and right) */ /* - Implizite parms are NEXT and CHAR. */ /* - Used once, you can use RFIND (F5) afterwords. */ /* */ /* Version Author Date Why */ /* --------- ------------- --------- -------------------------------- */ /* V01.03 N.Haas 28.05.03 remarks in english */ /* V01.02 N.Haas 14.05.03 Rechts Punkt abschneiden (Cobol) */ /* V01.01 N.Haas 21.06.95 Verbesserung (Messages) */ /* V01.00 N.Haas 22.12.92 Erstellung */ /**********************************************************************/ "ISREDIT MACRO (parm)" "ISPEXEC CONTROL ERRORS RETURN" /* translate parm to caps ------------------------------------------- */ parm = TRANSLATE(parm) /* examine parm ----------------------------------------------------- */ IF parm /= '' THEN DO zedsmsg = "PARAMETER ERROR" zedlmsg = "MACRO CFIND DOES NOT WORK WITH ANY PARAMETERS." "ISPEXEC SETMSG MSG(ISRZ001)" EXIT -8 END /* read char under the cursor --------------------------------------- */ "ISREDIT (zeile) = LINE .ZCSR" "ISREDIT (row,col) = CURSOR" col_save = col tst = SUBSTR(zeile,col,1) IF tst = '' THEN EXIT 0 DO WHILE (tst /= '') col = col - 1 IF col > 0 THEN tst = SUBSTR(zeile,col,1) ELSE tst = '' END col = col + 1 tst = SUBSTR(zeile,col,1) chr = '' DO WHILE (tst /= '') chr = chr || tst col = col + 1 tst = SUBSTR(zeile,col,1) END /* examine char (no & allowed) -------------------------------------- */ IF LEFT(chr,1) = '&' THEN DO zedsmsg = 'CFIND nicht m”glich' zedlmsg = 'Die Zeichenkette unter dem Cursor ('chr')', 'enth„lt vorne mindestens ein Ampersand (&)' "ISPEXEC SETMSG MSG(isrz001)" "ISREDIT CURSOR =" row col_save SIGNAL Ente END /* strip right dot (.) ---------------------------------------------- */ chr = STRIP(chr,'T','.') /* find char -------------------------------------------------------- */ "ISREDIT FIND '"chr"'" find_rc = rc IF find_rc = 4 THEN DO zedsmsg = '*Bottom of data reached*' zedlmsg = 'CHARS 'chr' - NOT FOUND.', 'PRESS RFIND KEY TO CONTINUE FROM TOP.' "ISPEXEC SETMSG MSG(isrz001)" "ISREDIT CURSOR =" row col_save END IF find_rc > 4 THEN DO zedsmsg = 'CFIND not possible' zedlmsg = 'The string under the cursor ('chr')', "contains one of the following chars ('), (,)", 'or (&).' "ISPEXEC SETMSG MSG(isrz001)" "ISREDIT CURSOR =" row col_save END Ente: EXIT 0