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



Thanks for everyone's help.  I think I will go with Scott's method, just
because I will never know  how people are going to be using this sub
procedure, and assumptions might be made on somebody else's part.

Yet another lesson learned in the AG journey:-)  

Hey Buck, maybe you could add an example like this to your AG FAQ on the
midrange page. . .

Thanks again,
Aaron Bartell

-----Original Message-----
From: Scott Klement [mailto:klemscot@klements.com]
Sent: Friday, January 17, 2003 10:43 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Activation Groups, external sub procedures, and OVRDBF



On Fri, 17 Jan 2003, Bartell, Aaron L. (TC) wrote:
[SNIP]
>
> I created the service pgm cLCmdExec is in with ACTGRP(*CALLER).
>
> The above doesn't override the file; when I open ORDHDR1 it grabs the
first
> ORDHDR1 in the library list which is in TESTLIB.
>


It sounds like you're running in the default activation group.   You said
you have the program compiled with ACTGRP(*CALLER).   Is this program
being called from something in the default AG?

When you use OVRDBF in default activation group, the override is scope
to the call level.   The subprocedure is at a later call level than the
mainline is, so the override is "disappearing" as soon as the subprocedure
ends.

Conversely, if you ran it in a named or *new activation group, the
override would affect anything running in the same AG, regardless of
call level.   That would solve your problem IF the program you're calling
is in the same AG.

What I do, instead of wrapping QCMDEXC into a subprocedure, is just
prototype the call.  This allows you almost the same level of readability
without creating an extra call stack entry:

     D clCmdExec       PR                  ExtPgm('QCMDEXC')
     D   command                   1024A   const
     D   length                      15P 5 const

     c                   callp     clCmdExec('OVRDBF FILE(ORDHDR1) ' +
     c                                'TOFILE(PRODLIB/ORDHDR1)': 1024)

The only downside is that you can't calculate the length of the string
automatically.   In this case, I just use the max size of 1024, since
QCMDEXC ignores trailing blanks anyway...   I'm far too lszy to count
the number of characters in the string :)


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo.cgi/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

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.