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



On 8/18/2015 2:55 PM, Dan wrote:
...
What is the advantage of ...
d WrapText2 pr 12288 Varying RtnParm
d UnfText 8192 Varying Const Options(*VarSize)
d LineLen 5 0 Const
d LineBreak1 10 Varying Const Options(*NoPass)
d LineBreak2 10 Varying Const Options(*NoPass)
NotesArrayDS = WrapText2( %trimr( c_SPdetl) : 80 : '~' : '|' );
vs.
C call 'WRAPTEXT2'
C parm LongString 12288
C parm LineLength 5 0
C parm Tilde 1
C parm Vbar 1
C parm ReturnArray


You don't have to use CALL+PARM if you want to call a program.

I think a prototype with the EXTPGM keyword should be the second alternative, rather than CALL+PARM.

There are really two questions.

1. What are the advantages of using a prototyped call to a program vs CALL+PARM?

The main ones are a) the compiler will be able to detect some parameter mismatches at compile time; b) you can pass literals an expressions if you define the parameters with CONST; and c) you can't use CALL+PARM in free-form calculations.

2. What are the advantages of calling a procedure vs a program.

Here's one to add to those already given in this thread: If you can't return a value, callers have to define the "return parameter" with the exact size and type that the program expects. That might seem trivial, but it can get really annoying to have to define temporary variables just for making calls.

When I try to think of some advantages of calling a program over a procedure, I'm a bit hard-pressed.


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.