COMPONENTISATION
Introduction and Benefits of Componentisation
Introduction
• A component is a logical and technical grouping of jBC artefacts
• jBC artefacts –
subroutines
functions
commons
tables
© 2010 Capgemini - All rights reserved 3
The Benefits
• Scoping allow method, properties, … to be hidden from the external
world (an other component)
• Defining Component oriented Unit Tests (UnitTest Framework)
© 2010 Capgemini - All rights reserved 4
Creating a New Component
STEP 1
• In the TAFJ Perspective, right-click on the directory you want the
component to be, choose New → T24 routine /component / testcase
© 2010 Capgemini - All rights reserved 6
STEP 2
• Enter a name for your component and click finish
• A component name is composed of a «module».«component»
• A module is a logical group of component. Eg. AA, FT, EB
© 2010 Capgemini - All rights reserved 7
STEP 3
• Once a new T24 component is created, it will automatically open the
EDS Component editor
© 2010 Capgemini - All rights reserved 8
STEP 4
• The Design Studio / Eclipse Component editor comes with auto-
completion facilities
• TO do so, press Ctrl + <SPACE>. You will have something like this:
© 2010 Capgemini - All rights reserved 9
STEP 5
• Choosing, as an example, “NewMethod” will automatically add this
code...
© 2010 Capgemini - All rights reserved 10
Syntax for Creating a Component
• Create a new component, call it [Link]
• Press Ctrl + <Space> to add a new method, keep the default values
and save
© 2010 Capgemini - All rights reserved 11
Creating a Component - Example
© 2010 Capgemini - All rights reserved 12
Scoping of Component Artefacts
Scoping
• The Scope is a mandatory information for ALL the component artefacts
(Constant, Method, Property and Table)
• It can have 3 different values –
• Public
• Module
• Private
© 2010 Capgemini - All rights reserved 14
Scoping - Public
• Public: The artefact is visible from everywhere (other module, other
component)
© 2010 Capgemini - All rights reserved 15
Scoping - Module
• Module: The artefact is visible only for the component being part of the
same module; by default the scoping is ≪ module ≫
© 2010 Capgemini - All rights reserved 16
Scoping - Private
• Private: Only visible in the same <module>.<component>
© 2010 Capgemini - All rights reserved 17
Using a Component
Using a Component in a Program
• In order to use a component, define it with the $USING keyword or add
the $PACKAGE at the top of your program
• As an example, to use the component [Link] created
previously, create a new PROGRAM, call it MAIN, and start editing
© 2010 Capgemini - All rights reserved 19
$USING Keyword
• If the scope of the method is public, it can be accessed using $USING
keyword
© 2010 Capgemini - All rights reserved 20
$PACKAGE Keyword
• If the scope of the method is module, it can be accessed using
$PACKAGE keyword
© 2010 Capgemini - All rights reserved 21
Example 1 - Component with a Method defined with module scope
© 2010 Capgemini - All rights reserved 22
Example 1 (Contd…)
© 2010 Capgemini - All rights reserved 23
Example 1 (Contd…)
© 2010 Capgemini - All rights reserved 24
Example 2 - Component with a Method defined with public scope
© 2010 Capgemini - All rights reserved 25
Example 2 (Contd…)
© 2010 Capgemini - All rights reserved 26
Example 2 (Contd…)
© 2010 Capgemini - All rights reserved 27
Example 3 - Component with a Method defined with private scope
© 2010 Capgemini - All rights reserved 28
Example 3 (Contd…)
© 2010 Capgemini - All rights reserved 29
Example 3 (Contd…)
© 2010 Capgemini - All rights reserved 30
Artefacts of a Component - METHOD
The Method
• A method describes a jBC SUBROUTINE or FUNCTION
• It is composed of the scope –
• an alias Name (OperationName)
• the optional return type (if a function), and currently only “string” is
a valid return type
• the list of the parameters
• the jBC implementation name (the ≪ real ≫ SUBROUTINE /
FUNCTION name)
© 2010 Capgemini - All rights reserved 32
The Parameters of the Method
• A parameter is composed of an Access, it's name it's type and it's
multiplicity
• They come right after the name of the method, separated by coma and
wrapped in brackets (…)
• The access is IN, INOUT or OUT
• IN means the parameter is not modified in the routine
• OUT means it is only for returning a value
• INOUT means the parameter value is relevant and will be modified
• The name can be any valid variable name.
• The type define the type of parameter, and currently only ≪string ≫ is
valid
• The type can be followed by open/close bracket to define a
DIMentionned array.
© 2010 Capgemini - All rights reserved 33
The Parameters of the Method - Syntax
© 2010 Capgemini - All rights reserved 34
The jBC Information
• The jBC information define the ≪ real ≫ SUBROUTINE / FUNCTION
name
• It is wrapped in curly brackets { … }
• Syntax:
© 2010 Capgemini - All rights reserved 35
The Method - Syntax
© 2010 Capgemini - All rights reserved 36
The Method - Example
• Component
© 2010 Capgemini - All rights reserved 37
The Method - Example
• Subroutines
© 2010 Capgemini - All rights reserved 38
The Method - Example
• Program and Output
© 2010 Capgemini - All rights reserved 39
Artefacts of a Component - CONSTANT
The Constant
• It is composed of the scope, a name and a value
• Optionally, jBC name can be specified which is only necessary for
auto-incorporation
• Syntax:
© 2010 Capgemini - All rights reserved 41
The Constant - Example
• Component
© 2010 Capgemini - All rights reserved 42
The Constant - Example
• Program and Output
© 2010 Capgemini - All rights reserved 43
Artefacts of a Component - TABLE
The Table
• It is composed of -
• the scope
• an alias (the tableName)
• the real jBC table name (Without the prefix)
• a list of fields
• The fields are separated by coma and wrapped in a fields:{ } group
• the fields can have, for the same reasons as constants,
the JBC name in brackets
• there is no coma separator between the fields
© 2010 Capgemini - All rights reserved 45
The Table - Syntax
© 2010 Capgemini - All rights reserved 46
The Table - Example
• Component
© 2010 Capgemini - All rights reserved 47
The Table - Example
• Subroutine and Output
© 2010 Capgemini - All rights reserved 48
Artefacts of a Component - PROPERTY
The Property
• A property wraps a COMMON variable
• It is composed of –
• the scope
• the property name
• its access
• its type
• optionally the corresponding COMMON defined by an Insert file
• a variable name
• The access can be read, write, readwrite or readonly (deprecated)
• Read - only a getter will be available
• Write - only a setter will be available
• Property scoping can be different for read / write
• i.e. private for the write and public for the read
© 2010 Capgemini - All rights reserved 50
The Property - Syntax
© 2010 Capgemini - All rights reserved 51
The Property - Example
• Component
© 2010 Capgemini - All rights reserved 52
The Property - Example
• Program and Output
© 2010 Capgemini - All rights reserved 53
The Property – DIMmed Array
• If the COMMON is a DIMmed array,
• the jBC variable name must be followed by the number of
dimensions in-between bracket
• For example:
• [Link](500) has 1 dimension
• [Link](10,20) has 2 dimensions
© 2010 Capgemini - All rights reserved 54
The Property – DIMmed Array - Syntax
• A property can also not have any JBC: implementation
• i.e. the underlying COMMON is only accessible from the
property
• Syntax:
• There is no such support for DIMmed array for the properties not
having a “jBC:” information
© 2010 Capgemini - All rights reserved 55
The Property – DIMmed Array - Example
• Insert File and Component
© 2010 Capgemini - All rights reserved 56
The Property – DIMmed Array - Example
• Program
© 2010 Capgemini - All rights reserved 57
The Property – DIMmed Array - Example
• Output
© 2010 Capgemini - All rights reserved 58
The Property – DIMmed Array - Example
• Program and Output
© 2010 Capgemini - All rights reserved 59
The Property – DIMmed Array - Example
• Program and Output
© 2010 Capgemini - All rights reserved 60
Artefacts of a Component - INTERFACE
The Interface
• The components have a last type of definition, the interfaces
• An interface is defined as follows -
• Interfaces are used to invoke methods ≪ by name ≫ (same as the
old ≪ CALL @ ≫)
• Basically, an interface is nothing else than a method, but without the
{ … jBC : … } body
• Once an interface is defined, it can be invoked the same way as a
method with one major difference; the name of the method that need
to be invoked can be specified
© 2010 Capgemini - All rights reserved 62
The Interface - Syntax
• << doSomething >> can then be invoked by name like this :
© 2010 Capgemini - All rights reserved 63
The Interface - Example
• Component
• Subroutine
© 2010 Capgemini - All rights reserved 64
The Interface - Example
• Program and Output
© 2010 Capgemini - All rights reserved 65
[Link]/financialservices