Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

zooming in on copybooks 1

Status
Not open for further replies.

SirHogaLot

Programmer
Jun 9, 2005
12
US
I used to have access to a functionality that, while in a COBOL program, you could put ZI (for zoom in)in the left margin next to a copybook name of field name and the copybook would be temporarily be copied in to the cobol member. Does anyone have experience with this functionality and know how to set it up?
 
In the Micro Focus editor, if you double-click on a copy-book name, you start another session with the copybook.
 
If you were in ISPF you could type ZI as a primary command which might invoke an edit macro to do something along those lines. I'm not sure how to do it (or if it can be done) in ISPF as a line command.

The following is an ISPF edit macro I've knocked up quickly and although I've givne it a basic test, it may still be a little buggy. To use, type ZI on the command line of the dataset being editted, position your cursor on the line that contains the COPY statement, and press enter.

I've not done ISPF edit macros for quite a while, so there may well be a better way to do this by now!

Code:
ISREDIT MACRO
CONTROL NOFLUSH NOMSG
ISPEXEC CONTROL ERRORS RETURN
/*********************************************************************/
/* BROWSE COPYBOOK FOUND ON CURSOR LINE . ASSUMES COPYBOOK RESIDES   */
/* IN EDIT LIBRARY                                                   */
/* MARC LODGE 26TH APRIL 2006                                        */
/*********************************************************************/
ISREDIT (ROW,COL) = CURSOR
ISREDIT (LCOL) = DATA_WIDTH
ISREDIT (ELINE) = LINE &ROW

/*************************************/
/* FIND THE WORD COPY                */
/*************************************/
ISREDIT F 'COPY' .ZCSR .ZCSR 1, &LCOL
IF &LASTCC NE 0 THEN DO
   SET &ZEDSMSG = &STR(INVALID POSITION)
   SET &ZEDLMSG = &STR(CURSOR MUST BE ON LINE WITH THE WORD COPY IN IT)
   ISPEXEC SETMSG MSG(ISRZ001)
   ISREDIT CURSOR = &ROW &COL
   EXIT CODE(0)
END
ISREDIT (ROW,COL) = CURSOR
SET &I = &COL

/*************************************/
/* FIND THE 1ST BLANK AFTER 'COPY'   */
/*************************************/
ISREDIT F ' ' .ZCSR .ZCSR &I, &LCOL
IF &LASTCC NE 0 THEN DO
   SET &ZEDSMSG = &STR(INVALID POSITION)
   SET &ZEDLMSG = &STR(CANNOT FIND A BLANK AFTER THE WORD COPY)
   ISPEXEC SETMSG MSG(ISRZ001)
   ISREDIT CURSOR = &ROW &COL
   EXIT CODE(0)
END
ISREDIT (ROW,COL) = CURSOR
SET &I = &COL

/*************************************/
/* FIND THE 1ST NON BLANK AFTER COPY */
/* WHICH SHOULD BE COPYBOOK NAME     */
/*************************************/
ISREDIT F P'¬' .ZCSR .ZCSR &I, &LCOL
IF &LASTCC NE 0 THEN DO
   SET &ZEDSMSG = &STR(INVALID POSITION)
   SET &ZEDLMSG = &STR(CANNOT FIND COPYBOOK NAME AFTER THE WORD COPY)
   ISPEXEC SETMSG MSG(ISRZ001)
   ISREDIT CURSOR = &ROW &COL
   EXIT CODE(0)
END
ISREDIT (ROW,COL) = CURSOR
SET &STARTPOS = &COL

/*************************************/
/* FIND THE NEXT '.' AFTER COPYBOOK  */
/* NAME. IF NO '.' EXISTS, FIND NEXT */
/* BLANK CHAR                        */
/*************************************/
ISREDIT F '.' .ZCSR .ZCSR &STARTPOS, &LCOL
IF &LASTCC NE 0 THEN DO
   ISREDIT F ' ' .ZCSR .ZCSR &STARTPOS, &LCOL
   IF &LASTCC NE 0 THEN DO
      SET &ZEDSMSG = &STR(INVALID POSITION)
      SET &ZEDLMSG = &STR(CANNOT FIND COPYBOOK NAME AFTER THE WORD COPY)
      ISPEXEC SETMSG MSG(ISRZ001)
      ISREDIT CURSOR = &ROW &COL
      EXIT CODE(0)
   END
END

/*************************************/
/* SET END POSITION TO ONE LESS THAN */
/* CURSOR POS AS POSITIONED ON SPACE */
/* PR '.' AFTER COPYBOOK NAME        */
/* SET UP MEMBER NAME AND BROWSE     */
/*************************************/
ISREDIT (ROW,COL) = CURSOR
SET &ENDPOS = &COL - 1
SET &MEMNAME = &SUBSTR(&STARTPOS:&ENDPOS,&STR(&ELINE))
ISREDIT BROWSE &MEMNAME
IF &LASTCC NE 0 THEN DO
   SET &ZEDSMSG = &STR(MEMBER NOT FOUND)
   SET &ZEDLMSG = &STR(MEMBER NAME &MEMNAME NOT FOUND IN LIBRARY)
   ISPEXEC SETMSG MSG(ISRZ001)
   ISREDIT CURSOR = &ROW &COL
   EXIT CODE(0)
END
ISREDIT RESET
EXIT CODE(&LASTCC)
 
Thanks MarcLodge, you were correct in assuming ISPF. My bad for not including that. I have never set up a macro in ISPF, do you guys know of any tutorials that will walk you through this. I checked the ISPF help and didn't see anything. Thanks again.
 
You can type the primary command:

ISRDDN

It will show you the allocated files and dd-names to your session.

You will perhaps find a command library which is allocated to your session. It can be a clist or a rexx library. The dd-name is SYSPROC. You can put Marc's edit macro in that library with the name ZI.

Information about this you can find in manuals like:

z/OS V1R2.0 ISPF User's Guide Vol I

You can search for them at IBM's
 
SirHogalot,
The macro only looks for the copybook in the same library as the Cobol source resides. If you wish a different library to be browsed (most sites I've been at keep their source and copybooks separate) then let me know and I will post an amendment.

Marc
 
I thought the ZI and ZO functions, along with CHECK commands were add-ons to the EDIT function of ISPF through a package called SMARTEDIT? am I wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top