77 Level Number Uses, significance:77 is a special Level number in COBOL which is used to declare the Individual Elementary data items. Of course, Individual elementary data items can be declared using 01 level but 77 declared fields does not allow any sub ordinate data field declarations.
You cannot move a COMP-3 variable to alphanumeric directly. It will not give a SOC7 error but will you give you a return code 12 stating that comp-3 and alphanumeric variables did not follow the move compatibility rule. 01 A1 PIC S9(4) COMP-3 VALUE 1234.
REDEFINES VS RENAMES:RENAMES clause is used for regrouping elementary data items and gives one name to it. REDEFINES clause allows you to use different data descriptions entries to describe the same memory area.
Comp is a binary usage, while comp-3 indicates packed decimal. The other common usages are binary and display. Display is the default. 3/28/00 Dave Herrmann: 'I was reading your FAQ on Cobol, as an fyi Comp is defined as the fastest/preferred numeric data type for the machine it runs on.
Level-number 88 designates a condition-name entry. Level 88s are used to assign names to values at execution time. Thus, a condition-name is not the name of an item, but rather the name of a value. A level 88 doesn't reserve any storage area.
The INSPECT statement can be used to tally the number of occurrences of specific character strings, to replace characters by other characters, or to convert from one set of characters to another including UPPERCASE TO LOWERCASE and vice versa. The INSPECT verb has two options, TALLYING and REPLACING.
To calculate the byte-length of a comp-3 field, start with the total number of digits and divide by 2 giving a result (discarding the remainder if any), then add 1 to the result. So, a field with "pic s9(6) comp-3" would take 4 bytes (6/2 +1).
My understanding of S9(9) COMP and S9(8) COMP is COBOL will manipulate any number up to +/-999,999,999 and +/-99,999,999 respectively.
The best choice is Packed-Decimal (COMP-3) and a Sign (S9). Regarding space Packed-Decimal is more effective, as the data is stored as decimal data, one decimal digit in one half byte, as Binary uses one byte oer digit.
In COBOL II the 88 levels can be set rather than moving their associated values to the related data item. (Web note: This change is not one of COBOL II's better specifications.)
RE: moving COMP value to numeric value
- 01 val1-display PIC 99.99999.
- MOVE 0.324 TO VAL1.
- MOVE VAL1 TO VAL1-DISPLAY. DISPLAY 'VAL1-DISPLAY=>' VAL1-DISPLAY.
What is the maximum size of a numeric field we can define in COBOL? The maximum size of a numeric field is PIC 9(18).
In COBOL, a copybook file is used to define data elements that can be referenced by many programs. When the Declaration Generator creates a declaration for a COBOL program, it writes it to a copybook file (. cpy file).
Why occurs clause cannot be declared at 01 level? according to the manual, a table is defined within a group item with an occurs clause. if the occurs clause were to be declared at the 01 level, there would be no group item, thus no beginning of table resolution.
S9(7) COMP-3 will take 4 bytes of storage This is the preferred way as it is clear to anyone what was intended.
The EVALUATE command provides a shorthand notation for a series of nested IF statements. The keywords cannot be abbreviated. A valid Debug Tool COBOL constant. A valid Debug Tool COBOL arithmetic expression.
A level-number is a one-digit or two-digit integer between 01 and 49, or one of three special level-numbers: 66, 77, or 88. The following level-numbers are used to structure records: 01. This level-number specifies the record itself, and is the most inclusive level-number possible.