Add Exit Program (ADDEXITPGM)

Where allowed to run: All environments (*ALL)
Threadsafe: Yes
Parameters
Examples
Error messages

The Add Exit Program (ADDEXITPGM) command adds an exit program entry for a specific exit point. Each exit point can have a single entry or multiple entries. The exit program number indicates the sequence in which the exit programs are run.

Top

Parameters

Keyword Description Choices Notes
EXITPNT Exit point Simple name Required, Positional 1
FORMAT Exit point format Simple name Required, Positional 2
PGMNBR Program number 1-2147483647, *LOW, *HIGH Required, Positional 3
PGM Program Qualified object name Required, Positional 4
Qualifier 1: Program Name
Qualifier 2: Library Name, *CURLIB
THDSAFE Threadsafe *UNKNOWN, *NO, *YES Optional
MLTTHDACN Multithreaded job action *SYSVAL, *RUN, *MSG, *NORUN Optional
TEXT Text 'description' Character value, *BLANK, *MSGID Optional
MSGID Message identifier Simple name Optional
MSGF Message file Qualified object name Optional
Qualifier 1: Message file Name
Qualifier 2: Library Name, *LIBL
REPLACE Replace existing entry *YES, *NO Optional
CRTEXITPNT Create exit point *YES, *NO Optional
PGMDTA Exit program data Single values: *NONE
Other values: Element list
Optional
Element 1: Coded character set ID Integer, *JOB
Element 2: Length of data 0-2048, *CALC
Element 3: Program data Character value, X''
Top

Exit point (EXITPNT)

Specifies the exit point name to which the exit program is added. If no exit point by this name exists, and CRTEXITPNT(*YES) is specified, an exit point is created.

Top

Exit point format (FORMAT)

Specifies the exit point format name of the exit program that is added.

Top

Program number (PGMNBR)

Specifies the sequence in which the exit programs are run when multiple exit point programs for a specific exit point are defined.

The possible values are:

*LOW
The lowest available number for that specific exit point is assigned.
*HIGH
The highest available number for that specific exit point is assigned.
program-number
Specify the exit program sequence number. Valid values range from 1 through 2,147,483,647. Processing sequence is from the lowest number to the highest number. Exit program numbers do not need to be consecutive.
Top

Program (PGM)

Specifies the name of exit program to be called. The program does not have to exist on the system when this command is run.

The name of the exit program can be qualified by one of the following library values:

*CURLIB
The current library for the thread is searched. If no library is specified as the current library for the thread, the QGPL library is used.
library-name
Specify the name of the library where the exit program is located.

The possible value is:

program-name
Specify the name of the exit program.
Top

Threadsafe (THDSAFE)

Specify the threadsafe attribute for the exit program entry. If you do not know the threadsafety status of the exit program entry, use the default value of *UNKNOWN.

The possible values are:

*UNKNOWN
The threadsafety status of this exit program entry is not known.
*NO
The exit program entry is not threadsafe.
*YES
The exit program entry is threadsafe.
Top

Multithreaded job action (MLTTHDACN)

Specify the multithreaded job action for this exit program entry. If you do not know the action to take in a multithreaded job, use the default value of *SYSVAL.

The possible values are:

*SYSVAL
The multithreaded job action specified in the QMLTTHDACN system value is used.
*RUN
Run the exit program entry.
*MSG
Run the exit program entry and send an informational message.
*NORUN
Do not run the exit program entry.
Top

Text 'description' (TEXT)

Specifies the text that briefly describes the exit program.

The possible values are:

*BLANK
No text is specified.
*MSGID
The description is taken from the message specified by the MSGID and MSGF parameters. The description is retrieved when exit program information is displayed using the WRKREGINF (Work with Registration Information) command or retrieved using the QusRetrieveExitInformation API.
'description'
Specify no more than 50 characters of text, enclosed in apostrophes.
Top

Message identifier (MSGID)

Specifies the message identifier that contains the text that describes the exit program. The message is retrieved from the message file specified by the MSGF parameter. This parameter can only be specified if TEXT(*MSGID) is specified.

The possible values are:

message-identifier
Specify the seven-character message identifier of the message that describes the exit program.
Top

Message file (MSGF)

Specifies the message file and library that contains the message specified by the MSGID parameter. This parameter can only be specified if TEXT(*MSGID) is specified. The name of the message file is qualified by one of the following library values:

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
library-name
Specify the name of the library where the message file is located.

The possible values are:

message-file
Specify the name of the message file.
Top

Replace existing entry (REPLACE)

Specify whether the attributes and data for an exit program entry are replaced. New values for the program data and the text or message identifier can be specified. The program name and library cannot be changed.

The possible values are:

*NO
Do not replace the attributes and data for an exit program.
*YES
Replace the attributes and data for and exit program entry.
Top

Create exit point (CRTEXITPNT)

Specify whether the exit point is automatically created if it does not already exist.

The possible values are:

*NO
Do not create the exit point. If the specified exit point does not exist the exit program is not added and an error message is returned.
*YES
Create the specified exit point.
Top

Exit program data (PGMDTA)

Specifies the data that is passed to the exit program. This data should correspond to the input data defined by the exit point provider.

The possible values are:

*NONE
No data is passed to the exit program.

The possible CCSID for program data values are:

*JOB
The CCSID (coded character set identifier) of the current job is used.
CCSID-for-data
Specify the CCSID associated with the data passed to the exit program.

The possible Length of program data values are:

*CALC
The length is determined by the number of bytes specified for the third element of this parameter.
length-of-data
Specify the number of bytes of data passed to the exit program.

The possible Program data value is:

program-data
Specify the character or hexadecimal program data to be passed to the exit program. If you specify more program data than the length specified, the program data passed to the exit program is truncated. If you specify less program data than the length specified, the program data passed to the exit program is padded on the right with blanks. You can specify up to 2048 bytes of program data.
Top

Examples

ADDEXITPGM   EXITPNT(USER_EXIT_ONE)  FORMAT(EXIT1)  PGMNBR(1)
             PGM(LIB2/MYPGM)  TEXT(*MSGID)  MSGID(TXT2345)
             MSGF(LIB1/MYMSGF)

This command adds exit program MYPGM in library LIB2 to exit point USER_EXIT_ONE. This is first exit program run for the exit point. The text description for the exit program is retrieved from message TXT2345 in message file MYMSGF in library LIB1. No program data is passed to the exit program.

Top

Error messages

*ESCAPE Messages

CPF0001
Error found on &1 command.
Top