action.skip

File Section

The File Section contains the descriptions of data items used in sequential, relative, indexed, and sort files.

General Format:

       [ FILE SECTION. ] 
              [ file-descripiton ]… 
              [ fd-data-level fd-data-description ]  
              [ sort-description ]… 
              [ sd-data-level sd-data-description ] 

The General Formats for the File Description and Sort Description are below:

General Rules:

  1. The File Section contains the File Descriptions and Sort Descriptions.
  2. Every File Description and Sort Description must have a corresponding SELECT statement in the Environment Division.

File Description

The File Descripiton describes the characteristics of a sequential, relative, or indexed file.

General Format:

       FD file-name [ IS { EXTERNAL } ] 
                         { GLOBAL   } 

              [BLOCK CONTAINS integer-1 [TO integer-2 ] {RECORDS   } ] 
                                                        {CHARACTERS} 

              [ CODE-SET IS alphabet-name ] 

              [RECORD { CONTAINS int-1 [TO int-2 ] CHARACTERS } ] 
              [ IS VARYING IN SIZE [ FROM int-3 ] [ TO int-4 ] CHARACTERS ] 
              [ DEPENDING ON record-depending ] 
              [ MODE IS VARIABLE [RECORD VARYING FROM 1]] 

              [ LABEL RECORDS [ARE] {STANDARD} ] 
                                   {OMITTED } 

              [ VALUE OF { LABEL   } IS valueof-name ] 
                         { FILE-ID } 

              [ { DATA RECORD IS } {record-name} ... ] 
                { DATA RECORDS ARE } 

              [ LINAGE IS page-size LINES 
              [ WITH FOOTING AT footing-line ] 
              [ LINES AT TOP top-lines ] 
              [ LINES AT BOTTOM bottom-lines ] ] . 

              [ RECORDING MODE IS { F } ] 
                                  { V } 
                                  { U } 
                                  { S } 
              [ { REPORT IS } report-name ] 
                { REPORTS ARE }

General Rules:

  1. file-name described in a File Description (FD), may be referenced by OPEN, CLOSE, START, READ, and UNLOCK statements
  2. The General Rules for the File Description clauses are described below.

Sort Description

The SORT Description describes the characteristics of a SORT file.

General Format:

       SD file-name 
              [RECORD { CONTAINS int-1 [TO int-2 ] CHARACTERS } ] 
              [ IS VARYING IN SIZE [ FROM int-3 ] [ TO int-4 ] CHARACTERS ] 
              [ DEPENDING ON record-depending ] 

              [ { DATA RECORD IS } {record-name} ... ] 
                { DATA RECORDS ARE } 

              [ VALUE OF FILE-ID IS valueof-name ]

General Rules:

file-name described in a Sort Description (SD), may only be referenced by SORT and MERGE statements.

The General Rules for the Sort Description clauses are described below.

File Section Clauses

Block Contains Clause

The BLOCK CONTAINS clause is recognized, and syntax is validated. However, the BLOCK CONTAINS clause is otherwise treated as commentary.

General Format:

       [BLOCK CONTAINS integer-1 [TO integer-2 ] {RECORDS } ] 
                                                 {CHARACTERS}

Syntax:

  1. integer-1 is an integer
  2. integer-2 is an integer that is greater than integer-1.

General Rules:

There are no General Rules.

Code-Set Clause

The CODE-SET clause associates an ALPHABET with a sequential file.

General Format:

[ CODE-SET IS alphabet-name ]

Syntax:

  1. The CODE-SET clause may only be applied to SEQUENTIAL files.
  2. Alphabet-name is the name of an alphabet de scribed in SPECIAL-NAMES.
  3. The CODE-SET clause requires that all data items in the record description be USAGE DISPLAY.

General Rules:

  1. The CODE-SET clause uses alphabet-name to represent the character set in which the file data is stored.
  2. Usage of the CODE-SET clause causes data conversion between the native character set and the character set described by alphabet-name to occur on input and output File I/O operations.

Data Records Clause

The DATA RECORDS clause names the 01-level record names in a file.

The DATA RECORDS clause is is recognized, and syntax is validated. However, the DATA RECORDS clause is otherwise treated as commentary.

General Format:

       [ { DATA RECORD IS } {record-name} ... ] 
         { DATA RECORDS ARE }

Syntax:

record-name(s) are the 01-level record names of the file.

General Rules:

There are no General Rules.

External Clause

The EXTERNAL clause allows an file to be shared between programs in the same execution instance.

General Format:

IS EXTERNAL

General Rules:

  1. A file declared IS EXTERNAL shares its OPEN, and CLOSE state, READ/WRITE buffers, and file pointer state between separately compiled programs.
  2. All programs using the file must have the same SELECT and FD declarations for the file, and all FD declarations must contain the IS EXTERNAL phrase.
  3. A file description or data item may be declared IS EXTERNAL and IS GLOBAL simultaneously. GLOBAL Clause

The Global clause

General Format:

IS GLOBAL

General Rules:

  1. A file declared IS GLOBAL shares its OPEN, and CLOSE state, READ/WRITE buffers, and file pointer state between a program and the nested programs it contains, and which together form a single compilation unit.
  2. The GLOBAL clause indicates that a data item, and any data items or conditions or indexes subordinate to it, may be accessed by any of the programs in a compilation unit.
  3. The GLOBAL clause may only be used with data items having an 01 data level.
  4. The GLOBAL clause may be used in the File Section, Working-Storage Section, Local Storage Section, and Linkage Section.
  5. A file description or data item may be declared IS EXTERNAL and IS GLOBAL simultaneously.

Label Records Clause

The LABEL RECORDS clause is recognized, and syntax is validated. However, the LABEL RECORDS clause is otherwise treated as commentary.

General Format:

       [ LABEL RECORDS [ARE] {STANDARD} ] 
                            {OMITTED  }

General Rules:

There are no General Rules.

Linage Clause

The LINAGE clause causes an internal counter to be maintained by print files which allows for the trapping of the END-OF-PAGE condition.

General Format:

       [ LINAGE IS page-lines LINES 
              [ WITH FOOTING AT footing-line-number ] 
              [ LINES AT TOP number-top-lines ] 
              [ LINES AT BOTTOM number-bottom-lines ] ] .

Syntax:

  1. page-lines is a numeric data item, or integer literal.
  2. footing-line number is a numeric data item, or integer literal.
  3. number-top-lines is a numeric data item or integer literal.
  4. number-bottom-lines is a numeric data item or integer literal.

General Rules:

  1. page-lines is maintained as an internal counter. When counter reaches page-lines, the end-of-page condition is trigge red, and can be trapped by the WRITE statement.
  2. The LINES AT TOP number-top-lines clause is the number of line feeds that are written after advancing a page.
  3. The LINES AT BOTTOM number-bottom-lines clause is the number of line feeds that are written before advancing a page.
  4. The FOOTING AT footing ine number describes an area of the report above the LINES at BOTTOM, on which a page-footing can be printed.

Record Clause

The RECORD clause describes the size of the record.

Format :

  [RECORD [ CONTAINS min-int-1 [TO max-int-1      ]CHARACTERS ]

Format 2:

       [RECORD [ IS VARYING IN SIZE [FROM min-int-2][TO max-int-2]] CHARACTERS ] 
               [ DEPENDING ON record-depending ]

Syntax:

  1. Min-int-1 is an integer.
  2. Max-int-1 is an integer.
  3. Min-int-2 is an integer.
  4. Max-int-2 is an integer.
  5. record-depending is a data item described in the working-storage or linkage section.

General Rules:

  1. When used with LINE SEQUENTIAL files, the RECORD clause is treated as commentary.
  2. The Format 1 RECORD clause can be used for fixed length records or variable length records.
  3. If the Format 1 CONTAINS phrase includes declarations of min-int and max-int CHARACTERS, and max-int is greater than min-int, then the records have variable length.
  4. If the Format 1 CONTAINS phrase includes a single declaration of max-int CHARACTERS, or declarations of min-int and max-int CHARACTERS, where min-int is equal to max-int, then the records have fixed length.
  5. The Format 2 RECORD clause is used for variable length records which may, optionally, rely on a DEPENDING ON phrase
  6. If a DEPENDING ON phrase is used, then the number of characters associated with the record length is derived from the value of the record depending variable.
  7. In the absence of a RECORD clause, the compiler computes whether the records in a file are of fixed or variable length, what the length of the record is, and if they are of variable length, what the minimum and maximum record lengths are.
  8. If the record size, as calculated by the compiler, is outside of the range described by the RECORD clause, the compiler will report an error, and the abort the compilation. In the example below, a RECORD CONTAINS 20 CHARACTERS clause was entered in an FD with a record that contained 30 characters:

reswords.fd:5: Error: Record size too large 'reswords-record' (30)

Recording Mode Clause

The RECORDING MODE clause is is recognized, and syntax is validated. RECORDING MODE F and RECORDING MODE V are supported. RECORDING MODE U, S, are treated as commentary.

General Format:

       RECORDING MODE IS { F } ] 
                         { V } 
                         { U } 
                         { S }

General Rules:

  1. LINE SEQUENTIAL files declared with RECORDING MODE F are stored with fixed record length. Trailing spaces are not removed.
  2. LINE SEQUENTIAL files declared with RECORDING MODE V are stored with variable record length.

Report Is Clause

The REPORT IS clause is recognized, and syntax is validated. However, the REPORT IS clause is otherwise treated as commentary.

General Format:

       [ { REPORT IS   } report-name ] 
         { REPORTS ARE }

General Rules:

There are no General Rules.

Value Of Clause

The VALUE OF clause is recognized, and syntax is validated. The handling of the VALUE OF clause is affected by:

-fvalue-of-id-priority

or

value-of-id-priority:yes

With either of these conditions, the literal or data element that is the target of the VALUE OF FILE-ID clause in the FD overrides the target of the ASSIGN clause for the file.

Otherwise, this setting is treated as commentary.

General Format:

       [ VALUE OF { LABEL   } IS value-of-name ] 
                  { FILE-ID }

Syntax:

Value-of-name is a literal or data element. When associated with the VALUE OF FILE ID phrase, it refers to the file's name, as it would appear in an ASSIGN TO clause.

General Rules:

There are no General Rules.