The :W option

When the :W option is specified using the Input File Override (-I) execution command, variable length records are reformatted by copying them from the input file into fixed format workspace before mapping begins and the map will take its input not from the input file but from workspace.

When this option is specified using the Output File Override (-O) execution command, data is mapped into fixed format workspace and then copied to its final target after mapping completes. Variable length records are separated out during the copy operation based on a defined record separator.

The following examples demonstrate how to specify the :W option using the Input File Override (-I) and Output File Override (-O) execution commands:

Example
Description
-I1:W MYINPUT
Input 1, MYINPUT, is a TSQ of variable length records; copy it to fixed format workspace before mapping it.
-O1:W MYOUTPUT
Output 1, MYOUTPUT, is a TSQ that will contain variable length records. Data is mapped to fixed format workspace and after mapping completes, variable length records are separated out and written to the queue.

Output files of variable length records must have a delimiter or delimiters at the end of each record so that the copy operation can detect where one record ends and the next begins. Output record separators are defined in and built by the map. The default delimiter expected is a single byte with the value hex 15, decimal 21. Optionally, you can use different delimiters by specifying them as a comma-delimited list of character or hex values. (Xnn is the syntax for indicating a hexadecimal value.)

The following example demonstrates how to specify a delimiter list using the Input File Override (-I) and Output File Override (-O) execution commands:

Example
Description
-O1:WX0D,X0A
Output data is mapped to fixed format workspace and records are copied to a TSQ of variable length records using the delimiter list of hex 0D 0A as record separators. In other words, when a 0D 0A byte pair is sensed in the output stream, it is understood that it indicates the end of a record. Record separators are removed.

Because reads against transient data queues are destructive and multiple passes may need to be made against them, data mapped to and from TDQs take place in workspace, regardless of the record format.