× 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 saw a similar answer as to what I'm going to give. Nevermind how the
fields appear in the file. All you need to do is list the fields in order
of a datastructure.

Assume Sales1 through 4 are defined as decimal 5,2 small yes but you'll
get the point.

* FSPECS
FFILENAME.... yadda yadda yadda.

* DSPECS
D salesDS DS
D Sales1
D Sales2
D Sales3
D Sales4
D Sales 1 20 2 Dim(4)


Since the fields are defined by the file... do not redefine them in the
datastructure... just simply list them. Then when you define the array...
you need to start at 1 and multiply the number of fields by the length.
4 * 5 = 20.... just specify the precision. 2 decimal points. Dim it 4
times to get your array.

Michael Schutte
Admin Professional

rpg400-l-bounces@xxxxxxxxxxxx wrote on 02/13/2008 09:00:52 AM:

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.


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



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.