File description
The FD entry in a COBOL program that describes a file's records, connecting the program to data supplied by the JCL.
Also written FD, FILE SECTION, SELECT
An FD, or file description, appears in the FILE SECTION of the DATA DIVISION and describes one file the program uses. Underneath it sits the record layout, field by field.
The chain from program to data has three links, and understanding it explains a lot about how mainframe programs work. The program declares an internal file name and selects it against an external name in the ENVIRONMENT DIVISION. The JCL supplies a DD statement with that external name, pointing at a real dataset. The program then opens, reads, writes and closes purely in terms of its own internal name.
Nothing in the source names a dataset. That is why the same compiled program processes test data one day and production data the next with no change. Only the JCL differs.
Files are declared as sequential, indexed for VSAM datasets accessed by key, or relative. The declaration determines which statements are available: sequential files are read in order, indexed files can be read directly by key and updated in place.
Related terms
- DATA DIVISIONThe part of a COBOL program that declares every record layout and variable it will use.
- DD statementThe JCL statement that connects a name inside a program to a real dataset outside it.
- KSDSThe most common VSAM dataset type, where every record has a unique key used to find it directly.
- Sequential datasetThe simplest kind of dataset: records stored one after another and normally read from start to finish.
- COBOLThe programming language most business logic on the mainframe is written in. Verbose by design, and still running the world's payments.
- VSAMA family of dataset types built for fast record access by key, used where applications need to look records up rather than read them in order.