z/OS DFSORT Application Programming Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


OUTREC control statement

z/OS DFSORT Application Programming Guide
SC23-6878-00

Read syntax diagramSkip visual syntax diagram
                     .-,----------.                          
                     V            |                          
>>-OUTREC--+-PARSE=(---definition-+-)--------------------+-----><
           |                   .-,----.                  |   
           |                   V      |                  |   
           '---+-+-FIELDS=-+-(---item-+-)------------+---'   
               | '-BUILD=--'                         |       
               |           .-,----.                  |       
               |           V      |                  |       
               +-OVERLAY=(---item-+-)----------------+       
               |           .-,----.                  |       
               |           V      |                  |       
               +-FINDREP=(---item-+-)----------------+       
               | .-,---------------.                 |       
               | V                 |                 |       
               '---IFTHEN=(clause)-+--+------------+-'       
                                      '-IFOUTLEN=n-'         

The OUTREC control statement allows you to reformat the input records after they are sorted, merged or copied.

The OUTREC control statement supports a wide variety of parsing, editing, and reformatting tasks, including:
  • The use of fixed position/length fields or variable position/length fields. For fixed fields, you specify the starting position and length of the field directly. For variable fields, such as delimited fields, comma separated values (CSV), tab separated values, blank separated values, keyword separated fields, null-terminated strings (and many other types), you define rules that allow DFSORT to extract the relevant data into fixed parsed fields, and then use the parsed fields as you would use fixed fields.
  • Insertion of blanks, zeros, strings, current date, future date, past date, current time, sequence numbers, decimal constants, and the results of arithmetic expressions before, between, and after the input fields in the reformatted records.
  • Sophisticated conversion capabilities, such as find and replace, hexadecimal display, bit display, translation of EBCDIC letters from lowercase to uppercase or uppercase to lowercase, translation of characters from EBCDIC to ASCII and from ASCII to EBCDIC, translation of characters using the ALTSEQ translation table, conversion of numeric values from one format to another, left-justify or left-squeeze (remove leading blanks or all blanks and shift left), and right-justify or right-squeeze (remove trailing blanks or all blanks and shift right).
  • Sophisticated editing capabilities, such as control of the way numeric fields are presented with respect to length, leading or suppressed zeros, thousands separators, decimal points, leading and trailing positive and negative signs, and so on.

    Twenty-seven pre-defined editing masks are available for commonly used numeric editing patterns, encompassing many of the numeric notations used throughout the world. In addition, a virtually unlimited number of numeric editing patterns are available via the user-defined editing masks.

  • Transformation of SMF, TOD, and ETOD date and time values to more usable forms.
  • Various types of arithmetic operations for input date fields.
  • Conversion of input date fields of one type (CH, ZD, PD, 2-digit year, 4-digit year, Julian, Gregorian) to corresponding output date fields of another type or to a corresponding day of the week.
  • Selection of a character constant, hexadecimal constant, or input field from a lookup table, based on a character, hexadecimal, or bit string as input (that is, lookup and change).
You can create the reformatted OUTREC records in one of the following three ways using unedited, edited, or converted input fields (p,m for fixed fields, or %nn for parsed fields - see PARSE), and a variety of constants:
  • BUILD or FIELDS: Reformat each record by specifying all of its items one by one. Build gives you complete control over the items you want in your reformatted OUTREC records and the order in which they appear. You can delete, rearrange and insert fields and constants. Example:
      OUTREC BUILD=(1,20,C'ABC',26:5C'*',
           15,3,PD,EDIT=(TTT.TT),21,30,80:X)
  • OVERLAY: Reformat each record by specifying just the items that overlay specific columns. Overlay lets you change specific existing columns without affecting the entire record. Example:
      OUTREC OVERLAY=(45:45,8,TRAN=LTOU)
  • FINDREP: Reformat each record by doing various types of find and replace operations. Example:
      OUTREC FINDREP=(IN=C'Mr.',OUT=C'Mister')
  • IFTHEN clauses: Reformat different records in different ways by specifying how build, overlay, find/replace, or group operation items are applied to records that meet given criteria. IFTHEN clauses let you use sophisticated conditional logic to choose how different record types are reformatted. Example:
      OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C'TYPE1'),
               BUILD=(1,40,C'**',+1,TO=PD)),
             IFTHEN=(WHEN=(1,5,CH,EQ,C'TYPE2'),
               BUILD=(1,40,+2,TO=PD,X'FFFF')),
             IFTHEN=(WHEN=NONE,OVERLAY=(45:C'NONE'))
You can choose to include any or all of the following items in your reformatted OUTREC records:
  • Fixed position/length fields or variable position/length fields. For fixed fields, you specify the starting position and length of the field directly. For variable fields, such as delimited fields, comma separated values (CSV), tab separated values, blank separated values, keyword separated fields, null-terminated strings (and many other types), you define rules that allow DFSORT to extract the relevant data into fixed parsed fields, and then use the parsed fields as you would use fixed fields.
  • Blanks, binary zeros, character strings, and hexadecimal strings
  • Current date, future date, past date and current time in various forms
  • Unedited input fields aligned on byte, halfword, fullword, and doubleword boundaries
  • Replaced or removed strings.
  • Hexadecimal or bit representations of binary input fields
  • Characters translated from uppercase to lowercase, lowercase to uppercase, ASCII to EBCDIC or EBCDIC to ASCII.
  • Left-justified, right-justified, left-squeezed, or right-squeezed input fields.
  • Numeric input fields of various formats converted to different numeric formats, or to character format edited to contain signs, thousands separators, decimal points, leading zeros or no leading zeros, and so on.
  • Decimal constants converted to different numeric formats, or to character format edited to contain signs, thousands separators, decimal points, leading zeros or no leading zeros, and so on.
  • The results of arithmetic expressions combining fields, decimal constants, operators (MIN, MAX, MUL, DIV, MOD, ADD and SUB) and parentheses converted to different numeric formats, or to character format edited to contain signs, thousands separators, decimal points, leading zeros or no leading zeros, and so on.
  • SMF, TOD and ETOD date and time fields converted to different numeric formats, or to character format edited to contain separators, leading zeros or no leading zeros, and so on.
  • Input date fields of one type (CH, ZD, PD, 2-digit year, 4-digit year, Julian, Gregorian) converted to corresponding output date fields of another type or to a corresponding day of the week.
  • The results of various types of arithmetic operations for input date fields.
  • Sequence numbers in various formats.
  • A character constant, hexadecimal constant or input field selected from a lookup table, based on a character, hexadecimal or bit constant as input.
  • A zoned decimal group identifier, a zoned decimal group sequence number, or a field propagated from the first record of a group to all of the records of a group.

For information concerning the interaction of INREC and OUTREC, see INREC statement notes and OUTREC statement notes.

See OUTFIL control statements for complete details on the OUTFIL OUTREC parameter.

PARSE
Read syntax diagramSkip visual syntax diagram
           .-,-------------------------------------------------.     
           |               .-,----------------------------.    |     
           V               V                              |    |     
>>-PARSE=(---+-%n=---+--(----+-FIXLEN=m-----------------+-+--)-+-)-><
             +-%nn=--+       +-+-ABSPOS=p-+-------------+            
             +-%nnn=-+       | +-ADDPOS=x-+             |            
             '-%=----'       | '-SUBPOS=y-'             |            
                             | .-,--------------------. |            
                             | V                      | |            
                             +---+-STARTAFT=string--+-+-+            
                             |   +-STARTAFT=an------+   |            
                             |   +-STARTAFT=BLANKS--+   |            
                             |   +-STARTAT=string---+   |            
                             |   +-STARTAT=an-------+   |            
                             |   +-STARTAT=BLANKS---+   |            
                             |   '-STARTAT=NONBLANK-'   |            
                             | .-,------------------.   |            
                             | V                    |   |            
                             +---+-ENDBEFR=string-+-+---+            
                             |   +-ENDBEFR=an-----+     |            
                             |   +-ENDBEFR=BLANKS-+     |            
                             |   +-ENDAT=string---+     |            
                             |   +-ENDAT=an-------+     |            
                             |   '-ENDAT=BLANKS---'     |            
                             +-+-PAIR=APOST-+-----------+            
                             | '-PAIR=QUOTE-'           |            
                             '-REPEAT=v-----------------'            

This operand allows you to extract variable position/length fields into fixed parsed fields. Parsed fields (%n, %nn or %nnn) can be used where fixed position/length fields (p,m) can be used in the BUILD (or FIELDS) or OVERLAY operands as described later in this section.

Note: Although you can use %n (%0-%9), %nn (%00-%99) or %nnn (%000-%999) for a parsed field, for convenience in this book %nn will be used in general when referring to a parsed field. %n, %0n or %00n can be used interchangeably for parsed field n (for example, %1, %01 or %001 for parsed field 1). %nn or %0nn can be used interchangeably for parsed field nn (for example, %12 or %012 for parsed field 12).

PARSE can be used for many different types of variable fields including delimited fields, comma separated values (CSV), tab separated values, blank separated values, keyword separated fields, null-terminated strings, and so on. You can assign up to 1000 parsed fields (%0-%999) to the variable fields you want to extract.

Note that if all of the fields in your records have fixed positions and lengths, you don't need to use PARSE. But if any of the fields in your records have variable positions or lengths, you can use PARSE to treat them as fixed parsed fields in BUILD or OVERLAY. You can mix p,m fields (fixed fields) and %nn fields (parsed fields) in BUILD and OVERLAY.

See PARSE under "OUTFIL Control Statements" for complete details.

Sample Syntax:
  OUTREC PARSE=(%200=(ENDBEFR=C'*',FIXLEN=3),
         %201=(ENDBEFR=BLANKS,FIXLEN=6),
         %202=(STARTAT=C'MAX',FIXLEN=8),
         %203=(STARTAFT=C'(',ENDBEFR=C')',FIXLEN=6),
         %204=(STARTAFT=BLANKS,FIXLEN=5)),
       BUILD=(%203,X,%203,HEX,21:%202,31:%201,SFF,M26,LENGTH=7,
              18,6,%200,UFF,M11,LENGTH=3,%204,JFY=(SHIFT=RIGHT))

Default for PARSE: None; must be specified. See Specification/override of DFSORT options for full override details.

Applicable Functions: See Specification/override of DFSORT options.

FIELDS or BUILD
Read syntax diagramSkip visual syntax diagram
>>-+-FIELDS=-+--(----------------------------------------------->
   '-BUILD=--'      

   .-,--------------------------------------------.      
   V                                              |      
>----+----+--+-s--------------------------------+-+--)---------><
     '-c:-'  +-p,m--+----+----------------------+        
             |      '-,a-'                      |        
             +-%nn------------------------------+        
             +-p--------------------------------+        
             +-+-p,m-+-,TRAN-+-LTOU---+---------+        
             | +-%nn-+       +-UTOL---+         |        
             | '-p---'       +-ALTSEQ-+         |        
             |               +-ATOE---+         |        
             |               +-ETOA---+         |        
             |               +-HEX----+         |        
             |               +-UNHEX--+         |        
             |               +-BIT----+         |        
             |               '-UNBIT--'         |        
             +-+-p,m-+-,HEX---------------------+        
             | +-%nn-+                          |        
             | '-p---'                          |        
             +-+-p,m,f---+-+-,edit-+------------+        
             | +-%nn,f---+ '-,to---'            |        
             | +-(p,m,f)-+                      |        
             | '-(%nn,f)-'                      |        
             +-+-deccon---+--+-,edit-+----------+        
             | '-(deccon)-'  '-,to---'          |        
             +-+-arexp---+--+-,edit-+-----------+        
             | '-(arexp)-'  '-,to---'           |        
             +-+-p,m-+-+-+-,Y2x-+-+---------+-+-+        
             | '-%nn-' | '-,Y4x-' +-,edit---+ | |        
             |         |          +-,to-----+ | |        
             |         |          +-,todate-+ | |        
             |         |          '-,dateop-' | |        
             |         +-,Y2x(s)--------------+ |        
             |         +-,Y4x(s)--------------+ |        
             |         '-,Y2xP----------------' |        
             +-+-p,m-+-,lookup------------------+        
             | '-%nn-'                          |        
             +-+-p,m-+-,justify-----------------+        
             | '-%nn-'                          |        
             +-+-p,m-+-,squeeze-----------------+        
             | '-%nn-'                          |        
             '-seqnum---------------------------'        

Specifies all of the items in the reformatted OUTREC record in the order in which they are to be included. The reformatted OUTREC record consists of the separation fields, edited and unedited input fields (p,m for fixed fields, or %nn for parsed fields - see PARSE), edited decimal constants, edited results of arithmetic expressions, and sequence numbers you select, in the order in which you select them, aligned on the boundaries or in the columns you indicate.

For variable-length records, the first item in the BUILD or FIELDS parameter must specify or include the unedited 4-byte record descriptor word (RDW), that is, you must start with 1,m with m equal to or greater than 4. If you want to include the bytes from a specific position to the end of each input record at the end of each reformatted output record, you can specify that starting position (p) as the last item in the BUILD or FIELDS parameter. For example:
  OUTREC FIELDS=(1,4,         unedited RDW
     1,2,BI,TO=ZD,LENGTH=5,   display RDW length in decimal
     C'|',                    | separator
     5)                       display input positions 5 to end

For fixed-length records, the first input and output data byte starts at position 1. For variable-length records, the first input and output data byte starts at position 5, after the RDW in positions 1-4.

The BUILD or FIELDS parameter of the OUTREC statement differs from the BUILD or OUTREC parameter of the OUTFIL statement in the following ways:
  • The BUILD or FIELDS parameter of the OUTREC statement applies to all input records; the BUILD or OUTREC parameter of the OUTFIL statement only applies to the OUTFIL input records for its OUTFIL group.
  • The BUILD or OUTREC parameter of the OUTFIL statement supports the slash (/) separator for creating blank records and new records; the BUILD or FIELDS parameter of the OUTREC statement does not.
c:
specifies the position (column) for a separation field, input field decimal constant, arithmetic expression, or sequence number, relative to the start of the reformatted output record. Unused space preceding the specified column is padded with EBCDIC blanks. The following rules apply:
  • c must be a number between 1 and 32752.
  • c: must be followed by a separation field, input field, decimal constant, or arithmetic expression.
  • c must not overlap the previous input field or separation field in the reformatted output record.
  • For variable-length records, c: must not be specified before the first input field (the record descriptor word) nor after the variable part of the input record.
  • The colon (:) is treated like the comma (,) or semicolon (;) for continuation to another line.

See Table 1 for examples of valid and invalid column alignment.

s
specifies that a separation field (blanks, zeros, character string, hexadecimal string, current date, future date, past date, or current time) is to appear in the reformatted output record. It can be specified before or after any input field. Consecutive separation fields may be specified. For variable-length records, separation fields must not be specified before the first input field (the record descriptor word) or after the variable part of the input record. Permissible values are nX, nZ, nC'xx...x', nX'yy...yy', and various date and time constants.
nX
Blank separation. n bytes of EBCDIC blanks (X'40') are to appear in the reformatted output records. n can range from 1 to 4095. If n is omitted, 1 is used.

See Table 2 for examples of valid and invalid blank separation.

nZ
Binary zero separation. n bytes of binary zeros (X'00') are to appear in the reformatted output records. n can range from 1 to 4095. If n is omitted, 1 is used.

See Table 3 for examples of valid and invalid binary zero separation.

nC'xx...x'
Character string separation. n repetitions of the character string constant (C'xx...x') are to appear in the reformatted output records. n can range from 1 to 4095. If n is omitted, 1 is used. x can be any EBCDIC character. You can specify from 1 to 256 characters.
If you want to include a single apostrophe in the character string, you must specify it as two single apostrophes:
Required:  O'NEILL     Specify:  C'O''NEILL'

See Table 4 for examples of valid and invalid character string separation.

nX'yy...yy'
Hexadecimal string separation. n repetitions of the hexadecimal string constant (X'yy...yy') are to appear in the reformatted output records. n can range from 1 to 4095. If n is omitted, 1 is used.

The value yy represents any pair of hexadecimal digits. You can specify from 1 to 256 pairs of hexadecimal digits.

See Table 5 for examples of valid and invalid hexadecimal string separation.

DATEn, DATEn(c), DATEnP
Constant for current date. The date of the run is to appear in the reformatted output records. See DATEn, DATEn(c), DATEnP under OUTFIL OUTREC for details.
&DATEn, &DATEn(c), &DATEnP
can be used instead of DATEn, DATEn(c), and DATEnP, respectively.
DATEn+r, DATEn(c)+r, DATEnP+r
Constant for future date. A future date relative to the current date of the run is to appear in the reformatted output records. See DATEn+r, DATEn(c)+r, DATEnP+r under OUTFIL OUTREC for details.
&DATEn+r, &DATEn(c)+r, &DATEnP+r
can be used instead of DATEn+r, DATEn(c)+r, and DATEnP+r, respectively.
DATEn-r, DATEn(c)-r, DATEnP-r
Constant for past date. A past date relative to the current date of the run is to appear in the reformatted output records. See DATEn-r, DATEn(c)-r, DATEnP-r under OUTFIL OUTREC for details.
&DATEn-r, &DATEn(c)-r, &DATEnP-r
Can be used instead of DATEn-r, DATEn(c)-r, and DATEnP-r, respectively
TIMEn, TIMEn(c), TIMEnP
Constant for current time. The time of the run is to appear in the reformatted output records. See TIMEn, TIMEn(c), TIMEnP under OUTFIL OUTREC for details.
&TIMEn, &TIMEn(c), &TIMEnP
Can be used instead of TIMEn, TIMEn(c), and TIMEnP, respectively.
DATE
specifies that the current date is to appear in the reformatted output records in the form 'mm/dd/yy'. See DATE under OUTFIL OUTREC for details.
&DATE
can be used instead of DATE.
DATE=(abcd)
specifies that the current date is to appear in the reformatted output records in the form 'adbdc'. See DATE=(abcd) under OUTFIL OUTREC for details.
&DATE=(abcd)
can be used instead of DATE=(abcd).
DATENS=(abc)
specifies that the current date is to appear in the reformatted output records in the form 'abc'. See DATENS=(ab) under OUTFIL OUTREC for details.
&DATENS=(abc)
can be used instead of DATENS=(abc).
YDDD=(abc)
specifies that the current date is to appear in the reformatted output records in the form 'acb'. See YDDD=(abc) under OUTFIL OUTREC for details.
&YDDD=(abc)
can be used instead of YDDD=(abc).
YDDDNS=(ab)
specifies that the current date is to appear in the reformatted output records in the form 'ab'. See YDDDNS=(ab) under OUTFIL OUTREC for details.
&YDDDNS=(ab)
can be used instead of YDDDNS=(ab).
TIME
specifies that the current time is to appear in the reformatted output records in the form 'hh:mm:ss'. See TIME under OUTFIL OUTREC for details.
&TIME
can be used instead of TIME.
TIME=(abc)
specifies that the current time is to appear in the reformatted output records in the form 'hhcmmcss' (24-hour time) or 'hhcmmcss xx' (12-hour time). See TIME=(abc) under OUTFIL OUTREC for details.
&TIME=(abc)
can be used instead of TIME=(abc).
TIMENS=(ab)
specifies that the current time is to appear in the reformatted output record in the form 'hhmmss' (24-hour time) or 'hhmmss xx' (12-hour time). See TIMENS=(ab) under OUTFIL OUTREC for details.
&TIMENS=(ab)
can be used instead of TIMENS=(ab).
p,m,a
specifies that an unedited input field is to appear in the reformatted output record.
p
specifies the first byte of the input field relative to the beginning of the input record.1 The first data byte of a fixed-length record has relative position 1. The first data byte of a variable-length record has relative position 5, because the first four bytes are occupied by the RDW. All fields must start on a byte boundary, and no field may extend beyond byte 32752. See OUTREC statement notes for special rules concerning variable-length records.
m
specifies the length of the input field. It must include the sign if the data is signed and must be a whole number of bytes. See OUTREC statement notes for more information.
a
specifies the alignment (displacement) of the input field in the reformatted output record relative to the start of the reformatted output record.
The permissible values of a are:
H
Halfword aligned. The displacement (p-1) of the field from the beginning of the reformatted input record, in bytes, is a multiple of 2 (that is, position 1, 3, 5, and so forth).
F
Fullword aligned. The displacement is a multiple of 4 (that is, position 1, 5, 9, and so forth).
D
Doubleword aligned. The displacement is a multiple of 8 (that is, position 1, 9, 17, and so forth).

Alignment can be necessary if, for example, the data is to be used in a COBOL application program where items are aligned through the SYNCHRONIZED clause. Unused space preceding aligned fields are always padded with binary zeros.

%nn
specifies that an unedited parsed input field is to appear in the reformatted output record. See PARSE for details of parsed fields. See p,m,a for further details. Note that alignment (H, F, D) is not permitted for %nn fields (for example, %nn,F results in an error message and ermination).
p
specifies that the unedited part of the variable input record (that part beyond the minimum record length), is to appear in the reformatted output record, as the last field. p without m can only be used for variable-length records; not for fixed-length records.
Attention: If 1,4,p is specified (only RDW and variable part of record), "null" records containing only an RDW will result if the record length is less than p.

A value must be specified for p that is less than or equal to the minimum record length (RECORD statement L4 value) plus 1 byte.

p,m,TRAN=keyword
Specifies that an input field is to be translated as indicated by the keyword. See p,m,TRAN=keyword under OUTFIL OUTREC for details.
%nn,TRAN=keyword
Specifies that a parsed input field is to be translated as indicated by the keyword. See %nn,TRAN=keyword under OUTFIL OUTREC for details.
p,TRAN=keyword
Specifies that the variable part of the input record is to be translated as indicated by the keyword. See p,TRAN=keyword under OUTFIL OUTREC for details.
p,m,HEX
Can be used instead of p,m,TRAN=HEX. See p,m,HEX under OUTFIL OUTREC for details.
%nn,HEX
Can be used instead of %nn,TRAN=HEX. See %nn,HEX under OUTFIL OUTREC for details.
p,HEX
Can be used instead of p,TRAN=HEX. See p,HEX under OUTFIL OUTREC for details.
p,m,f,edit or (p,m,f),edit
specifies that an edited numeric input field is to appear in the reformatted output record. You can edit BI, FI, PD, PD0, ZD, FL, CSF, FS, UFF, SFF, DC1, DC2, DC3, DE1, DE2, DE3, DT1, DT2, DT3, TC1, TC2, TC3, TC4, TE1, TE2, TE3, TE4, TM1, TM2, TM3 or TM4 fields using either pre-defined edit masks (M0-M26) or specific edit patterns you define. You can control the way the edited fields look with respect to length, leading or suppressed zeros, thousands separators, decimal points, leading and trailing positive and negative signs, and so on.

See p,m,f,edit under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=(5:(21,8,ZD),M19,X,46,5,ZD,M13,
                 31:35,4,FL,SIGNS=(,,+,-),LENGTH=10,
                 51:8,4,PD,EDIT=(**II,IIT.TTXS),SIGNS=(,,+,-))
%nn,f,edit or (%nn,f),edit
specifies that an edited numeric parsed input field is to appear in the reformatted output record. See PARSE for details of parsed fields. See p,m,f,edit or (p,m,f),edit for further details.
p,m,f,to or (p,m,f),to
specifies that a converted numeric input field is to appear in the reformatted output record. You can convert BI, FI, PD, PD0, ZD, FL, CSF, FS, UFF, SFF, DC1, DC2, DC3, DE1, DE2, DE3, DT1, DT2, DT3, TC1, TC2, TC3, TC4, TE1, TE2, TE3, TE4, TM1, TM2, TM3, or TM4 fields to BI, FI, PD, PDC, PDF, ZD, ZDF, ZDC, CSF, or FS fields.

See p,m,f,to under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=(21,4,BI,TO=PDF,X,8,4,ZD,FI,LENGTH=2)
%nn,f,to or (%nn,f),to
specifies that a converted numeric parsed input field is to appear in the reformatted output record. See PARSE for details of parsed fields. See p,m,f,to or (p,m,f),to for further details.
deccon,edit or (deccon),edit
specifies that an edited decimal constant is to appear in the reformatted output record. The decimal constant must be in the form +n or -n where n is 1 to 31 decimal digits. The sign (+ or -) must be specified. A decimal constant produces a signed, 31-digit zoned decimal (ZD) result to be edited as specified.

See deccon,edit under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=(-5000,EDIT=(-T,TT.T),21:(+0),M11,LENGTH=7)
deccon,to or (deccon),to
specifies that a converted decimal constant is to appear in the reformatted output record. The decimal constant must be in the form +n or -n where n is 1 to 31 decimal digits. The sign (+ or -) must be specified. A decimal constant produces a signed, 31-digit zoned decimal (ZD) result to be converted as specified.

See deccon,to under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=(+1,PD,LENGTH=6,(-1),PD,LENGTH=6,
      -50,TO=ZD,LENGTH=8)
arexp,edit or (arexp),edit
specifies that the edited result of an arithmetic expression is to appear in the reformatted output record. The arithmetic expression can consist of input fields, decimal constants, operators and parentheses. An arithmetic expression produces a signed, 31-digit zoned decimal (ZD) result to be edited as specified.

See arexp,edit under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=(C'**',27,2,FI,SUB,
                      83,4,PD,EDIT=(STTTTTTT),SIGNS=(+,-),
    25:(((15,5,ZD,MUL,+2),ADD,+100),MAX,62,2,PD),M25,LENGTH=12)
arexp,to or (arexp),to
specifies that the converted result of an arithmetic expression is to appear in the reformatted output record. The arithmetic expression can consist of input fields, decimal constants, operators and parentheses. An arithmetic expression produces a signed, 31-digit zoned decimal (ZD) result to be converted as specified.

See arexp,to under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=((15,6,FS,DIV,+5),ADD,(-1,ADD,36,6,FS),TO=FI,X,
       3,2,FI,MAX,-6,LENGTH=4,TO=FS)
p,m,Y2x or p,m,Y4x
Specifies that an input date field is to be edited. Real Y2x dates are edited using the century window established by the Y2PAST option in effect. Y2x and Y4x dates with special indicators are expanded appropriately (for example, p,6,Y2T transforms C'000000' to C'00000000').

See "p,m,Y2x or p,m,Y4x" under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC BUILD=(21,3,Y2U,X,3,8,Y4W)
%nn,Y2x or %nn,Y4x
Specifies that a parsed input date field is to be edited. See PARSE for details of parsed fields. See "p,m,Y2x or p,m,Y4x" for further details.
p,m,Y2x,edit or p,m,Y4x,edit
Specifies that the output for a p,m,Yxx input date field is to be edited according to the edit parameters you specify. For example, if you specify:
  OUTREC BUILD=(28,5,Y4V,EDIT=(TTTT-TT-TT)

The P'ccyymmdd' (X'0ccyymmddC') date value will be transformed to a C'ccyymmdd' date value and then edited to a C'ccyy-mm-dd' date value.

See "p,m,Y2x or p,m,Y4x" and "p,m,f,edit" for related details.

%nn,Y2x,edit or %nn,Y4x,edit
Specifies that the output for a parsed Yxx input date field is to be edited according to the edit parameters you specify. See PARSE for details of parsed fields. See "p,m,Y2x,edit or p,m,Y4x,edit" for further details.
p,m,Y2x,to or p,m,Y4x,to
Specifies that an input date field is to be converted according to the to parameters you specify. For example, if you specify:
  OUTREC BUILD=(5,6,Y2W,TO=PD,LENGTH=5)

The C'mmddyy' date value will be transformed to a Z'mmddccyy' date value and then converted to a P'mmddccyy' (X'0mmddccyyC') date value.

See "p,m,Y2x or p,m,Y4x" and "p,m,f,to" for related details.

%nn,Y2x,to or %nn,Y4x,to
Specifies that a parsed input date field is to be converted according to the to parameters you specify. See PARSE for details of parsed fields. See "p,m,Y2x,to or p,m,Y4x,to" for further details.
p,m,Y2x,todate or p,m,Y4x,todate
Specifies that an input date field of one type is to be converted to a corresponding output date field of another type. You can convert date fields between combinations of 2-digit and 4-digit year dates, CH/ZD and PD dates, and Julian and Gregorian dates. You can also convert a date field to a corresponding day of the week in several forms.

See "p,m,Y2x,todate or p,m,Y4x,todate" under OUTFIL OUTREC for details.

Sample Syntax:
* Convert a P'dddyy' input date to a C'ccyy/mm/dd' output date     
  OUTREC BUILD=(21,3,Y2X,TOGREG=Y4T(/),X,                           
* Convert a C'ccyymmdd' input date to a P'ccyyddd' output date     
     42,8,Y4T,TOJUL=Y4U,X,                                         
* Convert a C'mmddyy' input date to a C'yymmdd' output date        
     11,6,Y2W,TOGREG=Y2T)                                          
%nn,Y2x,todate or %nn,Y4x,todate
Specifies that an input date field of one type is to be converted to a corresponding output date field of another type. See PARSE for details of parsed fields. See "p,m,Y2x,todate or p,m,Y4x,todate" for further details.
p,m,Y2x,dateop or p,m,Y4x,dateop
Specifies an arithmetic operation for an input date field. See "p,m,Y2x,dateop or p,m,Y4x,dateop" under OUTFIL OUTREC for details.
%nn,Y2x,dateop or %nn,Y4x,dateop
Specifies an arithmetic operation for a parsed input date field. See "%nn,Y2x,dateop or %nn,Y4x,dateop" under OUTFIL OUTREC for details.
p,m,Y2x(s) or p,m,Y4x(s)
Specifies that an input date field is to be edited with separators. s can be any character except a blank. Real Y2x dates are edited using the century window established by the Y2PAST option in effect. Y2x and Y4x dates with special indicators are expanded appropriately (for example, p,8,Y4T(s) transforms C'00000000' to C'0000/00/00').

See "p,m,Y2x(s) or p,m,Y4x(s)" under OUTFIL OUTREC for details.

Sample Syntax:
* Convert a Z'dddccyy' date to a C'ddd/ccyy' date.         
  OUTREC BUILD=(19,7,Y4W(/),X,                             
* Convert a P'ccyymmdd' date to a C'ccyy-mm-dd' date.      
     43,5,Y4V(-))                                         
%nn,Y2x(s) or %nn,Y4x(s)
Specifies that a parsed input date field is to be edited with separators. See PARSE for details of parsed fields. See "p,m,Y2x(s) or p,m,Y4x(s)" for further details.
p,m,Y2xP
Specifies that an input date field is to be converted to a packed decimal output date field. Real Y2x dates are edited using the century window established by the Y2PAST option in effect. Y2x and Y4x dates with special indicators are expanded appropriately (for example, p,6,Y2TP transforms C'000000' to P'00000000').

See "p,m,Y2xP" under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC BUILD=(11,3,Y2XP,X,21,4,Y2WP)
%nn,Y2xP
Specifies that a parsed input date field is to be converted to a packed decimal output date field. See PARSE for details of parsed fields. See "p,m,Y2xP" for further details.
p,m,lookup or %nn,lookup
specifies that a character constant, hexadecimal constant, input field (p,m) or parsed input field (%nn) from a lookup table is to appear in the reformatted output record. You can use p,m,lookup or %nn,lookup to select a specified character set constant (that is, a character or hexadecimal string) or set field (that is, an input field or parsed input field) based on matching an input value against find constants (that is, character, hexadecimal, or bit constants).

See p,m,lookup or %nn,lookup under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=(11,1,
                 CHANGE=(6,
                   C'R',C'READ',
                   C'U',C'UPDATE',
                   X'FF',C'EMPTY',
                   C'A',C'ALTER'),
                 NOMATCH=(11,6),
                 4X,
                 21,1,
                 CHANGE=(10,
                   B'.1......',C'VSAM',
                   B'.0......',C'NON-VSAM'))
p,m,justify
specifies that a left-justified or right-justified input field is to appear in the reformatted output record. For a left-justified field, leading blanks are removed and the characters from the first nonblank to the last nonblank are shifted left, with blanks inserted on the right if needed. For a right-justified field, trailing blanks are removed and the characters from the last nonblank to the first nonblank are shifted right, with blanks inserted on the left if needed. Optionally:
  • specific leading and trailing characters can be changed to blanks before justification begins
  • a leading string can be inserted
  • a trailing string can be inserted
  • the output length can be changed (it's equal to the input length by default)
See p,m,justify under OUTFIL OUTREC for details.
Sample Syntax:
    OUTREC FIELDS=(1,10,
        21,20,JFY=(SHIFT=LEFT),5X,
        52,12,JFY=(SHIFT=RIGHT,PREBLANK=C'+',LEAD=C'$',TRAIL=C'.00')) 
%nn,justify
specifies that a left-justified or right-justified parsed input field is to appear in the reformatted output record. See PARSE for details of parsed fields. See p,m,justify for further details.
p,m,squeeze
specifies that a left-squeezed or right-squeezed input field is to appear in the reformatted output record. For a left-squeezed field, all blanks are removed and the characters from the first nonblank to the last nonblank are shifted left, with blanks inserted on the right if needed. For a right-justified field, all blanks are removed and the characters from the last nonblank to the first nonblank are shifted right, with blanks inserted on the left if needed. Optionally:
  • specific characters can be changed to blanks before squeezing begins
  • a leading string can be inserted
  • a trailing string can be inserted
  • a string (for example, a comma delimiter) can be inserted wherever a group of blanks is removed between the first nonblank and the last nonblank.
  • blanks can be kept as is between paired apostrophes ('AB CD EF') or paired quotes ("AB CD EF")
  • the output length can be changed (it's equal to the input length by default)
See p,m,squeeze under OUTFIL OUTREC for details.
Sample Syntax:
      OUTREC FIELDS=(21,20,SQZ=(SHIFT=RIGHT),5X,
        152,18,SQZ=(SHIFT=LEFT,PREBLANK=X'05',
          LEAD=C'VOL=SER=',MID=C',',PAIR=QUOTE,LENGTH=30)) 
%nn,squeeze
specifies that a left-squeezed or right-squeezed parsed input field is to appear in the reformatted output record. See PARSE for details of parsed fields. See p,m,squeeze for further details.
seqnum
specifies that a sequence number is to appear in the reformatted output record. The sequence numbers are assigned in the order in which the records are received for OUTREC processing. You can create BI, PD, ZD, CSF, or FS sequence numbers and control their lengths, starting values and increment values. You can restart the sequence number at the start value each time a specified input field (p,m) or parsed input field (%nn) changes.

See seqnum under OUTFIL OUTREC for details.

Sample Syntax:
  OUTREC FIELDS=(SEQNUM,6,ZD,START=1000,INCR=50,RESTART=(21,5),1,60)

Default for BUILD or FIELDS: None; must be specified. See Specification/override of DFSORT options for full override details.

Applicable Functions: See Specification/override of DFSORT options.

OVERLAY
Read syntax diagramSkip visual syntax diagram
>>-OVERLAY=--(-------------------------------------------------->

   .-,--------------------------------------------.      
   V                                              |      
>----+----+--+-s--------------------------------+-+--)---------><
     '-c:-'  +-p,m--+----+----------------------+        
             |      '-,a-'                      |        
             +-%nn------------------------------+        
             +-+-p,m-+-,TRAN-+-LTOU---+---------+        
             | '-%nn-'       +-UTOL---+         |        
             |               +-ALTSEQ-+         |        
             |               +-ATOE---+         |        
             |               +-ETOA---+         |        
             |               +-HEX----+         |        
             |               +-UNHEX--+         |        
             |               +-BIT----+         |        
             |               '-UNBIT--'         |        
             +-+-p,m-+-,HEX---------------------+        
             | '-%nn-'                          |        
             +-+-p,m,f---+-+-,edit-+------------+        
             | +-%nn,f---+ '-,to---'            |        
             | +-(p,m,f)-+                      |        
             | '-(%nn,f)-'                      |        
             +-+-deccon---+--+-,edit-+----------+        
             | '-(deccon)-'  '-,to---'          |        
             +-+-arexp---+--+-,edit-+-----------+        
             | '-(arexp)-'  '-,to---'           |        
             +-+-p,m-+-+-+-,Y2x-+-+---------+-+-+        
             | '-%nn-' | '-,Y4x-' +-,edit---+ | |        
             |         |          +-,to-----+ | |        
             |         |          +-,todate-+ | |        
             |         |          '-,dateop-' | |        
             |         +-,Y2x(s)--------------+ |        
             |         +-,Y4x(s)--------------+ |        
             |         '-,Y2xP----------------' |        
             +-+-p,m-+-,lookup------------------+        
             | '-%nn-'                          |        
             +-+-p,m-+-,justify-----------------+        
             | '-%nn-'                          |        
             +-+-p,m-+-,squeeze-----------------+        
             | '-%nn-'                          |        
             '-seqnum---------------------------'        

Specifies each item that is to overlay specific columns in the reformatted record. Columns that are not overlaid remain unchanged. If you want to insert, rearrange, or delete fields, use BUILD or FIELDS rather than OVERLAY. Use OVERLAY only to overlay existing columns or to add fields at the end of every record. OVERLAY can be easier to use then BUILD or FIELDS when you just want to change a few fields without rebuilding the entire record.

For fixed-length records, the first input and output data byte starts at position 1. For variable-length records, the first input and output data byte starts at position 5, after the RDW in positions 1-4.

Use c: (column) to specify the output positions to be overlaid. If you do not specify c: for the first item, it defaults to 1:. If you do not specify c: for any other item, it starts after the previous item. For example, if you specify:
   OUTREC OVERLAY=(25,2,11:C'A',15,3,C'**')

Input positions 25-26 are placed at output positions 1-2; C'A' is placed at output position 11; input positions 15-17 are placed at output positions 12-14; and C'**' is placed at output positions 15-16. The rest of the record remains unchanged.

You can specify items in any order, you can change the same item multiple times and you can overlap output columns. Changes to earlier items affect changes to later items. For example, say you specify:
  OUTREC OVERLAY=(21:8,4,ZD,MUL,+10,TO=ZD,LENGTH=6,
      5:5,1,TRAN=UTOL,
      5:5,1,CHANGE=(1,C'a',C'X',C'b',C'Y'),NOMATCH=(5,1))
and input position 5 has 'A'. The second item (UTOL) would change 'A' to 'a' and the third item (CHANGE) would change 'a' again to 'X'.
If you specify an OVERLAY item that extends the overlay record beyond the end of the input record, the reformatted record length is automatically increased to that length, and blanks are filled in on the left as needed. For variable-length records, the RDW length is also increased to correspond to the larger reformatted record length after all of the OVERLAY items are processed. For example, if your input record has a length of 40 and you specify:
  OUTREC OVERLAY=(16:C'ABC',51:5C'*',35:15,2)
the output record is given a length of 55. Blanks are filled in from columns 41-50. For variable-length records, the length in the RDW is changed from 40 to 55 after all of the OVERLAY items are processed.

Missing bytes in specified input fields are replaced with blanks so the padded fields can be processed.

The OVERLAY parameter of the OUTREC statement applies to all input records whereas the OVERLAY parameter of the OUTFIL statement only applies to the OUTFIL input records for its OUTFIL group.

See OUTREC FIELDS for details of the items listed in the OVERLAY syntax diagram shown previously in this section. You can specify all of the items for OVERLAY in the same way that you can specify them for BUILD or FIELDS with the following exceptions:
  • You cannot specify p or p,HEX or p,TRAN=keyword for OVERLAY.
  • For p,m,H or p,m,F or p,m,D specified for OVERLAY, fields are aligned as necessary without changing the preceding bytes.
  • For variable-length records, you must not overlay positions 1-4 (the RDW) for OVERLAY, so be sure to specify the first column (c:) as 5 or greater. If you do not specify the first column, it will default to 1: which is invalid for variable-length records with OVERLAY. Whereas FIELDS=(1,m,...) is required, OVERLAY=(1,m) is not allowed since it would overlay the RDW.

Sample Syntax:

Fixed input records:
  OUTREC OVERLAY=(21:21,4,ZD,TO=PD,LENGTH=4,
           2:5,8,HEX,45:C'*',32,4,C'*',81:SEQNUM,5,ZD)
Variable input records:
  OUTREC OVERLAY=(5:X'0001',28:C'Date is ',YDDDNS=(4D),
         17:5C'*')

Default for OVERLAY: None; must be specified.

Applicable Functions: See Specification/override of DFSORT options.

FINDREP
Read syntax diagramSkip visual syntax diagram
>>-FINDREP--+-IN=incon,OUT=outcon------------+------------------>
            |      .-,-----.                 |   
            |      V       |                 |   
            +-IN=(---incon-+--)--,OUT=outcon-+   
            |         .-,------------.       |   
            |         V              |       |   
            '-INOUT=(---incon,outcon-+-)-----'   

>--+---------------------------+-------------------------------><
   | .-,---------------------. |   
   | V                       | |   
   '---+-STARTPOS=p--------+-+-'   
       +-ENDPOS=q----------+       
       +-DO=n--------------+       
       +-MAXLEN=n----------+       
       +-+-OVERRUN=ERROR-+-+       
       | '-OVERRUN=TRUNC-' |       
       '-+-SHIFT=YES-+-----'       
         '-SHIFT=NO--'             

You can use FINDREP to find constants anywhere in a record and replace them with other constants of the same or different lengths. You can find character or hexadecimal input constants anywhere in your records and replace them with character, hexadecimal or null output constants. As appropriate, bytes can be shifted left or right, blank padding can be added for fixed-length records, and the length can be changed for variable-length records.

Various options of FINDREP allow you to define one or more input constants and a corresponding output constant, define one or more pairs of input and output constants, start and end the find scan at specified positions, stop after a specified number of constants are replaced, increase or decrease the length of the output record, define the action to be taken if nonblank characters overrun the end of the record, and specify whether output constants are to replace or overlay input constants.

See FINDREP under "OUTFIL Control Statements" for complete details.

Sample Syntax:
  OUTREC FINDREP=(INOUT=(C'Goodbye',C'Bye',C'Hello',C'Hi'))

Default for FINDREP: None; must be specified. See Appendix B, "Specification/Override of DFSORT Options".

Applicable Functions: See Specification/override of DFSORT options.

IFTHEN
Read syntax diagramSkip visual syntax diagram
   .-,-------------------------------------------------------------------.   
   V                                                                     |   
>>---IFTHEN=(-+-WHEN=INIT-+-,PARSE=(definitions)-+-------------------+-)-+-><
              |           '-+-,BUILD=(items)---+-'                   |       
              |             +-,OVERLAY=(items)-+                     |       
              |             '-,FINDREP=(items)-'                     |       
              +-WHEN=GROUP-+-,BEGIN=(logexp)-+-,PUSH=(items)---------+       
              |            +-,KEYBEGIN=(p,m)-+                       |       
              |            +-,END=(logexp)---+                       |       
              |            '-,RECORDS=n------'                       |       
              +-WHEN=(logexp)-+-,PARSE=(definitions)-+-+-----------+-+       
              |               '-+-,BUILD=(items)---+-' '-,HIT=NEXT-' |       
              |                 +-,OVERLAY=(items)-+                 |       
              |                 '-,FINDREP=(items)-'                 |       
              +-WHEN=ANY-+-,PARSE=(definitions)-+-+-----------+------+       
              |          '-+-,BUILD=(items)---+-' '-,HIT=NEXT-'      |       
              |            +-,OVERLAY=(items)-+                      |       
              |            '-,FINDREP=(items)-'                      |       
              '-WHEN=NONE-+-,PARSE=(definitions)-+-------------------'       
                          '-+-,BUILD=(items)---+-'                           
                            +-,OVERLAY=(items)-+                             
                            '-,FINDREP=(items)-'                             

IFTHEN clauses allow you to reformat different records in different ways by specifying how build, overlay, find/replace or group operation items are to be applied to records that meet given criteria. IFTHEN clauses let you use simple or complex conditional logic to choose how different record types are reformatted.

If you want to insert, rearrange, or delete fields in the same way for every record, use BUILD or FIELDS rather than IFTHEN. If you want to do find and replace operations in the same way for every record, use FINDREP rather than IFTHEN. Use IFTHEN clauses if you want to insert, rearrange, delete or overlay fields, or perform find/replace operations in different ways for different records, or if you want to perform operations on groups of records.

You can use five types of IFTHEN clauses as follows:
  • WHEN=INIT: Use one or more WHEN=INIT clauses to apply build, overlay or find/replace items to all of your input records. WHEN=INIT clauses and WHEN=GROUP clauses are processed before any of the other IFTHEN clauses.
  • WHEN=GROUP: Use one or more WHEN=GROUP clauses to propagate fields, identifiers and sequence numbers within specified groups of records. WHEN=INIT clauses and WHEN=GROUP clauses are processed before any of the other IFTHEN clauses.
  • WHEN=(logexp): Use one or more WHEN=(logexp) clauses to apply build, overlay or find/replace items to your input records that meet specified criteria. A WHEN=(logexp) clause is satisfied when the logical expression evaluates as true.
  • WHEN=ANY: Use a WHEN=ANY clause after multiple WHEN=(logexp) clauses to apply additional build, overlay or find/replace items to your input records if they satisfied the criteria for any of the preceding WHEN=(logexp) clauses.
  • WHEN=NONE: Use one or more WHEN=NONE clauses to apply build, overlay or find/replace items to your input records that did not meet the criteria for any of the WHEN=(logexp) clauses. WHEN=NONE clauses are processed after any of the other IFTHEN clauses. If you do not specify a WHEN=NONE clause, only the WHEN=INIT and WHEN=GROUP changes (if any) are applied to input records that do not meet the criteria for any of the WHEN=(logexp) clauses.
IFTHEN clauses are processed in the following order:
  • WHEN=INIT clauses or WHEN=GROUP clauses
  • WHEN=(logexp) clauses and WHEN=ANY clauses
  • WHEN=NONE clauses
Processing of IFTHEN clauses continues unless one of the following occurs:
  • A WHEN=(logexp) or WHEN=ANY clause is satisfied, and HIT=NEXT is not specified.
  • There are no more IFTHEN clauses to process. When processing of IFTHEN clauses stops, the IFTHEN record created so far is used as the output record.
Example:
  OUTREC IFTHEN=(WHEN=(12,1,BI,ALL,X'3F'),OVERLAY=(18:C'Yes')),
         IFTHEN=(WHEN=(35,2,PD,EQ,+14),BUILD=(1,40,45,3,HEX),HIT=NEXT),
         IFTHEN=(WHEN=(35,2,PD,GT,+17),BUILD=(1,40,41,5,HEX),HIT=NEXT),
         IFTHEN=(WHEN=ANY,BUILD=(1,55,C'ABC',70:X)),
         IFTHEN=(WHEN=(63,2,CH,EQ,C'AB'),OVERLAY=(18:C'No')),
         IFTHEN=(WHEN=NONE,BUILD=(1,40,51,8,TRAN=LTOU))
For this example, the IFTHEN clauses are processed as follows:
  • If IFTHEN clause 1 is satisfied, its overlay item is applied and IFTHEN processing stops.
  • If IFTHEN clause 1 is not satisfied, its overlay item is not applied and IFTHEN processing continues.
  • If IFTHEN clause 2 is satisfied, its build items are applied and IFTHEN processing continues.
  • If IFTHEN clause 2 is not satisfied, its build items are not applied and IFTHEN processing continues.
  • If IFTHEN clause 3 is satisfied, its build items are applied and IFTHEN processing continues.
  • If IFTHEN clause 3 is not satisfied, its build items are not applied and IFTHEN processing continues.
  • If IFTHEN clause 4 is satisfied, its build items are applied and IFTHEN processing stops.
  • If IFTHEN clause 4 is not satisfied, its build items are not applied and IFTHEN processing continues.
  • If IFTHEN clause 5 is satisfied, its overlay item is applied and IFTHEN processing stops.
  • If IFTHEN clause 5 is not satisfied, its overlay item is not applied and IFTHEN processing continues.
  • If IFTHEN clause 6 is satisfied, its build items are applied and IFTHEN processing stops.
  • If IFTHEN clause 6 is not satisfied, its build items are not applied and IFTHEN processing stops.
All of the IFTHEN clauses operate sequentially on an IFTHEN record. The IFTHEN record is created initially from the input record. Each IFTHEN clause tests and changes the IFTHEN record, as appropriate. Thus, changes made by earlier IFTHEN clauses are "seen" by later IFTHEN clauses. For example, if you have a 40-byte input record and specify:
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(8:8,4,ZD,ADD,+1,TO=ZD,LENGTH=4)),
         IFTHEN=(WHEN=(8,4,ZD,EQ,+27),OVERLAY=(28:C'Yes')),
         IFTHEN=(WHEN=NONE,OVERLAY=(28:C'No'))

The WHEN=INIT clause adds 1 to the ZD value and stores it in the IFTHEN record. The WHEN=(8,4,ZD,EQ,+27) clause tests the incremented ZD value in the IFTHEN record rather than the original ZD value in the input record.

The IFTHEN record is adjusted as needed for the records created or changed by the IFTHEN clauses. For fixed-length records, blanks are filled in on the left as needed. For variable-length records, the RDW length is adjusted as needed each time the IFTHEN record is changed.

Missing bytes in specified input fields are replaced with blanks so the padded fields can be processed.

DFSORT sets an appropriate LRECL (or reformatted record length if the OUTREC record is further modified) for the output records based on the build, overlay, find/replace and group operation items specified by the IFTHEN clauses. However, DFSORT does not analyze the possible results of WHEN=(logexp) conditions when determining an appropriate LRECL. When you use OUTREC IFTHEN clauses, you can override the OUTREC LRECL determined by DFSORT with the OUTREC IFOUTLEN parameter.

If SEQNUM is used in multiple IFTHEN clauses, the sequence number will be incremented for each record that satisfies the IFTHEN clause, that is, a separate SEQNUM counter will be kept for each IFTHEN clause. For example, if your input is:
RECORD A 1
RECORD B 1
RECORD B 2
RECORD C 1
RECORD A 2
RECORD C 2
RECORD B 3
RECORD D 1
and you specify:
  OUTREC IFTHEN=(WHEN=(8,1,CH,EQ,C'A'),OVERLAY=(15:SEQNUM,4,ZD)),
         IFTHEN=(WHEN=(8,1,CH,EQ,C'B'),OVERLAY=(16:SEQNUM,4,ZD)),
         IFTHEN=(WHEN=NONE,OVERLAY=(17:SEQNUM,4,ZD))
your output will be:
RECORD A 1    0001
RECORD B 1     0001
RECORD B 2     0002
RECORD C 1      0001
RECORD A 2    0002
RECORD C 2      0002
RECORD B 3     0003
RECORD D 1      0003
Separate SEQNUM counters are kept for the 'A' record, for the 'B' record, and for the NONE records.

The IFTHEN clauses of the OUTREC statement apply to all input records whereas the IFTHEN clauses of the OUTFIL statement only apply to the OUTFIL input records for its OUTFIL group.

WHEN=INIT clause
See "WHEN=INIT clause" under OUTFIL IFTHEN for details. Note that / cannot be used to create blank records or new records.
Sample Syntax:
  OUTREC IFTHEN=(WHEN=INIT,
           BUILD=(1,20,21:C'Department',31:3X,21,60)),
         IFTHEN=(WHEN=(5,2,CH,EQ,C'D1'),OVERLAY=(31:8,3)),
         IFTHEN=(WHEN=(5,2,CH,EQ,C'D2'),OVERLAY=(31:12,3))
WHEN=GROUP clause
See "WHEN=GROUP clause" under OUTFIL IFTHEN for details.
Sample Syntax
  OUTREC IFTHEN=(WHEN=GROUP,
    BEGIN=(1,40,SS,EQ,C'J82',OR,1,40,SS,EQ,C'M72'),
    PUSH=(41:ID=5))
WHEN=(logexp) clause
See "WHEN=(logexp) clause" under OUTFIL IFTHEN for details. Note that although / can be used to create blank records and new records with OUTFIL, it cannot be used with OUTREC.
Sample Syntax:
  OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,C'T01',AND,
       18,4,ZD,LE,+2000),OVERLAY=(42:C'Type1 <= 2000'),HIT=NEXT),
         IFTHEN=(WHEN=(1,3,CH,EQ,C'T01',AND,6,1,BI,BO,X'03'),
            BUILD=(1,21,42,13)),
         IFTHEN=(WHEN=(1,3,CH,EQ,C'T01',AND,
            18,4,ZD,GT,+2000),OVERLAY=(42:C'Type1 > 2000 '),HIT=NEXT),
         IFTHEN=(WHEN=(1,3,CH,EQ,C'T01',AND,6,1,BI,BO,X'01'),
            BUILD=(1,25,42,13))
WHEN=ANY clause
See "WHEN=ANY clause" under OUTFIL IFTHEN for details. Note that although / can be used to create blank records and new records with OUTFIL, it cannot be used with OUTREC.
Sample Syntax:
  OUTREC IFTHEN=(WHEN=(1,3,SS,EQ,C'T01,T02,T03'),
                 BUILD=(C'Group A',X,1,80),HIT=NEXT),
         IFTHEN=(WHEN=(1,3,SS,EQ,C'T04,T05,T06'),
                 BUILD=(C'Group B',X,1,80),HIT=NEXT),
         IFTHEN=(WHEN=(1,3,SS,EQ,C'T07,T08,T09,T10'),
                 BUILD=(C'Group C',X,1,80),HIT=NEXT),
         IFTHEN=(WHEN=ANY,OVERLAY=(16:C'Group Found')
WHEN=NONE clause
See "WHEN=NONE clause" under OUTFIL IFTHEN for details. Note that although / can be used to create blank records and new records with OUTFIL, it cannot be used with OUTREC.
Sample Syntax:
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,20,21:C'Department',31:3X,21,60)),
         IFTHEN=(WHEN=(5,2,CH,EQ,C'D1'),OVERLAY=(31:8,3)),
         IFTHEN=(WHEN=(5,2,CH,EQ,C'D2'),OVERLAY=(31:12,3)),
         IFTHEN=(WHEN=NONE,OVERLAY=(31:C'***'))

Default for IFTHEN clauses: None; must be specified.

Applicable Functions: See Specification/override of DFSORT options.

IFOUTLEN
Read syntax diagramSkip visual syntax diagram
>>-IFOUTLEN=n--------------------------------------------------><

Overrides the OUTREC LRECL (or reformatted record length if the OUTREC record is further modified) determined by DFSORT from your OUTREC IFTHEN clauses. DFSORT sets an appropriate LRECL for the output records based on the build, overlay, find/replace and group operation items specified by the IFTHEN clauses. However, DFSORT does not analyze the possible results of WHEN=(logexp) conditions when determining an appropriate OUTREC LRECL. When you use OUTREC IFTHEN clauses, you can override the OUTREC LRECL determined by DFSORT with the OUTREC IFOUTLEN parameter.

Fixed-length records longer than the IFOUTLEN length are truncated to the IFOUTLEN length. Fixed-length records shorter than the IFOUTLEN are padded with blanks to the IFOUTLEN length. Variable-length records longer than the IFOUTLEN length are truncated to the IFOUTLEN length.

n
specifies the length to use for the OUTREC LRECL (or for the reformatted record length if the OUTREC record is further modified) . The value for n must be between 1 and 32767, but must not be larger than the maximum LRECL allowed for the RECFM, and must not conflict with the specified or retrieved LRECL for the fixed-length output data set.
Sample Syntax:
  OUTREC IFOUTLEN=70,
         IFTHEN=(WHEN=(5,1,CH,EQ,C'1',AND,8,3,ZD,EQ,+10),
             BUILD=(1,40,C'T01-GROUP-A',65)),
         IFTHEN=(WHEN=(5,1,CH,EQ,C'2',AND,8,3,ZD,EQ,+12),
             BUILD=(1,40,C'T02-GROUP-B',65))

Default for IFOUTLEN: The LRECL determined from the IFTHEN clauses.

1 If INREC is specified, p must refer to the record as reformatted by INREC. If your E15 user exit reformats the record, and INREC is not specified, p must refer to the record as reformatted by your E15 user exit.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014