Many programming languages support the use of language snippets. These can be coded once and copied or included anywhere using a simple reference to the snippet name. For example,
COBOL programs may reference COBOL snippets found in copybooks, using a COPY statement
Assembler programs can reference macros
JCL can reference PROC members
C programs may reference Headers
Endevor processors may reference Include members
Using the name given to a snippet, it can be shared by many programs, as needed. Each language has one or more statements that indicate a snippet reference. For example, within a COBOL program, you may find a COPY statement or an INCLUDE statement. Each kind of statement names a snippet to be copied.
This document shows how users of Quick-Edit or Endevor can use a field-developed process to view an image of a code snippet, and without having to leave the working session for another session to view it.
Here is the first example. A developer is using Quick-Edit to modify a COBOL program and encounters a COPY statement referencing a copybook named COMPRECS.
The developer can type “EXP” onto the command line, and move the cursor to any location on the line that references the copybook, before pressing Enter.
Then, the copybook is copied as note lines into the edit session after the COPY statement. A comment showing the library name where the copybook member was found, is also inserted.
This next example shows the expansion of another copybook member in the same program.
Any number of copybooks can be expanded within an edit session.
NOTE lines are only for display, and disappear on a RESET command, or as the developer exits the edit session.
Expansions are not limited to COBOL and they are not limited to Quick-Edit. Expansions from Endevor can be performed as long as you have the Endevor ISPF BROWSE OR VIEW MODE option set to ‘V’.
This last example shows an expansion performed on a JCL element while Browsing the element with Endevor.
A JCL Procedure (PROC) is copied into the View Session as NOTE lines.
One-time Setup Steps
EXP is a simple field-developed REXX edit macro program that just needs a little help from you to find libraries for the kinds of snippets you want to support.
EXP is able to obtain values for these internal variables:
Set values to the variable named INCLUDE_LIBRARY_LIST, to represent library names you want to be searched. You can use the variables named above within the names of the datasets, and optionally you can use them to conditionally build lists of datasets names.
For example, if your environment name is ‘DEV’ and you want to support the expansion of copybooks only, you could code…
IF ENVBENV = 'DEV' THEN,
See also the example code in the EXP member within Broadcom’s GitHub.
As always, you can share your thoughts and suggestions in this blog. If you would like or need a little help, just reach out to me at email@example.com.