SQZ Subparameter - mfx - 3.1

Syncsort™ MFX Programmers Guide

Product type
Software
Portfolio
Integrate
Product family
Syncsort™ Software
Product
Syncsort™ MFX > MFX
Version
3.1
Language
English
Content type
Programmer’s Guide
Product name
Syncsort™ MFX
Title
Syncsort™ MFX Programmers Guide
Copyright
2024
First publish date
2010
Last updated
2024-08-27
Published on
2024-08-27T08:14:56.318001

The SQZ subparameter specifies that an input field be processed for “left-squeezing” or “right-squeezing” for the output record. It includes the justification functions of the JFY subparameter but adds elimination of all blank characters in the input field and additional options for selecting and replacing blank and nonblank characters.

The SQZ subparameter specifies the following basic operations:

  • All blank characters in the input field are eliminated.

  • If left-shifting is specified, the remaining characters are shifted left; any necessary blanks are introduced on the right to create a fixed-length field.

  • If right-shifting is specified, the remaining characters are shifted right; any necessary blanks are introduced on the left to create a fixed-length field.

  • If a variable-length field is requested, all characters are shifted left and trailing blanks are eliminated.

The SQZ subparameter also can specify the following options:

  • Introduce leading and trailing nonblank characters.

  • Replace user-specified nonblank characters with blank characters prior to squeeze operation.

  • Replace blank characters with user-specified nonblank characters.

  • Retain blank characters between paired apostrophes.

  • Retain blank characters between paired quotes.

  • Change the length of the field in the output record.

The format of the SQZ subparameter is shown below:
Figure 1. SQZ Subparameter

The following describes the elements of the SQZ subparameter:

p,l

Specifies the beginning byte position p and byte length l of the input record’s relevant field.

%pp

Specifies a fixed-length parsed field. See PARSE Parameter (Optional) for further description.

SHIFT=LEFT

Specifies left-squeezing of the input field. By default, all blank characters are eliminated and all nonblank characters are shifted left; if necessary, blank characters are introduced on the right side to compensate for the length of the output field. (The default output field length is equal to the input field length.)

SHIFT=RIGHT

Specifies right-squeezing of the input field. By default, all blank characters are eliminated and all nonblank characters are shifted right; if necessary, blank characters are introduced on the left side to compensate for the length of the output field. (The default output field length is equal to the input field length.)

VL

Specifies that a variable-length field should be produced. The field will be left-justified and all blank characters will be deleted. The output record must be a variable-length record.

The maximum length of the field is determined from the input field length and the lengths of any LEAD, MID and TRAIL strings.

Any INREC/OUTREC fields following a VL field cannot specify a starting column number or any of the alignment options (H, F or D for halfword, fullword or doubleword alignment). Also, VL cannot be used with the OVERLAY parameter or the LENGTH subparamter.

VL is permitted with fixed-length data and OUTFIL FTOV. It is also permitted with OUTFIL IFTHEN and FTOV, but not with a WHEN=INIT parameter or with a HIT=NEXT parameter when FTOV is used.

LENGTH=n

Optionally alters the length of the output field to accommodate a change in the total number of characters from the input field. The default output field length is equal to the input field length l. Use LENGTH=n to either extend a field that needs to be larger due to the addition of a leading or trailing string, or to shorten a field from the default length to reduce the number of padding blank characters. LENGTH cannot be specified with the VL subparameter.

PREBLANK=list

Optionally specifies user-defined nonblank characters to be replaced with blank characters before squeezing. The characters to be replaced are specified together in a character string constant (C'string') or hexa­decimal string constant (X'hh...hh') from 1 to 10 bytes. PREBLANK searches throughout the entire input field and substitutes a blank char­acter for each individual nonblank character that matches any individ­ual PREBLANK string character. For example, PREBLANK=C'<>' replaces each occurrence of '<' and '>' with a blank character through­out the entire input field before squeeze operation.

LEAD=string

Optionally specifies a character constant (C'string') or hexadecimal constant (X'hh...hh') from 1 to 50 bytes that is placed in the output field immediately left of the first nonblank character in the field. Note that LENGTH=n also may need to be specified to accommodate the additional leading characters. For example, LEAD=C'(' inserts '(' as a leading character in the field.

MID=string

Optionally specifies insertion of a string per one or group of adjoining blank characters that is eliminated between the first and last nonblank characters in the field. The string can be a character constant (C'string') or hexadecimal constant (X'hh...hh') from 1 to 10 bytes. Note that LENGTH=n also may need to be specified to accommodate the additional characters. For example, MID=C'*' substitutes a '*' for every group of one or more adjoining blank characters that have been eliminated between the first and last nonblank characters in the field.

TRAIL=string

Optionally specifies a character constant (C'string') or hexadecimal constant (X'hh...hh') from 1 to 50 bytes that is placed in the output field immediately right of the last nonblank character in the field. Note that LENGTH=n also may need to be specified to accommodate the additional trailing characters. For example, TRAIL=C')' inserts ')' as a trailing character in the field.

PAIR=APOST

Optionally specifies that all blank and PREBLANK characters between pairs of apostrophes remain unchanged. Any apostrophe throughout the field also remains unchanged. For an unpaired apostrophe, if SHIFT=LEFT or VL is specified, the characters are unchanged from the apostrophe rightward to the end of the field; if SHIFT=RIGHT is specified, the characters are unchanged from the apostrophe leftward to the beginning of the field.

PAIR=QUOTE

Optionally specifies that all blank and PREBLANK characters between pairs of quotes remain unchanged. Any quote throughout the field also remains unchanged. For an unpaired quote, if SHIFT=LEFT or VL is specified, the characters are unchanged from the quote rightward to the end of the field; if SHIFT=RIGHT is specified, the characters are unchanged from the quote leftward to the beginning of the field.

The following example illustrates the use of the SQZ subparameter:
Figure 2. Sample SQZ subparameter

In the example above, the field (11,18) is specified for left-squeezing for the output record; LENGTH changes the output length to 30 bytes to accommodate added characters; PREBLANK substitutes a blank character for each instance of /, [, ], *, { and } throughout the entire input field before squeezing; LEAD introduces < to the left of the first nonblank character in the squeezed field; MID substitutes a comma for each group of blank characters between the first and last nonblank characters; TRAIL introduces > to the right of the last nonblank character in the squeezed field; and PAIR specifies that all blank and PREBLANK characters between pairs of quotes remain unchanged.