IBM AS/400 manual Input, and Output, Example of Redirecting, File

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 298
Image 298

Overriding and Redirecting File

Input

and

Output

 

 

 

 

 

 

 

 

 

 

 

 

 

 

in the program. For example, if

the

RPG

device

name

 

is

PRINTER,

and

th

file

the

program connects to is not

a printer, the OS/400 system

ignore

print spacing and skipping specifications.

 

 

 

 

 

 

 

 

 

 

 

There are other file redirections

that the OS/400 system does

not

allo

cause

the

program to end. For example,

if

the

RPG

device

name

is

WO

and the EXFMT operation is specified

in

the

 

program,

 

the

program

is

st

actual

file

the program

connects to

is

not

a

display

or

ICF file.

 

In ILE, overrides are scoped to the activation group level, job

level

Overrides

that are scoped to the

activation

group

level

remain

in

eff

are deleted, replaced, or until the activation group in which they a

Overrides that are scoped to the

job level remain in effect

until

th

replaced,

or

until the

job in

which

they are specified ends. This i

the activation group in which the overrides were specified. Override

scoped to the call level remain in effect

until

they

are

deleted,

re

program or

procedure in

which

they

are

specified

ends.

 

 

 

 

 

The default scope for overrides is the activation group. For job-level OVRSCOPE(*JOB) on the override command. For call-level scope, specify OVRSCOPE(*CALLLVL) on the override command.

See theData Management manual for more detailed information on valid file rections and file overridesILE Concepts. also contains information about overrides and activation group vs. job level scope.

Example of Redirecting

File

Input

and Output

 

 

 

 

 

The

following

example

shows

the

use of

a

file override

at compilation

Assume that

you want to use an

externally

described file for a TAPE

does

not

have

field-level

description.

You

must:

 

1. Define a physical file named FMT1 with

one record format that cont

description

of each field in the

record format. The

record format

the data description specifications (DDS). For a tape device, the

described

file

should

contain only

one

record format.

 

2. Create the file named FMT1 with a Create Physical File CL command.

3.Specify the file name of QTAPE (which is the IBM-supplied device magnetic tape devices) in the RPG program. This identifies the file

described

(indicated

by

an E

in

position

22

of

the

file

descrip

and specifies the

device

name

SEQ in positions 36 through 42.

4. Use

an override

command–OVRDBF

FILE(QTAPE) TOFILE(FMT1)–at compila-

tion time to override the QTAPE

file name and use the

FMT1

file name

command causes the compiler to

copy in the external description of

file,

which

describes

the

record

format

to

the

RPG

compiler.

5.Create the RPG program using the CRTBNDRPG command or the CRTPGM command.

6. Call the program

at run

time. The

override

to file FMT1 should not b

while the program is running. If

the override is in effect, use

DLTOVR (Delete

Override)

before

calling the

program.

Note: You may need to use the CL command OVRTAPF before you call th program to provide information necessary for opening the tape f

274 ILE RPG for AS/400 Programmer's Guide

Page 298
Image 298
IBM AS/400 manual Input, and Output, Example of Redirecting, File