Date/time functions  Dynamic routing functions

Chapter 3: Building Production Objects

Miscellaneous functions

These functions do not fit in any other category, but perform useful functions, like conversion of EBCDIC data to ASCII and vice versa, sending data through mail, and so on.


AscEbc()

Description

Converts the current blob area from the ASCII to the EBCDIC character set.

Arguments

None.


asciiCtl()

Description

Appends the ASCII control character in the Arguments field onto the end of the current output blob area. Use the ASCII control characters from the list below. Use this filter as the first component of the first rule in a production object to place ASCII control characters at the beginning of an output transaction.

Arguments

Arguments – one or more ASCII control characters.

Control Char

Usage

Control Char

Usage

Control Char

Usage

NUL

Null

SOH

Start of Heading

STX

Start of Text

ETX

End of Text

EOT

End of transmission

ENQ

Enquiry

ACK

Acknowledge

BEL

Bell

BS

Backspace

HT

Horiz.Tab

LF

Line feed

VT

Vertical tab

FF

Form feed

CR

Carr. Return

SI

Shift In

SO

Shift Out

DLE

Data Link Escape

DC1

Device Control 1

DC2

Device Control 2

DC3

Device Control 3

DC4

Device Control 4

NAK

Negative Acknowledge

SYN

Synchronous DLE

ETB

End of Trans. Block

CAN

Cancel

EM

End of Media

SUB

Substitute

ESC

Escape

FS

Field Separator

GS

Group Separator

RS

Record Separator

US

Unit Separator

DEL

Delete

SP

Space Character

Examples


binaryVli()

Description

Generates either an 8-bit or a 16-bit binary variable length indicator (VLI) for the current blob area and places the VLI either at the beginning or the end of that blob area, depending on the information in the Arguments field. Use this function, or the formatted VLI function in a production object’s post-filter, to calculate the VLI for the entire output transaction.

Default (no arguments included) is a 16-bit VLI placed at the beginning of the blob area.

Arguments

Arguments – “1” is 8-bit, “2” is 16-bit, and “post” specifies to build trailing VLI.

Examples


charTranslate()

Description

Translates data from one character set to another.

Arguments


crc16()

Description

Appends a 16-bit CRC (Cyclical Redundancy Check) value to an output blob area in the format HIGHBYTELOWBYTE. The function processes the entire output blob area to compute the 16-bit value.

Arguments

Arguments – optional. Enter “pre” or “prefix” (without the quotes) to place the CRC value at the front of the output blob area.


cutColumn()

Description

Replaces the value in the current blob with the value contained in the column specified by the argument. To use this filter, the content of the current blob must consist of columns of data with each column separated by the character specified in the argument. An example of data fitting this format is “here^is^some^data^”. This example has four columns, each separated by a “^” character.

If the column specified in the argument does not exist or is empty, the function fails.

Arguments

Column Number[,Separator] – where Column Number is the number of the column whose contents you want to use to replace the value of the current blob, and Separator is the character that separates each column of data in the blob; for example, “3,#”. If a separator is not specified, the filter uses “^” by default.

Examples

Data:

Here|are|6|columns|of|data|				cutColumn(4,|)

Results in:

columns

dbAssemble()

Description

Retrieves data from collection files (obtains collection file names by calling dbDiskList) into a temporary Binary Search Tree (BST), and replaces the current blob data with the sorted data from the BST, inserting an optional separator string between collection data in the current blob.

Returns “MCMEM” if BST cannot be completed.

Retrieves only the data from collection files that match file name mask (key). Before end of function, the temporary BST is completely removed from memory.

Arguments


dbDelete()

Description

Deletes the specified entry from the referenced collection file.

Arguments


dbDiskAgeList()

Description

The dbDiskAgeList built-in function builds up a key list based on the age of keys rather than using a mask on the key name like memKeyList.

Arguments

See “memKeyList()” for a description of this function’s arguments.


dbDiskList()

Description

Finds the elements in the referenced collection file that match a pattern and writes a list of those elements to a file, separated by a literal string.

Arguments


dbInsert()

Description

Copies the contents of the current blob area to the referenced collection file.

Arguments


dbSelect()

Description

Copies the specified entry from the referenced collection file to the current blob area in the production object. The dbSelect() filter writes over the current contents of the blob area rather than concatenating the entry onto the current contents of the blob area. Call this filter from within an empty rule object each time you want to copy an entry from a collection file to the output transaction.

Arguments


EbcAsc()

Description

Converts the current blob area from the EBCDIC to the ASCII character set.

Arguments

None.


email()

Description

Sends the current blob area to the destination specified in the argument. The content of the argument is the e-mail destination.

Arguments

Dest. – the e-mail address where the current blob area should be mailed.


emailByFld()

Description

Sends the current blob area to the e-mail destination specified in the argument.

Arguments

Dest Fld – the field that contain the e-mail address where the current blob area should be mailed.


emailByData()

Description

Sends the current blob area to the destination specified in the argument.

Arguments

Dest Data – the datalink that contains the e-mail address where the current blob area should be mailed.


formattedVli()

Generates a variable length indicator (VLI) for the current blob area and places the VLI either at the beginning or the end of that blob area. The formatting and position of the VLI depend on the information in the argument. Use this function, or the binaryVli function in a production object’s post-filter, to calculate the VLI for the entire output transaction.

The default (no arguments included) is a 16-bit VLI placed at the beginning of the blob area.

Arguments

Format – format-control specifiers, as follows: %<len><type>, where <len> is the size of the VLI in bytes, 0 for leading zero, and <type> is any one of: “i” for integer, “u” for unsigned integer, “d” for decimal, “o” for octal, “orx” for hexadecimal. Entering “post” anywhere in the arguments generates a trailing VLI.

Examples

When the blob contains “12345”:

NoteIf you do not want to not have the length “0” filled, remove the “0” from the command; for example, “%04dpost = %4dpost”.


loadFile()

Description

Copies the contents of the file specified in the argument and places it in the current blob area, overriding the current contents of the blob.

Arguments

Use only one of the available argument fields to identify the file to read. The argument can include a path or just the filename. When the argument includes a path, always use forward slashes (/). Leave the argument fields blank to use the contents of the current blob as the argument to the filter.


logger()

Description

Appends the current blob area to the file name in the arguments. The file name can include its location. If the location is not included, then the file should reside in the current user’s PATH environment variable. If the function cannot find the file, it attempts to build the file and write to it. If the function cannot open the file, or cannot write to it, the function returns the system’s error number as a negative value to transaction production. Transaction production indicates in the current xlog file which operation failed (read or write), what the return value was, and ends processing of the current production object.

Arguments

File – the location (optional) and name of a file to which the current blob area should be appended; for example, “/usr/impact/logfiles/accounting.log”.


lrc()

Description

Adds an 8-bit or 16-bit LRC (Longitudinal Redundancy Check) value to the output blob area. The function processes the current output blob area to compute the value. Format of a 16-bit value is “HIGHBYTELOWBYTE”.

Arguments

Arguments – enter “2” to produce a 16-bit value. The default “LRC” is an 8-bit value.


memAssemble()

Description

Retrieves node data from the BST specified by table, then replaces the current blob data with the sorted node data, inserting an optional separator string between node data in the current blob. Retrieves data only from nodes with key values that match the key mask.

Arguments

NoteThe Key Field, Key Datalink, and Key Lit arguments are required and mutually exclusive. The first non-null value to occur is used. Generates an error (MCINPUT) if all arguments are null (blank). The “Key..” is used as a mask for a substring search (as opposed to an exact match). Use “*” or “?” as a wildcard. An error is generated (MCFIND) if no data is found.


memDelete()

Description

Removes a single node (releasing the node’s allocated memory) from the BST specified by the Table argument; if the table is empty after removing the BST node, the table node is also removed and its allocated memory released.

Arguments

NoteThe Key Field and Key Datalink arguments a required and mutually exclusive. Only one argument is used; that is, the first non-null value to occur in the list. An error is generated (MCINPUT) if both are null (blank). The Key argument value must be exact. An error is generated (MCFIND) if the key is not found.


memDeleteAll()

Description

Removes (releases allocated memory of) all nodes from the table specified by the Argument, or it removes all nodes from all tables if the Argument is blank.

Arguments

Arguments – literal name of the table to be completely deleted. Generates an error (MCFIND) if a table is specified but does not exist. If left blank (the default), then all tables are deleted.


memInsert()

Description

Adds the current blob data to a new node in the table.

Arguments

NoteThe Key Field and Key Datalink arguments are required and mutually exclusive. The first non-null value to occur is used. Generates an error (MCINPUT) if both arguments are null (blank). The “Key..” value must be exact. An error is generated (MCDUPKEY) if the key already exists in the table as specified by the Table argument. The MCMEM error is returned if memory cannot be allocated for the new node.


memKeyList()

Description

Replaces current blob data with an index (ordered list) of all node key values in the BST specified by the Table argument, inserting an optional separator string between each key value returned. Only retrieves key values that match the key mask.

Arguments

NoteThe Key Field, Key Datalink, and Key Lit arguments are required and mutually exclusive. The first non-null value to occur is used. Generates an error (MCINPUT) if all arguments are null (blank). The “Key..” is used as a mask for a substring search (as opposed to an exact match). Use “*” or “?” as a wildcard. An error is generated (MCFIND) if no matches are found.


memSelect()

Description

Replaces current blob data with stored data from a node, which is retrieved from the BST specified by the Table argument.

Arguments

NoteThe Key Field and Key Datalink arguments are required and mutually exclusive. The first non-null value to occur is used. Generates an error (MCINPUT) if all arguments are null (blank). The Key value must be exact. Generates an error (MCFIND) if the key is not found.


memTableAgeList()

Description

This function builds a key list based on the key age rather than using a mask on the key name, like memKeyList.

Arguments

See“dbDiskAgeList()” for a description of the arguments.


memUpdate()

Description

The memUpdate function works like memInsert except if a key already exists, it overwrites the data behind the key, as opposed to failing. In reverse mode, the function appends the data.

Arguments

See “memInsert()” for a description of the arguments.


shellCmd()

Description

Executes the UNIX command, or shell script file reference, in the arguments. The current blob area is not passed as an argument to the command or shell script.

Arguments


tblEdit()

Description

WARNING! Use this function only with tables that are in a tag/value format.

Allows you to add, change, or delete a translation table file. The incoming transaction contains the delimiter (optional), the name of the translation table file to edit (optional), the action to perform on the table (add, change, delete, reload), the tag, and the value. You can also optionally write an audit trail to the significant event log. The audit trail shows the date and time the filter ran, the name of the filter (tblEdit()), the name of the acquisition module that sent the transaction (SRCRef in the route_rec() call), the directory location of the table, the action performed, the tag, and the value.

Arguments

The production object puts the action to perform on the table (add, change, delete, reload), a delimiter, the tag, the delimiter, and the value.

The tblEdit filter always uses the character following the action as the delimiter, therefore, the delimiter must be the same between the action and the tag, and between the tag and the value.

The information needed to edit the translation table file can either be part of an incoming transaction or the entire transaction. When it is the production object’s entire input transaction, run this filter in the production object’s post-filters. Otherwise, run this filter from a rule or rule component object.

WARNING! The tblEdit() filter reads the entire table from disk, performs the edit, and saves the table back to disk, which can affect throughput.

Error values

If the tblEdit() filter fails, e-Biz Impact places one of the following error codes into the error message text. Use the geterrtext() method within an error function to extract this error code from the error message. See “Writing error functions”.

Code

Description

0

The arguments to the filter are bad or invalid, or the system is out of memory, or the system suffered a disk I/O failure.

-1

A change failed due to an invalid action code or not enough available memory.

-2

An add failed due to a duplicate key. Seen only in releases prior to e-Biz Impact version 2.19.

-3

An add failed due to not enough available memory.

-4

A delete failed because the key could not be found.

-5

A change failed due to not enough available memory.

-6

File open error on input.

-7

File open error on output.

-8

File write error on output.

-9

File write error on output items.

-10

Rename error on regeneration of translation table.

-11

Backup error on regeneration of translation table.

-12

Unlink error on regeneration of translation table.

-13

Translation table is not in a tag/value format.

Examples


writeFile()

Description

Writes the contents of the current blob area to the file specified in the arguments.

Arguments

Use one of the available argument fields to identify the file in which to write. The argument can include a path or just the filename. When the argument includes a path, always use forward slashes (/). If the subdirectories specified in a path do not exist, the filter attempts to create them. Leave all argument fields blank to use the contents of the current blob as the argument to the filter.





Copyright © 2005. Sybase Inc. All rights reserved. Dynamic routing functions

View this book as PDF