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.

Deleting overrides<br />

54 <strong>File</strong> <strong>Management</strong> V4R5<br />

described data and a different field level file is used at run time, it is usually<br />

necessary to specify LVLCHK(*NO) on the override. See “Redirecting files” on<br />

page 64 for details.<br />

The following example shows how overrides work when compiling a program:<br />

Override 1 OVRDBF FILE(RPGSRC) +<br />

TOFILE(SRCPGMS) MBR(INVN42)<br />

Override 2 OVRPRTF FILE(OUTPUT) TOFILE(REPORTS)<br />

CALL PGM(A)<br />

Program A<br />

Override 3 OVRPRTF FILE(LISTOUT) +<br />

TOFILE(OUTPUT)<br />

Override 4 OVRDBF FILE(RPGSRC) WAITFILE(30)<br />

CRTRPGPGM PGM(INVENTORY) +<br />

SRCFILE(RPGSRC)<br />

RETURN<br />

Override 5 OVRPRTF FILE(LISTOUT) +<br />

TOFILE(REPORTS) LPI(8)<br />

CALL PGM(INVENTORY)<br />

The program INVENTORY opens the printer file REPORTS in place of printer file<br />

LISTOUT and creates output at 8 lines per inch.<br />

The program INVENTORY is created (compiled) from the member INVN42 in the<br />

database file SRCPGMS. Override 4, which is applied first, overrides an optional<br />

file attribute. Override 1, which is applied last, causes the file RPGSRC to be<br />

overridden with the database file SRCPGMS, member INVN42.<br />

The program INVENTORY is created with the printer formats from the file<br />

REPORTS. Assume that the source for the program INVENTORY, which is taken<br />

from file SRCPGMS and member INVN42, contains an open to the printer file<br />

LISTOUT. Override 3, which is applied first, causes the file LISTOUT to be<br />

overridden with OUTPUT. Override 2, which is applied last, overrides OUTPUT<br />

with REPORTS. Other attributes may be specified here, but it is not necessary<br />

because only the record formats are used at compile time.<br />

At run time, override 3 is no longer active, because program A has ended.<br />

Therefore override 2 has no effect on LISTOUT. However, override 5, which is<br />

active at run time, replaces LISTOUT with REPORTS and specifies 8 lines per inch.<br />

Because the same file is used for compilation and run-time, you can leave level<br />

checking on.<br />

When a program that has been called returns control to the calling program, the<br />

system deletes any overrides specified in the call level of the called program. This<br />

does not include overrides that are scoped to the activation group level or the job<br />

level. Overrides that are scoped to the activation group level remain in effect until<br />

they are explicitly deleted, replaced, or until the activation group in which they are<br />

specified is deleted. Overrides that are scoped to the job level remain in effect until<br />

they are explicitly deleted, replaced, or until the job in which they are specified<br />

ends.

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

Saved successfully!

Ooh no, something went wrong!