Perfect!!! Thanks Jon!!!!!

Eric Hill
Senior Software Developer
Integrated Corporate Solutions
ehill@xxxxxxxxxxxxx
256-760-8239


NOTICE:
This message may contain privileged or otherwise confidential information. 
If you are not the intended recipient, please immediately advise the sender
by reply e-mail and delete the message and any attachments without using,
copying or disclosing the contents.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Tuesday, June 14, 2022 10:26 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Redefining Fields to Arrays from External Data Structures

Instead of using Pos(1) simply use SamePos. i.e.

dcl-ds arprf_rec extname(arprf);
array like(bnbr01) dim(20) samepos(BNBR01); end-ds;

No need for pointers. I don't have an issue with them but other pointer phobic folks who follow you might!

If the fields were not contiguous then instead of using an extname DS simply list the fields you want in the array in a DS.

e.g.

Dcl-Ds arrayStuff;
firstfield;
second field;
...
lastfield;

array like(first field) dim(xx) Pos(1);

End-ds;


Jon P.


On Jun 14, 2022, at 9:25 AM, Eric Hill via RPG400-L <rpg400-l@xxxxxxxxxxxxxxxxxx> wrote:

Thanks Jon but I misled you on the file layout. The BNBR01 - BNBR20 are not the only fields in the file. I was trying to not get to long winded with the message. There is a better look at the file layout below. I did find this and it seems like it will work for me:

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

d bnbr s like(bnbr01) dim(20)
d based(pbnbr)

d pbnbr s * inz(%addr(bnbr01))

for i = 1 to %elem(bnbr);
.... (do stuff);
endfor;
===============================================

File layout:
===============================================
A UNIQUE
A R ARPRFR TEXT('AR ACCOUNT PROFILE DATA')
A BNCOMP 1A TEXT('COMPANY CODE')
A BNURID 10A TEXT('USER ID')
A BNCUST 5S 0 TEXT('CUSTOMER NUMBER')
A BNNAME 25A TEXT('USER NAME')
A BNPWCD 8S 0 TEXT('PASSWORD CHANGE DATE')
A BNSTAT 1A TEXT('STATUS')
A BNBRIO 1A TEXT('BRANCH CODE INCLUDE/OMIT')
A BNPCIO 1A TEXT('PRODUCT CODE INCLUDE/OMIT')
A BNSCIO 1A TEXT('SERIES CODE INCLUDE/OMIT')
A* BNBR - BRANCH CODES
A BNBR01 1A TEXT('BRANCH CODE')
A .
A .
A .
A BNBR20 1A TEXT('BRANCH CODE')
A K BNCOMP
A K BNURID
===============================================


Eric Hill
Senior Software Developer
Integrated Corporate Solutions
ehill@xxxxxxxxxxxxx
256-760-8239


NOTICE:
This message may contain privileged or otherwise confidential information.
If you are not the intended recipient, please immediately advise the
sender by reply e-mail and delete the message and any attachments
without using, copying or disclosing the contents.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon
Paris
Sent: Monday, June 13, 2022 5:12 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Redefining Fields to Arrays from External Data Structures

CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

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://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.c
o
m_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-
v
5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=ePccLu
t
urBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1jY&s=lsJGIFRKlPT3q9RTg5-RlRG7ucn686
F jmqXskFvHnDU&e= or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1jY&s=3GhqE4_CEq5pnEbOhp6JInwa4woU7UgR9fsJgIZ8fzI&e=.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support
https://urldefense.proofpoint.com/v2/url?u=http-3A__midrange.com&d=Dw
I
CAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4
f
vgsym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1
j Y&s=rc39br9bgtMUMRDQGT1tCNxaG0q4ZBDC0rTpZfyJP0I&e= by shopping at
https://urldefense.proofpoint.com/v2/url?u=http-3A__amazon.com&d=DwIC
A
g&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fv
g
sym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1jY
& s=delqCGUqpOT__tiMybFeu-dUCYsp21iXQV83QuYXzW0&e= with our affiliate
link:
https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.
c
om&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sC
T
NheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZ
M f2kHYC1jY&s=yJc9B7viw3E4FhnVm4LMnlPkyhAQkvGt6oWvcPwP908&e=

--
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://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.co
m_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v
5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=ePccLut
urBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1jY&s=lsJGIFRKlPT3q9RTg5-RlRG7ucn686F
jmqXskFvHnDU&e= or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1jY&s=3GhqE4_CEq5pnEbOhp6JInwa4woU7UgR9fsJgIZ8fzI&e=.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support
https://urldefense.proofpoint.com/v2/url?u=http-3A__midrange.com&d=DwI
CAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4f
vgsym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1j
Y&s=rc39br9bgtMUMRDQGT1tCNxaG0q4ZBDC0rTpZfyJP0I&e= by shopping at
https://urldefense.proofpoint.com/v2/url?u=http-3A__amazon.com&d=DwICA
g&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvg
sym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZMf2kHYC1jY&
s=delqCGUqpOT__tiMybFeu-dUCYsp21iXQV83QuYXzW0&e= with our affiliate
link:
https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.c
om&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCT
NheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=ePccLuturBS5BPgcIXBjxndmzBDhDk2lZM
f2kHYC1jY&s=yJc9B7viw3E4FhnVm4LMnlPkyhAQkvGt6oWvcPwP908&e=
--
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://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.co
m_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v
5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_l
IZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&s=sorY-SaKjMbnx-IisZSzSU3EZBMai_7
vWZpZQW4lT2o&e= or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&s=PoP70qC8q_1p_P68WaSvtAKQQRODX0hN7wpXbaXHHDE&e=.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support
https://urldefense.proofpoint.com/v2/url?u=http-3A__midrange.com&d=DwI
CAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4f
vgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeT
I&s=DoHpiRQRiW9IRQjno4LhiIs0X9C36N9GsDmQk1G-hD4&e= by shopping at
https://urldefense.proofpoint.com/v2/url?u=http-3A__amazon.com&d=DwICA
g&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvg
sym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&
s=u6BX9VNiu0RRCJ7UPhC1GdSJuXNpt90fDeaGDVuMyww&e= with our affiliate
link:
https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.c
om&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCT
NheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-Kav
fiErqoeTI&s=PvW8ao-Bmc9HqH3A2UfdQDIXaQsdI_xpzHxtW2bgdVY&e=

--
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://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&s=sorY-SaKjMbnx-IisZSzSU3EZBMai_7vWZpZQW4lT2o&e=
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&s=PoP70qC8q_1p_P68WaSvtAKQQRODX0hN7wpXbaXHHDE&e=.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support https://urldefense.proofpoint.com/v2/url?u=http-3A__midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&s=DoHpiRQRiW9IRQjno4LhiIs0X9C36N9GsDmQk1G-hD4&e= by shopping at https://urldefense.proofpoint.com/v2/url?u=http-3A__amazon.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&s=u6BX9VNiu0RRCJ7UPhC1GdSJuXNpt90fDeaGDVuMyww&e= with our affiliate link: https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwICAg&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=vF4eKo1sCTNheR-l4fvgsym5TnbK2eSWXvTFhdOktpI&m=DQpR0_lIZPfuonKmpfE91NFnumD48D-KavfiErqoeTI&s=PvW8ao-Bmc9HqH3A2UfdQDIXaQsdI_xpzHxtW2bgdVY&e=

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.