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



Use Call(e) and trap the error.
John Brandt
iStudio400.com

-----Original Message-----
From: CarollaT@xxxxxxxxxxxxxx [mailto:CarollaT@xxxxxxxxxxxxxx]
Sent: Thursday, December 11, 2003 12:04 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: No need for CL/RPG Pair? (use of QCMDEXC, with MONMSG
capability )


I put together a program that uses the EXTFILE keyword with variables, and
was able to turn a CL/RPG pair of programs into one RPG program.  

 

Here is the situation.  I have 59 libraries with the same set of files in
each one.  I frequently need to write extracts/reports that deal with all of
these data sets as a whole.  I have built a Datamart, but that's another
story.  What I usually did to accommodate the multiple libraries is write a
CL program to step through the file that contains the library prefix for
each data set, and for each data set, build the library name, override the
files, call the RPG program, etc. etc.  This worked fine, but it forces you
to use an accumulation methodology, and I knew there was a more efficient
way than to call the same program 59 times.  

 

Then I attended RPGWorld, and found that, with a simple keyword and a
variable, I could overcome this 'CL handicap'.  For all of the files in
within my program that lie in the data sets, I declare them with them as
follows:

 

 

     FGCONV     IF   E           K DISK    EXTFILE(FileGCONV) USROPN

     FGFEESL    IF   E           K DISK    EXTFILE(FileGFEES) USROPN
BLOCK(*YES)

     FCHARG     IF   E             DISK    EXTFILE(FileCHARG) USROPN
BLOCK(*YES)

 

The 'Filexxxx' parameters represent variables, as follows:

 

     D FileGCONV       S             21    INZ(*BLANKS)

     D FileGFEES       S             21    INZ(*BLANKS)

     D FileCHARG       S             21    INZ(*BLANKS)

 

I read a record from the SYSTEMS file, which contains the first three
characters of the library name, and I EVAL the file names into the
variables, as follows:

 

     C                   Eval      FileGCONV = SysAcr + 'FILES/GCONV'

     C                   Eval      FileGFEES = SysAcr + 'FILES/GFEESL'

     C                   Eval      FileCHARG = SysAcr + 'FILES/CHARG'

 

Then I open the files, access the needed records, close the files, read the
next SYSTEMS record, and repeat the loop.  This makes it unnecessary to add
a CL program to every single program I write, except for one detail - which
brings me to my question.  I frequently need to clear an output file before
I start adding new records.  My plan is to call the 'QCMDEXC' program, as
follows:

 

     D Command         S             80    INZ('CLRPFM DMART/ACCNEW')

     D CmdLength       S             15  5 INZ(80)

 

     C                   Call      'QCMDEXC'

     C                   Parm                    Command

     C                   Parm                    CmdLength

 

Which works marvelously - when the file exists, and is not locked, etc.
Inside my CL program, I could use the MONMSG command, and deal with those
situations as they arose.  Is there a way to find out whether or not a
command completed successfully, and catch the message if it doesn't complete
successfully?  It sure would be a shame to have to write a CL program with
just one CLRPFM command...

 

 

 

Tony Carolla

Programmer/Analyst

MedAmerica Billing Services, Inc.

(209)491-7710 x4316

carollat@xxxxxxxxxxxxxx <mailto:carollat@xxxxxxxxxxxxxx> 

 

_______________________________________________
This is the RPG programming on the AS400 / 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.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.550 / Virus Database: 342 - Release Date: 12/9/03
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.550 / Virus Database: 342 - Release Date: 12/9/03
 

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.