|
Ron, I do the same as Tony. I indent code past the structure statement. If is 3 spaces, DoW is 4, DoU is 4, For is 4, When is 5. Exceptions are 3 spaces with an ElseIf to match the indentation on the original If and 5 spaces on Other to match the indentation on the other When in the Select. I do not indent code in the body of a subprocedure or subroutine. All the EndXX statements line up under the original structured statement. EndIf below the If, etc. Positioning the cursor on the original statement then scrolling down will locate the corresponding EndXX statement. A blank line will be placed before any structured statement and after the EndXX statement. The beginning and end of mainline, subroutine and subprocedures also get a blank line before & after /Free and before & after /End-Free. Otherwise I don't use blank lines in the code. The blank lines serve as markers for me to eye the code's decision points. CamelCase is used for Opcodes, BIFs, Reserved words, work variables and constants (EndIf, %Trim, *InLR, TotalHours, #Company) but ALL CAPS for file and file field names. When RPG allows the alias file field names then alias names will also use CamelCase. There is no use of fixed format mixed in with free format. A complex selection will have one comparison on each line with the logical And/Or at the end of each line. Parenthesis and indentation will be used for really complex nested And/Ors. The And/Ors might be spaced out to the right to show the nested hierarchy if there is room. For example: If ( ( FIELDA = '123' ) Or ( FIELDB = 'XYZ' ) ) And ( FIELDC = 999 ); Recently I've started to place a space before and after any variable or constant used in lists to separate them from the surrounding punctuation. It makes the code more readable. For example: Chain ( FIELDA : FIELDB ) FILEA ; CallProcedure ( PARMA : PARMB ); instead of: Chain (FIELDA:FIELDB) FILEA; CallProcedure(PARMA:PARMB); Paul
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.