30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

COPIES(2)<br />

From Override 2<br />

LPI(4) From Override 4<br />

Because no specific override is found for PRT2 in program B, override 4 is applied.<br />

In program A, override 2 specifies PRT2 and is applied.<br />

When program X opens the file PRT3, the opened file has the following attributes:<br />

COPIES(1)<br />

From Override 1<br />

LPI(8) From Override 5<br />

In program B, override 5 specifies PRT3 and is applied. Because no specific<br />

override is found for PRT3 in program A, override 1 is applied.<br />

When program X opens the file PRT4, the opened file has the following attributes:<br />

COPIES(2)<br />

From Override 3<br />

LPI(8) From Override 6<br />

In program B, override 6 specifies PRT4 and is applied. In program A, override 3<br />

specifies PRT4 and is applied.<br />

Applying overrides when compiling a program<br />

Overrides may be applied at the time a program is being compiled for either of<br />

two purposes:<br />

v To select the source file<br />

v To provide external data definitions for the compiler to use in defining the<br />

record formats to be used on I/O operations<br />

Overrides to the source file are handled just like any other override. They may<br />

select another file, another member of a database file, another label for diskette or<br />

tape, or change other file attributes.<br />

You can also apply overrides to files that are used within the program being<br />

compiled, if they are being used as externally described files in the program. These<br />

files are not opened at compile time, and thus the overrides are not applied in the<br />

normal manner. These overrides are used at compile time only to determine the<br />

file name and library that will be used to define the record formats and fields for<br />

the program to use I/O operations. Any other file attributes specified on the<br />

override are ignored at compile time. It is necessary that these file overrides be<br />

active at compile time only if the file name specified in the source for the program<br />

is not the file name that contains the record formats that the application needs.<br />

The file name that is opened when the compiled program is run is determined by<br />

the file name that the program source refers to, changed by whatever overrides are<br />

in effect at the time the program runs. The file name used at compile time is not<br />

kept. The record formats in the file that is actually opened must be compatible<br />

with those that were used when the program was compiled. Obviously, the easiest<br />

way to assure that records are compatible is to have the same overrides active at<br />

run time that were active at compile time. If your program uses externally<br />

Chapter 3. Using overrides 53

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!