IBM AS/400 manual Renaming Record-Format Names, Ignoring Record Formats, Renaming Field Names

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 290
Image 290

Defining Externally Described Files

Renaming Record-Format Names

Many

of the functions that you can specify

for externally

described

the

CHAIN operation) operate on either

a file

name

or a

record-format

sequently, each file and record-format

name

in

the

program

must be a

bolic name.

 

 

 

 

 

To rename a record-format name, use the RENAME keyword on the file des specifications for the externally described file as shown in Figure 13 is RENAME( old name:new name).

*.. 1 + 2 + 3 + 4 + 5 + 6 + 7 + *

 

 

 

 

FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++

 

 

FITMMSTL

IP

E

K DISK RENAME(ITEMFORMAT:MSTITM)

 

 

*

 

 

 

 

 

 

 

 

 

 

Figure 130.

RENAME Keyword for Record Format Names in an Externally Described File

 

The

RENAME

keyword is

generally used if the program contains two

files

have the same record-format names. In Figure 130, the record

format

ITEMFORMAT

in

the externally described file ITMMSTL is renamed MSTITM for

use

in

this

program.

 

 

 

Renaming Field Names

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

You

can

partially

rename

all

fields

in

an

externally

described

file

by

 

PREFIX

keyword

on

the file-description specification

for the file. You

 

add

a

prefix

to

the

existing

field

name

or you can replace part of

 

name

with

a

sequence

of

characters.

The

formatprefix-stringis: PREFIX(

 

 

 

{nbr_of_char_replaced}). Figure 131

shows

some

examples of the use

of

PREFI

 

 

 

 

 

 

*.. 1 + 2 + 3 + 4 + 5 + 6 + 7 + *

 

FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++

 

 

 

 

* Add the prefix MST to each name in the record format

 

 

 

 

 

 

FITMMSTL

IP

E

 

K DISK

PREFIX(MST)

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

* Change the prefix YTD to YE for each name in the record for￿mat

 

 

 

 

 

FSALESMSTR IP

E

 

K DISK

PREFIX(YE:3)

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure

131.

Prefix Keyword for Record Format Names in an Externally Described File

 

Ignoring Record Formats

If

a record

format

in

an

externally described file

is

not

to be

u

can

use

the

IGNORE

keyword

to make

the program run as if the record

not

exist

in

the file.

For

logical

files, this means

that

all

data

ass

format is inaccessible to the program. Use the IGNORE keyword on a description specifications for the externally described file as shown on page 267.

The file must have more than one record format, and not all of them c ignored; at least one must remain. Except for that requirement, any num record formats can be ignored for a file.

266 ILE RPG for AS/400 Programmer's Guide

Page 290
Image 290
IBM AS/400 manual Renaming Record-Format Names, Ignoring Record Formats, Renaming Field Names, nbrofcharreplaced. Figure