Syntax


ALIGN

 string-1

[ PREFIX | SUFFIX | WORD | CHAR ]

[StartScan-column]  { align-column | MAX }  

[ line-control-range ]

[ color-selection-criteria]

[ DS | CS ]

[ X | NX ]

[ U | NU }

[ ALL ]


Operands


string-1

The string being searched for. The string should contain the single occurrence of the value you wish to shift right to an alignment-column. This string may be any normal search value, a normal literal, a Picture string, or a Regular Expression


PREFIX

Locates search-string at the beginning of a word.


SUFFIX

Locates search-string at the end of a word.


WORD

Locates search-string when it is delimited on both sides by blanks or other non-Word characters.


CHAR

Locates search-string regardless of what precedes or follows it.


StartScan-column

If this optional column is provided, it identifies the starting column in each line at which the search for the string-1 is to begin.


align-column | MAX

You may specify either:

  • a specific desired column number to which you wish the string to me moved.  If the found string is to the right of this column (and would thus be shifted left) no alignment will take place. A warning message will be produced advising you that this has occurred.
  • MAX - which requests SPFLite to scan for all valid occurrences of the string-1 and use the right-most found column location as the desired alignment column.


line-control-range

The range of lines which are to be processed by the command. Line control ranges provide a powerful tool to customize the range of lines to be processed. The full syntax and allowable operands which make up a line control range are discussed in "Line Control Range Specification". Refer to that section of the documentation for details. 


color-selection-criteria

A request for selection based on the highlight color of the from-string. Color requests provide another powerful tool to control search selection. The full syntax and allowable operands which make up a color-selection-criteria  are discussed in "Color Selection Criteria Specification". Refer to that section of the documentation for details.


CS | DS

Specifies the Column Shift / Data Shift mode for this particular ALIGN command. See Effect of CHANGE/ALIGN Command on Column-Dependent Data for the significance of this operand. If not specified, the default CS/DS value for this file's Profile will be used.



X | NX

Specifies a subset of the line range to be processed. X requests only excluded lines are to be processed, NX requests only non-excluded lines are to be processed. If neither X or NX are specified, all lines in the range will be processed.


U | NU

Specifies a subset of the line range to be processed. U requests only User lines are to be examined, NU requests only non-User lines are to be examined. If neither U or NU are specified, all lines in the range will be examined.


ALL

ALL requests that all lines in the line range will be aligned. If the ALL option is omitted, then by default only the first line in the lines in the line range will be aligned.


  

 Description


ALIGN is used to simplify a common requirement. It provides a simple method to re-arrange or 'columnize' data.  Your data may be in some kind of 'ragged' columnar format and manually shifting data line by line can be very tedious.


Alignment Samples


This example aligns the data based on the word 'AND'


Command > ALIGN 'AND' ALL 15

****** ----+----1----+----2----+----3----+----4----+

000001 ABCDEF AND GHIJKL

000002 JKLMN AND OPQRS

000003 Y AND N


Result:

****** ----+----1----+----2----+----3----+----4----+

000001 ABCDEF        AND GHIJKL

000002 JKLMN         AND OPQRS

000003 Y             AND N


This example is similar, but shows the use of a startscan-column operand


Command > ALIGN 'AND' ALL 5 15

****** ----+----1----+----2----+----3----+----4----+

000001 ABC AND DEF 

000002 JKLMN AND OPQRS

000003 Y AND N


Result:

****** ----+----1----+----2----+----3----+----4----+

000001 ABC           AND DEF

000002 JKLMN         AND OPQRS

000003 Y AND N


Note: Line 000003 was skipped because the AND string was ignored since it was to the left of the StartScan-column.


The next examples show the difference between using the CS and DS operands


Command > ALIGN 'AND' ALL 20 CS

****** ----+----1----+----2----+----3----+----4----+

000001 ABC    AND        DEF 

000002 JKLMN AND                OPQRS

000003 Y AND                   N


Result:

****** ----+----1----+----2----+----3----+----4----+

000001 ABC                AND        DEF

000002 JKLMN              AND                OPQRS

000003 Y                  AND                   N


Note the spacing between the AND and the following words is maintained since CS (Column Shift Mode) was in effect.



Command > ALIGN 'AND' ALL 20 DS

****** ----+----1----+----2----+----3----+----4----+

000001 ABC    AND         DEF 

000002 JKLMN AND               OPQRS

000003 Y AND                   N


Result:

****** ----+----1----+----2----+----3----+----4----+

000001 ABC                AND        DEF

000002 JKLMN              AND   OPQRS

000003 Y                  AND   N


Note: Because DS (Data Shift Mode) was in effect, the results are dramatically different.


For line 00001 there are no 'spare' spaces between AND and the next word to allow shifting without also moving the DEF string, so the change is done in CS (Column shift mode)


For line 000002, there is plenty of unused space between AND and OPQRS, so the AND is shifted without moving the OPQRS string.


For line 000003, there is also plenty of spare room, so AND is moved, and N remains in place.


The next examples show how the MAX column request works.


Command > ALIGN 'AND' ALL MAX CS

****** ----+----1----+----2----+----3----+----4----+

000001 ABC    AND        DEF 

000002 JKLMN AND                OPQRS

000003 Y AND                   N


Result:

****** ----+----1----+----2----+----3----+----4----+

000001 ABC    AND        DEF

000002 JKLMN  AND                OPQRS

000003 Y      AND                   N


SPFLite scans the range and the rightmost AND is in line 00001, Column 8, so 8 is used as the alignment column.


Created with the Personal Edition of HelpNDoc: Full-featured Kindle eBooks generator