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



You could create a qualified data structure and have it overlay the
CTDATA array.

Dcl-S GlCtdata Char(80) Dim(10) Ctdata PERRCD(1);
Dcl-S Ptr_GlData Pointer Inz(%Addr(GlCtdata));
Dcl-Ds GlData Qualified LEN(80) Dim(10) BASED(ptr_GlData);
Account Char(10);
Amount Zoned(9);
End-ds;

For idx = 1 to 10;
NewAccount = GlData(Idx).Account;
NewAmount = GlData(Idx).Amount;
Endfor;


Or if you didn't to use a compile time array you could just define the
data inside a data structure;

Dcl-C RIM30V_MAX Const(05);
Dcl-C RIM30V_01 Const(01);
Dcl-C RIM30V_02 Const(02);
Dcl-C RIM30V_03 Const(03);
Dcl-C RIM30V_04 Const(04);
Dcl-C RIM30V_05 Const(05);

Dcl-Ds RIM30V_OPTIONS QUALIFIED;
*N Like(RIM30V_T.K) INZ(RIM30V_01);
*N Like(RIM30V_T.D) INZ('Expansion Position 01');
*N Like(RIM30V_T.K) INZ(RIM30V_02);
*N Like(RIM30V_T.D) INZ('Expansion Position 02');
*N Like(RIM30V_T.K) INZ(RIM30V_03);
*N Like(RIM30V_T.D) INZ('Expansion Position 03');
*N Like(RIM30V_T.K) INZ(RIM30V_04);
*N Like(RIM30V_T.D) INZ('Expansion Position 04');
*N Like(RIM30V_T.K) INZ(RIM30V_05);
*N Like(RIM30V_T.D) INZ('Expansion Position 05');
Opt Likeds(RIM30V_T) POS(1) DIM(RIM30V_MAX);
Key Like(RIM30V_T.K) Overlay(Opt);
Desc Like(RIM30V_T.D) Overlay(Opt:*next);
End-Ds;

// Template DS To provide Definitions for Options DS.
Dcl-Ds RIM30V_T QUALIFIED Template INZ;
K Zoned(2);
D Char(30);
End-Ds;

With this setup I can access the key using RIM30V_OPTIONS.Key(idx) Or
RIM30V_OPTIONS.Opt(Idx).K


Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the
author and do not necessarily represent those of the company.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff
Young
Sent: Wednesday, July 09, 2014 9:12 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Question on defining Alternating Array

All,
I have a DS that contains 20 fields:
GL_Number_01 10A
GL_Account_01 10A


After defining each of the 10 occurrences as sub fields, I then define
the arrays using the following code:
GL_Account Overlay(GL_DS) Dim(10)
GL_Amount Dim(10) Alt(GL_Account)

I am receiving the following error:
RNF3442: The parameter GL_ACCOUNT for keyword ALT is not valid; keyword
is ignored.

What am I missing?


The actual code is at: http://code.midrange.com/012d0ccc4e.htm
<http://code.midrange.com/012d0ccc4e.html>
Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i (AS/400 and 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.