This program retrieves exit point and exit program information. After retrieving the exit point information, the program calls each, exit program. The Retrieve Exit Information API returns a continuation handle when it has more information to return than what fits in the receiver variable.
F*************************************************************** F*************************************************************** F* F* Program: Retrieve Exit Point and Exit Program Information F* F* Language: ILE RPG F* F* Description: This program retrieves exit point and exit F* program information. After retrieving the F* exit point information, the program calls each , F* exit program. F* F* APIs Used: QusRetrieveExitInformation - Retrieve Exit F* Information F* F*************************************************************** F*************************************************************** F* FQPRINT O F 132 PRINTER OFLIND(*INOF) USROPN D* D* The following QUSREG include from QSYSINC is copied into D* this program so that the data structures can be declared as D* BASED. D* D*** START HEADER FILE SPECIFICATIONS **************************** D* D*Header File Name: H/QUSREG D* D*Descriptive Name: Standard Registration Structures. D* D*5763-SS1 (C) Copyright IBM Corp. 1994,1994 D*All rights reserved. D*US Government Users Restricted Rights - D*Use, duplication or disclosure restricted D*by GSA ADP Schedule Contract with IBM Corp. D* D*Licensed Materials-Property of IBM D* D* D*Description: All of the structures that are used in the D* Registration facilities are kept here to avoid D* conflict due to repetition. D* D*Header Files Included: None. D* D*Macros List: None. D* D*Structure List: Qus_Prep_Exit_t D* Qus_Qmff_t D* Qus_Selcrtr_t D* Qus_Select_Entry_t D* Qus_Program_Data_t D* Qus_EXTI0100_t D* Qus_EXTI0100_Entry_t D* Qus_EXTI0200_t D* Qus_EXTI0200_Entry_t D* Qus_EXTI0300_t D* Qus_EXTI0300_Entry_t D* D*Function Prototype List: none. D* D*Change Activity: D* D*CFD List: D* D*FLAG REASON LEVEL DATE PGMR CHANGE DESCRIPTION D*---- ------------ ----- ------ --------- ---------------------- D*$A0= D2862000 3D10 940327 LUPA: New Include D* D*End CFD List. D* D*Additional notes about the Change Activity D*End Change Activity. D*** END HEADER FILE SPECIFICATIONS ****************************** D***************************************************************** D*Format structure for the Preprocessing Exit Program Format for D*QusRegisterExitPoint API. D***************************************************************** DQUSPE DS D* Qus Prep Exit D QUSPPN 1 10 D* Prep Prog Name D QUSPPLIB 11 20 D* Prep Prog Library D QUSPPF 21 28 D* Prep Prog Format D***************************************************************** D*Format structure for the Qualified Message File Format for the D*entire service program. D***************************************************************** DQUSQMFF DS D* Qus Qmff D QUSMFIL 1 10 D* Message File D QUSMLIB 11 20 D* Message Library D QUSMI 21 27 D* Message Id D***************************************************************** D*Format structure for the Exit Program Selection Criteria of the D*QusRetrieveExitInformation API. D**** *** D*NOTE: This structure only defines fixed fields. Any varying D* length or repeating field will have to be defined by D* the user. D***************************************************************** DQUSSE DS D* Qus Select Entry D QUSSE00 1 4B 0 D* Size Entry D QUSCO 5 8B 0 D* Comp Operator D QUSSPD 9 12B 0 D* Start Pgm Data D QUSLCD 13 16B 0 D* Length Comp Data D*QUSCD 17 17 D* D* Varying length DQUSS DS D* Qus Selcrtr D QUSNBRSC 1 4B 0 D* Number Sel Criteria D*QUSARRAY 17 DIM(00001) D* QUSSE01 9B 0 OVERLAY(QUSARRAY:00001) D* QUSCO00 9B 0 OVERLAY(QUSARRAY:00005) D* QUSSPD00 9B 0 OVERLAY(QUSARRAY:00009) D* QUSLCD00 9B 0 OVERLAY(QUSARRAY:00013) D* QUSCD00 1 OVERLAY(QUSARRAY:00017) D* D* Varying length D***************************************************************** D*Format Structure for the Program Data. This structure has D*set up to facilitate COBOL and RPG pointer basing. D***************************************************************** DQUSPGMD DS D* Qus Program Data D QUSDATA01 1 1 D* Varying length D***************************************************************** D*Format structure for the EXTI0100 Format for the D*QusRetrieveExitInformation API. D**** *** D*NOTE: This structure only defines fixed fields. Any varying D* length or repeating field will have to be defined by D* the user. D***************************************************************** DQUS0100E DS BASED(INFSPCPTR) D* Qus EXTI0100 Entry D QUSEPN00 1 20 D* Exit Point Name D QUSFN08 21 28 D* Format Name D QUSMEP 29 32B 0 D* Max Exit Programs D QUSNBREP 33 36B 0 D* Number Exit Programs D QUSAD 37 37 D* Allow Deregistration D QUSACC 38 38 D* Allow Change Control D QUSREP 39 39 D* Registered Exit Point D QUSPNAP 40 49 D* Prep Name Add Pgm D QUSPLAP 50 59 D* Prep Lib Add Pgm D QUSPFA 60 67 D* Prep Format Add D QUSPNRP 68 77 D* Prep Name Rmv Pgm D QUSPLRP 78 87 D* Prep Lib Rmv Pgm D QUSPFR 88 95 D* Prep Format Rmv D QUSPNRI 96 105 D* Prep Name Rtv Info D QUSPLRI 106 115 D* Prep Lib Rtv Info D QUSPFR00 116 123 D* Prep Format Rtv D QUSDI 124 124 D* Desc Indicator D QUSDMFIL 125 134 D* Desc Msg File D QUSDMLIB 135 144 D* Desc Msg Library D QUSDMI 145 151 D* Desc Msg Id D QUSTD 152 201 D* Text Description D*QUSERVED03 202 202 D* D* Varying length DQUSI0100 DS BASED(BASSPCPTR) D* Qus EXTI0100 D QUSBRTN 1 4B 0 D* Bytes Returned D QUSBAVL00 5 8B 0 D* Bytes Available D QUSCH 9 24 D* Continue Handle D QUSOEPE 25 28B 0 D* Offset Exit Point Entry D QUSNBRPR 29 32B 0 D* Number Points Returned D QUSLEPE 33 36B 0 D* Length Exit Point Entry D*QUSERVED04 37 37 D* D* Varying length D*QUSARRAY00 202 DIM(00001) D* QUSEPN01 20 OVERLAY(QUSARRAY00:00001) D* QUSFN09 8 OVERLAY(QUSARRAY00:00021) D* QUSMEP00 9B 0 OVERLAY(QUSARRAY00:00029) D* QUSNBREP00 9B 0 OVERLAY(QUSARRAY00:00033) D* QUSAD00 1 OVERLAY(QUSARRAY00:00037) D* QUSACC00 1 OVERLAY(QUSARRAY00:00038) D* QUSREP00 1 OVERLAY(QUSARRAY00:00039) D* QUSPNAP00 10 OVERLAY(QUSARRAY00:00040) D* QUSPLAP00 10 OVERLAY(QUSARRAY00:00050) D* QUSPFA00 8 OVERLAY(QUSARRAY00:00060) D* QUSPNRP00 10 OVERLAY(QUSARRAY00:00068) D* QUSPLRP00 10 OVERLAY(QUSARRAY00:00078) D* QUSPFR01 8 OVERLAY(QUSARRAY00:00088) D* QUSPNRI00 10 OVERLAY(QUSARRAY00:00096) D* QUSPLRI00 10 OVERLAY(QUSARRAY00:00106) D* QUSPFR02 8 OVERLAY(QUSARRAY00:00116) D* QUSDI00 1 OVERLAY(QUSARRAY00:00124) D* QUSDMFIL00 10 OVERLAY(QUSARRAY00:00125) D* QUSDMLIB00 10 OVERLAY(QUSARRAY00:00135) D* QUSDMI00 7 OVERLAY(QUSARRAY00:00145) D* QUSTD00 50 OVERLAY(QUSARRAY00:00152) D* QUSERVED05 1 OVERLAY(QUSARRAY00:00202) D* D* Varying length D***************************************************************** D*Format structure for the EXTI0200 Format for the D*QusRetrieveExitInformation API. D**** *** D*NOTE: This structure only defines fixed fields. Any varying D* length or repeating field will have to be defined by D* the user. D***************************************************************** DQUS0200E DS BASED(INFSPCPTR) D* Qus EXTI0200 Entry D QUSONE 1 4B 0 D* Offset Next Entry D QUSEPN02 5 24 D* Exit Point Name D QUSFN10 25 32 D* Format Name D QUSREP01 33 33 D* Registered Exit Pt D QUSCE 34 34 D* Complete Entry D QUSERVED06 35 36 D* Reserved D QUSPGMN 37 40B 0 D* Program Number D QUSPGMN00 41 50 D* Program Name D QUSPGML 51 60 D* Program Library D QUSDC 61 64B 0 D* Data CCSID D QUSOED 65 68B 0 D* Offset Exit Data D QUSLED 69 72B 0 D* Length Exit Data D*QUSERVED06 73 73 D* D* Varying length D*QUSPD 1 D* QUSDATA02 74 74 D* D* Varying length DQUSI0200 DS BASED(BASSPCPTR) D* Qus EXTI0200 D QUSBRTN00 1 4B 0 D* Bytes Returned D QUSBAVL01 5 8B 0 D* Bytes Available D QUSCH00 9 24 D* Continue Handle D QUSOPGME 25 28B 0 D* Offset Program Entry D QUSNBRPR00 29 32B 0 D* Number Programs Returned D QUSLPGME 33 36B 0 D* Length Program Entry D*QUSERVED07 37 37 D* D* Varying length D*QUSARRAY01 74 DIM(00001) D* QUSONE00 9B 0 OVERLAY(QUSARRAY01:00001) D* QUSEPN03 20 OVERLAY(QUSARRAY01:00005) D* QUSFN11 8 OVERLAY(QUSARRAY01:00025) D* QUSREP02 1 OVERLAY(QUSARRAY01:00033) D* QUSCE00 1 OVERLAY(QUSARRAY01:00034) D* QUSERVED08 2 OVERLAY(QUSARRAY01:00035) D* QUSPGMN01 9B 0 OVERLAY(QUSARRAY01:00037) D* QUSPGMN02 10 OVERLAY(QUSARRAY01:00041) D* QUSPGML00 10 OVERLAY(QUSARRAY01:00051) D* QUSDC00 9B 0 OVERLAY(QUSARRAY01:00061) D* QUSOED00 9B 0 OVERLAY(QUSARRAY01:00065) D* QUSLED00 9B 0 OVERLAY(QUSARRAY01:00069) D* QUSERVED08 1 OVERLAY(QUSARRAY01:00073) D* QUSPD00 1 D* QUSDATA03 1 OVERLAY(QUSARRAY01:00001) D* D* Varying length D***************************************************************** D*Format structure for the EXTI0300 Format for the D*QusRetrieveExitInformation API. D**** *** D*NOTE: This structure only defines fixed fields. Any varying D* length or repeating field will have to be defined by D* the user. D***************************************************************** DQUS0300E DS D* Qus EXTI0300 Entry D QUSONE01 1 4B 0 D* Offset Next Entry D QUSEPN04 5 24 D* Exit Point Name D QUSFN12 25 32 D* Format Name D QUSREP03 33 33 D* Registered Exit Point D QUSCE01 34 34 D* Complete Entry D QUSERVED09 35 36 D* Reserved D QUSPGMN03 37 40B 0 D* Program Number D QUSPGMN04 41 50 D* Program Name D QUSPGML01 51 60 D* Program Library D QUSDI01 61 61 D* Desc Indicator D QUSMFIL00 62 71 D* Message File D QUSMFILL 72 81 D* Message File Library D QUSMI00 82 88 D* Message Id D QUSTD01 89 138 D* Text Desc D QUSRSV201 139 140 D* Reserved2 D QUSDC01 141 144B 0 D* Data CCSID D QUSOPD 145 148B 0 D* Offset Pgm Data D QUSLPD 149 152B 0 D* Length Pgm Data D*QUSERVED09 153 153 D* D* Varying length D*QUSPD01 1 D* QUSDATA04 154 154 D* D* Varying length DQUSI0300 DS D* Qus EXTI0300 D QUSBRTN01 1 4B 0 D* Bytes Returned D QUSBAVL02 5 8B 0 D* Bytes Available D QUSCH01 9 24 D* Continue Handle D QUSOPGME00 25 28B 0 D* Offset Program Entry D QUSNBRPR01 29 32B 0 D* Number Programs Returned D QUSLPGME00 33 36B 0 D* Length Program Entry D*QUSERVED10 37 37 D* D* Varying length D*QUSARRAY02 154 DIM(00001) D* QUSONE02 9B 0 OVERLAY(QUSARRAY02:00001) D* QUSEPN05 20 OVERLAY(QUSARRAY02:00005) D* QUSFN13 8 OVERLAY(QUSARRAY02:00025) D* QUSREP04 1 OVERLAY(QUSARRAY02:00033) D* QUSCE02 1 OVERLAY(QUSARRAY02:00034) D* QUSERVED11 2 OVERLAY(QUSARRAY02:00035) D* QUSPGMN05 9B 0 OVERLAY(QUSARRAY02:00037) D* QUSPGMN06 10 OVERLAY(QUSARRAY02:00041) D* QUSPGML02 10 OVERLAY(QUSARRAY02:00051) D* QUSDI02 1 OVERLAY(QUSARRAY02:00061) D* QUSMFIL01 10 OVERLAY(QUSARRAY02:00062) D* QUSMFILL00 10 OVERLAY(QUSARRAY02:00072) D* QUSMI01 7 OVERLAY(QUSARRAY02:00082) D* QUSTD02 50 OVERLAY(QUSARRAY02:00089) D* QUSRSV202 2 OVERLAY(QUSARRAY02:00139) D* QUSDC02 9B 0 OVERLAY(QUSARRAY02:00141) D* QUSOPD00 9B 0 OVERLAY(QUSARRAY02:00145) D* QUSLPD00 9B 0 OVERLAY(QUSARRAY02:00149) D* QUSERVED11 1 OVERLAY(QUSARRAY02:00153) D* QUSPD02 1 D* QUSDATA05 1 OVERLAY(QUSARRAY02:00001) D* D* Varying length D* D* Error Code parameter include. As this sample program D* uses /COPY to include the error code structure, only the first D* 16 bytes of the error code structure are available. If the D* application program needs to access the variable length D* exception data for the error, the developer should physically D* copy the QSYSINC include and modify the copied include to D* define additional storage for the exception data. D* D/COPY QSYSINC/QRPGLESRC,QUSEC D* D***************************************************************** D*Prototype for calling Retrieve Exit Information D***************************************************************** D QUSREI C 'QusRetrieveExitInformation' D* D* Miscellaneous data D* DEPNTNAME S 20 INZ('EXAMPLE_EXIT_POINT') DEPGM_NBR S 9B 0 INZ(-1) DRCVVAR S 1 DIM(3500) DRCVVAR_SZ S 9B 0 INZ(%SIZE(RCVVAR:*ALL)) DBASSPCPTR S * DINFSPCPTR S * DCALL_PGM S 21 C* C* Beginning of mainline C* C* Retrieve the exit point information first. If the current C* number of exit programs is not zero, retrieve the exit C* programs. It is not necessary to call for the exit point C* information to determine if the exit point has any exit C* programs. It is done here for illustrative purposes only. C* You can make one call to the API for the exit program C* information and check the number of exit program entries C* returned field to see if there are any exit programs to call. C* C* Initialize the error code to inform the API that all C* exceptions should be returned through the error code parameter. C* C EVAL QUSBPRV = %SIZE(QUSEC) C* C* Blank out the continuation handle to let the API know that this C* is a first attempt at the retrieve operation. C* C MOVE *BLANKS CONTIN_HDL 16 C* C* Call the API to retrieve the exit programs C* C CALLB QUSREI C PARM CONTIN_HDL C PARM RCVVAR C PARM RCVVAR_SZ C PARM 'EXTI0100' FORMAT 8 C PARM EPNTNAME C PARM 'EXMP0100' EPNT_FMT 8 C PARM EPGM_NBR C PARM 0 QUSNBRSC C PARM QUSEC C* C* If an exception occurs, the API returns the exception in the C* error code parameter. The bytes available field is set to C* zero if no exception occurs and greater than zero if an C* exception does occur. C* C IF QUSBAVL > 0 C OPEN QPRINT C EXCEPT ERRAEPNT C EXSR DONE C ENDIF C* C* If the call to retrieve exit point information is successful, C* check to see if there are any exit programs to call. C* C EVAL BASSPCPTR = %ADDR(RCVVAR) C IF QUSNBRPR > 0 C EVAL INFSPCPTR = %ADDR(RCVVAR(QUSOEPE+1)) C IF QUSNBREP > 0 C* C* There are some exit programs to call. Blank out the continuation C* handle to let the API know that this is a first attempt at the C* retrieve operation. C* C EVAL CONTIN_HDL = *BLANKS C* C* Call the exit programs C* C EXSR CUSREI C* C* If the continuation handle field in the receiver variable is C* not set to blanks, the API has more information to return than C* what could fit in the receiver variable. Call the API for C* more exit programs to call. C* C DOW QUSCH00 <> *BLANKS C EVAL CONTIN_HDL = QUSCH00 C EXSR CUSREI C ENDDO C ENDIF C ENDIF C EXSR DONE C* C* End of MAINLINE C* C* Process exit programs in receiver variable C* C CUSREI BEGSR C* C* Call the API to retrieve the exit program information C* C CALLB QUSREI C PARM CONTIN_HDL C PARM RCVVAR C PARM RCVVAR_SZ C PARM 'EXTI0200' FORMAT 8 C PARM EPNTNAME C PARM 'EXMP0100' EPNT_FMT 8 C PARM EPGM_NBR C PARM 0 QUSNBRSC C PARM QUSEC C* C* If an exception occurs, the API returns the exception in the C* error code parameter. The bytes available field is set to C* zero if no exception occurs and greater than zero if an C* exception does occur. C* C IF QUSBAVL > 0 C OPEN QPRINT C EXCEPT ERRAEPGM C EXSR DONE C ENDIF C* C* If the call to retrieve exit program information is successful, C* check to see if there are any exit programs to call. C* C* The receiver variable offers enough room for a minimum of one C* exit program entry because the receiver variable was declared C* as 3500 bytes. Therefore, this example only checks the C* number of exit programs returned field. If the receiver C* variable were not large enough to hold at least one entry, C* the bytes available field would need to be checked as well as C* the number of exit programs returned field. If the number of C* exit programs returned field is set to zero and the bytes C* available field is greater than the bytes returned field, the C* API had at least one exit program entry to return but was C* unable to because the receiver variable was too small. C* C EVAL INFSPCPTR = %ADDR(RCVVAR(QUSOPGME+1)) C DO QUSNBRPR00 C* C* Get the exit program name and library C* C EVAL CALL_PGM = %TRIMR(QUSPGML) + C '/' + QUSPGMN00 C* C* Call the exit program while ignoring failures on the call C* C CALL CALL_PGM 01 C PARM EXIT_PARMS 10 C* C* Set INFSPCPTR to point to the next exit program entry C* C EVAL INFSPCPTR = %ADDR(RCVVAR(QUSONE+1)) C ENDDO C ENDSR C* C* Return to programs caller C DONE BEGSR C EVAL *INLR = '1' C RETURN C ENDSR O* OQPRINT E ERRAEPNT 1 6 O 'Attempt to retrieve infor- O mation failed: ' O QUSEI OQPRINT E ERRAEPGM 1 6 O 'Attempt to retrieve Exit - O Programs failed: ' O QUSEI