Where allowed to run: All environments (*ALL) Threadsafe: Conditional |
Parameters Examples Error messages |
The Change Data Area (CHGDTAARA) command changes the value of the local data area (*LDA), the group data area (*GDA), the program initialization parameter data area (*PDA), or the specified data area that is stored in a library. The new value must have the same type and a length less than or equal to the data area length or the specified substring length.
In group jobs, the data area specified may be the group data area (*GDA). This data area is automatically associated with the group and cannot be accessed from jobs outside the group. The length of this character data area is 512 bytes. More information about group jobs is in the Work Management information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
The local data area (*LDA) is a character data area 1024 bytes in length. It is automatically associated with your job and other jobs cannot get access to it.
In prestart jobs, the data area specified may be the data area that contains program initialization parameter data (*PDA). This data area is automatically associated with your prestart job and other jobs cannot get access to it. The length of this character data area is 2000 bytes. More information about prestart jobs is in the Work Management information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
For character data areas, a substring of the data area can be changed without affecting the remainder of the data area. This substring is defined by specifying the starting position and the length of the substring. In this case, the new value must have a length less than or equal to the substring length.
When this command is run to change a data area other than the local data area, group data area, or program initialization parameter data area, the data area is locked by the job or thread during the change operation so that commands in other jobs cannot change or delete it until the operation is completed. If the data area is shared with other jobs and it is updated in steps involving more than one command in a job, the data area should be explicitly allocated to that job until all the steps have been performed. Data areas, other than the group data area , local data area, or program initialization parameter data area can be explicitly allocated with the Allocate Object (ALCOBJ) command; no allocation is necessary when the CHGDTAARA command is run specifying the group data area, local data area, or program initialization parameter data area.
Restrictions:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
DTAARA | Data area specification | Element list | Required, Positional 1 |
Element 1: Data area |
Single values: *LDA, *GDA, *PDA Other values: Qualified object name |
||
Qualifier 1: Data area | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
Element 2: Substring specifications |
Single values: *ALL Other values: Element list |
||
Element 1: Substring starting position | 1-2000 | ||
Element 2: Substring length | 1-2000 | ||
VALUE | New value | Not restricted | Required, Positional 2 |
Top |
Specifies the name and library of the data area whose value is being changed. It optionally specifies, for character data areas only, the starting position and length of the character string that is changed in the data area.
This is a required parameter.
Element 1: Data area
Single values
Qualifier 1: Data area
Qualifier 2: Library
Element 2: Substring specifications
Single values
Element 1: Substring starting position
Element 2: Substring length
Top |
Specifies the new value stored in the data area. Specify a value that is valid for the data attributes specified in the data area's description. If *CHAR or *LGL was specified for the Type (TYPE) parameter of the Create Data Area (CRTDTAARA) command when the data area was created and the value specified here is numeric, the value must be enclosed in apostrophes. If *DEC was specified for the Type (TYPE) parameter of the CRTDTAARA command, the value must not be enclosed in apostrophes.
This is a required parameter.
Top |
Example 1: Changing the Data Area Value
CHGDTAARA DTAARA(MYLIB/MYDATA) VALUE(GOODNIGHT)
This command changes the value of the data area named MYDATA in library MYLIB to GOODNIGHT. The data area must be for character data and must be 9 or more characters in length.
Example 2: Changing the Logical Value of the Data Area
CHGDTAARA DTAARA(PAYROLLSW) VALUE('0')
This command changes the logical value of the data area named PAYROLLSW to zero (0). The library search list is used to locate the data area.
Example 3: Changing Specific Characters of the Local Data Area
CHGDTAARA DTAARA(*LDA (5 4)) VALUE('TWO')
This command changes characters 5 through 8 of the user's local data area. Because the new value is shorter than the substring, it is padded with a blank.
Top |
*ESCAPE Messages
Top |