Joel,
IMO, source formatting "standards" vary. Over all, though, I'd say most shops simply accept the default formatting implemented in seu and command prompt facility... SEU for CLP is not kind to lower case, as you say... I've gotten tired of expecting pretty code to survive an encounter with SEU.
Shop standards are a means to address these questions, but unfortunately I feel that too many shops enforce standards in restrictive ways, to punish innovation, and "reign in" the trailblazers in their shop. Standards should promote meaningful conventions, such as requirements for proper error trapping, for example, or the goal of good naming practices in code... Style should be written as suggestions only, and used to promote other goals, such as good naming practices, efficient error handling, or whatever... Beauty is in the eye of the beholder, so don't expect everyone to agree with your style preferences. BTW, I'd select your first block as "easier to read" and preferred to the "promptified" version. I'd suggest for CLP/CLLE to start coding in column 1 instead of the conventional column 14. This gives you more room for indentation, and for coding expressions and formatted strings.
Good luck!
-Eric DeLong
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Stone, Joel
Sent: Tuesday, May 29, 2012 9:36 AM
To: midrange-l@xxxxxxxxxxxx
Subject: CL code formatting and programming etiquette
When you create CL code, do you try to make it easy to read ie use lower case; add some white space, skip keywords such as COND and VAR and THEN, and line things up?
Like this:
select
when (&reportID = 'LS') goto report_LS
when (&reportID = 'SR') goto report_SR
when (&reportID = 'SB') goto report_SB
otherwise goto endpgm
endselect
report_LS:
chgvar &TITLE1 'New Customer Report'
chgvar &TITLE2 'Trader Notification'
chgvar &SHOWCUST 'N'
chgvar &QRYSLT (&QRYSLT *bcat ' ASHPSTS = +
"UT" *and ASLSCNT = 0 *and ACTMDTR = "R"')
******************************************************
Or
******************************************************
Do you run everything thru the prompter, like this:
select
WHEN COND(&REPORTID = 'LS') THEN(GOTO +
CMDLBL(REPORT_LS))
WHEN COND(&REPORTID = 'SR') THEN(GOTO +
CMDLBL(REPORT_SR))
WHEN COND(&REPORTID = 'SB') THEN(GOTO +
CMDLBL(REPORT_SB))
OTHERWISE CMD(GOTO CMDLBL(ENDPGM))
ENDSELECT
report_LS:
CHGVAR VAR(&TITLE1) VALUE('Loaded Cars Available +
for Sale')
CHGVAR VAR(&TITLE2) VALUE('Trader Notification')
CHGVAR VAR(&SHOWCUST) VALUE('N')
CHGVAR VAR(&QRYSLT) VALUE(&QRYSLT *BCAT ' ASHPSTS = +
"UT" *and ASLSCNT = 0 *and ACTMDTR = "R"')
Which method is preferred or more widely used?
I always do the former (mixed case, skip keywords).
A co-worker goes thru my code and prompts it all into the harder-to-read (imo) ALL CAPS stuff.
Is this following IT etiquette?
I realize people alter other's code over the years. But this is happening prior to initial promotion.
Does such an etiquette concept exist in the IT development field?
______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit
http://www.symanteccloud.com
______________________________________________________________________
As an Amazon Associate we earn from qualifying purchases.