I picked a standard for myself a few years ago when we really started to
write procedures a lot more. Based on the comments here, some may think its
overly verbose, but I think this structure really gives a clear indication
of each of the sections of the code. It gives a standard place to look for
each of the parts we are looking for. By using the line extender "..." it
allows us to easily use this as a template so we can do find and replace
for the proc name without adjusting the position of everything after it.
So, I have only really typed out this structure once. Since then, its been
a snippet that I just provide the procedure name for.
*---------------------------------------------------------------
* Name : Hash_MD5
* Description : Take any length of data and produce a 128 bit
* "fingerprint" or hash value
* Argument(s) : Data
* Return value : 128 bit fingerprint
* Usage : char fingerprint = Hash_MD5('somedata':8);
*---------------------------------------------------------------
// BEGIN PROCEDURE
p Hash_MD5...
p b export
// Procedure Interface
//////////////////////////////////
d Hash_MD5...
d pi 32a
d pr_data 32766a options(*varsize)
d pr_len 10u 0
// Define Local Vars
//////////////////////////////////
d hash s 40a
//Main
/free
hash = executeCipher_FID5(pr_data :pr_len :HASH_MD5);
return %subst(hash :1 :HASH_MD5_LEN);
/end-free
p Hash_MD5...
p e
// END PROCEDURE
Robert Newton
EDPS
Electronic Data Processing Services
System Owner
804-353-1900 x2256
rnewton@xxxxxxxxxxxx
From: Vern Hamberg <vhamberg@xxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Date: 05/29/2009 12:25 AM
Subject: Re: Sub procedure end specification
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
The wizard in WDSC/RDi uses several of your standards, Simon - see
excerpt below. Also, it provides either fixed or free form, your choice.
And it can help you with prototypes to export.
Vern
Simon Coulter wrote:
On 28/05/2009, at 11:12 PM, David FOXWELL wrote:
-snip-
Get your shop standards set up such that they reflect the way you and
your team want to code. For example:
Procedures:
o All procedures will have a comment block explaining the
purpose of
the procedure, its input, output, and return values. See procedure
comment block in Appendix C.
o All procedures will have a P Begin and a P End. Do not
specify the
procedure name on the P End. <<<< It differs here in that it puts the
name here too >>>>
o All procedures will have the name specified on the D PI
specification.
-snip-
--
This is the RPG programming on the IBM i / System i (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.
This communication and any transmitted documents are intended to be confidential. If there is a problem with this transmission, please contact the sender. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.
As an Amazon Associate we earn from qualifying purchases.