Symbol Syntax

You must address each type of symbol using the proper syntax.

String Constant

To address a string constant, enclose the constant value in quotes:


#fieldname = "HDR";

HDR is the constant value.

Addressing or Creating a Field in Internal Storage

To address a field or create a field in internal storage, within the scope of the current mapping action, the syntax is #FIELD_NAME:


#field_1 = 2;

2 is a numeric constant value.

Addressing or Creating a Repeating Field in Internal Storage

To address a repeating field or create a repeating field in internal storage, within the scope of the current mapping action, the syntax is #FIELD_NAME[index]:


#field_1[3] = 2;

2 is a numeric constant value.

For more information about using indexes in maps, see Using Indexes in the Sterling B2B Integrator Map Editor and Translator.

Addressing or Creating a Field in a Group

To address a field within a group or create a field within a group in internal storage within the scope of the current hierarchy, the syntax is $GROUP.#FIELD_NAME.

Addressing or Creating a Repeating Field in a Group

To address a repeating field within a group or create a repeating field within a group in internal storage within the scope of the current hierarchy, the syntax is $GROUP.#FIELD_NAME[index].

For more information about using indexes in map, see Using Indexes in the Sterling B2B Integrator Map Editor and Translator.

Addressing or Creating a Group in Internal Storage

To fully address a group in the entire internal storage area or create a group in internal storage, the syntax is $LOOP[index1][index2][index3] where the index entries indicate the hierarchical structure of the loop and enable you to address specific instances of a group:


$Group_C[3][2].#Field_2

You are specifying the second instance of Group_C within the third instance of Group_B.

The following figure shows this relationship:

Addressing or Creating a Repeating Field in Internal Storage

Addressing or creating a repeating field in internal storage is similar to how you address or create a group in internal storage; however, for a repeating field, you can specify an instance of the field:


$Group_C[3][2].#Field_2[5]

You are specifying the fifth instance of field two within the second instance of Group_C within the third instance of Group_B.

Addressing an Array

To address an array (of any type), you address each field of the array individually. For example, if array_1 is an array (of integers) and is declared integer array_1[5], with variables 0 through 4, each field of the array is addressed individually:


array_1[0]
array_1[1]
array_1[2]
array_1[3]
array_1[4]

Accessing an Accumulator

An accumulator can be accessed in the same manner as variables or internal storage.

To assign a value to a specific accumulator (to write data into the accumulator), use the syntax accum(n), where n is the number (not the name) of the accumulator:


accum(2) = 5;

To assign the value of a field to equal a specific accumulator (to read data out of an accumulator), use the syntax accum(n), where n is the number (not the name) of the accumulator:


#field = accum(3)

Accessing Repeating Elements

You can access a specific occurrence of a repeating element (for EDI data) and access a specific occurrence of a field within a repeating composite (for EDI data).

This is the syntax for accessing a specific occurrence of a repeating field and a field within a repeating composite:


field_name[index_variable] = string;
where:      integer_variable   =   integer variable that indicates the specific 
occurrence of a repeating field or field within a 
repeating composite.

This is an example of accessing a specific occurrence of a repeating field and a field within a repeating composite.


string [32]strMsg;
 
strMsg = "Test";
#f2[1] = strMsg;
//access single repeating field
 
#f3[1] = strMsg;
//access a field within a repeating composite
//The rule assigns a string value to 2 different fields, #f2 and #f3 -- #f2 is 
//a single repeating field that can loop up to 10 times and #f3 is a field 
//within a repeating composite where the composite can loop up to 
//10 times. 

Example of a Simple Statement with Symbols

A statement is a single operation that consists of a combination of expressions, keywords, commands, operators, and symbols. The following figure shows an example of a simple statement, including symbols: