IBM AS/400 manual Merging an Array with an Externally Described DS Subfield, Initializing, Char

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 426
Image 426
Merging an Array with an Externally Described DS Subfield

Resolving Conversion Problems

Merging an Array with an Externally Described DS Subfield

As mentioned earlier, you are not allowed to define a standalone array structure subfield with the same name in RPG IV. In general, the Conv will merge these two definitions. However, if the subfield is in an e described data structure, this merging is not handled and you will be manually correct the converted source member.

For example, the field ARRAY in Figure 206

is

included

twice in

Figure 2

included once as a standalone array and once in the externally

descri

structure

EXTREC.

When converted,

the

RPG

IV

source

generated

is show

Figure 208.

This code will not compile

since ARRAY is defined twice. I

correct this problem, delete the standalone array and add a

subfield

keywords

to data

structure DSONE

as

shown

in

Figure 209.

 

AR RECORD

A

 

 

 

CHARACTER

10

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A

 

 

 

ARRAY

 

10

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure

206.

DDS for external data structure

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

E

 

 

 

 

ARRAY

10

1

 

 

 

 

 

 

 

 

 

 

 

 

 

IDSONE

 

E DSEXTREC

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C

 

 

CHAR

DSPLY

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C

 

 

 

 

SETON

 

 

 

 

LR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure

207. RPG III source using external data structure with array

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D ARRAY

 

S

 

 

1

DIM(10)

 

 

 

 

 

 

 

 

 

 

 

D DSONE

 

E DS

 

 

 

EXTNAME(EXTREC)

 

 

 

 

 

 

 

 

C

CHAR

 

 

DSPLY

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C

 

 

 

 

SETON

 

 

 

 

 

 

 

 

LR

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure

208. RPG IV source with two definitions for the array

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D DSONE

 

E DS

 

 

 

EXTNAME(EXTREC)

 

 

 

 

 

 

 

 

D

ARRAY

 

E

 

 

 

DIM(10)

 

 

 

 

 

 

 

 

 

 

 

C

CHAR

 

 

DSPLY

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C

 

 

 

 

SETON

 

 

 

 

 

 

 

 

LR

 

 

 

 

 

 

 

 

 

 

 

 

Figure

209. Corrected RPG IV source with a single definition for the array

 

 

 

Renaming

and

Initializing

an

Externally

Described

DS

Subfield

 

 

 

 

 

 

 

In RPG III, when both renaming

and

initializing a

field

in

an

externa

data

structure, you had to use two source

lines, as

shown

for the

 

Figure 210

on

page 403.

The

converted

source

also

contains

two

source

l

shown

in Figure 211

on

page 403.

This

use

of

two

source

lines

for a

 

result

in a compile-time error,

as the

field

CHAR

is defined

twice.

T

code

you

must

combine

the

keywords

of

the

field

CHAR

into

a

single

l

in Figure 212

 

on page 403,

where

the

key

fields

INZ and EXTFLD have b

bined

and

only

one

instance

on

the

field

CHAR

is

shown.

 

 

 

 

 

 

402 ILE RPG for AS/400 Programmer's Guide

Page 426
Image 426
IBM AS/400 Merging an Array with an Externally Described DS Subfield, Initializing, Resolving Conversion Problems, Char