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



Well I'm not reverting to fixed format but ..

dcl-ds arprf_rec extname(arprf);
array like(bnbr01) dim(20) pos(1)'
end-ds;

In other words just add the array def after the DS declaration.


Jon P.


On Jun 13, 2022, at 4:50 PM, Eric Hill via RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:

I'm having a hard time with this one and I know it has to be something I'm missing (well I am OLD!).

I have a file called ARPRF that has 20 branch codes defined. The branch code definitions look like this (snipped from entire file):

==========================================
A* BNBR - BRANCH CODES
A BNBR01 1A TEXT('BRANCH CODE')
A BNBR02 1A TEXT('BRANCH CODE')
A BNBR03 1A TEXT('BRANCH CODE')
A BNBR04 1A TEXT('BRANCH CODE')
A BNBR05 1A TEXT('BRANCH CODE')
A BNBR06 1A TEXT('BRANCH CODE')
A BNBR07 1A TEXT('BRANCH CODE')
A BNBR08 1A TEXT('BRANCH CODE')
A BNBR09 1A TEXT('BRANCH CODE')
A BNBR10 1A TEXT('BRANCH CODE')
A BNBR11 1A TEXT('BRANCH CODE')
A BNBR12 1A TEXT('BRANCH CODE')
A BNBR13 1A TEXT('BRANCH CODE')
A BNBR14 1A TEXT('BRANCH CODE')
A BNBR15 1A TEXT('BRANCH CODE')
A BNBR16 1A TEXT('BRANCH CODE')
A BNBR17 1A TEXT('BRANCH CODE')
A BNBR18 1A TEXT('BRANCH CODE')
A BNBR19 1A TEXT('BRANCH CODE')
A BNBR20 1A TEXT('BRANCH CODE')
==========================================

In my SQLRPGLE program I am wanting to use an external data structure to contain the ARPRF file data:

==========================================
d arprf_rec e ds extname(arprf)
==========================================

And then use the following SQL statement:

==========================================
exec sql
select * into :arprf_rec
from arprf
where bncomp = :udcomp and
bnurid = :use_id;
==========================================

This works great except I need to get those branch codes into a DIM(20) array and I just don't know how to redefine/code the external DS for this. If I was defining the ARPRF file using the "F" specs then I could just have a data structure that looks something like this to handle it:

==========================================
D DS
D BNBR 1 20
D DIM(20)
D BNBR01 1 1
D BNBR02 2 2
D BNBR03 3 3
D BNBR04 4 4
D BNBR05 5 5
D BNBR06 6 6
D BNBR07 7 7
D BNBR08 8 8
D BNBR09 9 9
D BNBR10 10 10
D BNBR11 11 11
D BNBR12 12 12
D BNBR13 13 13
D BNBR14 14 14
D BNBR15 15 15
D BNBR16 16 16
D BNBR17 17 17
D BNBR18 18 18
D BNBR19 19 19
D BNBR20 20 20
==========================================

I know I can do something like this:

==========================================
BNBR(1) = BNBR01
BNBR(2) = BNBR02
.
.
.
BNBR(20) = BNBR20
==========================================

But I thought for sure I had seen something somewhere that addressed this but I just cannot find it.

Any help would be appreciated!

Eric Hill
Senior Software Developer
--
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@xxxxxxxxxxxxxxxxxxxx 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.