AMT Help Files

UNSTRING

Unstring Without Delimiter

COBOL JAVA
UNSTRING unstringPosition

Syntax

unstringPosition ( <source>, <into>[, <pointer>] )

Parameter(s)

<source>
Item that will be unstringed.

<into>
The receiving variable.

<pointer>
The pointer variable which contains the start position.

Example(s)

COBOL Java
UNSTRING TXTINPUT INTO A.
                
UnstringPosition(m_LocDef.Txtinput, m_LocDef.A);
                
UNSTRING TXTINPUT INTO A POINTER Y.
                
UnstringPosition(m_LocDef.Txtinput, m_LocDef.A, m_LocDef.Y);
                
UNSTRING TXTINPUT INTO A B POINTER Y.
                
UnstringPosition(m_LocDef.Txtinput, new AmtVariable[] {m_LocDef.A, m_LocDef.B}, m_LocDef.Y);
                

Simple Unstring With Delimiter

COBOL JAVA
UNSTRING unstring

Syntax

<into> = unstring ( <source>, <pointer>, <delimiter>[, <keepMultipleOcurrence>] )

Parameter(s)

<into>
The receiving variable.

<source>
Item that will be unstringed.

<pointer>
The pointer variable, enter null when not used.

<delimiter>
The delimiter variable or literal.

<keepMultipleOcurrence>
When true, multiple occurrences of the delimiter will be counted separately. Defaults to false.

Example(s)

COBOL Java
UNSTRING TXTINPUT DELIMITED BY "A" INTO A.
                
m_LocDef.A.Value = Unstring(m_LocDef.Txtinput.Value, 0, "A", true);
                
UNSTRING TXTINPUT DELIMITED BY B INTO A.
                
m_LocDef.A.Value = Unstring(m_LocDef.Txtinput.Value, 0, m_LocDef.B.Value, true);
                
UNSTRING TXTINPUT DELIMITED BY ALL "AB" INTO A.
                
m_LocDef.A.Value = Unstring(m_LocDef.Txtinput.Value, 0, "AB");
                

Complex Unstring With Delimiter

COBOL JAVA
UNSTRING cobolUnstring

Syntax

cobolUnstring ( <source>, <delimiters>, <into>[, <all>[, <pointer>[, <tally>[, <counts>[, <delimiterIn>]]]]])

Parameter(s)

<source>
Item that will be unstringed.

<delimiters>
An array of delimiters.

<into>
The receiving variable.

<all>
An array of Booleans corresponding to the delimiters. When set to true, multiple contiguous occurrences of any delimiter are treated as if there were only one occurrence. Defaults to null.

<pointer>
The pointer variable which contains the start position. Defaults to null.

<tally>
The tallying variable that is incremented by the number of delimited fields processed. Defaults to null.

<counts>
The count variable that holds the amount of characters that are transferred to the receiving variable. Defaults to null.

<delimiterIn>
The 'delimiter in' variable which receives the delimiter associated with the receiving variable. Defaults to null.

Example(s)

COBOL Java
UNSTRING TXTINPUT DELIMITED BY "A"
    INTO A B POINTER Y.
                
cobolUnString(locDef.txtinput, "A", new AmtVariable[] {locDef.a, locDef.b}, false, locDef.y);
                
UNSTRING TXTINPUT DELIMITED BY "A" OR "B" INTO A.
                
cobolUnString(locDef.txtinput, new String[] {"A", "B"}, locDef.a);
                
UNSTRING TXTINPUT DELIMITED BY A OR ALL "B" INTO A B.
                
cobolUnString(locDef.txtinput, new String[] {locDef.a.toString(), "B"}, new AmtVariable[] {locDef.a, locDef.b}, new boolean[] {false, true});
                
UNSTRING TXTINPUT DELIMITED BY B INTO A DELIMITER C.
                
cobolUnString(locDef.txtinput, locDef.b.toString(), locDef.a, false, null, null, null, locDef.c);
                
UNSTRING TXTINPUT DELIMITED BY D OR ALL "B"
    INTO A DELIMITER C.
                
cobolUnString(locDef.txtinput, new String[] {locDef.d.toString(), "B"}, locDef.a, new boolean[] {false, true}, null, null, null, locDef.c);
                
UNSTRING TXTINPUT DELIMITED BY A
    OR ALL B INTO C D DELIMITER E
    COUNT X POINTER Y TALLYING Z
    OVERFLOW MOVE "There was overflow" to overflowstatus
    NOT OVERFLOW MOVE "No overflow" to overflowstatus.
                
if (!(cobolUnString(locDef.txtinput, new String[] {locDef.a.toString(), locDef.b.toString()}, new AmtVariable[] {locDef.c, locDef.d}, new boolean[] {false, true}, locDef.y, locDef.z, new Object[] {null, locDef.x}, new AmtVariable[] {null, locDef.e}))) {
    locDef.overflowstatus.assign("There was overflow");
} else {
    locDef.overflowstatus.assign("No overflow");
}