home about us   contact us
 
   







 


Chicago-Soft
ATTN: TSO Times
One Maple Street
Hanover, NH 03755
(603) 643-4002
information
@tsotimes.com

 

ISPF Edit Macro for Matching Skeleton SEL/ENDSEL Statements

by Gary Frickey

I have developed an edit macro under ISPF/PDF that has saved me considerable time during development of utilities in ISPF Dialog Manager.

This macro is designed to be used during development and testing of ISPF skeletons. This macro will match all ')SEL' statements with the corresponding ')ENDSEL' statements and verify that an equal number of both exist. The use of this macro can help to identify and prevent logic and execution errors in ISPF skeletons.

The use of this macro makes each ')SEL' and its corresponding ')ENDSEL' easily identifiable, even if they are several hundred lines apart. For each ')SEL' statement, a ')CM' statement is inserted prior to the ')SEL'. For each ')ENDSEL' statement, the current ')ENDSEL' statement is replaced with an ')ENDSEL' statement that contains the comments on the same line in columns 55-71. This method was used since the ISPF interpreter scans the entire 'SEL' line for valid information, and comments are not allowed on the same line. However, in the case of ')ENDSEL' statements, comments are allowed on the same line because the interpreter does not scan past the ')ENDSEL' string.

A complete source listing of the macro is shown in Figure 1. This should be entered into a member in a CLIST data set that is accessible to all ISPF users who may have a use for this tool. At the time of development, I named this member SKELCHEK. Any name that is meaningful to your environment can be used.

Following is an outline of the process performed by this macro.

* Count all occurrences of ')SEL' and ')ENDSEL' statements to determine if there is an equal number of each.
* Exclude all lines of the skeleton and then redisplay only the lines that contain either a ')SEL' or ')ENDSEL' statement.

If the count of ')SEL' and ')ENDSEL' statements do not match, then identify the unmatched ')SEL' or ')ENDSEL'. This is accomplished by looping through the following logic until all pairs are identified and only the non-matched occurrence remains.

1. Find the next non-excluded occurrence of ')ENDSEL'.
2. Exclude the previous occurrence of ')SEL'
3. Exclude the ')ENDSEL'.
4. GOTO (a.)

The result will look similar to the example shown in Figure 2. A count of the occurrences of each ')SEL' and ')ENDSEL' will be displayed in the upper corner of the screen in the ISPF short message area.

If the count of ')SEL' and ')ENDSEL' do match, then the macro identifies all matched pairs of ')SEL' and ')ENDSEL' by adding comments with an incrementing counter to ensure uniqueness.

This is accomplished by looping through the following steps until all pairs are identified.

1. Find the next non-excluded occurrence of ')ENDSEL'.
2. Save the row and column coordinates of the cursor after the find.
3. Replace the existing ')ENDSEL' with one that includes a comment with the counter value.
4. Exclude the previous occurrence of ')SEL'.
5. Save the row and column coordinates of the cursor after the exclude.
6. Insert a line previous to the excluded ')SEL' containing a comment with the current counter value.
7. Check for previous ')CM' lines, if they exist, then check for the formatted ')CM' line which may have been previously created by this macro. If any exist, delete them. If any other comments not created by this macro exist, leave them. This is accomplished by repositioning the cursor and parsing other ')CM' lines, if they exist, to check for the formatted ')CM' lines created by this macro.
8. Exclude the ')ENDSEL'.
9. GOTO (a.).

The result will look similar to the example shown in Figure 3. A count of the successfully matched ')SEL' and ')ENDSEL' pairs will be displayed in the upper right corner of the screen in the ISPF short message area.

The macro then ends and displays the appropriate message in the ISPF short message area. No automatic save is done to allow for a final review of the skeleton by the developer. Although now that the 'UNDO' facility exists, a SAVE command could be added to the end of the macro.

To use this macro, edit the ISPF skeleton to be checked and enter the name of the macro on the command line and press enter. Figure 4 shows the correct format.

I have used this macro successfully on skeletons with over 2,000 lines of JCL. This macro has proved valuable in saving time during development and maintenance of these skeletons.

Gary Frickey is a Programmer Specialist at First Interstate Bank of Arizona, Scottsdale, AZ.

 



The TSO Times is back by popular demand!
Register now for your FREE subscription









 

Chicago-Soft, LTD
ISPF Tools & Toys
MVS Help Board
Lionel Dyck's Tools
IBM ISPF Page
Tom Brennan's Vista tn3270 Page
Mark Zelden's MVS Utilities


 


 

home · current articles · archives · forums ·
· subscribe · about us · contact us · links