MOVE (MV)
The MOVE parameter builds an output record by moving data to it. The data can be supplied from either the input record, control cards, or timestamps.
Three syntax forms are used for the three data sources:
Input Record Data:
MOVE=(to-location,length,from-location)
Control Card Data:
MOVE=(to-location,[dupl]data)
Timestamp Data:
MOVE=(to-location,TS[+nn],length,timezone)
When a MOVE parameter is executed, data is moved from the input area, where input records reside, to the output area, where the output records reside. The output area is initialized to the PADCHAR value (which has a default of X’00’); any output location that does not have data moved to it retains the PADCHAR value. The initialization is performed prior to the first record being read and only at that time. (See PADCHAR-PAD.) You must build the entire output record.
Data that has been moved to an output location remains there until overlaid by another MOVE. This allows locations to be initialized once and left alone through successive iterations of the current function and/or successive functions. This also permits the merging of data from multiple input records into one output record.
During a move, File-AID maintains two relative locations, called the input and output relative locations, that correspond to the input and output areas. The input relative location advances whenever a scanning parameter results in a hit. The output relative location changes to where the last MOVE ended. Both the input and output relative location are reset to 1 (one) when File-AID reads a new input record.
When building variable-length records, File-AID keeps track of the highest location to which data has been moved, and writes a record containing the greatest length achieved. This feature allows the coding of MOVE parameters that reference locations in any order or combination of both actual and relative locations. However, you should code actual locations from left to right or enter primarily relative locations. This eliminates confusion as to whether the entire record has been filled.
When multiple variable-length records are created with multiple MOVE and WRITE parameters, the length of each record created from a single input record can only be equal to or greater than the preceding created record.
When creating one output variable-length record from multiple input records, the length of the fully merged record is determined by the data moved to the highest location of the output record for the final iteration for each output record.
When records are copied to an output dataset with a MOVE parameter, and a DUMP, LIST, or PRINT parameter is also used, File-AID prints both the input and output records on the SYSLIST dataset. File-AID labels the output record as OUTPUT, and prints the logical record number and record length. The entire output record is printed, including the RDW for variable length records depending on the setting of the RDW parameter (see RDW).
When the MOVE parameter is used with a DUMP, LIST, or PRINT function, File-AID treats the function as a request to display only part of the input record. File-AID keeps track of the highest output record location used and displays an output record equal to that length. However, the RDW for variable length records is not printed for these functions when the MOVE parameter is present regardless of the setting of the RDW parameter. This option is useful when a small portion of data in a large record must be examined.
The syntax of the MOVE parameter is based on whether the input data is received from an input record or control cards. Each syntax is described below.
Input record data
When moving data from the input record, the syntax of the MOVE parameter is:
MOVE=(to-location,length,from-location)
to-location
Location in the output record that the data is to occupy. Any valid actual or relative location can be used. Use a relative location of +0 to have File-AID use the current relative location in the output record.
length
Length of the data to move. Valid values are 0 (zero) to 256. Use 0 (zero) to tell File-AID to calculate the length, from the specified from-location in the input record, to the end of the input record, and to use the result as the length of the data to move.
from-location
Location in the input record where the data to move originates. It can be an actual or relative location. Use a relative location of +0 to reference the current relative location (first byte or last scan match location) in the input record. (See Relative Location.)
Example 1:
Example 1 lists the first ten locations of the input record. This use of the MOVE parameter avoids the printing of unneeded data.
Example 2:
Example 2 moves ten bytes of data from location 15 in the input record to location 1 in the output record.
Example 3:
Example 3 moves data, beginning in location 10 of the input record, to the output record. Because the length specified is zero (0), as much of the input record data, starting from location 10, as can fit into the remaining space of the output record, is moved.
Example 4:
Example 4 moves five bytes of data beginning in location 30 of the input area to the output area beginning at location 10. Since only the MOVE parameter is coded with the function, the remaining locations in the output record area remain the current PADCHAR parameter value.
Control card data
When control cards provide the data to place into an output record, the syntax of the MOVE parameter is:
MOVE=(to-location,[dupl]data)
to-location
Location in the output record that the data is to occupy. Any valid actual or relative location can be used. Use a relative location of +0 to reference the next available location in the output record.
dupl
Optional duplication factor that defines the number of times File-AID replicates the data string to move, starting at the specified to-location.
data
Data to move into the output record. Any valid data type listed in Data Element is allowed. The length of the MOVE is determined by the length of the data element entered, including the value of the dupl element.
Example 5:
Example 5 moves the string ABC to the output locations 1, 2, and 3.
Example 6:
Example 6 moves ten repetitions of the string ABC to output locations 1 through 30.
Example 7:
Example 7 moves a three-byte packed field, with a value of positive 1 (equivalent to X’00001C’), to the next available output location. The length of this packed field is determined by the number of decimal digits specified, including the leading zeros.
Timestamp data
When moving timestamp data into a given location, the syntax of the MOVE parameter is:
MOVE=(to-location,TS[+nn],length,timezone)
Timestamp is a 21 byte field in the format yyyymmddThhmmssffffff.
yyyymmdd is the 8 digit year, month and day.
The T is the actual letter T.
hhmmss is the 6 digit hour, minute, and second.
ffffff represents fractions of a second.
to-location
Location in the output record that the data is to occupy. Any valid actual or relative location can be used. Use a relative location of +0 to reference the next available location in the output record.
TS[+nn]
Identifies the parameter as a timestamp (TS or TIMESTAMP). TS may have an offset of +0 through +20 specified. If no offset is specified, the default is zero (0) which points at yyyy. TS+4 would point at the 5th position (mm - month).
length
Length (number of timestamp bytes to process) of the timestamp field. Valid values 1-21.
timezone
timezone is the fourth parameter (value following the length) specifies the time zone to use:
LOC or LOCAL specifies local time zone.
UTC specifies Universal Time Coordinated.
GMT specifies Greenwich Meridian Time.
If none is specified, the default is local time.
Example 8:
Example 8 replaces record positions 34-54 with the entire local timestamp.