When checking the value of the reason argument, use either the mnemonic (for example, EPARSE) or the integer value (for example, 5).
* When error 1 or 2 occur, if your error function returns a value of 1, the SFM truncates or extends the blob, as necessary, and attempts to continue.
Writing error functions
To create a production object error function:
Select Pro-Obj in the main TRAN-IDE window.
To create an error function in a new production object, click New below the Production Objects list. To create or edit an error function for an existing production object, double-click the object in the Production Object list.
In the Production Object Information window, enter a name in the Error Func field and click the ellipsis button. To edit an existing error function, select the function from the Error Func drop-down list, and click the ellipsis. The Error Function window appears.
To create a rule object error function:
Select Pro-Obj in the main TRAN-IDE window, then click the Rules icon. The Output Rules list displays in the left pane.
To create an error function in a new rule, click New below the Output Rules list. To create or edit an error function for an existing rule object, double-click the rule in the Output Rules list.
In the Current Output Rule window, enter a name in the Error Func field and click the ellipsis button. To edit an existing error function, select the function from the Error Func drop-down list, and click the ellipsis. The Error Function window appears.
Write the error function in the text editor pane. Click Load to load a text file into the function. Click Append to load a text file to append on to the error function.
Error function arguments included:
int reason
– an
error status code.
blob *pb
– a
pointer to the current blob. If the error function
is attached to a rule object, then the current blob is
the part of the transaction that the rule object is currently processing.
if the error function is attached to a production object, then the
current blob is the output message built to the
point that the error occurred plus the part of the transaction where
processing failed.
For example, a production object has two input fields containing the data “Hello” and “brave new world”. Rule1 changes the data in Field1 to uppercase characters, and Rule2 removes the first ten characters of data in Field2. If processing fails at Rule2, the contents of the blob sent to Rule2’s error function would be “brave new world” since Rule2 was processing only the contents of Field2. The contents of the blob sent to the production object’s error function would be “HELLO brave new world”; the output message built to the point where processing failed, plus the part of the transaction where processing failed.
Complete these options in the Error Function window:
Field (key) |
Description |
---|---|
Public |
Sets the error function status to public, which means that different modules can use this error function. The default is static (unselected), which means that only the production and rule objects in the current module can use the error function. |
Goto Line# |
Moves the cursor to the specified line of ODL text in the function text editor pane. Enter the line number to go to then press Enter. The ODL text editor moves the cursor to the specified line of text and highlights it. WARNING! Click once on the text or use an arrow key to de-select it before typing anything new, otherwise the selected line is replaced with the new characters. |
DFC’s |
Select the DFC to add to this error function. Select an existing DFC from the drop-down list, or click the ellipsis button to create a new DFC. See the e-Biz Impact MSG-IDE Guide for more information. |
Datalink |
Datalinks allow you to share data with other functions and TRAN-IDE objects, which can also change the data in the datalink. Select an existing datalink from the drop-down list. Click the ellipsis button to create a new datalink. See “Building a datalink”. |
Module |
To place the error function into a different module, select the module from the drop-down list. If you place the error function into a different module, you must make the function public. |
When you finish, select from these options:
OK – save the error function without closing the window.
Save – save the error function and close the window.
Cancel – cancel the error function, exit and close the window.
Print – print the error function.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |