This action might not be possible to undo. Are you sure you want to continue?
AS/400 Data area has remained an illusive thing for many. In this article we will try to learn all about data-area on an AS400 system. Here we will learn the definition of a data area first and then we will move on to learn how to create, display, change a data area. Once all this is complete and we have a little understanding of the data area, We will learn how to actually use them in our CL program and then in RPG program. Let us begin with the definition of the data area. Definition of Data Area: AS400 Data area is an object which has been allocated some memory (Area may be?). Data area can be understood to be flat file sort of object with only one record of specific length. We store those frequently used values (Data) in a data area which are supposed to be accessed and updated by different programs. Note:- Data area is not a file.Though it stores data. Handling of data area in programs and through commands is entirely different than that of a file. There's specific type of data area which is local to a job. What do we call it? Local Data Area: Local data area is a job specific data area. You start a job, AS400 system creates a local data area for the job.Local data area is accessible only to the different programs of the job only i.e Programs of a specific job can not access the Local data area of another job. We'll learn how to access a local data area in an RPG Program. How to create a data area To create a data area we use the CRTDTAARA Command. We follow the following steps to create a data area on an AS/400 machine. Firstly we write CRTDTAARA on the command line and press F4 to see the available options. The prompt displays the following options
• Name of Data area - Enter the name of the data area. Valid values of this field are same as any other
valid name of AS400 Objects. • Type of the data area o Enter *DEC if you have to store numeric only values. Like employee number etc. o Enter *CHAR if you have to store either character or mixed (Character and numeric) values. You can separate the character and numeric values through a data structure in an RPG program. o Enter *LGL if you have to store a logical value
have to store Employe name (15) and Employee Id (5,0) then you should give the length as 20 (15 + 5 etc.). • Decimal places - Specify the number of decimal places only if you described the type of the data area as *DEC otherwise leave this field blank • Initial Value - Specify the initial value of the data area. You may leave this empty as default. However, do mind the blanks if you are going to save multiple values (Which is very likely) in the data area. How to display the current values of a data area.
• Length of the data area - Specify the maximum possible length of the value of the data area. If you
To display the current value of the data area we use the command DSPDTAARA. To Display the value of the dataarea we can follow the following steps. We write the command DSPDTAARA on the command line and take F4. Now fill the values as below.
• The name of the data area
Option 4 runs the command DLTDTAARA and passes the required parameters implicitly. *HEX displays the data area in hexadecimal format. use the command DLTDTAARA. To change a data area we write the command CHGDTAARA and take F4. • Lock Handling on Files • Add your own specific usage. you should make sure that new value is the concatenation of individual values in their full length.This facility gives us freedom to change . Spool = *PRINT) .Only Emp ID).To genrate a spool file. • Optional output (Screen = *. Emp ID) in the data area and we wish to change only specific value(eg. • Optional Substring starting position (Default is *ALL) .) Common Usage of Data Area Data Area is commonly used to • Store Changing Values like Next available Employee Number. We can specify the following options. To delete a data area on an AS/400 machine. Take option 4 and press enter when asked to confirm. • New Value .TO display the values of the data area as it is (Readable format) use *CHAR. This parameter is required if the optional starting position is different than the default value (*ALL).. Change AS400 Data-Area We can change the current value or definition of a data area using the command CHGDTAARA . That's it! Alternatively.This is the limit of the changed area.g if Emp Name (15) and EMP Id (5. (Actually. • The name of the data area • The library where the data area object is placed. • Optional Substring length . . This command takes the two arguments name and library of the data area. I will keep the new value as 'NEWVALUE 12345' instead of 'NEWVALUE12345'.g Emp Name. The new value should be of the same length as the total length of the data area (Or the substring). Provide these information and press enter when asked to confirm..0) are the two values which I intend to store in the data area. This is the easiest and least complex thing. • Store Status of a program or engine or a file etc. If you need to change complete data area. • The library of the data area.. We can use the WRKOBJ command. Why? Can you guess! Delete a Data Area on AS/400 Machine. Or Current date in specific format etc. This facility is helpful when we have stored multiple values(E. Enter the name of the data area and object type and library. • Optional Output Format (*CHAR or *HEX). (E. only specific portion of the data area. enter '*PRINT'.To display the values on the screen enter '*' (Default).Enter the new value of the data area here.