Mainframe Utility: COUNTPIC

Return to Mainframe Utilities Page

Module


ISREDIT MACRO
/* PUT YOUR CURSOR WITHIN A PICTURE STRING AND IT WILL CALCULATE */
/* THE PICTURE SIZE AND REPLACE THE SIZE IN THE PICTURE CLAUSE */
SET &TICK = &NRSTR(')
SET &CHNGE = '(KK)'
ISREDIT (LINE,COL) = CURSOR
ISREDIT FIND "&TICK" .ZCSR .ZCSR NEXT
ISREDIT (LINE,COLEND) = CURSOR
ISREDIT FIND "&TICK" .ZCSR .ZCSR PREV
ISREDIT (LINE,COLBEG) = CURSOR
SET &COLLEN = &EVAL(&COLEND-&COLBEG-1)
SET &ZEDSMSG = -
&STR(STRING IS &COLLEN CHAR LONG)
ISPEXEC SETMSG MSG(ISRZ000)
ISREDIT FIND "(" PREV
ISREDIT (LINE,COL) = CURSOR
ISREDIT CURSOR = &LINE &EVAL(&COL-1)
ISREDIT CHANGE &CHNGE (&COLLEN.) NEXT
ISREDIT SAVE
EXIT
            


Documentation


 COUNTPIC - This edit macro command will take the current cursor position (which
 must be within the quotation marks of a COBOL VALUE clause) and compute the
 length of the string.  It only works for character VALUE clauses.
 Additionally, it will replace the value in the PICTURE clause if coded like
 this. - PIC x(kk) or PICTURE x(kk) The computation of the length will only work
 on VALUE clauses that are contained on one line.  It can replace the value, if
 the PICTURE clause and the VALUE clause are on separate lines.
            


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.