× 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 have almost 1,5 year expirience in ILE RPG IV and now I realized that
almost evry RPG pgm I've made needed additional CL pgm that shold prepare
LIBL, clear output PFs and perform similar actions after pgm finises...

That's interesting. Why would you want to prepare the library list? I can understand why you'd want to clear an output PF, but how often does that come up? And it's easy to do that in the RPG program.


I'm wondering would it be to complicated to perform all this within RPG
pgm (for example in separate module or subprocedure) with use of different
APIs (QCMDEXC) and explicit file OPENing. (inexaple. if I define file in f
spec with USROPN keyword would I get err. message if file is not in LIBL
on pgm start).

You'll get an error message when you use the OPEN op-code to open the file. If your code is structured so that this OPEN is at the start of your program, then yes, you'll get an error at that time.


I suppose there exist some actions (as file override options for RPG pgm
that will be run) that must be defined in CL??

That's not true, overrides can be done anywhere, as long as it's before the files are opened.

However, I almost never need to do overrides. What do you use them for? The only time I use them is when I want to specify something like DFRWRT(*NO) on a display file, or a DTAQ on a display file... I use an override so I don't have to remember to specify these things when the display file is created.

But, again, this is unusual. If you're just pointing the file to a different name, library or member, use the EXTFILE and EXTMBR keywords. You can use a variable (if necessary) to specify the file or member, and you can even make that variable a parameter if you need an outside program to control which file you use.


What is better practice? It's probably metter of programers style but it
would be nice to know how other programers do that.

Yeah, what's "better" is always a subjective question. Personally, I've always though it was an RPG program's responsibility to control how it's files are opened, so I've always felt it made more sense to control it via parameters than it did external overrides.

Not everyone feels that way, however.


Is there any situation when this start actions should be performed in CL?

Sometimes there are things that are much easier or more intuitive when performed in CL. For example, some of the RTV commands in CL provide functions that are otherwise only available via APIs -- so they're much easier to code in CL.

I have to admit, I don't often need to use these things, but when I do, I general do them in CL.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.