IBM AS/400 Sequential File, Record Address File, Using Program-Described Disk Files, D K1, D K2

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 314
Image 314

Using Program-Described Disk Files

On the file description specifications, the length of the key field positions 29 through 33 (the combined number of positions required for and ITEM fields). The starting position of the key field is described keyword KEYLOC (starting in position 44). The starting position must specif first position of the first key field.

*..

1

...+

... 2

...

+...

3 ...

+

... 4 ...

+...

5 ...

+

6

+

7

...+...

*

 

 

 

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

 

FORDDTLL

IP

F

120

10AIDISK

KEYLOC(15)

 

 

 

 

 

 

 

*..

1

...+

... 2

...

+...

3 ...

+

... 4 ...

+...

5 ...

+...

6 ...

+...

7

...+...

*

 

DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++

 

DKEY

 

 

DS

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D K1

 

 

 

 

 

1

 

5

 

 

 

 

 

 

 

 

 

D K2

 

 

 

 

 

6

 

10

 

 

 

 

 

 

 

 

 

*..

1

...+

... 2

...

+...

3 ...

+

... 4 ...

+...

5 ...

+...

6 ...

+...

7

...+...

*

 

CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq.￿

...

 

C

 

 

 

 

MOVE

 

ORDER

 

K1

 

 

 

 

 

 

 

C

 

 

 

 

MOVE

 

ITEM

 

K2

 

 

 

 

 

 

 

C

 

KEY

 

 

CHAIN

 

ORDDTLL

 

 

 

 

 

 

99

 

 

 

 

 

 

Figure

143.

(Part 2 of 2). Using Data Description Specifications to Define the Access Pa

(Composite

Key)

for

an

Indexed

File

 

 

 

 

 

 

 

 

When the DDS specifies a composite key, you must build a search arg program to CHAIN to the file. (A KLIST cannot be used for a program-d file.) One way is to create a data structure (using definition spec fields equal to the key fields defined in the DDS. Then, in the cal subfields equal to the value of the key fields, and use the data-st the search argument in the CHAIN operation.

In this

example, the MOVE operations set

the subfields K1 and K2 equ

value

of

ORDER and ITEM, respectively. The

data-structure name (KEY) is

used

as

the search argument in the CHAIN

operation.

Sequential File

Sequential files are files where the order of the records in the f order the records are placed in the file (that is, in arrival seque the tenth record placed in the file occupies the tenth record posit

Sequential

files

can be

processed randomly by relative record number,

utively,

or

by

a

record-address

file. You can use either the SETLL o

tion code

to set

limits

on the

file.

Record Address File

You can use a record-address file to process another file. A record contain (1) limits records that are used to process a file sequentia

(2)relative record numbers that are used to process a file by rel

numbers. The record-address file itself must be processed sequentially

A record-address file is identified by an R in position 18 of

the

ifications. If the record-address file contains

relative

record

number

must

contain a T. The

name

of the file to

be

processed

by

the

rec

must

be specified on

the

file description

specification.

You

identify

keyword RAFDATA( file-name).

290 ILE RPG for AS/400 Programmer's Guide

Page 314
Image 314
IBM AS/400 manual Sequential File, Record Address File, Using Program-Described Disk Files, D K1, D K2, Orddtll