Skip to content

qie.parseFixedLengthString

Signature: qie.parseFixedLengthString(value, length, lineEnding, encoding*, fieldDefinition*)

Returns: FixedLength Message fixedLengthMessage - the associated FixedLength message object

Parse the input string as Fixed Length and return the associated message object.

Note

You must specify either length or lineEnding or both.

Note

The environment variable used for the fieldDefinition must contain the following columns: name, offset, length.

Note

The return value CAN NEVER be assigned to the bound-in message object; it should be assigned to a locally declared variable.

Parameters

Type Name Description Default
String value the source string to be parsed
Integer length the length of each line in the fixed width message
String lineEnding the record delimiter to use for parsing
String encoding* (optional) the character encoding for this message Source Node encoding
String fieldDefinition* (optional) the system variable table containing columns specified for 'name','offset','length' that define the fixed width message parts null

Example

// Example: parse a fixed-length string into a Fixed Width message.

var sourceString = "100APPLES          7500";

var fixedLengthMessage = qie.parseFixedLengthString(
    sourceString,   // value: source string to parse
    23,             // length: total length of each fixed-width line
    '',             // lineEnding: record delimiter (empty when using fixed length)
    'ASCII',        // encoding: character encoding
    'fixedWidth'    // fieldDefinition: system variable table defining fields
);