Open List of Semaphores (QP0ZOLSM) API


  Required Parameter Group:

1 Receiver variable Output Char(*)
2 Length of receiver variable Input Binary(4)
3 List information Output Char(80)
4 Number of records to return Input Binary(4)
5 Format name Input Char(8)
6 Semaphore set identifier Input BINARY(4)
7 Error code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: No

The Open List of Semaphores (QP0ZOLSM) API lets you generate a list of description information about the semaphores within a semaphore set.

The QP0ZOLSM API places the specified number of list entries in the receiver variable. You can access additional records by using the Get List Entries (QGYGTLE) API. On successful completion of the QP0ZOLSM API, a handle is returned in the list information parameter. You may use this handle on subsequent calls to the following APIs:

The records returned by QP0ZOLSM include an information status field that describes the completeness and validity of the information. Be sure to check the information status field before using any other information returned.


Authorities and Locks

Job Authority
Service special authority (*SERVICE) is needed to call this API.

For additional information about this authority, see the Security reference topic collection.


Required Parameter Group

Receiver variable
OUTPUT; CHAR(*)

The variable that is used to return the semaphore information that you requested.

Length of receiver variable
INPUT; BINARY(4)

The length of the receiver variable.

List information
OUTPUT; CHAR(80)

Information about the list of semaphores that were opened. For a description of the layout of this parameter, see Open list information format.

Number of records to return
INPUT; BINARY(4)

The number of records in the list to put into the receiver variable.

Format name
INPUT; CHAR(8)

The format of the information to be returned in the receiver variable. You must use the following format name:

LSEM0100 This format is described in LSEM0100 Format.


Semaphore set identifier
INPUT; BINARY(4)

The semaphore set identifier of the semaphore set whose semaphores you would like the information about. The semaphore set identifier can be obtained from calling either the semget(), or QP0ZOLIP API.

Error code
I/O; CHAR(*)

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


LSEM0100 Format

This format name is used to return list information for the semaphores in a semaphore set. The following table shows the information returned in each record in the receiver variable for the LSEM0100 format. For a detailed description of each field, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 BINARY(4) Length of entry
4 4 BINARY(4) Number
8 8 BINARY(4) Value
12 C BINARY(4) Displacement to wait values
16 10 BINARY(4) Number of waiters
20 14 BINARY(4) Size of waiting information
24 18 BINARY(4) Waiting for zero
28 1C BINARY(4) Waiting for positive value
32 20 CHAR(26) Last changed qualified job identifier
58 3A CHAR(2) Reserved
60 3C BINARY(4) Process identifier
These fields repeat for each waiter on the semaphore value. BINARY(4) Wait value
CHAR(26) Waiting qualified job identifier
CHAR(2) Reserved


Field Descriptions

Displacement to wait values. The offset in characters (bytes) from the beginning of the semaphore record to the beginning of the array of wait values.

Last changed qualified job identifier. The job name, the job user profile, and the job number of the thread that last changed the value of the semaphore. The 26 characters are:

1-10 The job name
11-20 The user profile
21-26 The job number

These fields will be all blanks if any of the following are true:

Length of entry. The length of this semaphore record in the list.

Number. The semaphore number in the semaphore set.

Number of waiters. The total number of threads that are waiting for this semaphore to reach a certain value.

Process identifier The process identifier of the last thread to change the value of the semaphore. If no thread has changed the semaphore value, this field will be zero.

Reserved. An ignored field.

Size of waiting information. The size, in bytes, of the record that is used to store information about a thread that is waiting for a semaphore value.

Value. The current value of the semaphore.

Wait value. The value that a thread is waiting for the semaphore to reach. If the value is zero, the thread is waiting for the semaphore value to equal zero. If the value is a positive number, the thread is waiting for the semaphore value to be greater than or equal to this value.

Waiting for positive value. The number of threads that are currently waiting for a semaphore value to reach a positive number.

Waiting for zero. The number of threads that are currently waiting for the semaphore value to reach zero.

Waiting qualified job identifier. The job name, the job user profile, and the job number of the thread that is currently waiting for the semaphore. The 26 characters are:

1-10 The job name
11-20 The user profile
21-26 The job number


Error Messages

Message ID Error Message Text
GUI0002 E &2 is not valid for length of receiver variable.
GUI0027 E &1 is not valid for number of records to return.
GUI0115 E The list has been marked in error. See the previous messages.
GUI0118 E Starting record cannot be 0 when records have been requested.
CPF0F01 E *SERVICE authority is required to run this program.
CPF2204 E User profile &1 not found.
CPF24B4 E Severe error while addressing parameter list.
CPF3C19 E Error occurred with receiver variable specified.
CPF3C21 E Format name &1 is not valid.
CPF3C90 E Literal value cannot be changed.
CPF3CF1 E Error code parameter not valid.
CPFA988 E IPC object &1 does not exist.


API introduced: V4R2

[ Back to top | UNIX-Type APIs | APIs by category ]