Author: daveporcelan
Posted: Wed Mar 08, 2017 3:10 am (GMT 5.5)
To start with, I would not write in clist, EVER. It has not been the recommend language since 1985.
Next, sergeken is correct, use the ARG command.
Next, rather than use INDEX, use POS. It is more modern and preferred.
Be aware, the syntax is the reverse.
In fact, the RIGHT command would be best I think.
Just in case the member name length is not = 8.
This exec itself is not an edit macro, so leave off those commands.
Your alignment is really off. You can't tell which end lines up with which do.
I was intrigued by this so I wrote my own version of this.
There are two programs involved. The ZOOM exec, and the TOTLINES edit macro to determine if the member exists.
See the code here: First ZOOM
Now TOTLINES edit macro:
Posted: Wed Mar 08, 2017 3:10 am (GMT 5.5)
To start with, I would not write in clist, EVER. It has not been the recommend language since 1985.
Next, sergeken is correct, use the ARG command.
Next, rather than use INDEX, use POS. It is more modern and preferred.
Be aware, the syntax is the reverse.
In fact, the RIGHT command would be best I think.
Just in case the member name length is not = 8.
This exec itself is not an edit macro, so leave off those commands.
Your alignment is really off. You can't tell which end lines up with which do.
I was intrigued by this so I wrote my own version of this.
There are two programs involved. The ZOOM exec, and the TOTLINES edit macro to determine if the member exists.
See the code here: First ZOOM
Code: |
/* REXX EXEC TO ZOOM INTO A PDS MEMBER */ ARG MEM /* CHECK IF IN COBOL */ /* IF SO VIEW THIS DATASET THEN EXIT REXX EXEC */ "ISPEXEC VIEW DATASET('COBLIB("MEM")') MACRO(TOTLINES)" "ISPEXEC VGET (TOTLINE) SHARED" COBOLCNT = TOTLINE IF COBOLCNT > 0 THEN DO "ISPEXEC VIEW DATASET('COBLIB("MEM")')" SIGNAL EXIT99 END /* JCL AND PROC NAMES MUST END WITH BMP */ IF RIGHT(MEM,3) /= 'BMP' THEN DO SAY 'JCL AND PROC NAMES MUST END WITH BMP' SIGNAL EXIT99 END /* CHECK IF IN PRODJCL */ "ISPEXEC VIEW DATASET('PRODJCL("MEM")') MACRO(TOTLINES)" "ISPEXEC VGET (TOTLINE) SHARED" JCLCNT = TOTLINE /* CHECK IF IN PROCLIB */ "ISPEXEC VIEW DATASET('PROCLIB("MEM")') MACRO(TOTLINES)" "ISPEXEC VGET (TOTLINE) SHARED" PROCCNT = TOTLINE /* BASED ON COUNTS VIEW CORRECT DATASET */ SELECT WHEN JCLCNT > 0 & PROCCNT > 0 THEN DO SAY 'ENTER J TO VIEW JCL OR P TO VIEW PROC' PULL OPTION IF OPTION = J THEN "ISPEXEC VIEW DATASET('PRODJCL("MEM")')" ELSE "ISPEXEC VIEW DATASET('PROCLIB("MEM")')" END WHEN JCLCNT > 0 THEN "ISPEXEC VIEW DATASET('PRODJCL("MEM")')" WHEN PROCCNT > 0 THEN "ISPEXEC VIEW DATASET('PROCLIB("MEM")')" OTHERWISE SAY 'MEMBER' MEM 'NOT FOUND IN ANY PRODUCTION PDS' END EXIT99: EXIT |
Now TOTLINES edit macro:
Code: |
/* REXX EXEC EDIT MACRO TO FIND THE TOTAL NUMBER OF LINES */ /* IN A DATASET. VALUE IS PLACED IN SHARED POOL */ "ISREDIT MACRO" "ISREDIT (TOTLINE) = LINENUM .ZL" "ISPEXEC VPUT (TOTLINE) SHARED" "ISREDIT END" EXIT |