FILE-STATUS ERROR CODES


In addition to program status error codes, there are also file exception/error status codes. This type of code indicates when an error condition has been encountered after a file-specific operation is performed. An example is the CHAIN operation, where a record time-out error could occur.

Most operation codes set on resulting indicator 2 when an exception error is detected, however when the E operation extender is used, resulting indicator 2 is unnecessary. When the E operation extender is used, the %ERROR and %STATUS built-in functions may be used to detect the current status of the file (see Example 5.2). If the programmer has specified resulting indicator 2, the indicator is set on and control passes to the next RPG operation. If resulting indicator 2 is not specified and the E operation extender is not specified, but a file exception/error subroutine is specified, control automatically transfers to that subroutine. At that point, the value of *STATUS location may be interrogated. If resulting indicator 2 is not specified, the E operation extender is not specified, and a file exception/error subroutine is not specified, the RPG general exception/error handling subroutine receives control. The user or workstation operator is usually issued an error message at this point.

Example 5.2: Detecting a record lock/time-out condition.

start example
 .....FFileName++IFEASFRlen+LKeylnKFDevice+.Functions++++++++++++++++++++++++++++ 0010 FCUSTMAST  IF   E           KDISK .....CSRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHiLoEq 0020 C     1234567       CHAIN(E)  CUSTMAST 0030 C                   If        %Status = 1218 0040 C                   Eval      Msg - 'DBF Timeout' 0050 C                   EndIf 0060 C                   MOVE      *ON           *INLR 
end example

Table 5.14 contains the definitions for the abbreviations used to describe the device types for the file status error codes that are listed in Table 5.14.

Table 5.14: Device Type Abbreviation Glossary

Abbreviation

Device Type

Description

WS

WORKSTN

Workstation device file. Used to access display files and ICF (communications) files.

DSK

DISK

Disk file. Used to access database physical, logical, or joined-logical files. Also, save files can be accessed through this device type.

PRT

PRINTER

Printer file. Used to output printed data to a print device. Typically, the data is spooled (stored on disk) for a time and then printed later.

SEQ

SEQ

Sequential file. Used to access diskette, tape, and save files. The files can be opened, read, written to, and closed, but not updated.

SPC

SPECIAL

Special file. Used to support user-written device file drivers. A device file driver is a user-written program that handles the file access requests, such as open, close, read, and write.

The built-in function, %STATUS and the INFDS subfield *STATUS may contain any of the status codes in the range 1000 to 9999. The specific status codes are listed in Table 5.15.

Table 5.15: File Status (Error) Code Descriptions

Code

Devices

Description of Conditions

00000

No exception/error occurred.

00002

WS

Function key used to input display.

00011

WS,DSK,SEQ

End of file detected on a READ (input) operation.

00012

WS,DSK,SEQ

No-record-found condition for a CHAIN, SETLL, or SETGT operation.

00013

WS

Subfile is full.

01011

WS,DSK,SEQ

Undefined record type (identifying indicators do not match record).

01021

WS,DSK,SEQ

Attempted to write to an existing record or duplicate index value.

01031

WS,DSK,SEQ

Matching record match field data out of sequence.

01041

Array/table load sequence error.

01051

Too many array/table entries.

01052

Clearing of table prior to dump of data failed.

01071

WS,DSK,SEQ

Numeric sequence error.

01121

WS

Print key pressed with no resulting indicator.

01122

WS

Roll Up (Page Down) key pressed with no resulting indicator.

01123

WS

Roll Down (Page Up) key pressed with no resulting indicator.

01124

WS

Clear key pressed with no resulting indicator.

01125

WS

Help key pressed with no resulting indicator.

01126

WS

Home key pressed with no resulting indicator.

01201

WS

Workstation record mismatch detected on input.

01211

all

I/O operation to a closed file.

01215

all

OPEN operation issued to a file that was already opened.

01216

all

Error on an implicit OPEN/CLOSE operation (cycle oriented).

01217

all

Error on an explicit OPEN/CLOSE operation.

01218

DSK,SEQ

Unable to allocate record (record locked by another program).

01221

DSK,SEQ

Update operation without a prior successful read.

01231

SPC

Error on SPECIAL file.

01235

PRT

Error in PRTCTL data structure spacing or skipping entries.

01241

DSK,SEQ

ADDROUT record not found.

01251

WS

Permanent workstation I/O error detected.

01255

WS

Workstation session or device error occurred (recovery possible).

01261

WS

Attempted to exceed maximum number of acquired devices.

01281

WS

Operation to an acquired device.

01282

WS

Job ending (canceled) with controlled option.

01285

WS

Attempted to acquire an already acquired device.

01286

WS

Attempted to open shared file with SAVDS or IND file continuation.

01287

WS

Response indicators overlap IND continuation option indicators.

01299

WS,DSK,SEQ

Miscellaneous I/O error.

01331

WS

Wait-for-record time exceeded for READ or EXFMT operation.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net