HPlogo KSAM/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 USING KSAM FILES IN COBOL PROGRAMS

STATUS PARAMETER

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

The status parameter is a two-character item to which the status of the input-output operation is returned. It is always the second parameter in a KSAM procedure call. The status parameter must be defined in the WORKING-STORAGE SECTION of the COBOL program.

Status consists of two separate characters: the left character is known as status-key-1, and the right is known as status-key-2.

/---left character----\/---right character----\ 

|----------------------|------------------------| 

|                      |                        | 

|  "status-key-1"      |     "status-key-2"     |<-----status word 

|----------------------|------------------------| 

The possible combinations of the left and right characters of parameter status are shown in Table 3-2 “Valid status Parameter Character Combinations” The values of status-key-2 (the right character) shown in the table are the only valid values for status-key-2.

Table 3-2 Valid status Parameter Character Combinations

If left character of status

(status-key-1) equals:

Then right character of status

(status-key-2) may equal:

"0" (successful completion)"0" (no further information)
 "2" (duplicate key)
"1" (at end)"0" (no further information)
"2" (invalid key)"1" (sequence error)
 "2" (duplicate key)
 "3" (no record found)
 "4" (boundary violation)
"3" (request denied)"0" (lock denied)
 "1" (unlock denied)
"9" (file system error)"n" where n is the MPE file system error code.

 

Combining status-key-1 with status-key-2, the following values may be returned to the status parameter as a whole:

If status = "00"

Successful completion --

The current input/output operation was completed successfully; no duplicate keys were read or written.

= "02"

Successful completion; Duplicate key --

For a CKREAD or a CKREADBYKEY call, the current alternate key has the same value as the equivalent key in the sequentially following record; duplicate keys are allowed for the key. For a CKWRITE or CKREWRITE call, the record just written created a duplicate key value for at least one alternate key for which duplicates are allowed.

STATUS

If status = "10"

At End condition --

In a sequential read using CKREAD, no next logical record was in the file.

= "21"

Invalid key; Sequence error --

A call to CKWRITE attempted to write a record with a key that is not in sequentially ascending order, to a file opened for sequential access.

A call to CKREWRITE was attempted but the primary key value was changed by the program since the previous successful call to CKREAD.

= "22"

Invalid key; Duplicate key --

An attempt was made to write or rewrite a record with CKWRITE or CKREWRITE and the record would create a duplicate key value for a key where duplicates are prohibited.

= "23"

Invalid key; No record found --

An attempt was made with CKSTART or CKREADBYKEY to access a record identified by key, but no record is found with the specified key value at the specified location.

= "24"

Invalid key; Boundary violation --

An attempt was made with a call to CKWRITE to write past the externally defined boundaries of the file; that is, to write past the end-of-file.

= "30"

Lock denied --

An attempt was made to lock a file already locked by another process; or file was not opened with dynamic locking allowed.

= "31"

Unlock denied --

An attempt was made to unlock a file with CKUNLOCK, but the file had not been locked by CKLOCK.

= "9n"

File system error --

A call to an input/output procedure was unsuccessful as a result of a file system error, not one of the error conditions defined for the other status values. The value of status-key-2 (n) is a binary number between 0 and 255 that corresponds to an MPE file system error code (refer to appendix A). To convert this binary value to numeric display format, call the CKERROR routine (described next in this section).

Feedback to webmaster