S Syntax: DBA Training Manual
S Syntax: DBA Training Manual
S Syntax: DBA Training Manual
7.0
SCRIPTING SYNTAX
ExpertEdge Software
Info.training@cwlgroup.com
No part of this volume may be reproduced or transmitted in any form or by any means electronic or mechanical including
photocopying and recording or by any information storage or retrieval system except as may be expressly permitted.
Expertedge believes that the information in this publication is accurate as of its publication date. This document could
include typographical errors, omissions or technical inaccuracies. Expertedge reserves the right to revise the document
and to make changes without notice.
TABLE OF CONTENTS
1 SNAPSHOT.................................................... ERROR! BOOKMARK NOT DEFINED.
2 SECTION OBJECTIVES............................................................................................. 5
5 APPENDIX ................................................................................................................. 32
1 INTRODUCTION
This document discusses about the scripting language provided as a customisation
tool and extensibility toolkit in Finacle™ and it's syntax.
Using scripting, the users can set the default values for various fields in different
forms. Using scripting the user can also make a non-mandatory field as mandatory,
protect certain fields after setting a default value and also hide them in the
application. These are known as Form-Load Script events.
Scripting can use certain variables, which are available from certain memory areas
called as repositories. The user can within the script access the variables from the
repositories.
Scripts also have built-in functions known as user hooks. Using the userhooks only
the user performs the required tasks.
Scripting also forms the underlying power of Workflow. The concept of Workflow is to
automate a unit of work which may span across menu options (thread several menu
options together, populating certain default values, passing the output of one menu
option to the next etc.) which leads to reduction of data entry by the operator. For
e.g. A TERM deposit account opening involves starting from CUMM, OAAC, TM, VCHR
and finally DRP with verification needed for CUMM, OAAC & TM. Workflow scripts are
created using the scripting language. The concept of workflow drastically reduces the
end-user training and results in higher productivity once implemented.
1
IBR - Inter Branch Reconcillation
2 SECTION OBJECTIVES
At the end of the session, the user should be able to
3 PROCESS DIAGRAM
FINACLE FINACLE
User Application
USER Database
INTERFACE
FORMS
Repository Manager
Script
Work Flow Engine
Engine
WorkFlow Queue
User Defined
Database
Scripts
4 PROCESSES INVOLVED
4.1 TECHNICAL TERMS
TBAForms - This module controls all online interactions made with Finacle™
through a Web browser. The Menu Manager in this module recognises threaded
menu options and executes the associated Workflow script. It transfers data between
the repository and the forms, on startup and execution of the workflow.
values and identifying these variables by a name. This module is used by the
Workflow script engine to store values and transfer them between menu options. The
Forms module is used to pass values between fields in a screen. The structure of a
repository field reference is as follows:
Workflow Engine - The script engine allows you to thread a series of menu
options together to form a workflow. The Workflow engine module executes this
script. It also provides the capability of suspending a thread, forwarding a thread to
a specified user or workgroup and restarting threads from the point where it was
previously suspended or forwarded.
Queue Table - This is the area where uncompleted workflow is stored temporarily,
until retrieved for further processing. On completion of the workflow, the stored data
is deleted and an audit record is created optionally.
For example:
The bank decides the account number format. But this format may contain some
format that is common for all the accounts in the Service Outlet and the user wants
the same to be appended to the account number entered in some particular format
by default. It might be the Bank code, Branch code, Currency code, currency alias,
Data center alias etc. which are common to all accounts.
The format of the account is such that the user has to enter ‘-‘ in between the
account number which is very cumbersome. By making use of script, this can be
done by default and the user needs to enter only the actual account number
‘010203040001’ and it will be converted to the format by the script written by the
user before it is further processed.
2. The Branch may be connected to an ATM that supports only 10 character account
number and the actual account number size in FINACLE™ may be more. In this case,
the FINACLE™ account number format is to be converted to ATM account number
format using some logic. This can be done in scripting. The bank will decide on the
logic to derive the unique account number for ATM from FINACLE™ format and will
code the same in the Script.
To convert to 10 character ATM account number format, the bank may decide to
leave out the bank code portion as the ATM is attached to the branches of the same
BANK and leave out the formatting of account number with ‘-‘.
The ATM account number that is derived can be 0203040001 that should be unique
in the data center.
A Class is a set of name, value pairs. The name, value pair is called a fieldname and
fieldvalue. A Class can hold only one type of fieldvalue, which is specified during
Class creation.
Integer, Float, Double, Character and String Classes are currently supported. A
fieldvalue is referenced using the following syntax:
Repository-name.Class-name.Field-name
Some standard repositories and classes are managed by Finacle™ and are available
for use. Refer appendix (page-33) for list of repositories, the classes and the
variables available.
The bank can also create their own repositories, classes and fields while
implementing their scripting logic. However, it is their responsibility to cleanup these
repositories after use since otherwise, they may occupy memory unnecessarily.
The INPUT CLASS contains fields’ specific to the events. The list of fields available to
individual events is described in the section below.
The OUTPUT CLASS contains fields’ specific to events. The details mentioned for each
scripting event.
APPENDIX (on page 33) covers the details of the default values available in repository BANCS
and class STDIN.
The state of information is stored in repository variables only. To give more flexibility
for the application programmer, Scripting allows the programmers to access these
repository fields just like any other built-in variables.
The programmer can create new fields in the Repository dynamically by giving new
field names and values to them, though the type of field is fixed depending on the
class type.
REPOSITORY-NAME.CLASS-NAME.FIELD-NAME
REP.CLASS.FIELD, where Rep, Class and Field are the Repository Name, Class Name
and Field Name respectively.
All the repository fields are globally accessible across the scripts.
<--start
#ACCESS repository fields in one of the following ways
#assign it to a scratchpad variable
sv_a = MYREP.integerCLASS.FIELD1
#sv_a will become an INTEGER type variable
Built in repository functions are provided for checking if the Repository / Class / Field
exists. See section (on page 21) on in-built utilities for REPEXISTS, CLASSEXISTS,
FIELDEXISTS, CREATEREP, CREATECLASS, DELETEREP and DELETECLASS.
BANCS.OUTPUT.successOrFailure = “F”
The valid values are “S” for success and “F” Failure.
Script has 26 built-in scratch pad variables. These are sv_a, sv_b, … sv_z.
All these variables are globally accessible across scripts. The user need not define
the scratch pad variables to be of a particular type. The assignment to a scratchpad
variable will decide the type of the variable based on the type of the right-hand side.
Scripting allows the dynamic type change.
This type is maintained until a new assignment is made. So Scripting allows the
dynamic type change.
.....
....
sv_a = "Hello"
makes the type of 'sv_a' to be set to DOUBLE type at the first line. Until the last line
sv_a carries its type as DOUBLE. In the last statement its type is set to STRING.
4.5.1 COMMENT
All statements with ‘#’ as the first non-white space character are treated as
comments. This is the only way to make a line as comment.
Even if a sequence of lines are to be treated as comments then each line must be
preceded with a ‘#’.
4.5.2 OPERATORS
ARTHEMATIC OPERATORS
<--start
sv_a = "FIRST"
sv_b = sv_a + " AND "
#sv_b is "FIRST AND "
sv_c = "SECOND"
sv_a = sv_b + sv_c
#now sv_a is "FIRST AND SECOND"
sv_a = "FIRST" + " AND " + "SECOND"
# sv_a is "FIRST AND SECOND"
sv_a = 10
sv_b = 5
sv_c = sv_a + sv_b
# sv_c is 15
sv_d = sv_a / sv_b
# sv_d is 2
sv_e = sv_a - sv_b
# sv_e is 5
sv_f = sv_a * sv_b
# sv_f is 50
end-->
COMPARISON OPERATORS
The outcome all these operations are TRUE (1) or FALSE (0).
In all these operations, if both arguments are STRINGs the string comparisons are
made else, the STRINGs are converted to INTEGERs and the comparisons are done.
If CHAR types are available they are accessed as INTEGER types and comparisons
are made.
<--start
sv_a = 10
sv_b = 12
LOGICAL OPERATORS:
'AND', 'OR'
The outcome all these operations are TRUE (1) or FALSE (0).
In all these operations, if both arguments are STRINGs, the string logical operations
are made. If CHAR types are available they are accessed as INTEGER types and
logical operations are made.
then these conditions should be separated with parenthesis from the AND/OR keyword. Only
For ex.:
To do a processing only when the values in variable sv_a and sv_b are not null the
condition should be written as
endif
<--start
sv_a = "Hello"
sv_b = "Hi"
sv_a = 10
sv_b = 0
UNARY OPERATORS:
‘-’
The same ‘-’ operator can be used as binary as well as unary operator.
<--start
sv_a = 10
sv_b = -sv_a
# Now sv_b is -10
end-->
Checking a condition:
* IF (condition) THEN
statements
ENDIF
* IF (condition) THEN
statements
ELSE
statements
ENDIF
These two statements can be used depending on the necessity. Nested IF conditions
are allowed and the execution of these statements depends on the outer loop
condition.
<--start
sv_a = 10
sv_b = 12
Looping :
* WHILE (condition)
statements
DO
The above statement executes the statements until the condition in the WHILE
becomes FALSE (0).
<--start
sv_s = 1
print (sv_s)
while (sv_s <= 1000)
sv_s = ((sv_s + (10*(2+3))) + 23)
print (sv_s)
do
end-->
Transfer of control from one part of the script to another in the same script file
is facilitated by two constructs provided in the Scripting. The two constructs are
GOTO and GOSUB.
GOTO LabelName
GOSUB LabelName
In case of GOTO the execution of the script starts from the statement where the
LABEL is declared.
In case of GOSUB the execution of the script starts from the statement where the
LABEL is declared and returns back to the next statement after the GOSUB as soon
as it finds RETURN statement in the script.
Note about GOSUB : GOSUB cannot be used inside the Control structure to point to a
SUBROUTINE that is outside the innermost Control structure.
<--start
sv_a = 1
# if condition starts here
If(sv_a == 1) THEN
GOSUB subRoutine1
# if condition ends here
ENDIF
EXITSCRIPT
<--start
sv_a = 1
# if condition starts here
if(sv_a == 1) THEN
GOSUB subRoutine1
# we added a GOTO statement to jump
# beyond the subroutine after the sub
# routine exits
GOTO jmp1
jmp1:
# if condition ends here
endif
EXITSCRIPT
end-->
CALL ( ScriptName )
START ( ScriptName )
In both the above statements, if the script file doesn’t exist in the PATH, an error is
reported.
If the script file exists and is readable, the execution of the file starts from the
beginning.
In case of CALL the execution of the script returns back to the same point in the old
script as soon as it finds EXITSCRIPT statement in the new script.
All the scratchpad variables have a global context. That is, all the scratchpad
variables are carried over from the caller script to the called script and vice-versa.
Script can use the following built- The evaluation of these functions results as follows:
in functions at the appropriate An error will result in all the cases if data-type
places in expressions. mismatch occurs in any fields.
MID$ (Var, StartPosition, Length) Returns the substring from a given position upto a
defined length in a given variable.
LEFT$ (Var, Length) Returns the leftmost Length number of bytes from
Var.
RIGHT$ (Var, Length) Return the rightmost Length number of bytes from
Var.
lowercase.
SET$ (Var1, From, Length, Var2) Sets the contents of Var1 from From position till
Length bytes to the content of Var2.
LTRIM (Var1 [, Var2]) Left trim Var1. Var2 is the character to be trimmed.
Default value of Var2 is ‘ ‘.
RTRIM (Var1 [, Var2]) Right trim Var1. Var2 is the character to be trimmed.
Default value of Var2 is ‘ ‘.
LPAD (Var1, Var2 [, Var3]) Left pad Var1 with Var3 upto the length Var2. Var3 is
the character to be used for padding. Default value of
Var3 is ‘ ‘
RPAD (Var1, Var2 [, Var3]) Right pad Var1 with Var3 to make the length Var2.
Var3 is the character to be used for padding. Default
value of Var3 is ‘ ‘.
GETPOSITION (Var1, Var2) Returns the first position of Var2 in Var1. Var1 is
String and Var2 is String/Char. Case Sensitive.
GETIPOSITION (Var1, Var2) Returns the first position of Var2 in Var1. Var1 is
String and Var2 is String/Char. Case Insensitive.
CREATECLASS (Var1, Var2, Var3) Create a Temporary Class Var2 in Repository Var1 of
the type Var3. Var3 has the following value
1 for INTEGER
2 for DOUBLE
3 for FLOAT
4 for CHAR
5 for STRING
DELETECLASS (Var1, Var2) Delete the Temporary Class Var2 in Repository Var1
<--start
# Checking MID$ operation
sv_a = Mid$("1234567890",3,5)
print (sv_a)
# Prints "45678"
# Prints "1234567ASD"
sv_a = "AS****"
sv_b = rtrim(sv_a, '*')
print (sv_b)
# Prints "AS"
sv_a = "****AS"
sv_b = ltrim(sv_a, '*')
print (sv_b)
# Prints "AS"
sv_a = "****AS****"
sv_b = trim(sv_a, '*')
print (sv_b)
# Prints "AS"
sv_b = "LONG"
sv_c = getiposition (sv_a, sv_b)
print (sv_c)
#prints "11"
Scripting provides for certain functions, which can be called within a script. These
are known as User Hooks.
The following is the syntax for calling a User routine within a script:
where sv_a will have the value returned from the function FunctionName, i.e tha
value of sv_a will be 0(TRUE) if the userhook is successful or else it will be 1(FALSE)
for failure.
There are default scripting user hook functions available for use in the script. These
user hook functions are explained in a separate topic. These hook functions will
provide the functionality as explained and the input and output parameters are
defined.
Application programmer can debug the application by setting the TRACE option ON.
Setting TRACE ON, makes the Script Engine to log all the information about each
statement it has executed in a log file with name ScriptFile.trc.
The trace file will be formed in the directory depending on the following
“..\log” is taken as the log path. If there is no write permission for the specified
path then, current directory is taken as the log path. If there is no write permission
for the specified path then an error is set.
With in the script, to log information about a part of the script we can use the
combination of these two commands.
For e.g.:
......
......
TRACE ON
.....
.....
TRACE OFF
.....
PRINT ( SV_S )
(or)
(or)
PRINT ( GLOBAL.SECLASS.OUTPUTDATA )
If the trace is on and the trace file has been successfully opened, then the output of
PRINT command goes to the trace file, else the output is dumped to stdout [standard
output].
<--start
#...statements...
#...statements...
TRACE ON
# trace logging will be done for all statements from now onwards
#...statements...
#...statements...
sv_a = 1234
PRINT ("value of sv_a = " + sv_a)
#.above will print "value of sv_a = 1234" on screen and in trace file
TRACE OFF
#trace logging will not be done now
#...statements...
#...statements...
end-->
Finacle™ provides a menu option under ‘DB’ application to test Finacle™ scripts. The
menu option is “SCRIPT”. It brings up a form, which accepts a script name and
executes it with same context as the actual event except that the fields in INPUT
class will not be provided and the fields in OUTPUT class will not be used by the
application. This facility can be used to do some initial testing of a script by providing
‘default INPUT values’ in the script itself and printing out variables (including
OUTPUT fields) in the trace file.
the ‘ pre script “ can be used to initialize , set values for variables and the post script
to do processing based on the values got from script.
Scripting provides a safe way of exiting the execution of the script. Whenever the
Script Engine finds EXIT statement in the execution path stops the execution and
returns to the Calling routine.
Even when the EXIT statement is encountered in a new script that has been CALLed
from another script, Script Engine stops the whole execution and returns to the
upper layer.
Scripting locates the script file to execute, using the same logic as Finacle™ for its
executables. It first checks under the language specific directory
$TBA_PROD_ROOT/cust/language/scripts, if the user’s language is not INFENG. If
not found it checks in $TBA_PROD_ROOT/cust/scripts directory. If not found, it
checks in $TBA_PROD_ROOT/cust/INFENG/scripts.
5 APPENDIX
Fields values available for any scripts in the repository BANCS and class STDIN
******{XXXXXX}******