/* REXX ***************************************************************/ /* -------------------------------------------------------------------*/ /* Name: SETLAB */ /* Short Set Label on lines with */ /* Type: REXX-Macro */ /* Author: HAAS */ /* Syntax: SETLAB string */ /* Parameter: string = find string (required) */ /* Example: SETLAB isredit */ /* */ /* Version Author Date Why */ /* ------- ------------- ---------- --------------------------------- */ /* V01.01 N.Haas 15.07.2004 English version */ /* V01.00 N.Haas 22.12.2001 Erstellung */ /**********************************************************************/ /* Parameter */ "ISREDIT MACRO (string) NOPROCESS" "ISPEXEC CONTROL ERRORS RETURN" /* Parameter OK? */ IF WORDS(string) /= 1 THEN DO zedsmsg = 'Paramater required' zedlmsg = 'Macro SETLAB needs one parameter (string).' "ISPEXEC SETMSG MSG(isrz001)" EXIT END /* Init */ PARSE VALUE '1' WITH 1 mc1 1 mc2 1 mc3 1 mc4 letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' DO i = 1 TO LENGTH(letters) INTERPRET 'l.'i '= SUBSTR(letters,i,1)' END c = 0; max = 26 ** 4 letter = 'A' /* Main loop */ "ISREDIT FIND FIRST" string find_rc = rc DO WHILE (find_rc = 0) & (c < max) c = c + 1 label = MakeLabel(mc4, mc3, mc2, mc1) /* .AAAAA ... */ "ISREDIT LABEL .zcsr =" label "0" IF c = 1 THEN label1 = label "ISREDIT FIND NEXT" string find_rc = rc mc1 = mc1 + 1 IF mc1 > 26 THEN DO mc1 = 1 mc2 = mc2 + 1 IF mc2 > 26 THEN DO mc2 = 1 mc3 = mc3 + 1 IF mc3 > 25 THEN DO mc3 = 1 mc4 = mc4 + 1 IF mc4 > 26 then DO EXIT END END END END END /* End message */ IF c > 0 THEN DO zedsmsg = c 'label set' zedlmsg = c 'label have been set. From .'letter'AAAA to' label'.' "ISPEXEC SETMSG MSG(isrz000)" "ISREDIT LOCATE" label1 IF rc > 0 THEN DO "ISREDIT LOCATE FIRST LABEL" END END ELSE DO zedsmsg = 'Not found' zedlmsg = 'String' string 'not found.' "ISPEXEC SETMSG MSG(isrz001)" END EXIT MakeLabel: PARSE ARG p.4, p.3, p.2, p.1 label = "." || letter DO i = 4 TO 1 BY - 1 j = p.i label = label || l.j END RETURN label