Jeff
Jeff

Reputation: 349

Using externally described data structures in RPG ILE Free

I'm having a world of issues using externally described data structures in RPG ILE Free.
The simplest issue seems to be just declaring the structure.

DCL-DS PALWGHT extname(SCN102DS);
  PW DIM(20) OVERLAY(PALWGHT:1); 
END-DS;

When I compile, it says the external file does not exist...but it does and it is in my library list.

 A          R PALWGHT
 A            P01WGHT       11S 3
 A            P02WGHT       11S 3
 A            P03WGHT       11S 3
 A            P04WGHT       11S 3
 A            P05WGHT       11S 3
 A            P06WGHT       11S 3
 A            P07WGHT       11S 3
 A            P08WGHT       11S 3
 A            P09WGHT       11S 3
 A            P10WGHT       11S 3
 A            P11WGHT       11S 3
 A            P12WGHT       11S 3
 A            P13WGHT       11S 3
 A            P14WGHT       11S 3
 A            P15WGHT       11S 3
 A            P16WGHT       11S 3
 A            P17WGHT       11S 3
 A            P18WGHT       11S 3
 A            P19WGHT       11S 3
 A            P20WGHT       11S 3

This worked prior to changing it to free format.....

 DPALWGHT        E DS                  EXTNAME(SCN102DS)
 DPW                             11s 3 DIM(20) OVERLAY(PALWGHT:1)

I'm lost. It's probably something really stupid....

Upvotes: 0

Views: 7555

Answers (1)

jmarkmurphy
jmarkmurphy

Reputation: 11473

A couple issues. First, in free-form the file name in EXTNAME(filename) must be either a Named Constant or character literals. This is different from the fixed form variant which can be a File Name or character literals. If you read all the error messages you get RNF0202 - THE PARAMETER FOR EXTNAME OR EXTFLD MUST BE A DEFINED NAMED CONSTANT OR LITERAL. If you use a file name, it must be enclosed in quotes in free-form.

DCL-DS PALWGHT extname('SCN102DS');

PW is still undefined though because it does not have a type declaration. And, in free-form, OVERLAY() cannot point at the data structure. Instead you use POS(). So the whole thing should look something like:

DCL-DS PALWGHT extname('SCN102DS');
  PW LIKE(P01WGHT) DIM(20) POS(1); 
END-DS;

Upvotes: 6

Related Questions