Register Function (QSYRGFN, QsyRegisterFunction) API


  Required Parameter Group for QSYRGFN:

1 Function ID Input Char(30)
2 Function controls Input Char(*)
3 Error Code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: Yes



  Syntax for QsyRegisterFunction:
 #include <qsyrgfn1.h>

 void QsyRegisterFunction
        (char                  Function_ID[30],
         Qsy_Func_Controls_T  *Function_controls,
         void                 *Error_code);

  Service Program: QSYRGFN1
  Default Public Authority: *USE

  Threadsafe: Yes


The Register Function (OPM, QSYRGFN; ILE, QsyRegisterFunction) API registers a function with the registration facility. The function controls provide information to help manage and control the use of the function.

You can update a function entry by reregistering the function (using the replace control key) with new values for the function control keys. The registration facility will update the control keys and maintain the current list of usage settings that are associated with the function. The following conditions apply to updating the function control keys:


When a function is registered, the registration information is stored using the Exit Point Registration Facility. Each function is registered as an exit program within an exit point. The exit point that the function is registered in depends on the category of the function:


The Exit Point Registration Facility is used only for storing the function registration information. The exit programs within these exit points are never called, so the formats associated with these exit points (FCNR0100 and FCNR0200) are never used or documented.

Note: You must use this API and the Deregister Function (QSYDRGFN, QsyDeregisterFunction) API to manage the function registration entries. If the Exit Point Registration Facility APIs are used, the results will be unpredictable.


Authorities and Locks

API Public Authority
*USE

Authority Required
*SECADM special authority

Function Registration Lock
*EXCL

Required Parameter Group

Function ID
INPUT; CHAR(30)

The function ID to register. IBM® functions are named QIBM_Qccc_name, where _Qccc is the componenet qualifier and ccc is the component identifier, or are named QIBM_wccc_name, where _wccc is the component qualifier, w is a character A through I, and ccc is the component identifier. The component qualifier is included in IBM function IDs if the function is associated with a specific component. Otherwise, IBM function IDs will not contain the component qualifier. User-supplied function IDs should not preface their function ID with QIBM. User-supplied function IDs should start with the company name to eliminate most problems that involve unique names.

The first character of the function ID must be one of the following:

A-Z Uppercase A-Z

The remaining characters in the function ID must be made up of the following characters:

A-Z Uppercase A-Z
0-9 Digits 0-9
. Period
_ Underscore


Function controls
INPUT; CHAR(*)

The function control fields for managing the function. Any field not specified will be given the default value. Refer to Function Control Keys for more information.

The information must be in the following format:

Number of variable length records BINARY(4)
The total number of all of the variable length records.
Variable length records The fields of the function controls to set. Refer to Format for Variable Length Record for more information.


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 layout of 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) Function control 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 function control is to be set.

Function control key. The function control to be set. Refer to Function Control Keys for more information.

Length of data. The length of the function control value.

Length of variable length record. The length of the record including this field.


Function Control Keys

The following table shows the valid function control 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(1) Function category
2 CHAR(1) Function type
3 CHAR(30) Function product ID
4 CHAR(30) Function group ID
5 CHAR(27) Qualified message file name and message identifier for function name
6 CHAR(132) Function name
7 BINARY(4) Function name CCSID
8 CHAR(27) Qualified message file name and message identifier for function description
9 CHAR(132) Function description
10 BINARY(4) Function description CCSID
11 CHAR(1) Default usage
12 CHAR(1) *ALLOBJ indicator
13 CHAR(1) Replace


Field Descriptions

*ALLOBJ indicator.

Whether a user with *ALLOBJ special authority can use the function. The default value is 1. This key can be specified only if the function type control key is set to 3 (administrable function).

0 For a user with *ALLOBJ special authority to use the function, the usage information specified for the function must indicate that the user is allowed to use the function for one of the following reasons:
  1. the user is allowed usage,
  2. one of its groups is allowed usage, or
  3. the default setting is to allow usage.
1 A user with *ALLOBJ special authority is always allowed to use the function.

Default usage. The default usage for the function. The default usage is used if the user or one of its groups does not have a specific usage setting. This key can be specified only if the function type control key is set to 3 (administrable function). The default value is 2.

1 The default usage is to not allow usage of the function.
2 The default usage is to allow usage of the function.

Function category. The category of the function. This control is set when the function is registered and cannot be changed. The default value is 3.

1 The function is a locally managed client function within IBM i Navigator. The function defines code that runs on the client, is locally managed, and is included in the IBM i Navigator tree structure.
2 The function is a locally managed client function, not within IBM i Navigator. The function defines code that runs on the client and is locally managed, but is not included in the IBM i Navigator tree structure.
3 The function is a host function. The function defines code that runs on the server.
4 The function is a centrally managed client function within IBM i Navigator. The function defines code that runs on the client, is centrally managed, and is included in the IBM i Navigator tree structure.
5 The function is a centrally managed client function, not within IBM i Navigator. The function defines code that runs on the client and is centrally managed, but is not included in the IBM i Navigator tree structure.

Only client based applications should use category 1, 2, 4, or 5. See Application Administration concepts in the IBM i Navigator topic for more information about the difference between locally managed and centrally managed client functions.

Function description. The text for the function description. The default value is blanks.

Function description CCSID. The CCSID value associated with the function description. The default value is 0.

0 The current job default CCSID value is associated with the function description.
CCSID The CCSID value associated with the function description. The CCSID value must be from 1 to 65535. If 65535 is specified, then the data will not be converted to the desired CCSID when the function is retrieved.

Function group ID. The ID of the function group with which this function will be grouped. The function group must exist, have a function type of function group (2), and have the same category as the function being registered. If a value of *NONE is specified, then the function is not grouped under a function group. The default value is *NONE. This key cannot be specified if the function type control key is set to 1 (function product).

Function name. The text name for the function ID. The function name will be used to identify the function when using the IBM i Navigator Application Administration support. If this control is not specified, the function ID will be used to identify the function.

Function name CCSID. The CCSID value associated with the function name. The default value is 0.

0 The current job default CCSID value is associated with the function name.
CCSID The CCSID value associated with the function name. The CCSID value must be from 1 to 65535. If 65535 is specified, then the data will not be converted to the desired CCSID when the function is retrieved.

Function product ID. The ID of the product for which the function is being registered. This key cannot be specified if the function type control key is set to 1 (function product). This key must be specified if the function type control key is set to 2 (function group) or 3 (administrable function).

Function type. The type of function. This control is set when the function is registered and cannot be changed. The default value is 3.

1 The function is a function product. No usage information is stored for function products. The purpose is to group functions under a product when the functions are being administered by the IBM i Navigator Application Administration support.
2 The function is a function group. No usage information is stored for function groups. The purpose is to group functions within a product when the functions are being administered by the IBM i Navigator Application Administration support.
3 The function is an administrable function. Usage information can be stored and checked for this function.

Qualified message file name and message identifier for function description. A message file and message identifier that contains the function description. The message file and message identifier do not have to exist at the time of registration. The default value is blanks. Refer to Qualified Message File Format for the format of this field.

Qualified message file name and message identifier for function name. A message file and message identifier that contains the function name. The message file and message identifier do not have to exist at the time of registration. The default value is blanks. Refer to Qualified Message File Format for the format of this field.

Replace. Whether to replace an existing registered function. The default value is 0.

0 Do not replace an existing registered function. If this value is specified and the function is already registered, the request will fail.
1 Replace an existing registered function. If this value is specified and the function is not already registered, the function will be registered. If the function is already registered, only the function control keys that are specified on this call are replaced. Any other function control keys that were previously specified will keep their values.
2 Replace an existing registered function, but do not replace function control keys that are controlled by a system administrator. If this value is specified and the function is not already registered, the function will be registered. If the function is already registered, only the function control keys that are specified on this call are replaced. Any other function control keys that were previously specified will keep their values. Function control keys that are controlled by a system administrator are not replaced, even if they are specified on this call. These function control keys include:
  • *ALLOBJ indicator
  • Default usage

This value should be used by install exit programs to ensure that values set by the system adminstrator are not replaced by the install exit program.



Qualified Message File Format

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

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


Field Descriptions

Message file library name.

The library name in which the message file resides. No special values are supported.

Message file name. The name of the message file that contains the function name or function description.

Message identifier. The message identifier for the function name or function description.


Error Messages

Message ID Error Message Text
CPFA0AA E Error occurred while attempting to obtain space.
CPF2225 E Not able to allocate internal system object.
CPF222E E &1 special authority is required.
CPF228C E Function ID &1 not valid.
CPF228D E Function group &1 not registered in same category.
CPF228E E Function product &1 not registered in same category.
CPF228F E Function &1 already registered.
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.
CPF3C84 E Key &1 required with value specified for key &2.
CPF3C85 E Value for key &1 not allowed with value for key &2.
CPF3C88 E Number of variable length records &1 is not valid.
CPF3C90 E Literal value cannot be changed.
CPF3CD9 E Requested function cannot be performed at this time.
CPF3CDA E Registration facility repository not available for use.
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.
CPF9810 E Library &1 not found.
CPF9811 E Program &1 in library &2 not found.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


API introduced: V4R3

[ Back to top | Security APIs | APIs by category ]