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



Hi Jerry,

There has long been an option (NOMAIN) in the Header specs to strip out
all of the cycle clutter. Especially useful for service programs; I've
never tried to use that option for a "regular" program. Hmmm...wonder if
that would work if one did one's own OPEN's etc.?

The reason it won't work for a "regular" program is that there's no main procedure. When you run the CALL command to call a program, it tries to run the UEP (User Entry Procedure) which in RPG is the program's main procedure. (By "main procedure" I mean the "normal mainline part" of your program -- i don't mean a procedure named 'main')

So NOMAIN won't work for a regular program.

in V6R1, IBM is providing a new H-spec keyword called MAIN. With this keyword, your module will be pretty much identical to a NOMAIN module -- it'll have no RPG cycle, *INLR won't do anything, etc... The only difference between MAIN and NOMAIN is that you'll have a main procedure -- which is to say, a procedure that gets called when you invoke it as a *PGM object. Also, you'll be able to designate WHICH procedure this is.

Personally, I find myself thinking of it as a NOMAIN module where I can designate a subprocedure that's to be invoked when called as a program.

For example:

H MAIN(ScottProc)

D ScottProc PR ExtPgm('SCOTTPGM')
D parm1 10a
D parm2 5a

P ScottProc B
D ScottProc PI
D parm1 10a
D parm2 5a
//
// This is the procedure called when the program starts
//
P E

Hopefully I have the syntax correct -- I don't actually have access to V6R1 at this point, but this is the way I understand it to work.

If you code neither a MAIN or NOMAIN H-spec keyword, you'll get the original behavior, including the RPG cycle, et al. So don't worry there, you're not losing anything... And we'll still be able to have the same holy wars about the cycle.

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.