I always liked this guide to programming etiquette:
http://users.skynet.be/fb873035/1stelic/software_engineering/Theorie_How
_to_write_unmaintable_code.pdf
Regards,
Scott Ingvaldson
Senior IBM Support Specialist
-----Original Message-----
From: Stone, Joel [mailto:Joel.Stone@xxxxxxxxxx]
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.