In a COBOL program, the File Description (FD) Entry (or Sort File Description (SD) Entry for sort/merge files) represents the highest level of organization in the file section. The order in which the optional clauses follow the FD or SD entry is not important.
Format 1: sequential file description entry >>-FD--file-name-1--+------------------+--+----------------+----> '-+----+--EXTERNAL-' '-+----+--GLOBAL-' '-IS-' '-IS-' >--+-------------------------------------------------------------------+--> '-BLOCK--+----------+--+---------------+--integer-2--+-CHARACTERS-+-' '-CONTAINS-' '-integer-1--TO-' '-RECORDS----' >--+--------------------------------------------------------------------+--> '-RECORD--+-+----------+--integer-3--+------------+----------------+-' | '-CONTAINS-' '-CHARACTERS-' | +-+----------+--integer-4--TO--integer-5--+------------+-+ | '-CONTAINS-' '-CHARACTERS-' | '-| clause 1 |--+--------------------------------+-------' '-DEPENDING--+----+--data-name-1-' '-ON-' >--+------------------------------------------------------+-----> '-LABEL--+-RECORD--+----+---+--+-STANDARD------------+-' | '-IS-' | +-OMITTED-------------+ '-RECORDS--+-----+-' | .-----------------. | '-ARE-' | V | | '---+-------------+-+-' '-data-name-2-' >--+------------------------------------------------------+-----> | .----------------------------------------. | | V | | '-VALUE OF----system-name-1--+----+--+-data-name-3-+-+-' '-IS-' '-literal-1---' >--+---------------------------------------------+--------------> | .-------------. | | V | | '-DATA--+-RECORD--+----+---+----data-name-4-+-' | '-IS-' | '-RECORDS--+-----+-' '-ARE-' >--+----------------------------------------------------------+--> '-LINAGE--+----+--+-data-name-5-+--+-------+--| clause 2 |-' '-IS-' '-integer-8---' '-LINES-' >--+-----------------------------------+------------------------> '-RECORDING--+------+--+----+--mode-' '-MODE-' '-IS-' >--+---------------------------------+--.---------------------->< '-CODE-SET--+----+--alphabet-name-' '-IS-' clause 1 |--+----+--VARYING--+----+--+------+--+---------------------+---> '-IS-' '-IN-' '-SIZE-' '-+------+--integer-6-' '-FROM-' >--+---------------+--+------------+----------------------------| '-TO--integer-7-' '-CHARACTERS-' clause 2 |--+--------------------------------------------+---------------> '-+------+--FOOTING--+----+--+-data-name-6-+-' '-WITH-' '-AT-' '-integer-9---' >--+-----------------------------------------+------------------> '-+-------+--+----+--TOP--+-data-name-7-+-' '-LINES-' '-AT-' '-integer-10--' >--+--------------------------------------------+---------------| '-+-------+--+----+--BOTTOM--+-data-name-8-+-' '-LINES-' '-AT-' '-integer-11--'
Format 2: relative or indexed file description entry >>-FD--file-name-1--+------------------+--+----------------+----> '-+----+--EXTERNAL-' '-+----+--GLOBAL-' '-IS-' '-IS-' >--+-------------------------------------------------------------------+--> '-BLOCK--+----------+--+---------------+--integer-2--+-CHARACTERS-+-' '-CONTAINS-' '-integer-1--TO-' '-RECORDS----' >--+--------------------------------------------------------------------+--> '-RECORD--+-+----------+--integer-3--+------------+----------------+-' | '-CONTAINS-' '-CHARACTERS-' | +-+----------+--integer-4--TO--integer-5--+------------+-+ | '-CONTAINS-' '-CHARACTERS-' | '-| clause 1 |--+--------------------------------+-------' '-DEPENDING--+----+--data-name-1-' '-ON-' >--+-------------------------------------------+----------------> '-LABEL--+-RECORD--+----+---+--+-STANDARD-+-' | '-IS-' | '-OMITTED--' '-RECORDS--+-----+-' '-ARE-' >--+------------------------------------------------------+-----> | .----------------------------------------. | | V | | '-VALUE OF----system-name-1--+----+--+-data-name-3-+-+-' '-IS-' '-literal-1---' >--+---------------------------------------------+--.---------->< | .-------------. | | V | | '-DATA--+-RECORD--+----+---+----data-name-4-+-' | '-IS-' | '-RECORDS--+-----+-' '-ARE-' clause 1 |--+----+--VARYING--+----+--+------+--+---------------------+---> '-IS-' '-IN-' '-SIZE-' '-+------+--integer-6-' '-FROM-' >--+---------------+--+------------+----------------------------| '-TO--integer-7-' '-CHARACTERS-'
Format 3: line-sequential file description entry >>-FD--file-name-1--+------------------+--+----------------+----> '-+----+--EXTERNAL-' '-+----+--GLOBAL-' '-IS-' '-IS-' >--+--------------------------------------------------------------+--> '-RECORD--+-+----------+--integer-3--+------------+----------+-' | '-CONTAINS-' '-CHARACTERS-' | '-| clause 1 |--+--------------------------------+-' '-DEPENDING--+----+--data-name-1-' '-ON-' >--.----------------------------------------------------------->< clause 1 |--+----+--VARYING--+----+--+------+--+---------------------+---> '-IS-' '-IN-' '-SIZE-' '-+------+--integer-6-' '-FROM-' >--+---------------+--+------------+----------------------------| '-TO--integer-7-' '-CHARACTERS-'
Format 4: sort/merge file description entry >>-SD--file-name-1----------------------------------------------> >--+--------------------------------------------------------------------+--> '-RECORD--+-+----------+--integer-3--+------------+----------------+-' | '-CONTAINS-' '-CHARACTERS-' | +-+----------+--integer-4--TO--integer-5--+------------+-+ | '-CONTAINS-' '-CHARACTERS-' | '-| clause 1 |--+--------------------------------+-------' '-DEPENDING--+----+--data-name-1-' '-ON-' >--+---------------------------------------------+--------------> | .-------------. | | V | | '-DATA--+-RECORD--+----+---+----data-name-4-+-' | '-IS-' | '-RECORDS--+-----+-' '-ARE-' >--+-------------------------------------------------------------------+--> '-BLOCK--+----------+--+---------------+--integer-2--+-CHARACTERS-+-' '-CONTAINS-' '-integer-1--TO-' '-RECORDS----' >--+--------------------------------------------------+---------> '-LABEL--+-RECORD--+----+---+--+-STANDARD--------+-' | '-IS-' | +-OMITTED---------+ '-RECORDS--+-----+-' | .-------------. | '-ARE-' | V | | '---data-name-2-+-' >--+------------------------------------------------------+-----> | .----------------------------------------. | | V | | '-VALUE OF----system-name-1--+----+--+-data-name-3-+-+-' '-IS-' '-literal-1---' >--+----------------------------------------------------------+--> '-LINAGE--+----+--+-data-name-5-+--+-------+--| clause 2 |-' '-IS-' '-integer-8---' '-LINES-' >--+---------------------------------+--.---------------------->< '-CODE-SET--+----+--alphabet-name-' '-IS-' clause 1 |--+----+--VARYING--+----+--+------+--+---------------------+---> '-IS-' '-IN-' '-SIZE-' '-+------+--integer-6-' '-FROM-' >--+---------------+--+------------+----------------------------| '-TO--integer-7-' '-CHARACTERS-' clause 2 |--+--------------------------------------------+---------------> '-+------+--FOOTING--+----+--+-data-name-6-+-' '-WITH-' '-AT-' '-integer-9---' >--+-----------------------------------------+------------------> '-+-------+--+----+--TOP--+-data-name-7-+-' '-LINES-' '-AT-' '-integer-10--' >--+--------------------------------------------+---------------| '-+-------+--+----+--BOTTOM--+-data-name-8-+-' '-LINES-' '-AT-' '-integer-11--'