EXTENDED RULE LIBRARY
AN OVERVIEW
Abstract
An Extended Rule Library is a very useful tool for a Sterling map developer /
implementer. It helps to reduce lines of code as well as effort. This document will
provide you a brief idea how it works and how it is beneficial.
Neha Pallavi Sahoo [nehsahoo@[Link]]
Sujatha Mohan[sujatmha@[Link]]
Puneeth Umapathi[puneumap@[Link]]
Extended Rule library
Introduction
Traditional Library Vs Digital Library
A Traditional library is a collection of sources of information and similar resources, made accessible to a
defined community for reference or borrowing. It provides physical or digital access to material, and
may be a physical building or room, or a virtual space, or both. A library's collection can include books,
periodicals, newspapers, manuscripts, films, maps, prints, documents, microform, CDs, cassettes,
videotapes, DVDs, Blu-ray Discs, e-books, audiobooks, databases, and other formats. Libraries range in
size from a few shelves of books to several million items.
A digital library is a special library with a collection of digital objects that can include text, visual
material, audio material, video material, stored as electronic media formats (as opposed to print, or
other media), along with means for organizing, storing, and retrieving the files and media contained in
the library collection. Digital libraries can vary immensely in size and scope, and can be maintained by
individuals, organizations, or affiliated with established physical library buildings or institutions, or with
academic institutions. The digital content may be stored locally, or accessed remotely via computer
networks. An electronic library is a type of information retrieval system.
Extended Rule Library
Like digital libraries, Extended Rule Library (ERL) is an organized container / collection of various kind of
functions /rules/conditions in a IBM Sterling B2B Integrator (SI) server which can be retrieved from IBM
Sterling maps whenever there is a need. ERL can be used when there is a need of similar kind of
validation for different scenarios.
Examples
1. In Banking domain, if there a functionality for card validation, one can create a single rule with
the lengthy validation codes which can be called multiple times whenever it is needed by using a
single line of code.
2. Let us say for example, one bank has several Trading partners and they must pass through the
card number validation logic. In this case mapper can call the rule with a single line of code in
the map for Trading partner for validation.
IBM Commerce 1
Extended Rule library
Illustrations below show how a set of functions stored in a SI server inside extended rule
libraries (ERL 1 to n) can be called and used from 3 different maps. Here, Function represents
validation conditions and business logic (code).
Function 1 Function 4 Function 1 Function x
Function 2 Function 5 Function 3 Function y
ERL 1 ERL 2 ERL 3 ERL n
Function 2 IBM Sterling B2B Integrator Server Function 2
ERL 2. Function 5
Map 2
ERL 1
….
ERL n
SI Server
.
ERL 3. Function 1 ERL 1. Function 2
Map 1
Map 3
Function 3
IBM Commerce 2
Extended Rule library
Benefits of ERL
The benefits of using ERL are -
• Reduces the lines of code as you code once and keep re-using it wherever and whenever
necessary.
• Thereby also reduces effort and time.
• Last, but not the least, reduces cost.
The next section will describe all the questions like why to use? how to use? Where to use?
How to use ERL
ERL can be used in various ways as listed here -
• The extended rule libraries are used when maps are compiled, not at runtime.
• The extended rules library can contain many rules.
• An extended rule consists of a declarations section followed by a statements section.
• The declarations section is required only if you use additional variables. The declarations section
is where you declare the names and types of variables you use in the extended rule.
• The statements section is where you define the actions that you want the extended rule to
execute.
• You must declare variables that are not already defined as part of the input or output
specification of the map before you use those variables in an extended rule. For the extended
rule libraries, any variable can be passed as parameters.
Global variables can be referenced within a library function if the function has “Text Substitution”
selected. However, it is recommended that you do not use “Text Substitution” when you do not have a
reusable library of functions.
IBM Commerce 3
Extended Rule library
How to upload ERL in SI Server
Rule libraries are versioned resources. When you create a new rule library you need to check it in to
Sterling B2B Integrator just like you need to check in maps. This also enables you to check out, version,
and delete extended rule libraries.
Furthermore, when you view the checked in libraries through the Extended Rule Library check in
interface, you can also see all the maps that use each library. This is very important because it enables
you to easily view a list of the maps that will need to be recompiled if you change an extended rule in a
library (you would recompile all the maps that use that library).
When a rule library holds a list of rules in a separate file outside of the Sterling B2B Integrator Map
Editor Source, the map editor stores the name of the library in its source file, so when you open a map
the library is also loaded. Only the library of extended rules referenced by a map are compiled into the
compiled translation object (. TXO). This enables you to create a library of extended rules and then add
it to any other map, so you do not have to recreate those extended rules after the first time. You can
use this functionality with any data format.
This functionality minimizes the impact to users when you would need to update the extended rules for
each updated map (correlating to the updated messages), but using the extended rule library. You just
update the library and then use the library with all the applicable maps.
When you view the checked in libraries through the Extended Rule Library check in interface, you are
also able to obtain a list of all the maps that use each library.
Additionally, one can import and export extended rule libraries into Sterling B2B Integrator using the
Resource Manager. You can call an extended rule from a library in any extended rule in a map.
IBM Commerce 4
Extended Rule library
Calling a Rule from an Extended Rule Library in a Map
One can call any extended rule library which has been already checked into Sterling B2B Integrator into
any map.
The syntax one can use to call a rule from a library is:
call library_name.rule_name (parameter1, parameter2, parameter3).
In this syntax, library_name is the name of the extended rule library.
Note
You can have multiple rule libraries with the same name and different version numbers, but you can
only use one rule library of the same name in a map (the last version of that rule library that was
checked in to the system).
The syntax you use to call a rule with a return value set is:
integer i;
i = call library_name.rule_name parameter1
In this syntax, i is the return value set.
Note
Store the .erl file in the folder "Extended Rule Library" in your mapper installation directory. And later
load that file in mapper using the Edit --> Rule Library.
Importing and Exporting Extended Rule Libraries
The Import/Export feature enables you to import and export extended rule libraries along with the other
supported resource types. This means that you can configure an ERL on one system and then move or
copy it to a different system, thereby avoiding having to recreate the ERL on each system. Even if you
have libraries that are going to be slightly different from one system to another, you can export the
libraries from one system and import them to a different system, and then make the necessary changes
to the libraries on the second system.
IBM Commerce 5
Extended Rule library
Exporting Extended Rule Libraries
Before export, resources must be converted into the proper format for storage and transference. The
Export option converts a group of resources that you specify into one of the following formats:
1. XML – Enables you to transfer data or resources between two existing systems.
2. Installable bundle – Optionally enables you to load during a Sterling B2B Integrator install on a
new system.
In the export process, after you have defined the file format to use for the export, you select the
version of the resources to export:
1. The Standard export copies non-versioned extended rule libraries and the default version of
versioned resources.
2. The Advanced export copies non-versioned extended rule libraries and enables you to choose
to export just default versions or all versions of versioned extended rule libraries.
Importing Extended Rule Libraries
When you import extended rule libraries, the Import option converts an XML file or installable bundle to
Sterling B2B Integrator resources format. Depending on the type of export that you used (standard or
advanced, default or all versions), the Import option performs the following functions:
• Creates new non-versioned extended rule libraries
• Creates and checks in new versioned extended rule libraries (assigns time/date of the import)
• Updates or preserves existing non-versioned extended rule libraries
• Preserves or appends existing checked-in extended rule libraries.
The standard import:
• Replaces non-versioned records
• Appends to existing versioned resources
• Sets the default according to imported records.
IBM Commerce 6
Extended Rule library
Conclusion
Identify the common functionality that is applicable to your software/service solution and which can be
implemented through maps. Use the Extended Rule Library feature available in Sterling B2B Integrator
to write and re-use the functions identified. Minimize lines of code in maps, reduce map development
and maintenance time, thus reducing cost and effort.
IBM Commerce 7