The NAME field attribute clause declares a facility-specific name for a field. The specified language or language processor then recognizes only this name when you refer to the field.
1 – Parameter
quoted-string The facility-specific field name.
2 – Syntax Rules
o The quoted string must be a legal name for the specified language or language processor. The CDDL does not check the quoted string for validity or correct syntax. o You can use 8-bit characters in CDDL quoted strings.
3 – Usage Notes
o You can use this clause only if you have specified a field name in the field declaration. You can not specify a facility-specific name for unnamed fields. o Once you have assigned a facility-specific name to a field, the facility no longer recognizes the field's original name. o Be careful when you use the NAME clause because it enables you to assign completely different names to the same field. o Avoid assigning dissimilar names to the same field. The NAME clause is designed only to allow you to make field names seem native to applications languages.
4 – Example
The following example provides a VAX COBOL name and a VAX RPG II name for the ORDER_NUMBER field. Because of the NAME clause, VAX COBOL recognizes the field only by the name ORDER-NUMBER, and VAX RPG II recognizes the field only by the name ORDER#. ORDER_NUMBER DATATYPE IS UNSIGNED NUMERIC SIZE IS 10 DIGITS NAME FOR COBOL IS "ORDER-NUMBER". NAME FOR RPG IS "ORDER#". 1 OCCURS The OCCURS field attribute clause declares fixed-length, one-dimensional arrays.
5 – Parameters
max_number The number of occurrences of the array. COB_index A VAX COBOL index name.
6 – Syntax Rules
o An unsigned integer (max_number) declares the number of occurrences in one-dimensional, fixed-length arrays. This integer is the upper bound of the array. o The number of occurrences must be greater than zero.
7 – Usage Notes
o The unsigned integer (max_number) is the array's upper bound; the lower bound of an array declared with OCCURS is always 1. If you need to specify an array with a lower bound other than 1, use the ARRAY clause. o Only VAX COBOL supports the INDEXED FOR COBOL BY optional field attribute clause. Other processors ignore it. o You cannot use the INDEXED FOR COBOL BY optional field attribute clause with Version 3.0 of VAX COBOL or any earlier version. VAX COBOL supports INDEXED FOR COBOL BY in Version 3.1 and later. o If you use a name as a COBOL index name you cannot use that name as a field name or COBOL-specific name elsewhere in the record description.
8 – Example
In the following example, the OCCURS clause is used twice to declare 20 instances of SUPPLIER where each instance is four 30-character strings. Note that OCCURS clauses can be nested. SUPPLIER STRUCTURE OCCURS 20 TIMES. SUPPLIER OCCURS 4 TIMES DATATYPE IS TEXT SIZE IS 30 CHARACTERS. END SUPPLIER STRUCTURE.