Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The Change Pointer (CHGPTR) command changes the value of a pointer variable in a program. The value of the program pointer specified can be changed to point to a new system object, to a new space pointer address, or to a new offset within a space object. This command is not normally used in high-level language programs.
Restrictions:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
PTR | Pointer to be changed | Element list | Required, Positional 1 |
Element 1: Program variable | Character value | ||
Element 2: Basing pointer variable | Values (up to 5 repetitions): Character value | ||
SYSOBJ | System object | Single values: *NULL Other values: Qualified object name |
Optional, Positional 2 |
Qualifier 1: System object | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
OBJTYPE | Object type | Character value | Optional, Positional 3 |
ADR | Address to be pointed to | Single values: *NULL Other values: Element list |
Optional |
Element 1: Program variable | Character value | ||
Element 2: Basing pointer variable | Values (up to 5 repetitions): Character value | ||
OFFSET | New offset in space | Integer | Optional |
PGM | Program | Name, *DFTPGM | Optional |
PTRTYPE | Pointer type | *SAME, *SYP, *SPP | Optional |
RCRLVL | Recursion level | Integer, *LAST | Optional |
Top |
Specifies the pointer variable whose value is to be changed. This allows the pointer variable to point to a different address.
This is a required parameter.
Note: If the pointer variable is an HLL pointer (which was declared in the source for a high-level language program), a space or null value can be assigned to the pointer, or the offset of the pointer can be changed, but the variable cannot be set with a system pointer value. If you specify a pointer which is not a HLL pointer, or if you use the ODV number for a pointer which is an HLL pointer, this restriction does not apply. More information on testing and debugging at the machine interface level is in the CL information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Element 1: Program variable
If the pointer (program variable) is an array, the subscripts representing the element in the array to be changed must be specified. Up to 132 characters may be specified for this pointer (program variable) entry. This includes any qualifiers, subscripts, embedded blanks, parentheses, and commas. It does not include the enclosing apostrophes when special characters are not used. An integer, MI ODV number, or a numeric variable name can be specified for a subscript.
For more information, refer to "Parameter values used for testing and debugging" in "CL concepts and reference" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Element 2: Basing pointer variable
If the basing pointer is an array, the subscripts representing an element in the array must be specified. Up to 132 characters can be specified for a basing pointer name. This includes any qualification, embedded blanks, parentheses, and commas. It does not include the enclosing apostrophes when special characters are used. An integer, MI ODV number, or a numeric variable name can be specified for a subscript.
For more information, refer to "Parameter values used for testing and debugging" in "CL concepts and reference" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Top |
Specifies that the pointer is set to either a system pointer or to a space pointer that addresses a particular system object, or to a null pointer value. This parameter cannot be specified when an HLL pointer is specified for the Pointer to be changed (PTR) parameter.
Single values
Qualifier 1: System object
Qualifier 2: Library
Top |
Specifies the object type of the system object specified in the System object (SYSOBJ) parameter to which the pointer named in the Pointer to be changed (PTR) parameter is set.
Top |
Specifies the program variable (if any) to which the specified space pointer is to point (that is, the program variable's address).
Single values
Element 1: Program variable
If an array is specified without any subscripts, the pointer is set to the address of the first element in the array. Up to 132 characters may be specified for this program variable entry. This includes any qualifiers, subscripts, embedded blanks, parentheses, and commas. It does not include the enclosing apostrophes when special characters are used. An integer, MI ODV number, or numeric variable name can be specified for a subscript.
For more information, refer to "Parameter values used for testing and debugging" in "CL concepts and reference" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Element 2: Basing pointer variable
If the basing pointer is an array, the subscripts representing an element in the array must be specified. Up to 132 characters can be specified for a basing pointer name. This includes any qualifiers, embedded blanks, parentheses, and commas. It does not include the enclosing apostrophes when special characters are used. An integer, MI ODV number, or a numeric variable name can be specified for a subscript.
For more information, refer to "Parameter values used for testing and debugging" in "CL concepts and reference" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Top |
Specifies the value to which the offset portion of the specified space pointer is set. Specify the number of bytes from the start of the space object that the space pointer is set to.
Top |
Specifies the name of the program that contains the pointer whose value is to change.
Top |
Specifies the type of pointer named in the Pointer to be changed (PTR) parameter.
Note: A high level language (HLL) pointer cannot be changed to a system pointer value.
Top |
Specifies which recursion level of the program contains the variable whose value is to be changed. Changes made to static variables automatically affect all recursion levels. Recursion level 1 is the first (or earliest) call of the program, recursion level 2 is the second call of the program, and so on to the last (most recent) recursion level in the stack. For example, if program A calls program B, then program B calls program A, a new recursion level of program A is formed. If the first call of program A contains the variable to be changed, a value of 1 must be specified for the Recursion level (RCRLVL) parameter. Some high-level languages also allow recursive procedures. For these programs, refer to the appropriate high-level language manual for more information.
Top |
CHGPTR PTR(DATAFILPTR) SYSOBJ(QGPL/MYFILE) OBJTYPE(*FILE)
This command changes the value of the pointer DATAFILPTR that is used in the default program in the debug mode. The pointer value is changed to point to the file called MYFILE, which is stored in the QGPL library.
Top |
Top |