Data Areas

DATAAREA

What is Data Area?
Data area is used to store constant values, which can be retrieved by many users. Is an object of type *DTAARA which is located in auxiliary storage. Data area may be created by CRTDTAARA command and it is viewed by DSPDTAARA command, their values updated by CHGDTAARA command. There are three data types in data area is *DEC maximum 24 digit with maximum 9 digit of decimal places and *CHAR type has maximum 2000 character length and *LGL may contain 1 or 0 including on/off responsibility.

 RPG operation for Data Area processing:

IN                    retrieve data from a data area
OUT                write data to a data area
DEFN             define a data area

LDA, GDA and PIP.
LDA Local Data Area is created for each job in the system, including auto start jobs; jobs started on the system by reader and subsystem monitor jobs.
The system creates a local data area, which is initially filled with blanks, with a length of 1024 and type *CHAR. When you submit a job using SBMJOB command, the value of the submitting job’s local area is copied into the submitted job’s local data area. You can refer your job’s local data area by specifying *LDA for the DTAARA keyword on the CHGDTAARA, RTVDTAARA and DSPDTAARA commands or *LDA for the sub string built-in function (%SST)

            The local data area can’t be referred to from any other object.
            You can’t create, delete or allocate the local data area.
            No library is associated with the local data area.

GDA Group Data Area will be created by the system when an interactive job becomes a group job. Only one group data area can exist for a group. The group data area can be deleted when the last job in the group is ended or when the job is no longer part of the group job. The group data area which is initially filled with blanks has a length of 512 and type *char.

You can’t use the group data area as a substitute for a character variable on the sub string built-in function.
            A GDA can’t be referred by jobs outside the group.
            You can’t create, delete and or allocate a GDA
            No library is associated with GDA

PIP (Data Area) Program Initialization Parameter (Data Area) is created for each pre start job when the job is started. The object sub-type is of the PDA is different then regular data area. The PIP can only be referred to by the special name *PDA and the size is 2000.

RPG opcodes associated with data areas?
IN, OUT, UNLCK and DEFN.

Data areas and its types.
Data area is an area in main memory. The types are General DA, Local DA, Group DA and PIP DA. DAs are used to hold some data.

Referring the General DA in RPG and CL?
In RPG, *DTAARA, DEFN, *LOCK, *UNLOCK, IN and OUT commands are used.
In CL, CRTDTAARA, CHGDTAARA, RMVDTAARA, DSPDTAARA, RTVDTAARA commands are used.


No comments