Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1028913
  • 博文数量: 125
  • 博客积分: 10490
  • 博客等级: 上将
  • 技术积分: 2386
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-03 18:26
文章分类

全部博文(125)

文章存档

2011年(1)

2010年(9)

2009年(17)

2008年(98)

分类:

2008-09-29 10:21:52

A program status data structure (PSDS) can be defined to make program exception/error information available to an RPG IV program.   The PSDS must be defined in the main source section; therefore, there is only one PSDS per module.

A data structure is defined as a PSDS by an S in position 23 of the data structure statement.   A PSDS contains predefined subfields that provide you with information about the program exception/error that occurred.   The location of the subfields in the PSDS is defined by special keywords or by predefined From and To positions.   In order to access the subfields, you assign a name to each subfield.   The keywords must be specified, left-adjusted in positions 26 through 39.

Information from the PSDS is also provided in a formatted dump.   However, a formatted dump might not contain information for fields in the PSDS if the PSDS is not coded, or the length of the PSDS does not include those fields.   For example, if the PSDS is only 275 bytes long, the time and date or program running will appear as N/A.   in the dump, since this information starts at byte 276.
what ibm says:
about program Exception/Errors

Some examples of program exception/errors are: division by zero, SQRT of a negative number, invalid array index, error on a CALL, error return from called program, and start position or length out of range for a string operation. They can be handled in one of the following ways:

  • The operation code extender 'E' can be specified for some operation codes. When specified, before the operation begins, this extender sets the %ERROR and %STATUS built-in functions to return zero. If an exception/error occurs during the operation, then after the operation %ERROR returns '1' and %STATUS returns the program status. The optional program status data structure is updated with the exception/error information. You can determine the action to be taken by testing %ERROR and %STATUS.
  • An indicator can be specified in positions 73 and 74 of the calculation specifications for some operation codes. This indicator is set on if an exception/error occurs during the processing of the specified operation. The optional is updated with the exception/error information. You can determine the action to be taken by testing the indicator.
  • |ON-ERROR groups can be used to handle errors for statements |processed within a MONITOR block. If an error occurs when a statement |is processed, control passes to the appropriate ON-ERROR group.
  • You can create a user-defined ILE exception handler that will take control when an exception occurs. For more information, see ILE RPG Programmer's Guide.
  • A can be specified. You enter *PSSR in factor 1 of a BEGSR operation to specify this subroutine. Information regarding the program exception/error is made available through a program status data structure that is specified with an S in position 23 of the data structure statement on the definition specifications. You can also use the %STATUS built-in function, which returns the most recent value set for the program or file status.
  • If the indicator, 'E' extender, |monitor block, or program exception/error subroutine is not present, program exception/errors are handled by the RPG IV default error handler.
Program Status Data Structure
     D                SDS
     D PROC_NAME        *PROC                     Procedure name
     D PGM_STATUS       *STATUS                   Status code
     D PRV_STATUS             16     20S 0         Previous status
     D LINE_NUM               21     28            Src list line nu
     D ROUTINE          *ROUTINE                  Routine name
     D PARMS            *PARMS                    Num passed parms
     D EXCP_TYPE              40     42            Exception type
     D EXCP_NUM               43     46            Exception number
     D PGM_LIB                81     90            Program library
     D EXCP_DATA              91    170            Exception data
     D EXCP_ID               171    174            Exception Id
     D DATE                  191    198            Date (DATE fmt)
     D YEAR                  199    200S 0         Year (YEAR fmt)
     D LAST_FILE             201    208            Last file used
     D FILE_INFO             209    243            File error info
     D JOB_NAME              244    253            Job name
     D USER                  254    263            User name
     D JOB_NUM               264    269S 0         Job number
     D JOB_DATE              270    275S 0         Date (UDATE fmt)
     D RUN_DATE              276    281S 0         Run date (UDATE)
     D RUN_TIME              282    287S 0         Run time (UDATE)
     D CRT_DATE              288    293            Create date
     D CRT_TIME              294    299            Create time
     D CPL_LEVEL             300    303            Compiler level
     D SRC_FILE              304    313            Source file
     D SRC_LIB               314    323            Source file lib
     D SRC_MBR               324    333            Source file mbr
     D PROC_PGM              334    343            Pgm Proc is in
     D PROC_MOD              344    353            Mod Proc is in
     D CURR_USER             358    367            Mod Proc is in
Status codes *STATUS 
	   Normal Codes
       
        Code      Condition
        00000     No exception/error occurred
        00001     Called program returned with the LR indicator on.
       
       Exception/Error Codes
      
       Code      Condition
       00100     Value out of range for string operation
       00101     Negative square root
       00102     Divide by zero
       00103     An intermediate result is not large enough to
                 contain the result.
       00104     Float underflow. An intermediate value is too 
                 small to be contained in the intermediate
                 result field
       00112     Invalid Date, Time or Timestamp value.
       00113     Date overflow or underflow. (For example, when
                 the result of a Date calculation
                 results in a number greater than HIVAL or less
                 than LOVAL.)
       00114     Date mapping errors, where a Date is mapped from a 4 
                 character year to a 2 character year and the date range
                 is not 1940-2039.
       00120     Table or array out of sequence.
       00121     Array index not valid
       00122     OCCUR outside of range
       00123     Reset attempted during initialization step of program
       00202     Called program or procedure failed; halt indicator
                 (H1 through H9) not on
       00211     Error calling program or procedure
       00222     Pointer or parameter error
       00231     Called program or procedure returned with halt
                 indicator on
       00232     Halt indicator on in this program
       00233     Halt indicator on when RETURN operation run
       00299     RPG IV formatted dump failed
       00333     Error on DSPLY operation
       00401     Data area specified on IN/OUT not found
       00402     PDA not valid for non-prestart job
       00411     Data area type or length does not match
       00412     Data area not locked for output
       00413     Error on IN/OUT operation
       00414     User not authorized to use data area
       00415     User not authorized to change data area
       00421     Error on UNLOCK operation
       00425     Length requested for storage allocation is out of range
       00426     Error encountered during storage management operation
       00431     Data area previously locked by another program
       00432     Data area locked by program in the same process
       00450     Character field not entirely enclosed by shift-out 
                 and shift-in characters
       00501     Failure to retrieve sort sequence.
       00502     Failure to convert sort sequence.
       00802     Commitment control not active.
       00803     Rollback operation failed.
       00804     Error occurred on COMMIT operation
       00805     Error occurred on ROLBK operation
       00907     Decimal data error (digit or sign not valid)
       00970     The level number of the compiler used to generate
                 the program does not agree with the level number
                 of the RPG IV run-time subroutines
       09998     Internal failure in ILE RPG/400 compiler or in 
                 run-time subroutines
       09999     Program exception in system routine.
阅读(2780) | 评论(0) | 转发(0) |
0

上一篇:OS400自动重起设置

下一篇:添加ip

给主人留下些什么吧!~~