Mihael,

That's exactly what I was looking for! I did not know that a dataarea could
take a variable name; if it's in the ILE RPG manual I missed it.

Thanks!

Jerry C. Adams
If at first you don't succeed, try, try again. Then quit. No use being a
damn fool about it. -W.C. Fields
IBM i Programmer/Analyst
--
NMM&D
615-832-2730


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of
Mihael Schmidt
Sent: Friday, February 08, 2019 8:54 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: External Data Areas - Multiple Companies, One Program

Hi,

perhaps I am not understanding something about this whole problem but of
course you can specify at runtime the data area you want to access, f.
e. by using a variable with the dtaara keyword. I have done this in one of
my projects:

https://bitbucket.org/m1hael/bluedroplet/src/903c07a6ccc78c97982082a1f3bd7bb
59aef2d30/service.rpgle?at=master&fileviewer=file-view-default#service.rpgle
-63

HTH

Mihael


On 08.02.19 15:18, Jerry Adams wrote:
The discussion the other day on data structures brought to mind a
problem that I have been working on regarding data areas. I used a
data area to function as a sort of "truth table" for our company. O
read it into a program to determine if the next (or following) step is
ready.



Works fine, but the owner decided that he wants to add a new company.
There will be, I am sure, some new programs for it, but the basic back
office processing is pretty much the same. So I am modifying the
programs to access the file depending upon the company. That's relatively
easy.



The issue with the data area on disk is that I have not been able to
find a way in the manuals (that I understood, anyway) to access
different data areas. For example, a disk file can have a
EXTFILE(some-name) with USROPN that I then use to define that
"some-name" before I open the file. I cannot find anything similar for
data areas on disk.



I could, I know, just define two data areas in the program(s) and then
use the same method I'm using for files to determine which data area to
read.
But looking ahead, I wanted to make it flexible so that the next time
he sets up a new company, I will not have to go back into the program.
I could, for example, easily change it to a data file. But wondered
if there were any minimal coding changes that would accomplish the same
effect.



Any ideas/thoughts welcomed.



Thanks.



Jerry C. Adams

Do what is right because it is right, and leave it alone. -Chiune
Sugihara

IBM i Programmer/Analyst

--

NMM&D

615-832-2730



--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].