Add Exit Program (QUSADDEP, QusAddExitProgram) API


  Required Parameter Group:

1 Exit point name Input Char(20)
2 Exit point format name Input Char(8)
3 Exit program number Input Binary(4)
4 Qualified exit program name Input Char(20)
5 Exit program data Input Char(*)
6 Length of exit program data Input Binary(4)
7 Exit program attributes Input Char(*)
8 Error code I/O Char(*)

  Service Program Name: QUSRGFA1

  Default Public Authority: *EXCLUDE

  Threadsafe: Yes

The Add Exit Program (OPM, QUSADDEP; ILE, QusAddExitProgram) API adds an exit program entry to a specific exit point or replaces an existing exit program. Each exit point can have a single entry, or multiple entries. The exit program number indicates the sequence in which the exit programs should be run. The exit point provider determines the maximum number of exit programs that are allowed for the exit point. The API does not verify that the exit program exists.

If the exit point to which the exit program is being added does not exist, the registration facility creates the exit point and adds the exit program. This exit point will be considered unregistered until it is explicitly registered with the Register Exit Point API. The Add Exit Program, Remove Exit Program, Retrieve Exit Information, and Deregister Exit Point APIs can be performed against an unregistered exit point. This capability allows exit programs to be added to an exit point that will be supported in the future but is not currently registered with the registration facility.

This API provides support similar to the Add Exit Program (ADDEXITPGM) command.


Authorities and Locks

API Public Authority
*EXCLUDE
Exit Registration Lock
*EXCL

Required Parameter Group

Exit point name
INPUT; CHAR(20)

The exit point name to which the exit program is being added.

Exit point format name
INPUT; CHAR(8)

The format name of the exit point to which the exit program is being added.

Exit program number
INPUT; BINARY(4)

The sequence in which the exit programs are to be run when multiple exit point entries for a specific exit point are retrieved. The valid range is 1 through 2 147 483 647 where the processing sequence is from the lowest number to the highest number. Exit program numbers do not need to be consecutive. The following special values are allowed:

-1 The API assigns the next lowest available number for that specific exit point.
-2 The API assigns the highest available number for that specific exit point.

Qualified exit program name
INPUT; CHAR(20)

The exit program name and library that is being added. The first 10 characters contain the exit program name, and the second 10 characters contain the library name in which the exit program resides. The exit program does not need to exist when it is added to the exit point. A specific library name must be specified. The special values *LIBL and *CURLIB are not supported.

Exit program data
INPUT; CHAR(*)

The exit point provider describes what needs to be supplied for this parameter. It is not an error to supply more information than the exit point calls for. Pointer data will not be preserved, and the API does not perform any validation of this parameter.

Length of exit program data
INPUT; BINARY(4)

The length of the exit program data. The valid length is 0 through 2048.

Exit program attributes
INPUT; CHAR(*)

The specified information for the exit program. Refer to Exit Program Attribute Keys for more information. Any key not specified will be given the default value. The information must be in the following format:

Number of variable length records
BINARY(4)
Total number of all of the variable length records.
Variable length records
The exit program attributes and their values. Refer to Format for Variable Length Record for the format of this field.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Format for Variable Length Record

The following table shows the format for the variable length record. For a detailed description of each field, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 BINARY(4) Length of variable length record
4 4 BINARY(4) Exit program attribute key
8 8 BINARY(4) Length of data
12 C CHAR(*) Data

If the length of the data is longer than the key field's data length, the data is truncated at the right. No message is issued.

If the length of the data is shorter than the key field's data length and the key contains binary data, an error message is issued. If the key does not contain binary data, the field is padded with blanks.

It is not an error to specify a key more than once. If duplicate keys are specified, the last specified value for that key is used.

Each variable length record must be 4-byte aligned. If not, unpredictable results may occur.


Field Descriptions

Data. The value to which a specific exit program attribute is to be set.

Exit program attribute key. The exit program attribute to be set. Refer to Exit Program Attribute Keys for more information.

Length of data. The length of the exit program attribute value.

Length of variable length record. The length of the record.


Exit Program Attribute Keys

The following table shows the valid exit program attribute keys for the key field area of the variable length record. For a detailed description of each field, see Field Descriptions.

Key Type Field
1 CHAR(27) Qualified message file name and message identifier for exit program description
2 CHAR(50) Exit program text description
3 BINARY(4) Exit program data CCSID
4 CHAR(1) Replace
5 CHAR(1) Threadsafe
6 CHAR(1) Multithreaded job action


Field Descriptions

Exit program data CCSID. The coded character set identifier (CCSID) used for working with the exit program data. The default value is 0.

0 Use the current job default CCSID.
CCSID A valid CCSID number. The valid CCSID range is 1 through 65 535 but not 65 534. The CCSID will be validated by the API.

Exit program text description. The text for the exit program description. When this key is specified, the qualified message file name and message identifier for exit program description field must not be specified. The default value is blanks.

Multithreaded job action. The action to take in a multithreaded job. This key has no direct relationship with the threadsafe key; however, the value for the threadsafe key can be used to determine the multithreaded job action. The default value is 0. Valid values for this key are:

0 Use the QMLTTHDACN system value to determine the action to take.
1 Run the exit program in a multithreaded job.
2 Run the exit program in a multithreaded job, but send an informational message. CPI3C80 can be used as the informational message.
3 Do not run the exit program in a multithreaded job. Depending on the exit point, do one of the following:
  1. Send an escape message and do not call the exit program. CPF3C80 can be used as the escape message.
  2. Send an informational message and do not call the exit program. CPF3C80 can be used as the informational message.
  3. Call the exit program in a non-multithreaded job.

If you use the threadsafe value to determine the value for the multithreaded job action, consider the following recommendations:

  1. If the threadsafe value is 0, the multithreaded job action should be set to 3.
  2. If the threadsafe value is 1, the multithreaded job action should be set to 0.
  3. If the threadsafe value is 2, the multithreaded job action should be set to 1.

Qualified message file name and message identifier for exit program description. A message file and message identifier that contains the exit program description. When this key is specified, the exit program text description key must not be specified. The message file and message identifier do not have to exist at the time the exit program is added. The default value is blanks. Refer to Qualified Message File Format for more information.

Replace. Whether to replace an existing exit program entry. The combination of the exit program name and exit program number define an exit program entry. The default value is 0. Valid values for this key are:

0 Do not replace an existing exit program entry.
1 Replace an existing exit program entry.

Threadsafe. Whether the exit program entry is threadsafe. This key has no direct relationship with the multithreaded job action key. It is intended for documentation purposes only. The default value is 1. Valid values for this key are:

0 The exit program entry is not threadsafe.
1 The threadsafe status of the exit program entry is not known.
2 The exit program entry is threadsafe.


Qualified Message File Format

The following table shows the layout of the qualified message file name and message identifier for exit program description field. For a detailed description of each field, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 CHAR(10) Message file name
10 10 CHAR(10) Message file library name
20 14 CHAR(7) Message identifie


Field Descriptions

Message file library name. The library name in which the message file resides. The special value *CURLIB is not supported. The possible values are:

*LIBL Search the library list for the message file. This value uses the first message file in the library list that contains the message identifier.
library name The name of the message library the message file resides in.

Message file name. The name of the message file that contains the exit program text description.

Message identifier. The message identifier for the description.


Error Messages

Message ID Error Message Text
CPF24B4 E Severe error while addressing parameter list.
CPF3C1E E Required parameter &1 omitted.
CPF3C36 E Number of parameters, &1, entered for this API was not valid.
CPF3C4D E Length &1 for key &2 not valid.
CPF3C81 E Value for key &1 not valid.
CPF3C82 E Key &1 not valid for API &2.
CPF3C85 E Value for key &1 not allowed with value for key &2.
CPF3C90 E Literal value cannot be changed.
CPF3CD2 E Exit point name &1 not valid.
CPF3CD3 E Exit point format name &1 not valid.
CPF3CD4 E Maximum number of exit programs reached for exit point &1 with format &2.
CPF3CD6 E Length of exit program data &1 not valid.
CPF3CD9 E Requested function cannot be performed at this time.
CPF3CDA E Registration facility repository not available for use.
CPF3CDE E Exit program name &1 library &2 not valid.
CPF3CDF E Exit program number &1 already assigned for exit point &2 with format &3.
CPF3CE1 E Exit program number &1 not valid.
CPF3CE5 E Exit point &1 with format &2 will not allow exit program &3 library &4 to be added.
CPF3CF1 E Error code parameter not valid.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF8100 E All CPF81xx messages could be returned. xx is from 01 to FF.
CPF9802 E Not authorized to object &2 in &3.
CPF9810 E Library &1 not found.
CPF9811 E Program &1 in library &2 not found.
CPF9820 E Not authorized to use library &1.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


API introduced: V3R1

[ Back to top | Registration Facility APIs | APIs by category ]