If a CICS ASRA abend (OC4) occurs at PUTPIPE

There are two common causes of ASRA abends at the PUTPIPE command: a SQLLEN packed decimal error and VARCHAR or LVARCHAR definition error.


A SQLLEN packed decimal error

Defining packed decimals in the SQLDA is a common source of errors. When you define the length of a packed decimal in the SQLLEN field, the length is a decimal translation of hexadecimal 'PPSS', where:

An incorrect length causes an ASRA abend at the PUTPIPE command. The following table shows how the problem can occur.

Table 6-1: Coding decimal and hexadecimal values

Code

Picture

Hex value

Decimal value

PIC S9(03)V99

nnn.nn

X'0502'

'1282'

PAC S9(11)V99

nnnnnnnnnnn.nn

X'0D02'

'3330'

You can calculate the hex value using the following formula:

pp x 256 + ss = length

where pp is precision and ss is scale.

For example:

05 SQLLEN PIC S9(4) COMP VALUE +3330.
13 x 256 + 02 = 3330

You can avoid decimal translation by redefining the SQLLEN field as a PIC(2) with a hexadecimal value:

05 SQLLEN-X                 PIC X(2)VALUE X'0D02’.
 05 SQLLEN REDEFINES SQLLEN-X PIC S9(4)COMP.

VARCHAR or LVARCHAR definition error

When VARCHAR and LVARCHAR are defined in the LINKAGE SECTION, they each require a preceding 2-byte field for their length. Not including this length field causes an ASRA abend at the PUTPIPE command.

The code must include a computed field, which passes the amount of space that is required for the text:

01 VARCHAR-HOLD.
     05 VARCHAR-LENGTH     PIC S9(4)COMP.
     05 VARCHAR-TEXT       PIC X(200).

If the code omits the computed field, the first two characters in the text field are used for the length of the text field:

01 VARCHAR-HOLD.
        05 VARCHAR-TEXT       PIC X(200).

The hexadecimal value for alphas can be very large. The result is an ASRA abend, or even a CICS crash.