It's Not Easy Being Green - RPG World - Its not Easy Being... · Greater Productivity ÎTime to...
Transcript of It's Not Easy Being Green - RPG World - Its not Easy Being... · Greater Productivity ÎTime to...
It's Not Easy Being Green (Green Screen, That Is!)
Wild, Crazy, and Fun Productivity Tips
for Green Screen DevelopersGreg Veal
Why Are We Still Green?
Why Not WDSC?1. Lack of Awareness
"We don't use WebSphere!"
2. Fat Footprint
3. Resistance to Change !!!That is the same reason many developers don't use the PDM/SEU green screen more creatively today.
People are Creatures of Habit
Programmers Tend to beJust Like Golfers
Many Available Functions are Underutilized
In This Session, I Will Challenge You• To open up your mind to new ways of doing things
• To prove to yourself you're not an "old dog"
• To break old habits and develop NEW ones!
Greater Productivity Time to Play More Golf!
It's Not Easy Being Green
We Will Discuss. . .
• Using a Personal System Library
• Personalized and Shortcut Commands
• Keyboard Mapping (with Macros)
• Hijacking SysRqs 5
• Personal User-Defined Options in PDM
• Using Group Jobs and Smart Sessionsto Manage a Cluttered Desktop
• The Power of an Initial Program
• Formatting RPGLE Source for Productivity
• Cool Things to Change on Your User Profile
Let's Start with Your Profile
CHGPRF (Change Profile)You are Probably Authorized to the CHGPRF Cmd
You Can Customize How You Work: Change:• Your default CurLib
• Your InlPgm and/or InlMnu
• Default JobD, MsgQ, OutQ
• Default Message Delivery
• Default Attn Pgm
• Special User Options• *CLKWD, *ROLLKEY, *EXPERT,, *HLPFULL, *PRTMSG, etc.
• Others
Let's Start with Your Profile
CHGPRF (Change Profile)Some to Consider Right Away…
CHGPRF ASTLVL(*ADVANCED)
DLVRY(*BREAK)
ATNPGM(QUSCMDLN)
USROPT(*CLKWD *EXPERT *PRTMSG
*HLPFULL)
Your Personal System Library
Every Developer Needs OneCRTLIB MySys *Test Text('My system library')
Put it First in your System Library List• ChgSysLibL in Initial Pgm
Home for:• Personalized Commands
• Shortcut Commands
• Many Other Useful Functions!• Wait and See !!!
Personalized Commands
Do It Your Way!Change Command Defaults Freely1. CrtDupObj System Cmds to Your SysLib2. ChgCmdDft Your Personal Copy
Some Likely Choices…• CRTBNDRPG• CRTRPGMOD• CRTPGM• CRTPF
May Have to Re-Do after New Release• (Keep Changes in a CL Pgm)
Shortcut Commands
Save Keystrokes & Avoid Typing ErrorsUse Short Names & Change Command Defaults1.CrtDupObj System Cmds to Your SysLib w Short Name2.ChgCmdDft Your Personal Version
Some Likely Choices…WJ or WS - WRKSBMJOBWUJ - WRKUSRJOBWS or SP - WRKSPLFBG or DEBUG - STRDBG UPDPROD(*YES) OPMSRC(*YES)WMP WRKMBRPDMWOP - WRKOBJPDMWLP - WRKLIBPDM
• Create new ones in as needed
Keyboard Map Essentials
Your Preferences are Better for You!Some of My Essentials
• Ctrl Z = Undo• Ctrl X = Cut• Ctrl C = Copy• Ctrl V = Paste• Ctl -> = Tab Word• Ctrl P = Dump a screen print to the printer.
Some of My Preferences…• Numpad “-“ = minus sign (“-“)• Numpad “+“ = plus sign (“+“)• Right Ctrl = Field Exit• End = NewLine• Shft End = End of Line• Enter (Both Enter keys are mapped to enter)
Keyboard Map Essentials
Add or Change Key FunctionsRemapping Keys is Simple1. Click the "Keyboard Mapping" Icon
2. Click the Key to Assign Function to
3. In the Function Box, Type the 1st Letter of Function
4. Scroll if necessary and Select Function• Make sure it's Highlighted
5. Click the Desired Assignment Button
6. Assign More if Desired
7. Close and Save (Yes - Yes)
OOOOOOOOOOOOOOOOOOOOO
->
Beyond Mapping
Kool Keyboard TipsAttention (Esc)• Pops up a command line
(unless Input Inhibited)
• To Set up . .
CHGPRF ATNPGM(QUSCMDLN)
Beyond Mapping
Kool Keyboard TipsSysRqs (Shift–Esc)• For developers only, hijack SysRqs option 5!
(Nobody uses it anyway)
SysRqs 5 lets you run a command ANYTIME• Even interrupt when you are in a loop and want to put
the program in debug.
(For single key access, remap F2 to Sys Rqs!)
Beyond Mapping
Kool Keyboard TipsSysRqs 5 Example: You are on a screen with no command line.
Maybe even a program is running so you can’t use your attention key to get a command line. You could always interrupt and run DSPJOB using SysRqs 3. But if you really wanted WRKJOB, just press SysRqs (Shift–Esc). Then, on the SysRqs line, type: 5wrkjob. The WRKJOB command will run.
Note: SysRqs 5 works best with simpler commands (<= 32 total characters). If you use parms with special values (with “*” in them), etc., you must enclose it in quotes. Also, you can promptthe command but again, you must enclose it in quotes.
E.g. 5 ’? cpyf’. The spaces after the 5 and after the “?” are not required.
Beyond Mapping
Keyboard Shortcuts with MacrosRecording Macros is Simple1. Click the "Start Keystroke Recording" Icon
2. Fill in the Macro name (or point n click to change)
3. Select Record Format "Macro File"
4. Select Record User Wait Time "None"
5. Press OK
6. Type the Desired Keystrokes . . .
7. Click the Stop Recording Icon• May have to clean up timing commands
Beyond Mapping
Keyboard Shortcuts with MacrosAssigning Macros to Keys is Simple1. Click the "Keyboard Mapping" Icon
2. Click the Key to Assign Macro to
3. In the Macro/Script Box, Type the 1st Letter of Macro
4. Scroll if necessary and Select Macro• Make sure it's Highlighted
5. Click the Desired Assignment Button
6. Assign More if Desired
7. Close and Save (Yes - Yes)
OOOOOOOOOOOOOOOOOOOOO
->
Beyond Mapping
Keyboard Shortcuts with MacrosAlt E Macro = Edit.mac• An alternative to option 2 in WrkMbrPdm.
• Edits a member and windows to column 5• (Allows lines to display in color)
• Good for all but CL members.
Alt S Macro = signon.mac• Enters profile and password on signon screen.
• Compromises Security Somewhat!
Beyond Mapping
Keyboard Shortcuts with MacrosAlt X Macro = ChgTxtY.mac• Selects the type and text editing In PDM
• Sets the “Change type and text” default (F18) to “Y”
Alt U Macro = ChgTxtN.mac• Unselects the type and text editing In PDM
• Sets the “Change type and text” default (F18) to “N”
Beyond Mapping
Keyboard Shortcuts with MacrosAlt D Macro = Bug.mac• Puts Pgm in Debug
• Presses F10
• Calls Pgm
• Presses F10 Again
But HOW Can a Macro Know the Pgm Name to Put in Debug Mode?
• Stay tuned…
Beyond Mapping
Keyboard Shortcuts with Macros
What are the Keystrokes YOU Repeat Often?
• Even if only for a few days! .. Or hours!!!
Keyboard Macros are Quick and Easy!
And they save you time!
Beyond Mapping
Kolorful Keyboard MagikW,R,Y,T,G,C,B,M Keys• Used with Alt, Ctrl, and Ctrl–Shift
• Insert color attribute bytes• Primarily for colorizing code
• Typically in column 5 or in any comment), but can be used anywhere.
Beyond Mapping
Kolorful Keyboard MagikSet Up Your Keyboard Map for Color• There are two ways
• The hard way
• The easy way.
• The hard way: • With a CA session open, select the icon to customize your keyboard.
For the key combinations you want to use for attribute bytes, enter the value “apl” followed by a 2-digit hex value for the attribute byte. The following chart shows you what these bytes are.
Beyond Mapping
Kolorful Keyboard MagikSet Up Your Keyboard Map for Color
apl 3Capl 39apl 38MMagenta(Pink)
apl 34apl 31apl 30TTurquoise(Cyan)
apl 3Eapl 3Bapl 3ABBlue
apl 36apl 33apl 32YYellow
apl 2Capl 29apl 28RRed
apl 24apl 21apl 20GGreen(normal)
UnderscoreCtrl-Shft
Reverse ImageCtrl
Color OnlyAlt
KeyCOLOR
NOTE: I suggest using M for magenta instead of P for pink so that the P key can be used for the PRINT function.
Beyond Mapping
Kolorful Keyboard MagikHow to set up your keyboard map for Color
The easy way: • Edit your keyboard map file using notepad. • C:\Program Files\IBM\Client Access\Emulator\Private\as400.kmp
• (It’s possible you use a different file with the .kmp extension.)
Copy the download text to completely replace your file or copy just the display attribute lines making sure you are not already mapping these key combinations.
Beyond Mapping
Hijacking SysRqs 5
SysRqs 5 is SndMsg! • Nobody Uses That!!!
• (Anyway, This only affects YOU!)
Set Up SysRqs 5 to let you run any command…ANYTIME!
Beyond Mapping
Hijacking SysRqs 51. Create CL Pgm CMDEXCCPP (in your SysLib)
PGM PARM(&CMD &P1 &P2 &P3 &P4) DCL &CMD *CHAR 80 DCL &P1 *CHAR DCL &P2 *CHAR DCL &P3 *CHAR DCL &P4 *CHAR DCL &COMMAND *CHAR 512 MONMSG CPF9999 EXEC(GOTO ERROR) CHGVAR &COMMAND (&CMD |> &P1 |> &P2 |> &P3 |> &P4)CALL QCMDCHK (&COMMAND 512)
MONMSG CPF6801 EXEC(RETURN) SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&COMMAND) +
MSGDTA(&COMMAND) TOPGMQ(*EXT) MSGTYPE(*STATUS) + SNDPGMMSG MSG(&COMMAND) TOPGMQ(*PRV) MSGTYPE(*RQS) CALL QCMDEXC (&COMMAND 512) RETURN
ERROR: CALL QCMD
ENDPGM
Beyond Mapping
Hijacking SysRqs 52. Create Command CMDEXC
CMD PROMPT('Run any command') PARM KWD(COMMAND) TYPE(*CHAR) LEN(80) +
EXPR(*YES) PROMPT(COMMAND)
PARM KWD(PARM1) TYPE(*CHAR) LEN(32) +
EXPR(*YES) PROMPT(Parm 1)
PARM KWD(PARM2) TYPE(*CHAR) LEN(32) +
EXPR(*YES) PROMPT(Parm 2)
PARM KWD(PARM3) TYPE(*CHAR) LEN(32) +
EXPR(*YES) PROMPT(Parm 3)
PARM KWD(PARM4) TYPE(*CHAR) LEN(32) +
EXPR(*YES) PROMPT(Parm 4)
/*- - – - - - - - - - - - - - - - - - - - - - - - - */CRTCMD MySysLib/CMDEXC)PGM(MySysLib/CMDEXCCPP) SRCFILE(MySrcFile)
Beyond Mapping
Hijacking SysRqs 53. Create a MsgF in Your SysLib
CrtMsgF MySysLib/MyMsgFText('My Personal System Messages')
Name it what you like. Mine is UCPFMsg.
4. Add a Message ADDMSGD MSGID(CPX2313) MSGF(UCPFMSG)
MSG('ENDRQS WRKJOB DSPMSGCMDEXC SIGNOFF DSPMSGDSCJOB DSPWSUSR ENDRDBRQS')
The words (commands) are every 11th character (1 12 23 34 . . .)
Beyond Mapping
Hijacking SysRqs 55. In Your INLPGM . . .
OVRMSGF QCPFMSG TOMSGF(MySysLib/UCPFMSG)SECURE(*YES)
The System will look for a MsgD here first !
Personal PDM User Options
Do It YOUR Way!
Copy QAUOOPT to Your Personal Library
Change PDM Defaults (F18) to Point to Your Personal Copy of QAUOOPT
Add, Change, Delete at Will (F16)
2 to Edit - Press Help (F1) for Help with Variables
Personal PDM User Options
Do It YOUR Way!Some Convenient User-defined Options
CB VERY handy for compiling RPGLE programs. CRTBNDRPG ??PGM(&O/&N) SRCFILE(&L/QRPGLESRC) ??OPTION(*NODEBUGIO *SRCSTMT) DBGVIEW(*SOURCE)
• The prompts let you change the OBJLIB or add other parms if you need to.
Personal PDM User Options
Do It YOUR Way!CR Converting RPG to RPGLE. • The EXPCPY(*YES) parm eliminates the problem of
having to separately convert copybooks.? CVTRPGSRC FROMFILE(&L/&F) FROMMBR(&N)TOFILE(&L/QRPGLESRC) TOMBR(&N) EXPCPY(*YES)
Personal PDM User Options
Do It YOUR Way!BG Putting Pgm in Debug ModeSTRDBG PGM(&N) TRCFULL(*WRAP)
UPDPROD(*YES) OPMSRC(*YES)
• Or just…DEBUG &N
Hey! BG Could Go in a Macro!!! ☺
Group Jobs Manager
Manage Your Cluttered DesktopBasic Assumption:• Keeping Everything on an Organized Desktop
is More Efficient than Putting Everything Away When You Switch Tasks - (the Windows™ concept)
"Matrix" Mangement Style• Multiple "Smart" Sessions
• Has a job to do and does it!• Fastest Toggle is by Session (Alt Tab)
• Multiple Group Jobs per Session• Keep Similar Tasks Within a Session
Controlled by InlPgm
Group Jobs Manager
"Matrix" Mangement StyleSmart Sessions
FREE
SQLCL1
MYFILE3OBJECTSSPCLSRCF
MYFILE2PRTF1RPG2
MYFILE1WRKSPLFTESTDSPF1RPG1
G
R
O
U
P
J
O
B
S
DBUWrkSplFTestCoding 2DDS
Coding
RPG
Group Jobs Manager
"Matrix" Mangement StyleName Your "Smart" Workstation Sessions• Demo: If you click File, Run Other… in a CA Express
session, you see a list of WorkStation File names: Each of these has special attributes for the type of functions you might use them for: Coding, Test, WrkSplF, Etc.
Group Jobs Manager
Name Your "Smart" Workstation SessionsSome Examples…
* Coding.ws• Normal colors – 80 char display – Starts in PDM WMP
* Coding-2.ws• Alternate colors – 132 char display – Starts in PDM WMP
* DBU.ws• Slightly altered colors – 80 char display – Starts on Command Entry
• The Group Jobs Manager recognizes this workstation and provides a special function. That is, if you transfer to: G myfile, (the name of a file), the job will immediately DBU the file.
Group Jobs Manager
Name Your "Smart" Workstation Sessions* Prod.ws
• Normal colors
• The Group Jobs Manager recognizes this workstation and provides a special function: It starts in a production session
* SQL.ws• Special colors – 132 char display
• The Group Jobs Manager recognizes this workstation and provides a special function: It starts in interactive SQL
Group Jobs Manager
Name Your "Smart" Workstation Sessions* Test.ws
• Special colors – 80 char display
• The Group Jobs Manager recognizes this workstation and provides a special function: It starts in command entry with a RUNPTY of 35.
* WrkSplF.ws• Special colors – 132 char display
• The Group Job Manager recognizes this workstation and provides aspecial function: It starts in WRKSPLF and remains there.
Group Jobs Manager
Name Your "Smart" Workstation SessionsNaming and Setting Up Your "Smart" Workstation Sessions is Easy!
If You only Use One Session Today, Start by Setting It Up for say, "Coding"
1. Sign Off
2. Click Communication, Configure
3. Check Specify Workstation ID
4. Enter "Coding" (for example) (Could Prefix w Initials)
5. Check Avoid duplicate names …
6. OK
Group Jobs Manager
Name Your "Smart" Workstation SessionsYour Workstation is Now "Smart" -
Let's Do a Little More Customizing…1. Sign On
2. Edit, Preferences, Appearance, Display Setup
3. Set Up Your Preferences(Turn Off Viewing, Column Separators)
4. Edit, Preferences, Appearance, Window Setup
5. Set Up Your Preferences• Check Session Name only - Enter "Coding"
• You may prefer some other options here also
Group Jobs Manager
InlPgm is STRGRP (Start Group) In your personal system library• Later you will…CHGPRF INLPGM(MYSYSLIB/STRGRP)
Allows You to Easily Manage Group Jobs
Perform Special Functions Based on Group Job Name
Modify and Customize it in Any Way You Like…As Often as You Like!• ALWAYS be signed on to another session when you test a change!
Group Jobs Manager
Group Jobs Shortcuts3 shortcut commands to navigate group jobs• (All should also be PDM user options)
• G (Shortcut for TFRGRPJOB)Followed by a name will transfer to a group job having that name
If the group job doesn’t exist in that session, it will be started
Not followed by a name, will transfer back to the previous group job.
You may prefer to think of “G” as meaning “Go”, but not like the GO command to start a menu.
Group Jobs Manager
Group Jobs Shortcuts3 shortcut commands to navigate group jobs
• GG (Shortcut for TFRGRPJOB (*SELECT))Displays a selection list of active Group Jobs and allows you to select one to transfer to (or press F6 and start a new one).
• EG (Shortcut for ENDGRPJOB)Ends the current group job.
• Can be run from any command line or as PDM user options.
• !!! When combined with the hijacked SysRqs 5, they allow very convenient navigation among group jobs.
Group Jobs Manager
Group Jobs ShortcutsG, GG, and EG
• Demo: You’re editing some RPG source and you want to look at the source for the associated DSPF. Just press Shift–Esc and enter 5g mydspf. A new group job named MYDSPF starts up and runs WRKMBRPDM selecting the MYDSPF member (or just transfers to it if its already started) and prompts you for the source file and Lib. Just hit enter. If you need to change the source file, fine.
• Now, you’re in the middle of browsing the source for the DSPF and you want to go back to the RPG. Press Shift–Esc and 5g – you’re back where you came from.
• Now, you want to see the source for a related CL program that you were working in earlier but can’t remember the name. Press Shift–Esc and 5gg – you get a list of all the group jobs for the session and can select the one you want.
• All done with a group job? On any command line, PDM option field,or SysRqs 5, type eg
Group Jobs Manager
Group Jobs LogicGeneral Logic Sequence:• If The group job name is a special function
Then, perform the function
Some special functions are:• DBU
• WS or WRKSPLF
• OBJECTS
• SRCFILES
• Etc. (see Group Jobs Special Functions below)
Group Jobs Manager
Group Jobs LogicGeneral Logic Sequence:• Else…The group job name is not a special function
• 1. Prompt a WRKMBRPDM command filling in MBR(JobName)
• 2. If The above WRKMBRPDM is cancelled (F3), Then, See if the group job name is an existing command:
If so, run it.
• 3. If It’s not a command, Then, See if the group job name is an existing menu:
If so, run it.
• 4. If IT’S not a menu, Then See if the group job name is an existing file:
If so, DBU it.
Group Jobs Manager
Group Jobs Special FunctionsEach of the functions in the following table are accessed by typing “G“ followed by the function name.
A new group job with the name you specify and the related function is performed.
Group Jobs Manager
Group Jobs Special Functions
Prompts a WRKOBJPDM commandOBJECTS
Runs WRKSPLF in a never–ending loopWS or WRKSPLF
Changes the job to RUNPTY(35) and opens interactive SQL/400
SQL
Changes the job to RUNPTY(35) and presents Cmd Entry display
Also runs an EDTLIBL command
BATCH or TEST
Presents the Command Entry displayCMDS or CMDENT
Group Job Function Group Job Name
Group Jobs Manager
Group Jobs Special Functions
Prompts a WRKOBJPDM command filling in OBJTYPE(*FILE)
FILES
Prompts a WRKMBRPDM command filling in FILE(MyDevLib/MySRC) and the appropriate member type
CL, CMD, RPG, SQLS, DDS, PF, LF, PRTF, DSPF
Prompts a WRKOBJPDM command filling in LIB(MyDevLib) OBJTYPE(*FILE) OBJATR(*SRC)
(for source files in your development library)
SRCFILES
Group Job Function Group Job Name
Group Jobs Manager
Group Jobs LogicRemember, this is your personal program• Customizable by you
But here is how mine looks...• Demo: Note, if you examine my code, you’ll see remnants of other
systems I’ve used this on. A Stripped Down Version is available for Download.
• The most common use of the Group Jobs Manager is to start or transfer to a group job for editing a source member: Just type g, space, and the member name. eg “g mymember”
• Another common use is to DBU a file: Just type SysRqs, 5g, space, and the file name. eg “g myfile”
• Or, to run a command in its own group job: Just type SysRqs, 5g, space, and the command name. eg “g WrkSbmJob”
Formatting RPGLE Source
Pretty Code is Easier to Read(And More Fun to Write)
How Does EveryoneWant to do Everything
Differently These Days?
You: "No, Seriously! What Are You Talking About?!"
Me: "No, Seriously!"
Formatting RPGLE Source
Faster!And the audience said…
The number one answer!!!Not to mention…
Cheaper,Smarter, Better,
More Efficiently, with Greater Quality, Etc…
Formatting RPGLE Source
Writing Pretty CodeIncrease the Quality of the Development Process• by Making it Faster
• by Making it Cheaper
• by Making it Smarter
• by Making it Better
• by Making it More Efficient
• And by Making it More FUN
Remember: Pretty Code is Easier to Read
(And More Fun to Write)
Formatting RPGLE Source
Writing Highly Readable CodeTechniques Include:• Colorized Comments
• Mixed Case
• Proper EndXXs
• Commented EndXXs
• "Smart" Comments
• 20-Line blocks
• White Space
• Colorized Lines by Op Code
Formatting RPGLE Source
Writing Highly Readable CodeColorized Comments• Whiting comments helps them to stand out from code
• Makes it obvious they are comments• Especially important in /Free-form• Becoming very popular - Some 3rd party tools do it!
Proper EndXXs (EndIf v. End)• No Arguments here, right?
Commented EndXXs• Additionally, a comment after the EndXX that echos the
matching If, Do, etc, can really help code analysis in fixed format.
Formatting RPGLE Source
Writing Highly Readable CodeMixed Case• IF YOU DON'T BELIEVE THAT READING MIXED CASE
IS EASIER, FASTER, AND LESS TIRING, YOU'RE CLEARLY NOT A STUDENT OF ERGONOMICS. ONE KEY IS IN THE "PROFILE", I.E., SHAPE OF THE INDIVIDUAL MIXED CASE WORDS AS OPPOSED TO THE GENERALLY RECTANGULAR SHAPE OF AN UPPERCASE WORD.
• AND, Mixed case allows you to capitalize initial letters in a multi-word variable name or token:MTHENDDATE = %LOOKUP(SLSDT : FSCLCALNDRARRAY : I)MthEndDate = %LookUp(SlsDt : FsclCalndrArray : i)
Formatting RPGLE Source
Writing Highly Readable Code"Smart" Comments • Special standard scan character in comments
identifying main sections of code• * =Definitions
• * =Mainline
• * SR=MySubR
• Makes important code sections easy to scan for
Formatting RPGLE Source
Writing Highly Readable Code20-Line blocks• You must see this to understand it!
• When other developers page through my code or look over my shoulder while I do, they often comment that they're struck by the ease of assimilating meaningful "chunks"
• Only useful when you use SEU like S/38:• Amount to Roll = D• Full screen mode = Y
• Technique:• Put a divider-line comment ( *- - - - - - - - - - - - - - - - - - - - -) of some
kind on every line that is a multiple of 20• Keep a complete thought within the 20 line block
or break it up into 20-line blocks• Don't worry about White Space (OK, BLACK Space! : )
White Space is GOODNESS to the reader!
Formatting RPGLE Source
Writing Highly Readable CodeColorized Lines by Op Code• Demo: Program source code can be made more
readable with the judicious use of color and other display attributes. The easiest way to use color in source code is to map attribute bytes to various keys in the keyboard mapping file (see “How to …” later in this document. Then, when you want to insert an attribute byte in the source code, you simply position the cursor to the position before you want the display attribute to begin.
Formatting RPGLE Source
Writing Highly Readable CodeTIPS for using attribute bytes in source code:• The Yellow and Turquoise (or cyan) attribute bytes turn
on column separators. I recommend that developers turn OFF column separators in client access display preferences.
• An attribute byte affects the entire rest of the line it occurs in unless another attribute byte is encountered in the same line. To simply end a particular display attribute partway thru a line, insert the “normal”attribute byte (green, or x’20’)
Formatting RPGLE Source
Writing Highly Readable CodeTIPS for using attribute bytes in source code:• In CL, attribute bytes can only be placed within
comments. However, an attribute byte within a short comment at the beginning of a line will affect the entire line.
• In RPG, attribute bytes can be placed in any position prior to 6 on a line of code and anywhere at all on a comment line.
Formatting RPGLE Source
Writing Highly Readable CodeTIPS for using attribute bytes in source code:• An attribute byte must be within the display window for
it to affect the display. That is, if an attribute byte is in position 5 on a line and the display is windowed beginning with column 6, the attribute byte will have no effect. • NOTE: The most common position for an attribute byte on a code
line in RPG is position 5, immediately before the form type in position 6. However, the default window for RPGLE is position 6. So when working with colorized RPGIV, it is best to set the window at 5 using the W line command. (W5) !You can do this with a Macro!
Formatting RPGLE Source
Writing Highly Readable CodeAlthough ANY judicious use of color in source code can
improve readability, it is ideal if there are standards. Here are the standards I recommend:
PList, KList, /Free, /CopyDeclaratives, Compiler Directives, Temp Code
Turquoise
BegSR, EndSRSubroutinesBlue
Iter, Leave, LeaveSR, ExSR, GoTo, CABxx
Branching CodeMagenta(Pink)
IFxx, ELSExx, ENDxx, DOxx, FORxx, CASxx, SELECT, WHEN, OTHER
Structured Op-CodesYellow
C* DEL GoTo TagDeleted CodeRed
* This is a comment - - - - - - - - - -CommentsWhite
C Eval X = X + 1Normal CodeGreen
Formatting RPGLE Source
What About Legacy Code?Ah Yes! Legacy Code! NO PROBLEM!
Convert to RPGIV (Use a PDM User-defined Option)
Apply the FmtSrc Command that comes FREEwith RPG World ProDev Attendance!• Demo
It's Not Easy Being Green
Where's My FREE Code?
All Code Demonstrated in this Session Can be Downloaded From:
rpgworld.com/handouts/prodev
Please note: The Code is not shrink wrapped and it is free.
I will answer email questions but I don't "support" the code. ( ; ^{)>
Now It's Easy Being Green