Using KSAM/XL and KSAM 64 (32650-90886)

Appendix A 191
COBOL Intrinsics
CKERROR
CKERROR
Converts KSAM file system error code returned in
status
to a display format number.
CALL "CKERROR" USING
status, result
Whenever a 9 is returned as the left character of the status parameter following any call to
a KSAM procedure, you can call the procedure CKERROR to convert the MPE file system
error code in the right character of
status
from a binary number to a display format
number. This allows you to display the error code.
Parameters
status
The status parameter to which a value was returned by a previous KSAM
procedure call. The entire status parameter, both left and right characters,
must be specified.
result
An item to which the error number is returned right justified in display
format. The item must have a picture of 4 numeric characters (PIC 9(4) ).
Operation Notes
The following example shows the WORKING-STORAGE SECTION entries needed to
check for errors and a call to CKERROR in the PROCEDURE DIVISION that checks for and
displays the error number if a file system error occurred in a call to process a KSAM file.
DATA DIVISION.
.
.
.
WORKING-STORAGE SECTION.
77 RESULT PIC 9(4) VALUE ZERO.
01 STAT.
03 STATUS-KEY-1 PIC X.
03 STATUS-KEY-2 PIC X.
.
.
.
PROCEDURE DIVISION.
START.
.
.
.
IF STATUS-KEY-1 = "9" THEN
CALL "CKERROR" USING STAT, RESULT.
DISPLAY "ERROR NUMBER ",RESULT.