Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
COBOL
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Aggregated data==== Data items in COBOL are declared hierarchically through the use of level-numbers which indicate if a data item is part of another. An item with a higher level-number is subordinate to an item with a lower one. Top-level data items, with a level-number of 1, are called ''{{dfn|records}}''. Items that have subordinate aggregate data are called ''{{dfn|group items}}''; those that do not are called ''{{dfn|elementary items}}''. Level-numbers used to describe standard data items are between 1 and 49.{{sfn|ISO/IEC JTC 1/SC 22/WG 4|2014|loc=Β§ 8.5.1.2}}{{sfn|Cutler|2014|loc=Appendix A}} <syntaxhighlight lang="cobol"> 01 some-record. *> Aggregate group record item 05 num PIC 9(10). *> Elementary item 05 the-date. *> Aggregate (sub)group record item 10 the-year PIC 9(4). *> Elementary item 10 the-month PIC 99. *> Elementary item 10 the-day PIC 99. *> Elementary item </syntaxhighlight> In the above example, elementary item {{code|num}} and group item {{code|the-date}} are subordinate to the record {{code|some-record}}, while elementary items {{code|the-year}}, {{code|the-month}}, and {{code|the-day}} are part of the group item {{code|the-date}}. Subordinate items can be disambiguated with the {{code|IN}} (or {{code|OF}}) keyword. For example, consider the example code above along with the following example: <syntaxhighlight lang="cobol"> 01 sale-date. 05 the-year PIC 9(4). 05 the-month PIC 99. 05 the-day PIC 99. </syntaxhighlight> The names {{code|the-year}}, {{code|the-month}}, and {{code|the-day}} are ambiguous by themselves, since more than one data item is defined with those names. To specify a particular data item, for instance one of the items contained within the {{code|sale-date}} group, the programmer would use {{code|the-year IN sale-date}} (or the equivalent {{code|the-year OF sale-date}}). This syntax is similar to the "dot notation" supported by most contemporary languages.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
COBOL
(section)
Add topic