Barbara,

Thank you for the explanation.

Greg

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Thursday, January 31, 2019 5:27 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Free format question on D specs

On 2019-01-31 2:17 PM, Greg Wilburn wrote:
Not to hijack this thread... but I often wondered why the "order" of some things matter on free form d-specs.

Example:

// This is not valid
dcl-ds myDS qualified extname('ExtFile');
end-ds;
RNF3529E Keyword is not allowed for a program-described data structure; keyword is ignored.
(extname is highlighted)

// This IS valid
dcl-ds myDS extname('ExtFile') qualified;
end-ds;

I guess it's "not so free form" free form? :)

True :-)

There are a few cases where a keyword has to be first if it's specified, all basically for the same reason.

The compiler code for scanning free-form definitions is almost all the same as for fixed-form code, and there are a few things available in fixed form columns that the compiler needs so it knows which direction to take. For example, the data type keywords (CHAR, DATE) etc have to be first because fixed form has a data-type columm. For files, the device keyword (DISK, PRINTER) has to be first because fixed form has a device column. And for externally-described data structures, the EXT or EXTNAME keyword has to be first, because fixed form has the 'E' before the 'DS'.
The compiler takes completely different paths for externally-described vs program-described data structures, so it needs to know right away what it's dealing with.

If you want to put EXTNAME later (or if don't want to code it at all), you could code EXT as the first keyword and code the EXTNAME keyword later (or not at all).

--
Barbara

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].