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



Vern,

Can't help you with breakfast...try asking Michael Schutte ;)

As far as passing DS, I should perhaps worded that differently.

What I meant to say was you shouldn't generally create a DS for all your
input values and another for all the output values. In my opinion, a DS
should be used for data that is co/interdependant, such that you can think
of the DS as a single piece of information. A good exmple, might be an
address.

d t_Address ds template qualified
d line1 30a
d line2 30a
d City 30a
d state 2a
d zip 9a

I have no problem with passing such DSs as parameters.

Charles




On Thu, Jun 25, 2009 at 9:31 AM, Vern Hamberg <vhamberg@xxxxxxxxxxx> wrote:

I'm not sure I agree that passing data structures is a globally bad
thing - having done enough C programming where structs are passed all
the time. But if this is to be a general-purpose thing, then a format
parameter is necessary - or else make the first element have the format
- another technique.

I am in the midst of writing up some procedures that process a set of
fields of the same nature - easily handled as an array - but I have to
use a DS to get these fields into an array - they span across 5 columns
of a table - so I pass the DS. But this discussion just let me realize I
could pass only the array subfield of the DS .

Now on the other hand, since I am declaring the DS as based in an
include member, making a change is less onerous, seems to me.

Food for thought!! But I want some breakfast instead!

Vern

Charles Wilt wrote:
I believe it's been discussed before, but might as well reiterate...

Passing DS's to your procedures instead of individual parameters is not a
generally considered a good thing.

By doing so you're giving up some of the flexibility and benefits of
procedures along with making maintenance difficult.

You can at least get some of the maintainability back by taking a page
from
IBM's book and passing addition parameters that till you what format the
DS
is using. This way, if you need to add some parameters, you can do so
without having to recompile everything using it.

As far as your three char abbreviation standard....

I'd much prefer AcquireClientsWifesSistersDogsName()....

With WDSC, you'd only have to type 3 or 4 characters of either name, so
why
not use the longer one?

I will sometimes use well known and common abbreviations, but to require
every procedure to be made up of 3-char abbreviations? Not a chance.


Charles

On Thu, Jun 25, 2009 at 4:26 AM, David FOXWELL <David.FOXWELL@xxxxxxxxx
wrote:


I get PTSD with long names, but I'll explain why :

We started off with this kind of prodedure naming :

AcqCltNam
ACltNo

Meaning Acquire client name, with the client number as a parameter.
Prefix
A is reserved for parameters.
All procedures has 3, 3, 3 abreviation format. Parameters 3 + 2
characters.

Then, a bright spark dreamt up using DS as one input parameter and one
output parameter.

So we'd always have this format :

AcqCltNam ( AcqCltNamInDS : AcqCltNamOutDS )

The zones of the DS continued to follow the parameter convention, so
you'd
end up with a zone named :

AcqCltNamInDS.ACltNo which identifies the client number for input to the
procedure.

As people discovered the ... Extender, they started putting whole
sentences
as the procedure name, but still with the same kind of abreviations, for
example :

Acquire the client's wife's sister's dog's name might give you :

AcqCltWifSisDogNamInDS.ACltNo.

Hence my PTSD.




-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Vern Hamberg
Envoyé : mardi 23 juin 2009 17:52
À : RPG programming on the IBM i / System i
Objet : Re: Procedure naming conventions (WAS: Validate client name)

David

Had to look up PTSD, then almost had to get a mop for my keyboard.

Thx
Vern

David Gibbs wrote:

DeLong, Eric wrote:


Good for you! Keep your procedures short and on-point.


Seconded!



Naming conventions, like all standards, vary from shop to shop.
Personally, I never liked aaannn type conventions, since

the numeric

component tells you precisely NOTHING about what this

procedure does.

I like to choose names that seem to make sense when you

read them in

code, like "Clt_NameIsValid" and "Com_NameIsValid". In use, your
code reads like a book:


I agree in general ... although I prefer to go with a more

'java-esque' mode ... so I'll have the major 'object' of my
procedure as the first part ... and then the method as the
2nd part. For instance: for something that checks to see if
an issue number is valid ... "Issue_isValid(issueNum)" or
"Issue_setState(issueNum, newState)".

I abhor short names and numbered names ... for the same

reasons Eric mentioned ... with the added reason that it
harkens back to the dark ages of short variable names ...
which has been known to cause PTSD type responses in some programmers.

david



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



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.