Subject: ARMRCALC20
Function: split(input, f1(1),f1(2),out1, f2(1),f2(2),out2,...etc)
Use the split function when you want to decompose a tabular field's values into any number of sub-strings.
We need to process block numbers by looking at the prefix and numeric parts as separate entities; i.e. we want to move data from a T-type BLOCK field to a T-type PREFIX field and a B-type NUMBER field as shown below:
input BLOCK output PRFX1 output NUMBER ----------- ------------ ------------- VA520 VA 520 VB113 VB 113 VB114 VB 114 VB115 VB 115 VB116 VB 116
The following calc bracket will generate the desired result:
columns= block calc_start= split(block, 1,2,prefix, 3,3,number) calc_end= end=
The split function will not execute unless you specify a data view as shown above; i.e. we expect a pure columnar view with a single field specified. The sole view field is expected to be the split function's "input" field.
The "input" field is assumed to be a T-type field.
You may specify any number of output fields. All ARMR data types are acceptable here. For each output item you must specify its source position and size; e.g. in the above example, prefix is extracted from positions 1 for 2 from block; number is extracted from position 3 for 3 from block.
ARMRCALC will normally process a calc bracket for each data term of the data view. This is not the case with split. When split appears in a calc bracket, ARMRCALC performs a single pass. Therefore the call to the split function should be the only statement in the calc bracket. Any other statements in the same bracket would only be executed for the very first data term!