The steps to creating an exit program are
Create you exit program
Use WRKREGINF to work with exit programs
Use option 1 to add the program to the list of registered exit programs
This link to an example:
http://publib.boulder.ibm.com/infoce...imstsmprpg.htm
Examples: Create exit programs with RPG
The following example illustrates how to set up a user exit program with RPG*.
Note: Read the Code example disclaimer for important legal information.
**
** OS/400 SERVERS - SAMPLE USER EXIT PROGRAM
**
** THE FOLLOWING RPG PROGRAM UNCONDITIONALLY
** ACCEPTS ALL REQUESTS. IT CAN BE USED AS A SHELL
** FOR SPECIFIC APPLICATIONS. NOTE: REMOVE THE
** SUBROUTINES AND CASE STATEMENT ENTRIES FOR THE SERVERS
** THAT DO NOT REQUIRE
** SPECIFIC EXIT PROGRAM HANDLING FOR BETTER PERFORMANCE.
**
E*
E* NECESSARY ARRAY DEFINITIONS FOR TRANSFER FUNCTION
E* AND REMOTE SQL
E*
E TFREQ 4096 1
E RSREQ 4107 1
I*
I*
IPCSDTA DS
I 1 10 USERID
I 11 20 APPLID
I*
I* SPECIFIC PARAMETERS FOR VIRTUAL PRINTER
I*
I 21 30 VPFUNC
I 31 40 VPOBJ
I 41 50 VPLIB
I 71 750VPIFN
I 76 85 VPOUTQ
I 86 95 VPQLIB
I*
I* SPECIFIC PARAMETERS FOR MESSAGING FUNCTION
I 21 30 MFFUNC
I*
I* SPECIFIC PARAMETERS FOR TRANSFER FUNCTION
I*
I 21 30 TFFUNC
I 31 40 TFOBJ
I 41 50 TFLIB
I 51 60 TFMBR
I 61 70 TFFMT
I 71 750TFLEN
I 764171 TFREQ
I*
I* SPECIFIC PARAMETERS FOR FILE SERVER
I*
I* NOTE: FSNAME MAY BE UP TO l6MB.
I* FSNLEN WILL CONTAIN THE ACTUAL SIZE OF FSNAME.
I*
I B 21 240FSFID
I 25 32 FSFMT
I 33 33 FSREAD
I 34 34 FSWRIT
I 35 35 FSRDWR
I 36 36 FSDLT
I B 37 400FSNLEN
I 41 296 FSNAME
I*
I* SPECIFIC PARAMETERS FOR DATA QUEUES
I*
I 21 30 DQFUNC
I 31 40 DQQ
I 41 50 DQLIB
I 70 750DQLEN
I 76 77 DQROP
I 78 820DQKLEN
I 83 338 DQKEY
I*
I* SPECIFIC PARAMETERS FOR REMOTE SQL
I*
I 21 30 RSFUNC
I 31 40 RSOBJ
I 41 50 RSLIB
I 51 51 RSCMT
I 52 52 RSMODE
I 53 53 RSCID
I 54 71 RSSTN
I 72 75 RSRSV
I 764182 RSREQ
I*
I* SPECIFIC PARAMETERS FOR NETWORK PRINT SERVER
I*
I 21 28 NPFT
I B 29 320NPFID
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT SPLF0l00
I 33 42 NPJOBN
I 43 52 NPUSRN
I 53 58 NPJOB#
I 59 68 NPFILE
I B 69 720NPFIL#
I B 73 760NPLEN
I 77 332 NPDATA
I*
I* Data queue server:
I*
I* QIBM_QZHQ_DATA_QUEUE format ZHQ00100
I*
I 21 28 DQOFMT
I B 29 320DQOFID
I 33 42 DQOOBJ
I 43 52 DQOLIB
I 53 54 DQOROP
I B 55 580DQOLEN
I 59 314 DQOKEY
I*
I* Specific PARAMETERS FOR CENTRAL SERVER
I*
I 21 28 CSFMT
I B 29 320CSFID
I* Central server:
I*
I* QIBM_QZSC_LM format ZSCL0l00 for license management calls
I*
I*
I 33 287 CSLCNM
I 288 295 CSLUSR
I 296 302 CSLPID
I 303 306 CSLFID
I 307 312 CSLRID
I B 313 3140CSLTYP
I*
I* Central server:
I*
I* QIBM_QZSC_LM format ZSCS0l00 for system management calls
I*
I*
I 33 287 CSSCNM
I 288 542 CSSCMY
I 543 543 CSSNDE
I 544 798 CSSNNM
I*
I* Central server:
I*
I* QIBM_QZSC_LM format ZSCN0l00 for retrive conversion map calls
I*
I*
I 21 30 CSNXFM
I 29 320CSNFNC
I B 33 360CSNFRM
I B 37 400CSNTO
I B 41 420CSNCNT
I*
I* SPEClFIC PARAMETERS FOR DATABASE SERVER
I*
I 21 28 DBFMT
I B 29 320DBFID
I*
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAD0l00
I 33 160 DBDFIL
I 161 170 DBDLIB
I 171 180 DBDMBR
I 181 190 DBDAUT
I 191 318 DBDBFL
I 319 328 DBDBLB
I 329 338 DBDOFL
I 339 348 DBDOLB
I 349 358 DBDOMB
I*
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAD0200
I B 33 360DBNUM
I 37 46 DBLIB2
I*
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAQ0l00
I 33 50 DBSTMT
I 51 68 DBCRSR
I 69 70 DBOPI
I 71 72 DBATTR
I 73 82 DBPKG
I 83 92 DBPLIB
I B 93 940DBDRDA
I 95 95 DBCMT
I 96 351 DBTEXT
I* THE FOLLOWING PARAMETERS REPLACE DBTEXT FOR FORMAT ZDAQ0200
I 96 105 DBSQCL
I B 133 1360DBSQLN
I 137 392 DBSQTX
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAR0l00
I 33 52 DBLIBR
I 53 88 DBRDBN
I 89 108 DBPKGR
I 109 364 DBFILR
I 365 384 DBMBRR
I 385 404 DBFFT
I* THE FOLLOWING PARAMETERS ADDITIONAL FOR FORMAT ZDAR0200
I 33 42 DBRPLB
I 43 170 DBRPTB
I 171 180 DBRFLB
I 181 308 DBRFTB
I*
I* Remote command and distributed program call server:
I*
I* QIBM_QZRC_RMT format CZRC0100
I* RCPGM AND RCLIB ARE NOT USED FOR REMOTE COMMAND CALLS
I*
I 21 28 RCFMT
I B 29 320RCFID
I 33 42 RCPGM
I 43 52 RCLIB
I B 53 560RCNUM
I 57 312 RCDATA
I*
I* signon server:
I*
I* QIBM_QZSO_SIGNONSRV format ZSOY0l00 for TCP/IP signon server
I*
I 21 28 SOXFMT
I B 29 320SOFID
I*
I***************************************************************
I*
I '*VPRT ' C #VPRT
I '*TFRFCL ' C #TRFCL
I '*FILESRV ' C #FILE
I '*MSGFCL ' C #MSGF
I '*DQSRV ' C #DQSRV
I '*RQSRV ' C #RQSRV
I '*SQL ' C #SQL
I '*NDB ' C #NDBSV
I '*SQLSRV ' C #SQLSV
I '*RTVOBJINF' C #RTVOB
I '*DATAQSRV ' C #DATAQ
I 'QNPSERVR ' C #QNPSV
I '*CNTRLSRV ' C #CNTRL
I '*RMTSRV ' C #RMTSV
I '*SIGNON ' C #SIGN
I*
C*
C* EXIT PROGRAM CALL PARAMETERS
C*
C *ENTRY PLIST
C PARM RTNCD 1
C PARM PCSDTA
C*
C* INITIALIZE RETURN VALUE TO ACCEPT REQUEST
C*
C MOVE '1' RTNCD
C*
C* COMMON PROCESSING
C*
C* COMMON LOGIC GOES HERE
C*
C* PROCESS BASED ON SERVER ID
C*
C APPLID CASEQ#VPRT VPRT
C APPLID CASEQ#TRFCL TFR
C APPLID CASEQ#FILE FILE
C APPLID CASEQ#MSGF MSG
C APPLID CASEQ#DQSRV DATAQ
C APPLID CASEQ#RQSRV RSQL
C APPLID CASEQ#SQL SQLINT
C APPLID CASEQ#NDBSV NDB
C APPLID CASEQ#SQLSV SQLSRV
C APPLID CASEQ#RTVOB RTVOBJ
C APPLID CASEQ#DATAQ ODATAQ
C APPLID CASEQ#QNPSV NETPRT
C APPLID CASEQ#CNTRL CENTRL
C APPLID CASEQ#RMTSV RMTCMD
C APPLID CASEQ#SIGN SIGNON
C END
C SETON LR
C RETRN
C*
C* SUBROUTINES
C*
C*
C* VIRTUAL PRINT
C*
C VPRT BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* TRANSFER FUNCTION
C*
C* THE FOLLOWING IS AN EXAMPLE OF SPECIFIC PROCESSING
C* THAT THE EXIT PROGRAM COULD DO FOR TRANSFER FUNCTION.
C*
C* IN THIS CASE, USERS ARE NOT ALLOWED TO SELECT
C* DATA FROM ANY FILES THAT ARE IN LIBRARY QIWS.
C*
C TFR BEGSR
C TFFUNC IFEQ 'SELECT'
C TFLIB ANDEQ'QIWS'
C MOVE '0' RTNCD
C END
C ENDSR
C*
C*
C* FILE SERVER
C*
C FILE BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* MESSAGING FUNCTION
C*
C MSG BEGSR
C* SPECIFIC LOGIC GOFS HERE
C ENDSR
C* DATA QUEUES
C*
C DATAQ BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* REMOTE SQL
C*
C RSQL BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* SERVERS
C*
C*
C* DATABASE INIT
C*
C SQLINT BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* DATABASE NDB (NATIVE DATABASE)
C*
C NDB BEGSR
C* SFECIFIC LOGIC GOES HERE
C ENDSR
C*
C* DATABASE SQL
C*
C SQLSRV BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* DATABASE RETRIEVE OBJECT INFORMATION
C*
C RTVOBJ BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* DATA QUEUE SERVER
C*
C ODATAQ BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* NETWORK PRINT
C*
C NETPRT BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* CENTRAL SERVER
C*
C*
C* THE FOLLOWING IS AN EXAMPLE OF SPECIFIC PROCESSING
C* THAT THE EXIT PROGRAM COULD DO FOR LICENSE MANAGEMENT.
C*
C* IN THIS CASE, THE USER "USERALL" WILL NOT BE ALLOWED
C* TO EXECUTE ANY FUNCTIONS THAT ARE PROVIDED BY THE
C* CENTRAL SERVER FOR WHICH THIS PROGRAM IS A REGISTERED
C* EXIT PROGRAM - LICENSE INFORMATION, SYSTEM MANAGEMENT
C* OR RETRIVE A CONVERSION MAP.
C*
C CENTRL BEGSR
C USERID IFEQ 'USERALL'
C MOVE '0' RTNCD
C ENDIF
C* SPECIFIC LOGIC GOES HERE
C ENDSR
C*
C* REMOTE COMMAND AND DISTRIBUTED PROGRAM CALL
C*
C* IN THIS CASE, THE USER "USERALL" WILL NOT BE ALLOWED
C* TO EXECUTE ANY REMOTE COMMANDS OR REMOTE PROGRAM CALLS
C*
C RMTCMD BEGSR
C USERID IFEQ 'USERALL'
C MOVE '0' RTNCD
C ENDIF
C ENDSR
C*
C* SIGNON SERVER
C*
C SIGNON BEGSR
C* SPECIFIC LOGIC GOES HERE
C ENDSR
No comments:
Post a Comment