Before you create or open a file, you must set up a data area for the file's FCD. For ease of use, this program also sets up a number of pre-defined operation code values that you can call upon.
01 opcode pic x(2). 78 OP-QUERY-FILE value x"0006". 78 OP-OPEN-INPUT value x"fa00". 78 OP-OPEN-OUTPUT value x"fa01". 78 OP-OPEN-I-O value x"fa02". 78 OP-WRITE value x"faf3". 78 OP-RELEASE value x"faf3". 78 OP-REWRITE value x"faf4". 78 OP-READ-NEXT value x"faf5". 78 OP-START-EQUAL value x"fae9". 78 OP-CLOSE value x"fa80".
The opcode variable will be used throughout the running of this example, each time using one of the level-78 constant values shown to perform a specific operation.
01 fcd. copy "xfhfcd3.cpy".
xfhfcd3.cpy is a copybook that is supplied with your product, defining all the possible fields that you may use to set up the FCD for the file that you will create. The tutorial will only use a small selection of the fields available.