30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The file MSTOUT opens because of the override that is requested by the call to the<br />

QCMDEXC program.<br />

In an actual program, you might want to use data that is supplied by the program<br />

as a parameter of the override. You can do this by using program variables in the<br />

call to QCMDEXC. For more information on the use of program variables, refer to<br />

the appropriate language information.<br />

Securing files against overrides<br />

On occasion, you may want to prevent the person or program that calls your<br />

program from changing the file names or attributes you have specified. You can<br />

prevent additional file overrides by coding the SECURE(*YES) parameter on a file<br />

override command for each file that needs protection. This protects your file from<br />

overrides at lower call levels, the activation group level, and the job level.<br />

The following shows an example of a protected file:<br />

Override 1 OVRPRTF FILE(PRINT1) SPOOL(*NO)<br />

Override 2 OVRDBF FILE(NEWEMP) TOFILE(OLDEMP) +<br />

MBR(N67)<br />

CALL PGM(CHECK)<br />

Program CHECK<br />

Override 3 OVRDBF FILE(INPUT) +<br />

TOFILE(NEWEMP) MBR(N77) +<br />

SECURE(*YES)<br />

CALL PGM(EREPORT)<br />

Program EREPORT<br />

(NEWEMP and PRINT1 are opened.)<br />

Override 4 OVRDBF FILE(INPUT) +<br />

TOFILE(NEWEMP) MBR(N77)<br />

CALL PGM(ELIST)<br />

Program ELIST<br />

(OLDEMP and PRINT1 are opened.)<br />

When the example calls program EREPORT, it attempts to open the files INPUT<br />

and PRINT1. EREPORT actually opens file NEWEMP, member N77. Because<br />

override 3 specifies SECURE(*YES), the system does not apply override 2. When<br />

the example calls program ELIST, it also attempts to open the files INPUT and<br />

PRINT1. ELIST actually opens files OLDEMP, member N67. Because override 4 has<br />

the same name as override 3 and is at the same call level as override 3, it replaces<br />

override 3. Thus, the file is no longer protected from overrides at lower call levels,<br />

and the system applies override 2 for program ELIST.<br />

PRINT1 is affected only by override 1, which is in effect for both programs<br />

EREPORT and ELIST.<br />

Using a generic override for printer files<br />

The OVRPRTF command allows you to have one override for all the printer files<br />

in your job with the same set of values. Without the generic override, you would<br />

have to do a separate override for each of the printer files.<br />

Chapter 3. Using overrides 51

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

Saved successfully!

Ooh no, something went wrong!