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



Whoa. Wait! Not understanding this concept.

I bow to the experts on this as I'm most assuredly not proficient, but I need clarification and pictures and diagrams (yes, I'm that old).

I'm fairly understanding of how procedures work, but I've not been able to sit down with someone who uses it in a working environment. Can you elaborate on the "Bad, bad thing to do." (More specifically) what is it that is bad and why?

Duane

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Wednesday, February 01, 2017 4:53 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Procedure Examples VR7.1

As you note, I use the Service program name. Obviously easy if you know the service program name to find the module it is in and usually a service program only has one member anyway and please never bind the same module to multiple programs or service programs. Bad, bad thing to do. Create service programs.

On Wed, Feb 1, 2017 at 1:49 PM, Jeff Young <jyoung0950@xxxxxxxxx> wrote:

Thomas,
Ahaaa. NOW I see.
I do agree that with the lack of useful tools to determine what module
/ service program a procedure is located in, it becomes a difficult
task to track it down. If the module name is embedded in the name on
the EXTPROC, it becomes a much easier task.

Thanks for the very useful information.

Jeff Young
Sr. Programmer Analyst

On Wed, Feb 1, 2017 at 4:39 PM, Tools/400 <thomas.raddatz@xxxxxxxxxxx>
wrote:

You are right that the EXTPROC procedure does not serve any
technical purpose. It is just for better reading of call stack dumps.

Thomas.

Am 01.02.2017 um 22:24 schrieb Jeff Young:
Thomas,
I agree with you regarding Camel Case, but do not see any benefit
on
adding
EXTPROC unless the procedure will in fact be exported. If it is
just internal, than it serves no purpose.


Jeff Young
Sr. Programmer Analyst

On Wed, Feb 1, 2017 at 4:13 PM, Tools/400
<thomas.raddatz@xxxxxxxxxxx>
wrote:

Jeff,

I gree with you regarding the EXPORT keyword, since the cvt2F()
procedure is for internal use only.

But I do not agree with you regarding the EXTPROC keyword.
Reading a stack trace or an error message is a lot easier, when
the procedure
name
is shown in camel case. Just my opinion and not necessarily yours.

Also it was a good idea, at least for our development team, to
prefix the external procedure names with the name of the module.
This way it
is
very easy to find the module that contains a procedure, e.g. when
displaying the exported procedures of a service program with
DSPSRVPGM.
Or it is easy to find the module for a given unresolved
referenced
item.

I love camel case and the module name prefix, e.g.:

Exported procedure:

*
* Opens a job log.
D JobLog_open...
D PR like(JobLog_handle_t)
D extproc('JOBLOG1_+
D JobLog_open+
D ')
D i_qJob const likeds(qJob_t)
D options(*nopass: *omit)
D i_options const like(JobLog_options_t)
D options(*nopass: *omit)
D i_direction const like(JobLog_direction_t)
D options(*nopass: *omit)
D i_strMsgKey const like(JobLog_msgKey_t)
D options(*nopass: *omit)

Internal procedure:

*
* ------------------------------------
* Internal prototypes
* ------------------------------------
*
* Opens the job log and returns the first entry.
D openJobLog...
D PR n
D extproc('openJobLog')
D i_qJob const likeds(qJob_t)
D i_options const like(JobLog_options_t)
D i_direction const like(JobLog_direction_t)
D i_msgKey const like(JobLog_msgKey_t)
D o_listInf likeds(qgy_opnListInf_t)
D o_options likeds(listOptions_t)
D o_errCode likeds(errCode_t)

DSPSRVPGM SRVPGM(JOBLOG) DETAIL(*PROCEXP):

JOBLOG1_JobLog_open
JOBLOG1_JobLog_getEntry
JOBLOG1_JobLog_close
JOBLOG1_JobLog_getNewest
JOBLOG1_JobLog_getOldest
JOBLOG1_JobLog_getMessageType
JOBLOG1_JobLog_isNull
JOBLOG1_JobLog_null

Of course it is more work to add the EXTPROC keyword to
prototypes of internal procedures and in fact it is even more work for for **free.
But
it is worth the effort for me.

Just my two cents.

Thomas.

Am 01.02.2017 um 20:58 schrieb Jeff Young:
Scott,
You do not want the EXTPROC on the Prototype if your procedure
is in
the
same module.
You also do not want the EXPORT value on the Procedure Interface.

Jeff Young
Sr. Programmer Analyst

On Wed, Feb 1, 2017 at 2:47 PM, Scott Williams <
scottwill0707@xxxxxxxxx>
wrote:

Been trying to learn procedures, and having some difficulty.
After
reading
examples online, I've found myself going in circles and even
more
confused.
I feel like I'm throwing knifes in a dark room...

I'm attempting to create a very simple procedure that converts
a
given
numeric value into another. In this case, a value in Celsius to
be converted to Fahrenheit.

I can't seem to get my PR and PI sorted out, and/or the
positioning
of
the
P spec decs. Do I create this as a module, or a bound program?
Please
let
me know what I am doing wrong. I would like to understand how
to
properly
use a procedure so I can extrapolate this simple example into
larger
ideas.
(Machine is 7.1 version of the OS)

HDFTACTGRP(*NO)
HMAIN(C2F)
D CVT2F PR 5S 2 EXTPROC('C2F')
D
D $C 5S 2 VALUE

D$F S 5S 2

/FREE
$F = C2F($C);
DSPLY $F;
*INLR = *ON;
/END-FREE

PC2F B EXPORT
DC2F PI 5S 2
D $C 5S 2 VALUE
D$F S 5S 2
/FREE
$F = (($C * 1.8) + 32);
RETURN $F;
/END-FREE
P E

Thanks in advance!

--
Scott Williams
--
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.

Please contact support@xxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: http://amzn.to/2dEadiD


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

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: http://amzn.to/2dEadiD


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

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: http://amzn.to/2dEadiD

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

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

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

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD
CONFIDENTIALITY NOTICE: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact NALC Health Benefit Plan at 703-729-4677 and delete and destroy the original message and all copies.

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.