× 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.



Another method is to use a combination of data structure and array, such as:

D Methods DS
D LxCigs
D LxChew
D LxSnuff
D LxSmokel
D LxCigars
D LxLittle
D LxRolling
D LxPlug

D MethArr Overlay(Methods)
D Like(LxCigs) Dim(8)

In this example, the LX... fields are defined in a table, which is defined in the F-Specs. The table has other fields in addition to the ones shown in the Methods DS. Of course, this technique is only used to load an array for %Lookup( ) purposes and all of the LX.. fields naturally have the same dimensions (1a in this case).
Giving credit where credit is due, I've seen this technique elsewhere since, but I originally "stole" it from a presentation that Paul Tuohy gave at COMMON a few years back.

* Jerry C. Adams
*IBM System i Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
615.995.7024
fax
615.995.1201
email
jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



Mike Roderick wrote:
In RPG, is there a way to refer to a field in a file by its relative
position in the file?

E.g. File with 10 fields use array element FIELD(5) to get to 5th
field.

I have a file with 53 weekly buckets for a number of different pieces of
information(sales, cost, rebates, etc) so there are > 300 fields.


I know I can define an array in the I specs and list the fields one at a
time but is there any other mechanism I can use that would allow me to
access the fields in the order they exist in the file(using array like
syntax). Maybe a Data structure or SQL?


Any thoughts would be appreciated


Thanks,

Mike





____________________________________

This email message is intended for the use of the individual to which it is addressed and may contain confidential and privileged information. Any unauthorized distribution or disclosure is prohibited. If you have received this message in error, please contact the sender immediately and delete it from your system.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.