Data Structures
Date Structures:
Data Structure in general means ‘Structure of Different Data Types’. The ILE RPG compiler allows you to define an area in storage and the layout of the fields, called subfields, within the area.Data Structure can be defined by specifying DS in positions 24 through 25 on a definition specification.
Uses of Data Structure:
- Define the same internal area multiple times using different data formats
- Define a data structure and its sub fields in the same way a record is defined.
- Define multiple occurrences of a set of data.
- Group non-contiguous data into contiguous internal storage locations.
- Operate on all the sub fields as a group using the name of the data structure.
- Operate on an individual sub field using its name.
Special Data Structures:
- A data area data structure (identified by a U in position 23 of the definition specification)
- A file information data structure (identified by the keyword INFDS on a file description specification)
- A program-status data structure (identified by an S in position 23 of the definition specification)
- An indicator data structure (identified by the keyword INDDS on a file description specification).
Few Important Points about Data Structure:
Data structures can be either program-described or externally described, except for indicator data structures, which are program-described only. One data structure can be defined like another using the LIKEDS keyword.A program-described data structure is identified by a blank in position 22 of the definition specification. The subfield definitions for a program-described data structure must immediately follow the data structure definition.
An externally described data structure, identified by an E in position 22 of the definition specification, has subfield descriptions contained in an externally described file. At compile time, the ILE RPG compiler uses the external name to locate and extract the external description of the data structure subfields. You specify the name of the external file either in positions 7 through 21, or as a parameter for the keyword EXTNAME.
Comments
Post a Comment