Module 5: Data Division
Data-name and FILLER
- Data name or identifier or variable name is used to reference the storage location in the memory where the actual data is stored.
- Data name must be user-defined word; COBOL reserved words are not allowed
- Data name can have maximum of 30 characters. The characters can be 0 -9, A-Z or hyphen.
- Data name should not begin or end with hyphen. No blanks/special characters except hyphen is allowed
- Data name should be unique within a record (or group). If two elementary data items of different groupings contains same name then you can use OF qualifier followed by group data item name to refer variable uniquely.
- Example:- MOVE DD OF DATE-1 TO DD OF DATE-2
- In above example it is considered that two group data items exist namely DATE-1 and DATE-2 with elementary data item having same name ‘DD’. So the above instruction indicates that the value contained in elementary data item ‘DD’ of group data item is ‘DATE-1’ will be moved to the elementary data item ‘DD’ of group data item ‘DATE-2’
- FILLER is used to name those elementary data item which the programmer does not want to assign specific name.
- FILLER items cannot be initialized or used in any of the operation in procedure division
- When you initialize a group variable, FILLER fields are unaffected. This can be used to our advantage. For example in Date fields-
01 DATE. 05 DD PIC X(2). 05 FILLER PIC X(1) VALUE ‘/’. 05 MM PIC X(2). 05 FILLER PIC X(1) VALUE ‘/’. 05 YYYY PIC X(4).
- By declaring this variable we do not need to move '/' as a separator each time we use or initialize ‘DATE’ in program.