You are on page 1of 47

JBC P r e c o m pil e r R ul e s

R19
JBC P r e c o m pil e r R ul e s

Amendment History:

Revisio
Date Amended Name Description
n
1 17th Dec 2018 Monisha A Initial version
Basheer
2 21st Mar 2019 R19 AMR review
Ahamed

Page 2
JBC P r e c o m pil e r R ul e s

C o p yri g h t

Copyright © Temenos Headquarters SA 2009-2018.


All rights reserved.
This document contains proprietary information that is protected by copyright. No part of this document may
be reproduced, transmitted, or made available directly or indirectly to a third party without the express
written agreement of TEMENOS UK Limited. Receipt of this material directly TEMENOS UK Limited
constitutes its express permission to copy. Permission to use or copy this document expressly excludes
modifying it for any purpose, or using it to create a derivative therefrom.

Err a t a a n d C o m m e n t s
If you have any comments regarding this manual or wish to report any errors in the
documentation, please document them and send them to the address below:
Technology Department

Temenos Headquarters SA
2 Rue de l’Ecole-de-Chimie,
CH - 1205 Geneva,
Switzerland

Tel SB: +41 (0) 22 708 1150


Fax: +41 (0) 22 708 1160

Please include your name, company, address, and telephone and fax numbers, and email
address if applicable. TAFJdev@temenos.com

Page 3
JBC P r e c o m pil e r R ul e s

Table of Contents

Copyright................................................................................................................................................ 3
Errata and Comments............................................................................................................................ 3
Introduction.......................................................................................................................... 6
JBC Precompiler Rules....................................................................................................... 6
Rule 1: !HUSHIT is not supported in TAFJ. Use HUSHIT............................................6
Rule 2: ABORT will result in abrupt abortion...............................................................7
Rule 3: Avoid CALLC command- Check if Integration Event (IF) can be used..........7
Rule 4: Avoid CHAIN as Process control will never return to the invoker.................8
Rule 5: Avoid Code after THEN/ELSE on Same line....................................................8
Rule 6: Avoid GOTO as readability of code is reduced...............................................9
Rule 7: CHAR should be replaced by CHARX............................................................10
Rule 8: Check if C$SESSION.NO can be used instead of TNO_Operator................10
Rule 9: Check if CACHE.DBR can be replaced by CACHE.READ............................11
Rule 10: Check if DBR can be replaced by Read of full record................................12
Rule 11: Check if sequential file can be changed to T24 data base file...................13
Rule 12: Condition lines '$1' ; exceeded allowed limit '$2'.......................................13
Rule 13: CRT is incompatible with Browser, Desktop and other GUI......................14
Rule 14: Do not do Input / Output operations in filter of a service/COB-
API/Command '$1'........................................................................................................15
Rule 15: Do not read Standard Selection directly to improve performance............18
Rule 16: Do not tamper/refer to Sensitive property / Method '$1'............................20
Rule 17: Do not use DCOUNT on FOR loop to improve performance.....................23
Rule 18: Do not use IDescriptor..................................................................................23
Rule 19: Ensure EB.ERROR with Pattern<Product-ErrorText> is used to set ETEXT
....................................................................................................................................... 24
Rule 20: Ensure OVERRIDE with Pattern <Product-OverrideText> is used to set
TEXT.............................................................................................................................. 24
Rule 21: INPUT is incompatible with Browser, Desktop and other GUI...................25
Rule 22: INPUT.BUFFER is incompatible with Browser, Desktop and other GUI....25
Rule 23: MATCHES does not work with Field and Sub-value Markers....................26
Rule 24: Maximum no of executable lines in code '$1' exceeded allowed limit '$2'
....................................................................................................................................... 27
Rule 25: Move to Load routine API/Command :'$1'...................................................28

Page 4
JBC P r e c o m pil e r R ul e s

Rule 26: No call to BATCH.BUILD.LIST made............................................................29


Rule 27: No of lines '$1' in para before LINE.NO '$2' exceeded allowed limit '$3'...30
Rule 28: No of lines '$1' in para name '$2' exceeded allowed limit '$3'....................30
Rule 29: PRINT is incompatible with Browser, Desktop and other GUI...................31
Rule 30: Replace API/Command calls with component methods :'$1'....................31
Rule 31: Replace CALL @ with EB.SystemTables.CallAPI.......................................32
Rule 32: Replace EB.READLIST with DAS.................................................................33
Rule 33: Replace INSERT I_F.<Table> with $USING component methods..............34
Rule 34: Replace TXT with overrides.........................................................................34
Rule 35: SEQ should be replaced by SEQX...............................................................35
Rule 36: TAFJ does not support '$1'...........................................................................36
Rule 37: TXTINPUT is incompatible with Browser, Desktop and other GUI............36
Rule 38: Usage of '$1' can jeopardize transaction management..............................37
Rule 39: Use EB.SMS.getRole /EB.SMS.getSMSProfile API.....................................37
Rule 40: Use AC.API.EbReadContractBalances API if reading ECB for ACCOUNT
Application................................................................................................................... 38
Rule 41: AC.API.EbWriteContractBalances API if writing ECB for ACCOUNT
Application................................................................................................................... 39
Rule 42: Use Account Service API to get balances...................................................40
Rule 43: Use CHANGE to improve performance if you use large arrays.................42
Rule 44: Use Customer Service API...........................................................................42
Rule 45: Use of OfsGlobusManager can result in corruption of Transaction
Boundaries...................................................................................................................43
Rule 46: Use ST.CurrencyConfig.GetCcyHistory API................................................44
Rule 47: Use ST.CurrencyConfig.GetCurrencyRecord API.......................................44

Page 5
JBC P r e c o m pil e r R ul e s

Intro d u c ti o n
JBC Precompiler is a component that contains a set of rules used by JBC SonarQube plugin
to analyse the JBC code and provide the following metrics such as

- Potential bugs and “code smells” (SQ terminology).

- Code coverage by unit tests.

- Code duplication.

- Rating or code quality.

- Lines of code and documentation.

This document contains the list of rules, examples of compliant code and tips for working
around the issue.

JBC P r e c o m p i l e r R u l e s

R u l e 1 : ! H U S H IT i s n o t s u p p o r t e d i n TAFJ. U s e H U S H I T
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

!(exclamation) should not be used before HUSHIT.

Page 6
JBC P r e c o m pil e r R ul e s

R u l e 2 : A B ORT w i l l r e s u l t i n a b r u p t a b o r t i o n
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Avoid using ABORT statement as it is handled by transaction management.

R u l e 3 : Avo i d CALLC c o m m a n d - C h e c k if I n t e g r a t i o n Ev e n t ( I F ) c a n
be used
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Equivalent java function should be provided and it should be called directly instead of
CALLC.

Page 7
JBC P r e c o m pil e r R ul e s

R u l e 4 : Avo i d C HAI N a s P r o c e s s c o n t r o l w i l l n e v e r r e t u r n t o t h e
invok er
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

CHAIN is not recommended as per T24 standards.

R u l e 5 : Avo i d C o d e a f t e r T H E N / EL S E o n S a m e l i n e
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Code should be written in separate lines after THEN and ELSE statements.

Page 8
JBC P r e c o m pil e r R ul e s

R u l e 6 : Avo i d GOTO a s r e a d a b i l i ty o f c o d e i s r e d u c e d
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

GOSUB can be used instead of GOTO.

Page 9
JBC P r e c o m pil e r R ul e s

R u l e 7 : C HAR s h o u l d b e r e p l a c e d b y C HARX
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

CHARX should be used instead of CHAR.

Rul e 8 : C h e c k if C $ SES SION. NO can be used instead of


T N O_O p e r a t o r
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Page 10
JBC P r e c o m pil e r R ul e s

C$SESSION.NO can be used in place of TNO_OPERATOR.

R u l e 9 : C h e c k if CAC H E. D B R c a n b e r e p l a c e d b y CAC HE . REA D


Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

CacheRead can be used in place of CacheDbr.

Page 11
JBC P r e c o m pil e r R ul e s

R u l e 1 0 : C h e c k if D B R c a n b e r e p l a c e d b y R e a d o f f u l l r e c o r d
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Full record read can be used in place of Dbr.

Page 12
JBC P r e c o m pil e r R ul e s

R u l e 1 1 : C h e c k if s e q u e n t i a l fil e c a n b e c h a n g e d t o T 2 4 d a t a b a s e
fi l e
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use sequential file only when there is a necessity to process a file line by line.

R u l e 1 2 : C o n d i t i o n li n e s ' $ 1' ; e x c e e d e d a l l o w e d l i m i t ' $ 2'


Noncompliant Code (as per T24 standards)

Page 13
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Split the code into separate GOSUBs if necessary.

R u l e 1 3 : CRT i s i n c o m p a t i b l e w i t h B r o w s er, D e s k t o p a n d o t h e r G UI
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use Logger if necessary to capture the output with Browser, Desktop and other GUI.

Page 14
JBC P r e c o m pil e r R ul e s

R u l e 1 4 : D o n o t d o I n p u t / O u t p u t o p e r a t i o n s i n fi l t e r o f a
s e r vi c e /CO B - API/C o m m a n d ' $ 1'
Noncompliant Code (as per T24 standards)

Page 15
JBC P r e c o m pil e r R ul e s

Page 16
JBC P r e c o m pil e r R ul e s

Page 17
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

I/O operations can be done in process routine of a service.

R u l e 1 5 : D o n o t r e a d S t a n d a r d S e l e c t i o n d i r e c t ly t o i m p r o v e
p erf or m a n c e
Noncompliant Code (as per T24 standards)

Page 18
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

The following APIs can be used to get the details of Standard Selection instead of direct
read.

Page 19
JBC P r e c o m pil e r R ul e s

R u l e 1 6 : D o n o t t a m p e r /r e f e r t o S e n s i t iv e p r o p e r ty / M e t h o d ' $ 1'
Noncompliant Code (as per T24 standards)

Page 20
JBC P r e c o m pil e r R ul e s

Page 21
JBC P r e c o m pil e r R ul e s

Page 22
JBC P r e c o m pil e r R ul e s

R u l e 1 7 : D o n o t u s e D CO U N T o n FO R l o o p t o i m p r o v e p e r f o r m a n c e
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use a separate variable to get the value of DCOUNT and then use the same variable in FOR
loop.

Rul e 1 8: D o n o t u s e ID e s cript or
Noncompliant Code (as per T24 standards)

Page 23
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Handle the required functionality in enquiry level by attaching conversion routine to the field
in enquiry as IDESC is not supported in TAFJ.

R u l e 1 9 : E n s u r e E B . E R R OR w i t h P a t t e r n < P r o d u c t - Err o rT e x t > i s


u s e d t o s e t ETEXT
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Set ETEXT with pattern <Product-ErrorText>

R u l e 2 0 : E n s u r e OVERRI D E w i t h P a t t e r n < P r o d u c t - Ov e r ri d eT e x t >


i s u s e d t o s e t TEXT
Noncompliant Code (as per T24 standards)

Page 24
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Set TEXT with pattern <Product-OverrideText>

R u l e 2 1 : I N P U T i s i n c o m p a t i b l e w i t h B r o w s er, D e s k t o p a n d o t h e r
GUI
Noncompliant Code (as per T24 standards)

Page 25
JBC P r e c o m pil e r R ul e s

R u l e 2 2 : I N P UT. B U F FE R i s i n c o m p a t i b l e w i t h B r o w s er, D e s k t o p
a n d o t h e r G UI
Noncompliant Code (as per T24 standards)

Rul e 2 3 : MATC H E S d o e s n o t w o r k w i t h Fi e l d a n d S u b-valu e


Markers
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

MATCHES works only with VM.

Page 26
JBC P r e c o m pil e r R ul e s

R u l e 2 4 : M a x i m u m n o o f e x e c u t a b l e li n e s i n c o d e ' $ 1' e x c e e d e d
a l l o w e d l i m i t ' $ 2'
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Page 27
JBC P r e c o m pil e r R ul e s

The entire code can be analysed and split up into separate sub routines.

R u l e 2 5 : M o v e t o L o a d r o u t i n e API/C o m m a n d :' $ 1'


Noncompliant Code (as per T24 standards)

Page 28
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

All file opens can be done in load routine.

R u l e 2 6 : N o c a l l t o BATC H . B U ILD.LI S T m a d e
Noncompliant Code (as per T24 standards)

Page 29
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Call to BATCH.BUILD.LIST must be made in SELECT routine of a service.

Page 30
JBC P r e c o m pil e r R ul e s

R u l e 2 7 : N o o f li n e s ' $ 1' i n p a r a b e f o r e LI N E. N O ' $ 2' e x c e e d e d


a l l o w e d l i m i t ' $ 3'
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Split the code into separate GOSUBs according to the functionality.

R u l e 2 8 : N o o f li n e s ' $ 1' i n p a r a n a m e ' $ 2' e x c e e d e d a l l o w e d li m i t


' $ 3'
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Split the code into separate GOSUBs according to the functionality.

Page 31
JBC P r e c o m pil e r R ul e s

R u l e 2 9 : P R I N T i s i n c o m p a t i b l e w i t h B r o w s er, D e s k t o p a n d o t h e r
GUI
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use Logger if necessary to view the details.

Rul e 3 0: Replac e API/C o m m a n d c alls with co mponent


m e t h o d s :' $ 1'
Noncompliant Code (as per T24 standards)

Page 32
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Replace the direct call statements with component methods.

Page 33
JBC P r e c o m pil e r R ul e s

R u l e 3 1 : R e p l a c e CALL @ w i t h E B . S y s t e mT a b l e s .C a l lA PI
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use EB.SystemTables.CallAPI instead of direct call.

R u l e 3 2 : R e p l a c e E B . R EA DLI S T w i t h DA S
Noncompliant Code (as per T24 standards)

Page 34
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Use DAS instead of EB.READLIST.

R u l e 3 3 : R e p l a c e I N S E RT I_F. <T a b l e > w i t h $ U S I N G c o m p o n e n t


methods
Noncompliant Code (as per T24 standards)

Page 35
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Replace INSERT with $USING component.

R u l e 3 4 : R e p l a c e TXT w i t h o v e rr i d e s
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Specify the text that needs to be displayed in OVERRIDE table and mention the override id
in TEXT before calling STORE.OVERRIDE.

Page 36
JBC P r e c o m pil e r R ul e s

R u l e 3 5 : S E Q s h o u l d b e r e p l a c e d b y S E QX
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

SEQX should be used instead of SEQ.

Page 37
JBC P r e c o m pil e r R ul e s

R u l e 3 6 : TAFJ d o e s n o t s u p p o r t ' $ 1'


Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Don’t use the below list of commands as they are not supported in TAFJ.

ESEARCH, SEARCH, LIST, LIST-ITEM, REFORMAT, SREFORMAT, SDUMP, TLOAD,


SORT, SORTITEM, SORTLABEL, STAT, SUM, TDUMP, TLOAD.

R u l e 3 7 : TXTI N P U T i s i n c o m p a t i b l e w i t h B r o w s er, D e s k t o p a n d
o t h e r G UI
Noncompliant Code (as per T24 standards)

Page 38
JBC P r e c o m pil e r R ul e s

R u l e 3 8 : U s a g e o f ' $ 1' c a n j e o p a r d i z e t r a n s a c t i o n m a n a g e m e n t
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Avoid using above statements directly in code as it is handled by transaction management.

R u l e 3 9 : U s e E B . S M S . g e t R o l e /E B . S M S . g e t S M S P r o f i l e API
Noncompliant Code (as per T24 standards)

Page 39
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Use respective APIs instead of direct read on the table

R u l e 4 0 : U s e AC.API.E b R e a d C o n t r a c t B a l a n c e s API if r e a d i n g EC B
f o r ACCO U N T Ap p l i c a t i o n
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use respective API to read contract balances record for ACCOUNT.

Page 40
JBC P r e c o m pil e r R ul e s

R u l e 4 1 : AC.A PI.E b Wri t e C o n t r a c t B a l a n c e s API if w r i t i n g EC B f o r


ACCO U N T Ap p l i c a t i o n
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use respective API to write contract balances record for ACCOUNT.

Page 41
JBC P r e c o m pil e r R ul e s

R u l e 4 2 : U s e A c c o u n t S e r vi c e API t o g e t b a l a n c e s
Noncompliant Code (as per T24 standards)

Page 42
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Use the respective APIs to get the balance details

Page 43
JBC P r e c o m pil e r R ul e s

R u l e 4 3 : U s e C HA N GE t o i m p r o v e p e r f o r m a n c e if y o u u s e l a r g e
a rr ay s
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use CHANGE in place of CONVERT if large arrays are used.

R u l e 4 4 : U s e C u s t o m e r S e r vi c e API
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use CustomerService APIs to get the customer details.

Page 44
JBC P r e c o m pil e r R ul e s

R u l e 4 5 : U s e o f Of s G l o b u s M a n a g e r c a n r e s u l t i n c o r r u p t i o n o f
Tra n s a c t i o n B o u n d a r i e s
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

OfsCallBulkManager can be used instead of using OfsGlobusManager directly.

Page 45
JBC P r e c o m pil e r R ul e s

R u l e 4 6 : U s e ST.C u rr e n c yC o n f i g .G e t C c y H i s t o ry API
Noncompliant Code (as per T24 standards)

Compliant Solution (as per T24 standards)

Use API to get the history file instead of direct read on history file.

R u l e 4 7 : U s e ST.C u rr e n c yC o n f i g .G e t C u rr e n c y R e c o r d API
Noncompliant Code (as per T24 standards)

Page 46
JBC P r e c o m pil e r R ul e s

Compliant Solution (as per T24 standards)

Use API to get the currency record instead of direct read.

Page 47

You might also like