Day4a T24 Programming Standards
Day4a T24 Programming Standards
Standards
Slide1
Introduction
Slide 2
Program Structure
• All routines in T24 are called subroutines. Routines must not be written in such a way
that they are executed directly from jSHELL.
• Subroutines should be less than 600 lines. Ideally the code should be broken down
into internal subroutines.
• Each routine should have one main controlling section with the detailed code written
as subroutines.
• All code should be structured in a modular fashion and broken into small
units/paragraphs (less than 100 lines) and each unit should have a single entry and
exit point.
• Avoid deeply nested IF's and large case constructs. If an IF construct exceeds 20
lines then use a GOSUB
• Keywords should not be used as Variables. E.g IF, THEN, ABORT, ABS etc..
• Labels, Variables and Routines should not use the same names.
Slide 3
Program Structure
• Labels must exist on their own line with no other text appended to the label.
E. g.. The following way in incorrect.
OPEN.FILES: *This section open all required file
FN.ACCOUNT = „‟
F.ACCOUNT = „‟
The correct way is:
OPEN.FILES:
* This section open all required file
FN.ACCOUNT = „‟
F.ACCOUNT = „‟
Slide 4
Program Structure
• Code should not be commented out - remove it.
• File variable names must be F.filename (Where file name is the EXACT name
of the file e.g. F.ACCOUNT);
similarly record variables should be R.filename.
• All subroutines, both the subroutine itself and internal subroutines, should
return from a single exit point.
Slide 5
Routines to be structured like:
Slide 6
Naming Conventions
2. Product level Variables: are defined in product level common block. E.g
I_ENQUIRY.COMMON. The variable prefix is XX$
Slide 7
Subroutine Names
• Subroutine names should begin with the product prefix and then
describe the routine, e.g. FT.INPUT.RTN.
Slide 9
File and Record Variables
Example
While using F.WRITE OR F.DELETE, avoid to use ELSE & THEN verbs,
instead make use of ON ERROR verb.
Dynamic arrays must always be used with a single „<‟ & a single „>‟ character.
Any other use of dynamic arrays is illegal in jBASE.
Slide 11
Keywords Usage
All keywords used must always be coded in capital letters.
E.g.
PRINT “Welcome”
LOCATE statement
Syntax is:
Slide 12
Performance Considerations
• Use the faster operators := , += etc..
• Construct case statements so that the most often used condition is at the top.
• Use SUM etc to add all multi-values in a field together. Do not use a loop to process each multi-
value separately.
Slide 13
Ready to use Core Routines
Slide 14
Ready to use Core Routines (Contd…)
Presented By:
Prakash Parupudi
Slide 16