You are here: Commands > Fieldshift

Fieldshift

The Fieldshift command allows you to shift the starting position of a data field. For example, if data fields are added to or removed from a source file at any position before the end, data in previously defined fields often moves out of alignment. You can use Fieldshift to realign these data fields. By shifting a data field’s start position, you automatically shift the start position of that data field along with all data fields to its right.

Fieldshift only shifts physical data fields. Because computed fields are virtual fields that make reference to other fields, they are not affected.

You can shift data fields using the Shift Fields button on the [Edit Fields/Expressions] tab of the Table Layout window or using command mode.

Analyzer does not allow you to shift data fields if doing so causes the shifted data fields to extend beyond the current record length. As a result, you may need to increase the record length on the [Table Options] tab of the Table Layout window before shifting fields.

If a data field has been removed from the source file, delete the field from the table layout before shifting fields.

If a data field has been removed from the source file, decrease the record length on the [Table Options] tab after you shift the fields.

Parameters

The Fieldshift command has the following command parameters:

Columns

Specifies the number of bytes to shift to the right (+) or left (-).

Start

Specifies the starting position of the first field you want to shift.

OK

Indicates that the command is to be executed without confirmation.

Shift Fields Button

To shift fields using the Shift Fields button:

1. Select Edit from the menu and choose Table Layout to display the Table Layout window.
2. From the list of fields on the [Edit Fields/Expressions] tab, select the name of the leftmost data field of those fields that you want to shift. Then click the [Shift Fields] buton to open the Shift Fields dialog.
3. You can also click the Shift Fields button to open the Shift Fields dialog, then enter the starting byte of the first data field that you want to shift in the Start Shifting Fields From position text box.
• To display fields in order of their start positions from left to right, click the heading titled Start in the list View on the [Edit Fields/Expressions] tab.
• In multiple record-type files, you can shift fields related to a particular record type by first selecting the name of the filter that identifies these fields from the drop-down list on the [Edit Fields/Expressions] tab.
4. Enter the number of bytes that you want the fields to shift in the "Shift Fields by the Following Number of Bytes text box". Enter a positive number to move the fields to the right or a negative number to move the fields to the left.
5. Click [OK], then click [Yes] to confirm the realignment.

Command Mode Syntax

FIELDSHIFT START starting_position COLUMNS bytes_to_shift <data_filter_name> <OK>

• tarting_position specifies the byte position of the first field you want to shift
• bytes_to_shift specifies the number of bytes to shift.
• data_filter_name specifies the record type whose fields are to be shifted.

Examples

In the following Fieldshift command, field definitions starting on or after byte 12 will be shifted 4 bytes to the right.

FIELDSHIFT START 12 COLUMNS 4