Edit Utilities

1 - Complete COBOL field names dynamically

This is a point-and-shoot utility which I wrote as a feasability study to show how to complete the name of a COBOL field contained in a copybook while you are typing the source code.

You type in the beginning of a field name (as much characters as you remember) and invoke the edit macro. This macro reads the current source line to determine the field name prefix, dynamically creates some panels, does the required allocations and libdefs, asks for the copybook to be scanned, invokes itself to scan the copybook, presents a list of possible hits, lets the user select one field name from that list, frees all temporary files, completes the field name and positions the cursor.

To implement this utility you only have to add the REXX program to a library concatenated under SYSEXEC or SYSPROC respectively. For allowing simple use just assign the name of the program (in. my case "gf") to a function key. So you can easily keep the cursor at the current position.

Here is the program and a HTML file demonstrating how to use the edit macro:

2 - Generating labels at REXX procedures

RXLABEL generates labels at REXX procedures. The complete list of those labels can be displayed to offer a handy way of jumping directly to the desired piece of code.

Label names were generated dynamically based on the initial letters of words contained in the procedure name.

For more details about the parameters please look at the comments in the source code.

Here is the program (an edit macro) , the corresponding panel, and a HTML file showing a sample output of the labels processing:

3 - Analyze the code structure of a REXX program

RXSTRUC analyzes the references to external modules as well as the internal call structure. It recognizes several calling techniques commonly used in REXX and the usage of ISPF objects such as panels and skeletons.

RXSTRUC inserts the structure chart as "notes" lines after the first code line.

Here is the program (an edit macro) , a sort routine (RXSORT) used by RXSTRUC, and a HTML file showing a sample output of the generated notes lines:

4 - Run SQL dynamically

DOSQL allows dynamic execution of the SQL statements currently edited.

The statements are passed to DSNTEP2 and the result is presented to the user by browsing a temporary dataset.

Several configuration details can be choosen by an options panels.

Here is the program (an edit macro) , the corresponding data entry panel, a formatting routine (DOSQL2) used by DOSQL, and a HTML file showing a the correspondig ISPF panel:

5 - Download HTML source and invoke web browser

SHOWHTML works as an edit macro and allows the currently edited HTML source code to be rendered by your favorite web browser .

The file transfer to your workstation and the invocation of the web browser is both implemented by means of the ISPF Workstation Agent.

For a great explanation of all relevant features of the ISPF Workstation Agent please visit Gilbert Saint-Flour's website.

Here is the program (an edit macro) :

6 - View dataset under cursor in new split screen

VNEW is an example for some kind of point-and-shoot utility. It determines the data pointed to by the cursor by using special ISPF variables. This makes VNEW work not only as an Edit macro but also as a stand-alone program which can be used anywhere within ISPF.

In addition it is an example for using the ISPF program behind the START command to create a new screen while invoking some additional functionality, in this case the EPDF service .

Here is the program :

7 - Scan and Analyze JCL

JSCAN scans and analyzes the JCL source member you are currently editing. It works as an edit macro and shows a scrollable list of step name, program name, DD label, and dataset name.

In addition it recognizes the invocation of DB2 batch programs and displays member names or GDG versions when used.

Here is the program and a sample screen shot :

8 - Determine the ISPF Edit search string recently used

GETFIND is a sample code on how to get the string which the user has entered recently as a parameter to the FIND primary command within the ISPF editor. This might be useful if you write an edit macro which issues a FIND itself and thus overwrites this information. To give the user the possibility to use a RFIND after invoking your macro, you only have to get the search string, do your own processing, and then find this particular string again before leaving your macro.

Here is the program :

9 - Determine and show all columns of a DB2 table

This program determines the column structure of a DB2 table passed as a parameter and inserts its definitions as note lines into the current data. Running as an edit macro it checks the text string at which the cursor is located and treats this as the DB2 table name. Table names must be specified in the form <CREATOR.TABLE>.

If the program is being called from outside ISPF Edit, the list will be shown by browsing a temporary dataset.

This solution is based on a sample by Kannan AK published in winter 2003 issue of TSO Times by Chicago-Soft, LTD.

Here is the program :

10 - AutoComplete for REXX languages

This ISPF Edit macro checks the current line and determines, what the user has entered as last word. This keyword is used to search through a list of predefined templates. The resulting lines will be inserted behind the current line.

If the keyword is unknown, the current line is empty, or the last word is a question mark, a list of keywords with their associated templates is shown from which the user can select one.

This program can easily be expanded with more keywords or adopted to other languages. The inline documentation should be sufficient for maintenance purposes.

Here is the program :

If you have any difficulties with the program or with general concepts behind, feel free to contact me.