/* QCHK macro -- Quote Check -- quick version of PLICHK -- REXX */ /* David McRitchie, "The REXX Macros Toolbox" created May 1, 1994 */ /* related: plichk, editpr, editpair */ /*********************************************************************/ Address "ISREDIT";"MACRO" "(last) = linenum .ZLAST" "x all" do i = 1 to last "(line) = line" i; line=strip(line) q=0; qq=0; co=0; cc=0; /*quote, double quote, comment open/close*/ do j=1 to length(line) x2=substr(line,j,2); x=left(x2,1) select; when x = '''' then q=q+1; when x="""" then qq=qq+1 when x2='/*' then co=co+1 /* ' */ when x2='*/' then cc=cc+1 /* " */ otherwise; end; end j; q=q//2; qq=qq//2; if q\=0 | qq \= 0 | co \= cc then do; Special = ' ', ' Unmatched on line 'i 'q='q', qq='qq', co='co', cc='cc "line_after" i "= noteline (special)" "reset" i i "x" end end i /* The perspective of QCHK is on a per card basis, making this process fast and not encumbered by rigorous syntax checking which may in fact work against identifying the line on which a simple mistake has been made. The purpose of QCHK is to find unmatched quotes, and comments on a per line basis. If a comment extends to multiple lines it is easy to identify the end as also unmatched. Uses REXX to count the Quotes on a line rather than using ISPF, SPF faciliites. */