× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I can't think of any real advantage to using the file approach - unless you plan on passing the file as a parm - which is primarily what templated files are for.

The ExtName approach also has the advantage that additional fields and/or redefinitions can be added to the DS. A LikeRec cannot be used in that way.



On Oct 16, 2019, at 9:43 AM, Robert Jacobs <robertjacobsit@xxxxxxxxx> wrote:

I have a question about the differences/advantages/disadvantages between
these two methods of utilizing a data-structure template containing field
definitions for a physical file.

_______________

Method 1
-Define the physical file as a template
-Define a template data-structure as LikeRec the defined
file_name.format_name
-Refer to the data-structure when defining other fields

example:
dcl-f CUSTFILE keyed template qualified;
dcl-ds cust_t likeRec(CUSTFILE.CUSTFILER) template;
dcl-s custName like(cust_t.name);

_______________

Method 2
-Define a template data-structure as ExtName the physical file
-Refer to the data-structure when defining other fields

example:
dcl-ds cust_t extName('CUSTFILE') qualified template end-ds;
dcl-s custName like(cust_t.name);

_______________

The few questions I have:
1. Is there a benefit to method 1, considering the requirement to define
the file in the F specs?
2. I would assume in method 1 that since the file is defined as a
template, if a new field were to be added to the file, the program would
not need to be re-compiled unless it needed to refer to that new field.
And I would make the same assumption for method 2, as the file isn't
defined at all. Am I correct in my reasoning?
3. If there is no advantage to method 1, does anybody have a good reason
to use template defined f-specs?
4. Why is the end-ds required at the end of an ExtName data-structure, but
not LikeRec?

Thanks in advance for any insight!
--
This is the RPG programming on IBM i (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


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.