IBM AS/400 Frozen Dessert Maker User Manual


 
Resolving Conversion Problems
Merging an Array with an Externally Described DS Subfield
As mentioned earlier, you are not allowed to define a standalone array and a data
structure subfield with the same name in RPG IV. In general, the Conversion Aid
will merge these two definitions. However, if the subfield is in an externally
described data structure, this merging is not handled and you will be required to
manually correct the converted source member.
For example, the field ARRAY in Figure 206 is included twice in Figure 207. It is
included once as a standalone array and once in the externally described data
structure EXTREC. When converted, the RPG IV source generated is shown in
Figure 208. This code will not compile since ARRAY is defined twice. In order to
correct this problem, delete the standalone array and add a subfield with the
keywords to data structure DSONE as shown in Figure 209.
A R 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 externally described
data structure, you had to use two source lines, as shown for the field CHAR in
Figure 210 on page 403. The converted source also contains two source lines, as
shown in Figure 211 on page 403. This use of two source lines for a field will
result in a compile-time error, as the field CHAR is defined twice. To correct this
code you must combine the keywords of the field CHAR into a single line as shown
in Figure 212 on page 403, where the key fields INZ and EXTFLD have been com-
bined and only one instance on the field CHAR is shown.
402 ILE RPG for AS/400 Programmer's Guide