[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic Entry Parameter Question



[SNIP]
> This work just like "*ENTRY PLIST" operators ??
> I assume that yes, but I need to know why.

Back in V3R2 (June 1996) IBM stopped enhancing the RPGIII "CALL/PARM" and 
"PLIST/PARM" method of calling and receiving parameters. They created a 
better method, with more features, easier to use syntax, and put it in the 
D-specs using PR/PI.

This new method (which isn't really new anymore, but it was in 1996) has 
one awkward thing about it. If you want to define a PI statement (an 
*ENTRY PLIST replacement) you must also code a PR, even if you don't use 
it. That's annoying. But, other than that, this support is much nicer 
than the old-fashioned CALL/PLIST/PARM method, and has really improved my 
code and made me a more productive programmer  Granted, like anything you 
learn, there's a learning curve, but in the end it's well worth the 
effort.

I've written a few articles that try to explain the PI/PR support:
http://www.systeminetwork.com/article.cfm?id=52167
http://www.systeminetwork.com/article.cfm?id=52255

I have some comments regarding some of the replies that people have made:

a) Buck said "This is RPG IV support for something called a subprocedure."

    Actually, in this instance, it's not.  Although you can use a PR
    (prototype) to call a subprocedure, you can also use it to call
    programs and java methods.  And although PI (procedure interface)
    can be used to receive entry parameters to a subprocedure, it can
    also be used to receive them for a program.

    In the example posted here, the PR/PI was used to receive *ENTRY
    parameters to a program, not a subprocedure.  (The EXTPGM should've
    given this away -- but if not, the fact that there was no P-spec
    prior to the procedure interface should've made it clear that it
    was the main procedure and not a subprocedure.)


b) Raul said "You have the ability to check the parameters at compile
    time, you can pass data that will not accidentaly be modified
    (const), you can pass by "value""

    It's true that SUBPROCEDURES can receive data passed by VALUE, but
    PROGRAMS cannot. You can use CONST but not VALUE when calling a
    program.

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------