Change Program Data (QBNCHGPD) API


  Required Parameter Group:


  Optional Parameter Group:


  Default Public Authority: *USE

  Threadsafe: No

The Change Program Data (QBNCHGPD) API lets you change data for module, program and service program objects. The data available to be changed includes source file information, bound module library names, bound service program library names, and export source file information.

When the source file information is changed, the location of the source for debug source views is also changed. This will allow debug views that refer to a copy of the source (such as DBGVIEW(*SOURCE)), to be able to locate the creation source files if their location has changed.

Start of changeThe source file can be changed to a database file (using the CHGP0100 format) only if the object being changed already has its source file originating from a database file. Similarly, the source file can be changed to a stream file (using the CHGP0200 format) only if the object being changed already has its source file originating from a stream file. There is no mechanism to change the source file from a database file to a stream file or vice versa.

Although format CHGP0200 (used to change source stream files) can be used on modules/programs created for a release prior to 7.4, the format has no effect.

Note: For compatibility, the display module/program commands and the retrieve module/program information APIs will present both the stream file name and the equivalent database file name if the stream file is in the QSYS file system. However, if an object was built from a stream file in the QSYS file system, the source is considered to be originating from a stream file, not a database file. In that case, only format CHGP0200 can be used if the source file requires changing.End of change

When an object has been successfully updated by the API, the change date and time stamp (date and time the object was changed) field is also updated.


Authorities and Locks

Library Authority
*EXECUTE
*DLT and *ADD are also required to change ILE program and service program objects.
Object Authority
*OBJMGT *USE
Object Lock
*EXCL

Required Parameter Group

Qualified object name
INPUT; CHAR(20)

The object for which you want to change information and the library in which it is located. The first 10 characters contain the object name, and the second 10 characters contain the library name.

You can use these special values for the library name:


Object type
INPUT; CHAR(10)

The type of object for which you want to change the information. You must use one of these special values for the object type:


Format name
INPUT; CHAR(8)

The format of the Change records provided for the Changed object information parameter.

The possible format names are:


Changed object information
INPUT; CHAR(*)

The information for the object that you want to change. The information must be in the following format:


Error code
I/O; CHAR(*)

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


Optional Parameter Group

The optional parameters can be used to specify the bound modules and bound service programs that are to be selected for update for ILE program and service program objects. If the optional parameters are not specified, the API behavior will be as if *ALL was specified for both the Qualified bound module name and the Qualified bound service program name.

Qualified bound module name
INPUT; CHAR(20)

The bound modules for which you want to change information and the library that they were in when they were bound into this program/service program. The first 10 characters contain the module name, and the second 10 characters contain the library name. If this optional parameter is not specified, the behavior will be as if *ALL was specified for both the bound module name and the bound module library name.

You can use one of the following formats for the bound module name:

You can use these special values for the bound module library name:

Qualified bound service program name
INPUT; CHAR(20)

The bound service programs for which you want to change information and the library that they were in when they were bound into this program/service program. The first 10 characters contain the service program name, and the second 10 characters contain the library name. If this optional parameter is not specified, the behavior will be as if *ALL was specified for both the bound service program name and the bound service program library name.

You can use one of the following formats for the bound service program name:

You can use these special values for the bound service program library name:


Format for the Change Records--Format CHGP0100

The following table defines the format of the change records for format CHGP0100. These records are used to specify the type of data to be changed, the selection values used to determine which data items are to be changed, and the new values to which the data items are to be changed.

For this format, the data items indicated by the specified key value will be selected for update if they meet the selection critera specified by the "From" values. Selected data items will be changed to the value specified by the "To" values.

It is not an error to specify more than one change record for a particular key value. If a data item is affected by more than one change record, the value assigned by the last change record is used.


Start of changeFormat for the Change Records--Format CHGP0200

The following table defines the format of the change records for format CHGP0200. These records are used to specify the type of data to be changed, the selection values used to determine which data items are to be changed, and the new values to which the data items are to be changed.

For this format, the data items indicated by the specified key value will be selected for update if they meet the selection criteria specified by the "From" values. Selected data items will be changed to the value specified by the "To" values.

It is not an error to specify more than one change record for a particular key value. If a data item is affected by more than one change record, the resulting value will be the value after all change records have been applied, in order. For example, if the starting path is /abc/def/x.c, and the change records are as follows:

Record 1:
From = "/abc"
To = "/xyz"
Record 2:
From = "/x"
To = "/xyz"

The resulting path will be /xyzyz/def/x.c. Record 1 changes the original path to /xyz/def/x.c and record 2 changes the intermediate path to /xyzyz/def/x.c.End of change


Field Descriptions

Start of changeCCSID of the from path. The coded character set identifier (CCSID) of the From path. When searching for selected stream file paths for update, paths will be converted to a common CCSID prior to performing any comparisons. If this field is 0, then the From path is assumed to be in the current job's CCSID.End of change

Start of changeCCSID of the to path. The coded character set identifier (CCSID) of the To path. When searching for selected stream file paths for update, paths will be converted to a common CCSID prior to performing any comparisons. If this field is 0, then the To path is assumed to be in the current job's CCSID.End of change

From file. The source file names that will be selected for update.

You can use one of the following formats for the From file:

From library. The library names that will be selected for update.

You can use one of the following formats for the From library:

From member. The source member names that will be selected for update.

You can use one of the following formats for the From member:

Start of changeFrom path. The stream file path that will be selected for update. The From Path specifies the portion of the stream file path to be updated. If it is found at the beginning of the current source stream file path, it will be updated with the path specified in the To Path. See the table in the To path description for examples. Note that the path specified in the From Path will be compared starting at the beginning of the stream file path. If the string is contained in the middle or end of the stream file path, it will not match and will not be updated. Wild cards are not allowed in the From path.End of change

Key. Identifies the data to be changed by this change record. See Keys for the list of valid values.

Start of changeLength of the from path. The length, in bytes, of the From path. The From path must specify a value; therefore, this field cannot be zero.End of change

Start of changeLength of the to path. The length, in bytes, of the To Path. The To Path must specify a value; therefore, this field cannot be zero.End of change

Start of changeOffset to the from path. Offset from the beginning of the current record to the From Path.End of change

Start of changeOffset to the to path. Offset from the beginning of the current record to the To Path.End of change

Start of changeRecord length. The length of the given change record, including the variable portion of the record. This field can be used to reach the next change record if one is present.End of change

To file. The name to which the source file is to be changed.

You can use one of the following formats for the To file:

To library. The name to which the library is to be changed.

You can use one of the following formats for the To library:

To member. The name to which the source member is to be changed. A value other than *SAME is only valid for this field when specific name values are also provided for the From library, From file, and From member fields. If the From library, From file, or From member fields contain a generic or *ALL value, then the To member must be *SAME.

You can use one of the following formats for the To member:

Start of changeTo path. The path to which the matching portion of the stream file is to be changed. If a From path is found at the beginning of a stream file path, that text will be replaced with the To Path. Some examples follow:

End of change

Keys

Start of changeThe following table lists the valid values for the key field of the change records, the format allowed, and the object types for which each key is valid.End of change

Start of change1For key=1, OPM programs can only be changed with format CHGP0100.End of change

Start of change2This function requires that the object contain creation data.End of change

OPM refers to original program model, and ILE refers to Integrated Language Environment®.

For ILE program and service program objects, the creation source file fields apply to the bound modules.


Key Descriptions

Bound module library. This key is used to change the library name for bound modules. The name specified must be in a valid object name format. It is not required to be the name of an existing library on the system. An attempt to change a bound module library name is not allowed if the change results in a program or service program having duplicate qualified bound module names.

Bound service program library. This key is used to change the library name for bound service programs. The name specified must be the name of an existing library, and the corresponding service program must exist in that library.

Start of changeCreation source files. This key is used to change the database file names (library, file, member) or the stream file names of the source files that were used to create the object.

The source files that will be changed by this key are the root source file (the one that is displayed by the DSPMOD and DSPPGM comands), and if a source debug view was specified during object creation, the names of the include files that were stored as debug data.

When changing the root source file, this API will attempt to change the "Source file change date/time" field to the current value for the source file at the newly specified location. If a source file can not be accessed at the newly specified location, the "Source file change date/time" field will be left unchanged.End of change

Disallow service program library name update. This key is used to prohibit further change to the library name for bound service programs. The attribute "Allow bound service program library update" will be changed to *NO at the completion of the API processing. Any change records with a key value of 4 (bound service program library) on this API call will be processed before the attribute is set to *NO.

Prohibit update. This key is used to prevent further change to the program or service program via the UPDPGM and UPDSRVPGM commands. The attribute "Allow update" will be changed to *NO at the completion of the API processing. The "Allow bound service program library update" attribute is also changed to *NO as part of the processing of this key. Any change records with other key values on this API call will be processed before the attributes are set to *NO.

Export source file. This key is used to change the library, source file, and source member names for the export source file. The name specified must be the name of an existing source file.


Error Messages




API introduced: V6R1

[ Back to top | Program and CL Command APIs | APIs by category ]