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.
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
Soon to be followed with working example in RPGLE
Thursday, July 24, 2008
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment