Ü  %STATUS

·         %STATUS provides a five-digit status code that identifies the error.

·         Program status codes are in the range 00100 to 00999 and File status codes are in the range 01000 to 01999.

·         Status codes in the range 00000 to 00050 are considered to be normal (i.e., they are not set by an exception/error condition).

·         We can see all the program/file related system messages using the command below:

DSPMSGD RANGE(*FIRST *LAST) MSGF(QRNXMSG) DETAIL(*BASIC)

 

The below table lists some of the commonly used Status Codes:


MSG ID MESSAGE DETAIL
 
00100  Value out of range for string operation
00102  Divide by zero
00112  Invalid Date, Time or Timestamp value.
00121  Array index not valid
00122  OCCUR outside of range
00202  Called program or procedure failed
00211  Error calling program or procedure
00222  Pointer or parameter error
00401  Data area specified on IN/OUT not found
00413  Error on IN/OUT operation
00414  User not authorized to use data area
00415  User not authorized to change data area
00907  Decimal data error (digit or sign not valid)
01021  Tried to write a record that already exists (file being used has unique keys
       and key is duplicate, or attempted to write duplicate relative record number to
       a subfile).     
01211  File not open.
01218  Record already locked.
01221  Update operation attempted without a prior read. 

 

 

 

Example –%status built-in function in rpgle

 

Å        ERROR HANDLING USING E-OPERATOR EXTENDER AND %ERROR BUILT-IN FUNCTION


Columns . . . :    6  80                                          AMITCC/QRPGLESRC
SEU==>                                                                  E_OP_EXTND
FMT H  HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*************** Beginning of data ************************************************
0001.00 HOPTION(*SRCSTMT)
0002.00 FCUST      UF A E             DISK    USROPN
0003.00
0004.00 C     1             SETLL(E)  CUSTR
0005.00 C                   EXSR      @ERROR
0006.00 C                   EVAL      CSNAME='CCC'
0007.00 C                   UPDATE(E) CUSTR
0008.00 C                   EXSR      @ERROR
0009.00 C                   SETON                                        LR
0010.00  *
0011.00 C     @ERROR        BEGSR
0012.00 C                   IF        %ERROR()
0013.00 C                   IF        %STATUS(CUST)=1211
0014.00 C                   OPEN      CUST
0015.00 C                   ELSEIF    %STATUS(CUST)=1221
0016.00 C                   READ(E)   CUST
0017.00 C                   EVAL      CSNAME='CCC'
0018.00 C                   UPDATE(E) CUSTR
0019.00 C                   ENDIF
0020.00 C                   ENDIF
0021.00 C                   ENDSR
****************** End of data **************************************************

 











User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy