/* REXX -- CHECKDUP */ /* CHECKDUP: Checks SCRIPT or other material for repeated words*/ /* author: David McRitchie, "The REXX Macros Toolbox" Corp, 1990/09/15 */ /* contact: David McRitchie, "The REXX Macros Toolbox" */ /* "The REXX Macros Toolbox" */ /* documentation available: //www.geocities.com/davemcritchie/rexx01/txt/checkdup.txt */ /* This clist is universally available with the stipulation that */ /* the original author remains credited */ /* and that no charge or licensing fee accrues to any party. */ /* This is my second meaningful REXX execute */ /* TEST WITH DATA IN -- Self testing, or use IS03.LIBR.CLIST(duptest)*/ Address "ISREDIT" /* this and that and that and that*/ xcnt = 0 "MACRO" "LOC 0" /* word repeated is the word reset */ "reset" "exclude all" MAXCC = 0 LASTWORD = '##' /*self-testing duplicate is ... dodo dodo */ do forever "LABEL .zcsr = .aa 0" "SEEK NEXT PREFIX P'@' " lastrc = rc IF lastrc <> 0 THEN do; "loc 0"; ZEDSMSG = "duplicates rc="||maxcc ZEDLMSG = zedsmsg "LINE_BEFORE .ZF = MSGLINE '" zedsmsg "'" address ISPEXEC 'SETMSG MSG(ISRZ000)' return(maxcc); end; "(RECORD) = LINE .ZCSR " RECORD = translate(RECORD,' ','!%^&*()+={}[]:"~;''`|<>?›,./') ||' ' word# = 0 do while(lastrc = 0); /* second dumb dodo dodo*/ "(LINE#,COL1) = CURSOR" "SEEK NEXT ' ' .ZCSR .ZCSR" lastrc = rc IF lastrc = 0 then do; "(LINE#,COL2) = CURSOR" THATWORD = substr(record,col1,(col2 - col1 + 1)) THATWORD = word(THATWORD,1) THISWORD = translate(THATWORD) if thisword = 'END' , | thisword = 'GT' | thisword = 'HP' , | thisword = 'RELATED' , | thisword = 'SK' , | thisword = 'ZCSR' , then do;xcnt=xcnt+1; if xcnt = 1 then "line_before .zf = msgline '" , "words not checked for duplication include -- " , "END, GT, HP, RELATED, SK, ZCSR'" end; else do; if thisword = lastword then do; "LINE_BEFORE .ZCSR = noteLINE 'Duplicate word -- " , """"thatword"""'" "reset .ZCSR .zcsr " if word# = 0 then "reset .AA .aa " IF 4 > maxcc then maxcc = 4 end; end; LASTWORD = thisword "SEEK NEXT PREFIX P'@' .ZCSR .ZCSR" lastrc = rc word# = word# + 1 end; end; end;