Mainframe Debugging Aids

  1. ABEND Trap Set ON
  2. ABEND Trap Set OFF
  3. Avoiding Loops
  4. The SELCOPY Query Desk

SELCOPY should never dump, but it is unrealistic to leave out this section. It is not intended as a full reference for dump analysis, but we do hope that, as a guide, it may assist you in some areas.

In an abend situation, depending on the Operating System, the JCL used, and whether SELCOPY's Abend Trap is enabled (via CBLNAME setting or ABTRAP=YES/NO on an OPTION statement), a storage dump is produced on SYSLST or SYSUDUMP, or in a CMS environment you just return to CMS with a single line error message.

Any part of storage may have been overwritten so the information below is not always true. Also, the error may have occurred outside SELCOPY, in which case the registers displayed are not SELCOPY's.

All registers and displacements quoted below are release dependent, and subject therefore to change without prior notice. Every effort however will be made to avoid inconvenience to the user.

The Abend Trap option in SELCOPY will suppress the storage dump produced by the system in abend situations, and instead give the user more readable diagnostics, and it is recommended that this option is taken at install time, for all operating systems, by setting the appropriate "bit" in CBLNAME, because when the Abend Trap is enabled it is normally much easier to find the cause of the problem.

The Abend Trap should only be disabled when the problem is such that a conventional dump is needed by CBL for investigation.

Code ABTRAP=NO on an OPTION statement, in order to disable the Abend Trap on a temporary basis.



ABEND Trap Set ON

Program Check Interrupt handling for MVS, VSE and CMS is provided, but interrupts are only trapped and handled by SELCOPY if the CBLNAME option for Abend Trap is set ON.

Selected areas of storage are printed instead of the normal full dump of the whole of storage, which is not only wasteful of paper if it is printed, but is also wasteful of system resources, whether printed or not.





Selection Id

The offending Selection Id is usually all that is needed in order to establish why an arithmetic operation has failed. This is readily available, printed at the bottom of the SELCOPY Selection Summary, alongside the Return Code 88 message.

If an abend occurs on an IF arithmetic test, the Selection Id (SEL-ID) of the statement following the offending IF statement is displayed, prefixed with less than signs (<<<). This is because an IF statement does not have a Selection Id of its own.





File Name Last Used

The full Selection Summary is printed, together with the failing Selection Id, which gives immediate access to information on all files used.





Arithmetic Exceptions

Arithmetic errors, often only due to an uninitialised work area, may therefore be diagnosed more easily by the user, knowing the failing selection id, without having to contact technical staff.





Diagnostic Information

In addition to normal output, the following information is also supplied on the SYSPRINT/SYSLST output:

SELCOPY ABEND PROCESSING....        PSW........ Addr.            R1

This is immediately followed by a TYPE=D (Dump Format) print of SELCOPY's Abend Control Block which contains:
8 bytes - Character constant
 ' AB S/A '
8 bytes - PSW at time of Interrupt. (Both VSE and MVS)
64 bytes - Registers 0 through 15 at time of Interrupt. (Both)
8 bytes - VSE PSW at time of Interrupt. (X'00's for MVS)
4 bytes - VSE Abnormal Termination Code. (X'00's for MVS)
Refer to IBM's manual "Supervisor and I/O Macros" (GC33-5373).
Some Abend Codes for VSE (in hex) are:
  • 19 Operator replied CANCEL or EOB to I/O ERR.
  • 1A An I/O Error has occurred.
  • 20 Program check, e.g. a Divide exception.
  • 22 Phase not found.
  • 23 Cancel macro issued.
  • 24 Cancelled due to Operator intervention.
  • 27 Undefined Logical Unit.
4 bytes - Reserved. (X'00's)


SELCOPY WORK AREA.... (UP TO 4096)

If a Work Area is in use, the above message is printed and is immediately followed by a TYPE=D (Dump Format) print of the first 4096 bytes of SELCOPY's Work Area.
Register 10 above should contain the absolute address of this work area.


*** SELECTION TIME ERROR 536 *** *** SYSTEM ABEND INTERCEPTED ***

The above message gives an error number to identify the condition.


MOST RECENT INPUT BLOCK (PRINTED FROM I/O BUFFER)....

If an input I/O buffer exists the above message is printed and is immediately followed by a TYPE=D (Dump Format) print of the whole of the most recently used input I/O buffer. No truncation occurs.


*** WARNING *** 88 = RETURN CODE FROM SELCOPY (SEL--nnn)

A high Return Code is given, as before, but additionally, the Selection Id of the offending, or at least the last active, SELCOPY statement is given in brackets. If this information is not available at the time, the selction id is omitted.

Finally, the Selection Summary is printed in full, as on an execution which completed normally.



ABEND Trap Set OFF





Selection Id

Even with the Abend Trap OFF, finding the selection-id of the operation SELCOPY is currently obeying is often all that is required to point to the source of the problem. Register 3 will point at the beginning of a control block for the current selection (a THEN, ELSE or NOW card), and at a displacement of X'60' on this address you will find a half-word (2 bytes) containing the Selection-id in hex.





File Name

The file name last used or currently being used by SELCOPY is another possible source of debugging information. Register 4+X'20' will often point at this 8 byte file name.





Selection Summary

Because the Abend Trap is switched OFF, no Selection Summary can be printed. The system has taken control and does not return to SELCOPY.





Arithmetic exceptions

See also:
ADD, SUB, MULT and DIV in section Operation Words, Parameters and Keywords.
The packed decimal arithmetic operations ADD, SUB, DIV and MULT can go wrong for various reasons, giving a Decimal Data Exception. The data on a record may have invalid characters.

Even if you have already located the selection-id, it may still be too much to believe that something is wrong. The following information may then be of assistance:

No INTO=n (i.e. no dest. field.) INTO=F3 (i.e. dest. field.)

 ____________________________________     ____________________________________
|       |          |        |        |   |       |          |        |        |
| Op Wd | R8 (Len) |   R7   |   R9   |   | Op Wd | R8 (Len) |   R7   |   R9   |
|_______|__________|________|________|   |_______|__________|________|________|
|       |          |        |        |   |       |          |        |        |
| ADD   |  F1  F2  | A(F1)  | A(F2)* |   | ADD   |      F3  | A(F3)* | A(F2)  |
|       |          |        |        |   |       |          |        |        |
| SUB   |  F1  F2  | A(F1)  | A(F2)* |   | SUB   |      F3  | A(F3)* | A(F2)  |
|       |          |        |        |   |       |          |        |        |
| MULT  |  F1  F2  | A(F2)  | A(F1)* |   | MULT  |  F1  F2  | A(F2)  | A(F1)  |
|       |          |        |        |   |       |          |        |        |
| DIV   |  F1  F2  | A(F1)* | A(F2)  |   | DIV   |  F3  F2  | A(F1)  | A(F2)  |
|_______|__________|________|________|   |_______|__________|________|________|

Rn - Register n     Fn - Field n        A - Address         * - A(result)

The "machine" length is always 1 less than the actual length, and is stored in a single hex digit. i.e. it will only take up 4 "bits" (half a byte). Thus together, the two lengths only take up 1 byte, the junior (right most) byte of Register 8. The other 3 bytes of R8 will be zero.
Thus, in the operation:

 ADD  4 AT 20   TO  6 AT 30

Reg 7 will point at position 20 of the work or I/O area.
Reg 8 will contain X'0000 0035' (M/c lengths 3 and 5).
Reg 9 will point at position 30 of the work or I/O area.

In the case of a DIVIDE INTO, SELCOPY will use its own work area of 16 bytes for the temporary destination, and the destination machine length in R8 will not be set.

When totally convinced that all data is valid and correct, remember that with decimal arithmetic, when a result is too large for the destination field, the decimal data exception does not occur until the destination field has overflowed. Thus the data in the dump will appear to be valid.

Decimal data exception may also occur on a MULT operation where the destination field is of insufficient length.





Under CMS

For versions of VM prior to VM/ESA, to look at storage in a program that has just abended you may use the CMS DEBUG facilities which are described fully in the CMS Command and Macro Reference.
In later releases of VM, the functions provided by the DEBUG subcommands are available using CP DISPLAY , TRACE and PER - Refer to CP General User Commands.



Avoiding Loops

See also: Looping on GU in section IMS and DL/1 Processing.

The missed IF EOF statement can cause a loop. EOF tests do not have to follow a READ operation. They may go anywhere, but beware of a GOTO which can cause SELCOPY to bypass the EOF test, resulting in an infinite EOF loop, This is discussed more fully under the EOF statement and also in the section on Multiple Input Files.

Beware too of getting the last record doubled:

READ FILEA
WRITE FILEB        * Last record  written  ** TWICE **
IF EOF FILEA
  THEN PRINT       * Print last record.
  THEN GOTO EOJ

For safety and readability, EOF tests should be immediately after the READ operation.



The SELCOPY Query Desk

Your installation's Technical Representative has access to the "SELCOPY Query Desk", so if the above information is insufficient, please pass the problem on, so that it may be referred to us by post, fax, e-mail or telephone as preferred.

COMPUTE(Bridgend)Ltd UK Tel:+44(1656) 65 2222 Fx:2227
2003/07/31 FUR - Debugging Aids SELCOPY Rel 2.0x