Fri Jan 29 1999

ARMRCALC

Subject: ARMRCALC21

Function: mend(inp1,f1(1),f1(2),inp2,f2(1),f2(2), ... output)


mend(inp1,f1(1),f1(2),inp2,f2(1),f2(2), ... output)

Purpose

Use the mend function when you want to concatenate any number of input fields into a T-type output field.

Example

Assume that we need to generate effectivity brackets from a set of components as shown in the following table:

      input: PRFX1 FROM PRFX2  TO       output:     EFF
             ----- ---- ----- ----              -----------
             P2     813 P2     817              P2813-P2817
             P2     813 P2     821              P2813-P2821
             P2     818 P2     821              P2818-P2821
             P3     609 P3     610              P3609-P3610
             P3     612 P3     612              P3612-P3612
             P3     612 P3     618              P3612-P3618
             P3     613 P3     613              P3613-P3613
             P3     614 P3     615              P3614-P3615

The following calc bracket will generate the desired result:

      columns= prfx1 from prfx2 to

      calc_start=
         mend(prfx1,1,2, from,3,3, prfx2,7,2, to,9,3, eff)
      calc_end=

Calling Procedure

The mend function will not execute unless you specify a data view as shown above; i.e. we expect a pure columnar view with fields corresponding in number and sequence to the input fields listed in the mend function.

Any number of input fields may be specified. Their data type can be any ARMR data type except R-type. The output field is assumed to be a tabular type.

With each input field you specify the target field definition; e.g. in the example above, the first input "prfx1,1,2" states that prefix 1 will end up in the output effectivity field in column 1 for 2. The numeric "from" field will be converted (always with leading zeroes) into output column 3 for 3, etc.

ARMRCALC primes the output field with dashes ('-'). Intervening dashes will therefore appear as delimiters in the output columns for which there was no input. Should your application require special delimiting characters other than a dash, you will need to bring those in from another data base field.

Note

ARMRCALC will normally process a calc bracket for each data term of the data view. This is not the case with mend. When mend appears in a calc bracket, ARMRCALC performs a single pass. Therefore the call to the mend 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!