|
1 - Prototype the call to QCMDEXC. Do NOT use a straight CALL. Use a CALLP and use prototypes. 2 - Now that you prototyped the call to QCMDEXC go from using CALLP to CALLP (E). Notice the E error extender? Research that in the RPGLE Reference. 3 - Add a "Program Status Data Structure". I suggest putting this into a /COPY member and then using a /COPY line in your program: DMYPSDS SDS D PROC_NAME *PROC * Procedure name D PGM *PROC Program name D PGM_STATUS *STATUS * Status code D PRV_STATUS 16 20S 0 * Previous status D LINE_NUM 21 28 * Src list line num D ROUTINE *ROUTINE * Routine name D PARMS *PARMS * Num passed parms D EXCP_MSG 40 46 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 PGM_DATE 191 198 * Date (*DATE fmt) D PGM_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 WSID 244 253 Workstation ID D USER 254 263 * User name D JOB_NUM 264 269S 0 * Job number D JOB_NUMA 6A overlay(JOB_NUM) * Job number, alpha 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 Src_id_a 354 355i 0 * see pos 21-28 D Src_id_b 356 357i 0 * see pos 228-235 D Curr_User 358 367a * Current user D* * see profile handle D* * api's 4 - Now, check %error after the use of CALLP (e). If %error then check the value of EXCP_MSG. This is where you'll find the CPFyaddaYaddaYadda message. If you want to look at the message data associated with a particular message you can look at EXCP_DATA. Rob Berendt
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.