× 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 the responses. My main procedures usually consist of the following:
- any global initializations needed (loading arrays, etc)
- calls a procedure (or procedures) to 'start' up the program's core logic
- end of program processing

This is why I tend to lack in having a good, unique name for it.

I use MAIN to remove the unneeded cycle from the programs. I also like having all logic in a procedure with local variables (no longer needing global variables for mainline code).

I wasn't following you, Barbara, at first, but now I think I do. It sounds like you're coming from the angle that there's a copybook with the prototype of every program. We do not do that.

At my shop we'd have a call to DspCurTime defined as
D DspCurTime PR EXTPGM('DSPCURTIME')
not
D mainProcedure PR EXTPGM('DSPCURTIME')

However in the help, its example is like this:
D DisplayCurTime PR EXTPGM('DSPCURTIME')

I guess I never thought of the Main procedure name being visibly external to the program. It sounds like from this example (taken from help on the MAIN control spec) the main procedure name is merely expanding on the name of the program (taking it beyond 10 characters if need be). I can get on board with that.

Kurt Anderson
Sr. Programmer/Analyst - Application Development, Service Delivery Platform

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Monday, April 07, 2014 1:41 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Main Procedure

On 2014-04-07 11:09, Kurt Anderson wrote:
For those who use the Control Statement (H-Spec) MAIN, do you usually give the main procedure a name unique to the program, or do you have a standard name such as mainProcedure? I find that sometimes I struggle to name the main procedure. In the program I'm working in now I settled on mainProcedure, which made me wonder how other people were naming their main procedures.

Kurt Anderson
Sr. Programmer/Analyst - Application Development, Service Delivery
Platform [cid:image002.jpg@01CD16F9.25D27630]
web: www.customcall.com<http://www.customcall.com/> | email:
kurt.anderson@xxxxxxxxxxxx<mailto:kurt.anderson@xxxxxxxxxxxx>

A Division of Enghouse Systems Ltd.<http://www.enghouse.com/>
(TSX:ESL)


If you will be calling the program from some other RPG code, you will need to use the same prototype for the callers as for the program itself. In those cases, it should be given a unique name.

Setting up a standard where you use MAIN(mainProcedure) might make it awkward to break the standard for a case where you need to call the program from RPG. So I think it's probably better to always give it a unique name.

--
Barbara

--
This is the RPG programming on the IBM i (AS/400 and 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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.