Previous Topic: What a File Description Tells YouNext Topic: Generating a Basic Report from Standard Files


How to Use Information in a File Description

You don't have to understand the differences between the data types to use CA Culprit, but you must identify them correctly. You just have to read the information off of the file description and enter it correctly into your code.

The figure below shows the layout of a record within an employee data file. Sample data illustrates how an occurrence of the employee record might appear:

   1      5       15        115             160       171                     200    │      │        │          │               │         │                       │    │      │        │          │               │         │                       │    ▼      ▼        ▼          ▼               ▼         ▼                       ▼ ┌───────┬──────────────────────────────────────────────────────────────────────┐ ◄─┐ │ 1111  │ ROGER    WILCO      WEATHER         2000      CLOUDGATHERER          │   ├─── SAMPLE DATA └───────┴──────────────────────────────────────────────────────────────────────┘ ◄─┘ ┌────┬─────────────┬─────────────┬─────┬────────────┬─────────┬──┬─────────────┐ ◄─┐ │ 1  │  5          │  15     30  │     │ 115        │ 160     │  │ 171         │   │ ├────┼-------------┼-------------┼-----┼------------┼---------┼--┼------------─┤   ├──┐ │ ID │  FIRST-NAME │  LAST-NAME  │     │ DEPARTMENT │ SALARY  │  │ TITLE       │   │  │ RECORD ├────┼------------─┴─────────────┼----─┴────────────┴─────────┴──┴─────────────┘ ◄─┘ │    │         EMPLOYEE          │ └────┴───────────────────────────┘

The sample record above has six data fields that can be used for a report. Note that the record is always 200 bytes long, even if all the space is not needed by a particular word or number. The data field lengths also remain constant, with blanks used to fill out the space.

For example, the record allocates a 10-byte space for FIRST-NAME; therefore, the five characters in ROGER are followed by five blanks so that WILCO begins in position 15, the starting position of LAST-NAME.