Store Program Associated Space (QCLSPGAS) API


  Required Parameter Group:

1 Input data buffer Input Char(*)
2 Length of input data buffer Input Binary(4)
3 Qualified program name Input Char(20)
4 Call stack counter Input Binary(4)
5 Data handle Input Char(16)
6 Error code I/O Char(*)

  Default Public Authority: *EXCLUDE

  Threadsafe: No

The Store Program Associated Space (QCLSPGAS) API allows you to store information in the associated space of an original program model (OPM), user-state program in the user domain. This API is intended to be used only on programs created by the Create Program (QPRCRTPG) API.

This API's primary use is to store information about a program object for later use. For example, it can be used by a compiler to store information about the compilation process that is needed later at run time. The space associated with a program object is not a replacement for data areas or user spaces. It is recommended for static data only.

There is no capability to delete the information after it is stored. Multiple store requests using the same data handle will write over any information previously stored.


Authorities and Locks

Program Library Authority
*USE
Program Authority
*ALL
Program Lock
*EXCL

Required Parameter Group

Input data buffer
INPUT; CHAR(*)

The information to store in the associated space. This information can contain scalar data only. If it does contain pointer data, the pointer data is not kept.

Length of input data buffer
INPUT; BINARY(4)

The length of the data in the input data buffer, in bytes. The maximum size of an associated space is 16MB. An error is returned if the length of the input data and the data already stored in the associated space exceeds 16MB.

Qualified program name
INPUT; CHAR(20)

The program object for which you want to store data in the associated space. This must be an OPM, user-state program in the user domain. An error is returned if the program is an ILE program, or if it is a system-state or system-domain program. The first 10 characters contain the program name, and the second 10 characters contain the library name.

You can use the following special value for the program name:

* A program in the call stack. The call stack counter contains the number of programs up the stack from the calling program to look for the program where the data is to be stored.

You can use the following special values for the library name:

*CURLIB The job's current library
*LIBL The library list

Call stack counter
INPUT; BINARY(4)

A number greater than zero identifying the location in the call stack for the program if * is specified for the program name. This number is relative to the program that called this API. This parameter is ignored if the program name is not *.

Data handle
INPUT; CHAR(16)

The identifier to store the information under in the associated space. This identifier can be any unique value you choose to store your information under. You must remember this value if you want to later retrieve this information. Data may have been stored under a data handle. If this API is called to store data under it, the existing data is overwritten with the new data.

Error code
I/O; CHAR(*)

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


Error Messages

Message ID Error Message Text
CPF0301 E Length of data buffer is not valid.
CPF0302 E Value for call stack counter not valid.
CPF0303 E Limit of associated space size exceeded.
CPF0304 E Operation not allowed for program &1 in library &2.
CPF24B4 E Severe error while addressing parameter list.
CPF3C90 E Literal value cannot be changed.
CPF3CF1 E Error code parameter not valid.
CPF8100 E All CPF81xx messages could be returned. xx is from 01 to FF.
CPF9803 E Cannot allocate object &2 in library &3.
CPF9807 E One or more libraries in library list deleted.
CPF9808 E Cannot allocate one or more libraries on library list.
CPF9810 E Library &1 not found.
CPF9811 E Program &1 in library &2 not found.
CPF9820 E Not authorized to use library &1.
CPF9821 E Not authorized to program &1 in library &2.
CPF9830 E Cannot assign library &1.
CPF9838 E User profile storage limit exceeded.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.

API introduced: V2R3
Top | Program and CL Command APIs | APIs by category