• Subject: Re: Service program files and overrides
  • From: Pete Hall <pbhall@xxxxxxxxxx>
  • Date: Wed, 08 Nov 2000 21:07:23 -0600

At 09:00 11/08/2000, Loyd Goodbar wrote:
>I'm working on a service program that will "externalize" file I/O, as
>suggested in the RPG/IV sorcerer's book.
>Say I have file OUTPUT defined in the service program.
>What I'd like to do is override OUTPUT to a different library at runtime.
>Does the override work in this situation?
>
>I guess another question is, when is the file opened and closed?

You can override, but you need to make sure that the override is 
appropriate for the activation group of the service program. If it 
specifies ACTGRP(*CALLER), then the default override scope of *ACTGRPDFN 
will work. If not, you will need to specify *JOB, or there's a value for 
invocation level which I can't recall at the moment. The file will be 
opened when the module containing it becomes the active module in the stack 
if it opens implicitly. If this isn't convenient though, you can use a user 
controlled open. You could even issue the override in the service program 
module itself before opening the file if you wanted to, but once the file 
is open, be sure to destroy the activation group before changing the 
library you want to read the next file from, or provide a mechanism like a 
parameter telling the sp module to close its file so that you can be 
assured that the new override will be in effect when it is reopened.

Pete

Pete Hall
pbhall@execpc.com
http://www.execpc.com/~pbhall/

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@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].