Set up the FCD

You need to set the appropriate information in the FCD according to the operation codes that you will use. The following block sets the details required for the opening of the file.

  1. In the procedure division, paste the following code:
               set-fcd section.
          *> Initially sets up FCD for OPEN op 
               move low-values to fcd
               move length of fcd to fcd-length
               move fcd--version-number    to fcd-version             
               move fcd--indexed-org       to fcd-organization
               move fcd--dynamic-access    to fcd-access-mode
               move fcd--open-closed       to fcd-open-mode *> When opening a file this should be set to fcd--open-closed
               move fcd--recmode-variable  to fcd-recording-mode
               move fcd--format-big        to fcd-file-format
               move fcd--auto-lock-bit     to fcd-lock-mode
               move 12                     to fcd-name-length
               set fcd-filename-address    to address of ex-filename
               set fcd-idxname-address     to address of ex-index-name
               set fcd-key-def-address     to address of ex-keydef
               move 10                     to fcd-max-rec-length
               move 5                      to fcd-min-rec-length
               set fcd-record-address      to address of ex-record
               perform set-keydefinitions

    This section populates the FCD data area with the details required to perform an OPEN. The last line performs another section that will populate the key definition block that you defined in the last step; that section is below.

  2. Paste the following code underneath the set-fcd section:
               set-keydefinitions section.
               move low-values to ex-keydef
               move length of ex-keydef to key2length
               move 1 to key-count
               set component-defs to length of key-specification
               add 14 to component-defs
               move 1 to component-count
               move 0 to component-offset *> start of key
               move 5 to component-length *> key length

    This section states that there will be only one key (move 1 to key-count), and that will contain only one component (move 1 to component-count), 5 bytes in length (move 5 to component-length).

Next step is to code the call to the file handler.