CL Command Reference - CHGDTAARA
CL Command List > CHGDTAARA Reference
Description:
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.
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.
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:
1. To use this command, the user must have change (*CHANGE) authority for the data area being changed and execute (*EXECUTE) authority for the library in which it is stored. No specific authority is required for the local data area, group data area, or program initialization parameter data area.
2. This command is conditionally threadsafe. The following restrictions apply:
a. Changing DDM data areas in a job that allows multiple threads is not threadsafe.
b. Changing DDM data areas will fail when more than one thread is active in a job.
c. Changing the special data areas (*LDA, *GDA and *PDA) is allowed from the initial thread only and will fail if attempted from a secondary thread.
Examples:
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.