Formatting Functions

Transforming Numeric Packed values into ASCII

Inserting a decimal point in a value

Transforming Numeric values into Alphanumeric without leading zeroes

Transforming Numeric values into Alphanumeric with leading zeroes

Transforming Numeric values into left-justified Alphanumeric

Transforming Numeric values into Hexadecimal

Transforming Numeric values into Alphanumeric with leading zeroes, given by empty spaces

About Formatting Functions

You use Formatting Functions to access data formatting modules (entry point 71) to apply specific formatting modules to the contents of alphanumeric or numeric fields in a reference table. These Functions are based on external calls that you must program beforehand. For more information, refer to AccountingIntegrator Enabler  Rule Engine Exits and External Calls Manual.

The syntax for the Table key depends on which of the following formatting modules you want to access:

  • transforming Numeric Packed values into ASCII
  • inserting a decimal point in a value
  • transforming Numeric values into Alphanumeric without leading zeroes
  • transforming Numeric values into Alphanumeric with leading zeroes
  • transforming Numeric values into left-justified Alphanumeric
  • transforming Numeric values into Hexadecimal
  • transforming Numeric values into Alphanumeric with leading zeroes, given by empty spaces

For more information, refer to Overview of $SEARCH Function.

Formatting functions are distinct from Table functions which you use for working with arguments and values in Table objects created within Composer.

Note: The maximum length of the Table key, including empty spaces and punctuation is 256 characters.

$SEARCH("lllt";"71";"PACK2ASC:ppp"&Field_to_convert)

Description

$SEARCH("lllt";"71";"PACK2ASC:ppp"&Field_to_convert) transforms a Packed field into an ASCII format.

Syntax

$SEARCH("lllt";"71";"PACK2ASC:ppp"&Field_to_convert)

Return

Alphanumeric values that must be compatible with the Target field if used in a Mapping Rule.

Parameters

lllt specifies the length and data type of the value extracted by the function:

  • lll

    is the length of the value extracted by the function
  • t

    is the data type of the
    value extracted by the function (A, N, D) 

71

corresponds to the predefined entry point for external calls specific to formatting modules

ppp

corresponds to the physical length of the field to be converted. For example, a field named FIELD2 with length P17, has a physical length of 9. That is, 17/2 + 1.

Field_to_convert

Specify the zone to convert. This is the name of the field whose value you want to convert to ASCII. You must use a Packed data type in this field.

Example

For a field named FIELD1 which has a length P18, the physical length of FIELD1 is 15 (28/2 + 1):

$SEARCH("018N"; "71"; "PACK2ASC:010" &FIELD1)

$SEARCH("lllt";"71";"POINT:")

Description

$SEARCH("lllt";"71";"POINT:&Field_to_process") inserts a decimal point into a numeric value. By default the function produces a value to two decimal places.

Syntax

$SEARCH("lllt";"71";"POINT:&Field_to_process")

Return

Numeric values that must be compatible with the Target field if used in a Mapping Rule

Parameters

lllt

71

Field_to_process

is the name of the field whose value must contain a decimal point separator. You must use a Numeric data type in this field.

Examples

The following examples are based on a variable named CH of length and data type N6, that contains the value 987654.

Example 1:

 ("007A";"71";"POINT:"&@CH) returns the result:9876.54

Example 2:

("006A";"71";"POINT:"&@CH) returns the result:987.65

Note: The total number of characters returned is that specified by the lll parameter.

$SEARCH("lllt";"71";"NUM2ASC:"&Field_to_convert)

Description

$SEARCH("lllt";"71";"NUM2ASC:"&Field_to_convert) transforms numeric values into alphanumerics without leading zeroes.

Syntax

$SEARCH("lllt";"71";"NUM2ASC:"&Field_to_convert)

Return

Alphanumeric values that must be compatible with the Target field if used in a Mapping Rule

Parameters

lllt

71

Field_to_convert

is the name of the field whose value is to be converted to an alphanumeric value.

  • There are no zeros to the left of the number in the result of this transformation, even if the length of the number is less than the length of the target field.
  • The value of the field to convert is truncated if its length is greater than the length of the target field.
  • Spaces are added to the right of the number if the length of the number is less than the length of the target field.

Examples

Example 1:

A variable named CH of length and data type N5, contains the value 12345.

The function ("010A";"71";"NUM2ASC:"&@CH) returns a string 12345 preceded by five spaces.

Example 2:

A variable named CH of length and data type N10, contains the value 1234567890.

The function ("005A";"71";"NUM2ASC:"&@CH) returns the result:12345.

$SEARCH("lllt";"71";"NUM2ASC0:"&Field_to_convert)

Description

$SEARCH("lllt";"71";"NUM2ASC0:"&Field_to_convert) transforms numeric values into alphanumerics with leading zeroes.

Syntax

$SEARCH("lllt";"71";"NUM2ASC0:"&Field_to_convert)

Return

Alphanumeric values that must be compatible with the Target field if used in a Mapping Rule.

Parameters

lllt

71

Field_to_convert

is the name of the field whose value is to be converted to an alphanumeric value.

  • Zeros are added to the left of the number in the result of this transformation, when the length of the number is less than the length of the target field.
  • The value of the field to convert is truncated if its length is greater than the length of the target field.

Examples

Example 1:

A variable named CH of length and data type N10, contains the value 1234567890.  

The function $SEARCH("005A";"71";"NUM2ASC0:"&@CH) returns the result: 12345

Example 2:

A variable named CH of length and data type N5, contains the value 12345.

The function $SEARCH("010A";"71";"NUM2ASC0:"&@CH) returns the result: 0000012345

The result is the string 12345 preceded by five zeroes.

 

$SEARCH("lllt";"71";"NUM2LEFT:"&Field_to_convert)

Description

$SEARCH("lllt";"71";"NUM2LEFT:"&Field_to_convert) transforms numeric values into left-justified alphanumeric.

Syntax

$SEARCH("lllt";"71";"NUM2LEFT:"&Field_to_convert)

Return

Alphanumeric values that must be compatible with the Target field if used in a Mapping Rule.

Parameters

lllt

71

Field_to_convert

is the name of the field whose value is to be converted.

  • The result of the transformation is justified to the left.
  • Spaces are added to the right when needed.

Examples

Example 1:

A variable named CH of length and data type N10, contains the value 1234567890.  

The function $SEARCH("005A";"71";"NUM2LEFT:"&@CH) returns the result:12345

Example 2:

A variable named CH of length and data type N5, contains the value 12345.

The function $SEARCH("010A";"71";"NUM2LEFT:"&@CH) returns the result: 12345-----

The result is the string 12345 followed by five spaces.

$SEARCH("lllt";"71";"ASC2HEX:"Numeric_value)

Description

$SEARCH("lllt";"71";"ASC2HEX:"Numeric_value) transforms numeric values into hexadecimal.

Syntax

$SEARCH("lllt";"71";"ASC2HEX:"Numeric_value)

Return

Alphanumeric values that must be compatible with the Target field if used in a Mapping Rule.

Parameters

lllt

71

Numeric_value

is the numeric value to be converted to hexadecimal.

For a target field of length n, the Numeric_value must be entered using n characters, with left zeros, if the length of the number is less than n.  

Examples

Example 1:

$SEARCH(“001A”;”71”;”ASC2HEX:2”)

Result: Corresponds to the hexadecimal value 02

Example 2:

$SEARCH(“001A”;”71”;”ASC2HEX:13”)

Result: Corresponds to the hexadecimal value 0D

$SEARCH("lllt";"71";"ASC2ASC0_SPACE:Numeric_value")

Description

$SEARCH("lllt";"71";"ASC2ASC0_SPACE:Numeric_value")  transforms ASCII values to alphanumeric with leading zeros or spaces when needed .

Syntax

$SEARCH("lllt";"71";"ASC2ASC0_SPACE:Numeric_value")

The parentheses and the double quotes are mandatory.

Return

Alphanumeric values that must be compatible with the Target field if used in a Mapping Rule.

Parameters

lllt

71

Numeric_value

is the value to convert.

Examples

Example 1:

$SEARCH(“005A”;”71”;”ASC2ASC0_SPACE:12345”)

Result: "12345"

Example 2:

$SEARCH(“010A”;”71”;”ASC2ASC0_SPACE:12345”)

Result: "0000012345"

Example 3:

$SEARCH("010A";"71";"ASC2ASC0_SPACE:01234")

Result: "-----01234"

Back to top

Related Links