From m204wiki
Jump to navigation Jump to search

Return list of bound semaphores onto a $list

Note: Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Bind_List function.

This function retrieves semaphores bound with $Bind by a specific or all users.

The $Bind_List function accepts three arguments and returns a number indicating the success of the function.


%rc = $Bind_List(olist, [sem_name], [user_num])

Syntax terms

%rc The number of items added to olist, or a negative (error) return code.
olist The output $list identifier. If the output $list is not empty, data is added to the end of the $list. See "Usage notes" for the $list format.
sem_name The name of the semaphore for which information is to be returned. This value can be a single specific semaphore name, or it can be a wildcard string that matches a number of semaphores. The argument default value is asterisk (*), which means to return all semaphores bound by all users or by a specific user.
user_num The user number of the user for which bound semaphores are to be returned. This optional argument defaults to -1, which means return semaphores bound by all users.

Return codes

>=0 Number of bound semaphores returned
-3 $list full or out of CCATEMP

All other errors result in request cancellation

Usage notes

  • The format of the olist output $list is shown below:
    0-4 The user number of the user that has the semaphore bound represented as a string with leading zeros included.
    5-14 The userid of the user that has the semaphore bound represented as a string padded with trailing blanks.
    15-end The name of the bound semaphore.
  • The semaphore name specified in the second argument can be an explicit name or it can contain the following wildcard characters:
    * Matches any number of characters including none
    ? Matches any single character
    " Indicates that the next character must be treated literally even if it is a wildcard character.

    For example:

    C*D matches CUSTID, COD or CLOD.
    S??T matches SALT, SLOT or SORT.


The following code fragment retrieves all semaphores bound by the current user where the semaphore name ends with the letters _TEMP into a $list and sorts the $list by semaphore name.

%rc = $Bind_List(%olist, '*_TEMP', $USER) %slist = $ListSort(%olist, '16,255, A')

Products authorizing $Bind_List