Introduction
When S2PX encounters Server Routine names it takes the following approach:
Look for an appropriately-named mapping in the
mapping
section of theconfig.yml
file and substitute the Server function name for the defined Parallel expression. This expression may include one or more references to new Parallel functions, defined in theconfig.yml
file'slibraries
section.If a mapping is not found then the Server function name is retained, unaltered, in the generated Parallel job, and S2PX assumes that an identically-name Parallel function is available. A set of new Parallel functions to support this behaviour, and which are named after Server functions, is suppled by IBM’s recent Fix Packs.
Generated Parallel Function Definitions
Where a custom Parallel function is defined in your configs2px.yml
file's libraries
section then S2PX will create a Parallel Routine asset in your DataStage project which will provide DataStage’s interface into that external function.
...
By way of example, the function defined in the example configs2px.yamlyml
file above would be made accessible in DataStage using the S2PX-generated files described here.
The following configs2px.yml
configuration file section…
Code Block | ||
---|---|---|
| ||
customRoutines:
generateCHeaders: true
mapping:
AddOneToNumber: "{0} + 1"
GetBalanceInUSD: "{0} * 0.75"
MyCustomServerRoutine: ACustomRoutine({0}, {1}) : {2}
libraries:
-
name: test # FUNCTION LIBRARY 'test'
path: /path/to/lib/
type: SHARED_LIBRARY
routines:
ACustomRoutine: # DATASTAGE FUNCTION 'a_custom_function(FLOAT, STRING, STRING)'
type: STRING
externalName: "a_custom_function" # Wraps C function 'a_custom_function(float arg1, char * arg2, char * a)'
arguments:
-
name: arg1
type: FLOAT
-
name: arg2
type: STRING
-
name: a
type: STRING
-
name: test2 # FUNCTION LIBRARY 'test2'
path: /path/to/lib/again/
type: SHARED_LIBRARY
routines:
ConvertSomething: # DATASTAGE FUNCTION 'convert_something(INT)'
type: UINT
externalName: "convert_something" # Wraps C function 'convert_something(int a)''
arguments:
-
name: a
type: INT |
...
Due to the dependency on the apt_util
classes (logmsg
, errlog
and errind
) the generated files need to be linked against the appropriate liborch<arch>.so
file (where <arch>
is the relevant host architecture. e.g. liborchx86_64.so
) which is located in /opt/IBM/InformationServer/Server/PXEngine/lib
.
Compiling Your Custom Parallel Routines
A detailed description of how you can compile your custom Parallel Routines, ready for use by DataStage, can be found here.