× 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 would prefer using a file for this purpose as well.  Data areas have
their place but in this situation it would appear to be overkill....

Just my 2 cents... 


Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Fisher, Don
Sent: Friday, December 16, 2005 11:52 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Help with data area in RPG

The complexity came about in the answer that suggested the data area
a.p.i.
Based on his most recent post, a file is really the best approach here,
in
my opinion.  He may only want to store the printer device name now, but
what
about later?  A file and a service program would make maintenance of
this
simpler, I think. 

Donald R. Fisher, III
Project Manager
Roomstore Furniture Company
(804) 784-7600 extension 2124
DFisher@xxxxxxxxxxxxx


<clip>
Isn't that extremely easy to do?

      D                SDS
      D  UserID               358    367A

      D QCMDEXC         PR                  ExtPgm('QCMDEXC')
      D   cmd                      32702A   const options(*varsize)
      D   len                         15P 5 const

      D cmd             s            200A   varying
      D UserDtaAra      s             21A

      D Location        ds                  dtaara(*Var:UserDtaAra)
      D   part1                 1      2A
      D   part2                 3      4A
      D   part3                 5     10A

       /free
           // ------------------------------------------------
           // Data areas are in the DTAARALIB library, and
           //  have the same name as the userid.
           // ------------------------------------------------

           UserDtaAra = 'DTAARALIB/' + UserID;

           // ------------------------------------------------
           // Does the data area exist?  If not, create it.
           // ------------------------------------------------

           cmd = 'CHKOBJ OBJ(' + %trim(UserDtaAra) + ')
OBJTYPE(*DTAARA)';
           monitor;
              QCMDEXC(cmd:%len(cmd));
           on-error;
              cmd = 'CRTDTAARA DTAARA(' +%trim(UserDtaAra) + ') ' +
                              'TYPE(*CHAR) LEN(10)';
              QCMDEXC(cmd:%len(cmd));
           endmon;

           // ------------------------------------------------
           // The IN op-code reads a data area:
           // ------------------------------------------------

           in *lock Location;

           // ------------------------------------------------
           // The OUT op-code updates a data area:
           // ------------------------------------------------

           Part1 = 'AA';       // these are just test values.
           Part2 = 'BB';
           Part3 = 'CCCCCC';
           out Location;

           *inlr = *on;
       /end-free

Is there something else that I'm missing that would make this
complicated? 
<clip>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.