Data harness function syntax

The Standards Processing Engine (SPE) adapter supports data harness functions that operate on SPE correlations, process data, code lists, delimiters, and the transaction register. You can use data harness functions only in WebSphere Transformation Extender maps that run under SPE.

Command
Description
getBinaryDocument
Retrieves the specified binary document. This command is valid in a GET function.
getEnvelope
Retrieves the specified field from an envelope. This command is valid in a GET function.
setCorrelation
Updates the Standards Processing Engine correlation table with the specified name/value pair for the document or business process. This command is valid in a PUT function.
getProcessData
Retrieves process data from the XML document object model (DOM) specified by the XPath. Process data is intermediate data that accumulates in an XML document during document processing. You can use process data to determine the next step in document processing, such as which map to launch based on the result of parsing a document. This command is valid in a GET function.
setProcessData
Stores process data from the current field into the XML DOM that is specified by the XPath. Process data is intermediate data that accumulates in an XML document during document processing. You can use process data to determine the next step in document processing, such as which map to launch based on the result of parsing a document. This command is valid in a PUT function.
getCodeListItemBySenderCode
Retrieves a trading-partner code-list entry from SPE by sender code. A trading partner code list consists of one or many pairs of code values containing a sender code and a receiver code. Code pairs in code lists identify items in transactions between two or more trading partners. This command is valid in a GET function.
getCodeListItemByReceiverCode
Retrieves a trading-partner code list from SPE by receiver code. A trading partner code list consists of one or many pairs of code values containing a sender code and a receiver code. Code pairs in code lists identify items in transactions between two or more trading partners. This command is valid in a GET function.
getTransactionRegister
Compares the fields that you loaded into the Transaction Register with the input data, returns a code, and clears the Transaction Register. This command is valid in a GET function.
Code
Meaning
0
Success; no duplicate data found.
1
Failure; duplicate data found.
8
No updates performed to this transaction register yet. Cannot perform a select before an update. The Transaction Register is empty. You must invoke setTransactionRegister to load the Transaction Register before you can invoke getTransactionRegister.
The following example:
PUT("SPE", "-t+ -c setTransactionRegister -k 1", "Reg 1")
GET("SPE", "-t+ -c getTransactionRegister") 
GET("SPE", "-t+ -c getTransactionRegister") 
  1. Loads Transaction Register field 1 with the literal value Reg 1.
  2. Compares the input document data to the content of the Transaction Register and returns 0 or 1.
  3. Attempts to invoke getTransactionRegister again without loading the Transaction Register, resulting in return code 8.
The following example loads Transaction Register field 3 with the contents of the specified input data field:
PUT("SPE", "-t+ -c setTransactionRegister -k 3",PONumber Field:In1)
setTransactionRegister
Loads the specified Transaction Register field with the specified data. You can load up to six fields of data into memory for the Transaction Register. This command is valid in a PUT function.

After you run the setTransactionRegister command, you can run the getTransactionRegister command to check for duplicate input data.

getDelimiter
Gets a delimiter from an SPE document envelope. This command is valid in a GET function.
validateCodeWords
Validates a series of code words defined by a delimited string. This command takes the code words to validate from the data_from_map option instead of from the -KEY argument. This command is valid in a GET function.
This example PUT rule uses the SPE adapter to create an element under process data that is called "getmap". The -NOW option creates the key even if the map fails:
=PUT("SPE", "-t+ -c setProcessData -k getmap -now", "data")
This example GET rule uses the SPE adapter to read the value of a key called "getmap" from the process data:
=GET rule " + VALID( GET("SPE", "-t+ -c getProcessData -k getmap")
This example of a SPE adapter command line on a card creates a correlation that is called "adapter" when the card completes. The correlation includes all of the data that was built on the card:
-c setCorrelation -k adapter -t+
The SPE adapter supports the harness functions with the following command line arguments:
Table 1. SPE adapter command line arguments
Command Long Form Command Short Form Description
-COMMAND -C Command
-KEY -K Key
-CODE -D Sender/Receiver code
-TABLE -B Code table name
-NOW -N Executes the harness function as soon as the PUT rule is processed, even if the map fails
-T -T Adapter trace (overwrite)
-T+ -T+ Adapter trace (append)
-TE -TE Adapter trace error (overwrite)
-TE+ -TE+ Adapter trace error (append)
-TV -TV Adapter trace verbatim (overwrite)
-TV+ -TV+ Adapter trace verbatim (append)
The default trace file name is M4spe.mtr.

This table describes the data harness functions and key values that you can use on the SPE adapter:
Table 2. SPE adapter data harness functions and key values
Command Key
getBinaryDocument The name of the document to retrieve.
setCorrelation The name of the correlation to update.
getProcessData The XPATH to select.
setProcessData The XPATH to update.
getCodeListItemBySenderCode The sender value for the code-list entry to retrieve. The command requires a sender code, code list table name, and column.
getCodeListItemByReceiverCode The receiver value for the code-list entry to retrieve. The command requires a receiver code, code list table name, and column.
getEnvelope The envelope field name.
getTransactionRegister There are no keys for this command.
setTransactionRegister Each entry is a number between 1 and 6 that indicates the field to update.
getDelimiter An array of numbers that indicates the fields to select. The list is defined in Table 4.
validateCodeWords This command takes the code words to validate from the data_from_map option instead of from the -KEY argument.
The following table lists the sender and receiver keys and values to use with the getCodeListItemBySenderCode and getCodeListItemByRecieverCode functions. You define the column names for the code list. The keys refer to the position of the column, not to a specific column name. This pattern continues for as many text columns as you have in the table.
Table 3. Sender and receiver keys and values
Key Value
COL_SENDER 0
COL_RECEIVER 1
COL_DESC 2
First_text_column 4
Second_text_column 5
Third_text_column 6
Fourth_text_column 7
Fifth_text_column 8
Sixth_text_column 9
Seventh_text_column 10
Eighth_text_column 11
Ninth_text_column 12
The following table lists the keys and values to use with the getDelimiter function.
Table 4. Delimiter keys and values
Key Value
SEGMENT_TERMINATOR 0
TAG_DELIMITER 1
ELEMENT_DELIMITER 2
SUB_ELEMENT_DELIMITER 3
REPEATING_ELEMENT_DELIMITER 4
RELEASE_CHAR 5
DECIMAL_SEPARATOR 6
The following table lists the keys and values to use with the setTransactionRegister function.
Table 5. Transaction Register keys and values
Key Value
COL_TEXT1 0
COL_TEXT2 1
COL_TEXT3 2
COL_TEXT4 3
COL_TEXT5 4
COL_TEXT6 5