RPG Tips & Technicques February 2001

 

Here's A Very Good RPG SEU tip

PRINTING SEU LINE NUMBERS IN COMPILE LISTINGS

 

As of V4R2, a useful keyword for ILE RPG lets you print SEU line numbers in compile listings (instead of letting the ILE compiler create its own line numbers, which rarely have any relation to the SEU source). Thus, when a program abends, the system will site the SEU line number - rather than the "manufactured" line number - as the failing instruction.

 

By using the OPTION keyword with the Source Statement (*SRCSTMT) parameter in the H (control) specifications, as shown in the sample code below, you can place SEU numbers in a compile listing and use them in the ILE debugger, error messages, and formatted dumps. A second parameter, *NODEBUGIO, lets you single step (F10) through an I/O operation in the debugger without having to pass through each field of the file. Original Program Model (OPM) RPG currently performs both these functions by default.

 

*****************************

* Using the OPTION keyword.

*****************************

H DEBUG OPTION(*SRCSTMT:*NODEBUGIO)

FNEWS400F IF E K DISK

C Z-ADD 0 X 1 0

C DUMP

C MOVE '1' *INLR

 

As shown above, the OPTION keyword can take up to two arguments. The default is OPTION(*NOSRCSTMT:*DEBUGIO), and the other options are *SRCSTMT and *NODEBUGIO. (If you use both arguments, separate them with a colon.) Two cautionary notes: First, SEU doesn't recognize OPTION as a keyword and generates a syntax error when the line is created or modified. You can ignore this error message upon exiting SEU; the program will compile just fine. Second, for programs of 10,000 lines or more, you must number your source in increments of 0.1 starting at 0.1. (The SEU default is increments of 1 starting at 1.)

The above NEWS/400 tip is from Clark Heiser