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


INREC control statement

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

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

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

The INREC 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 user-defined editing masks.

  • Transformation of SMF, TOD, and ETOD date and time values to more usable forms.
  • 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.
  • Various types of arithmetic operations for input date fields.
  • 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 INREC records in one of the following 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 INREC records and the order in which they appear. You can delete, rearrange and insert fields and constants. Example:
      INREC 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:
      INREC OVERLAY=(45:45,8,TRAN=LTOU)
  • FINDREP: Reformat each record by doing various types of find and replace operations. Example:
      INREC 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:
      INREC 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 INREC 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.

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

  INREC PARSE=(%00=(ENDBEFR=C'*',FIXLEN=3),
      %01=(ENDBEFR=BLANKS,FIXLEN=6),
      %02=(STARTAT=C'MAX',FIXLEN=8),
      %03=(STARTAFT=C'(',ENDBEFR=C')',FIXLEN=6),
      %04=(STARTAFT=BLANKS,FIXLEN=5)),
    BUILD=(%03,X,%03,HEX,21:%02,31:%01,SFF,M26,LENGTH=7,
           18,6,%00,UFF,M11,LENGTH=3,%04,JFY=(SHIFT=RIGHT))

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

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 INREC record in the order in which they are to be included. The reformatted INREC 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:
  INREC 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.

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 input 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 input 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.

Both valid and invalid examples are shown in Table 1.

Table 1. Examples of Valid and Invalid Column Alignment . Examples of Valid and Invalid Column Alignment

Validity

Specified

Result

Valid

33:C'State '

Columns 1-32 — blank
Columns 33-38 — 'State '

Valid

20:5,4,30:10,8

Columns 1-19 — blank
Columns 20-23 — input field (5,4)
Columns 24-29 — blank
Columns 30-37 — input field (10,8)

Invalid

0:5,4

Column value cannot be zero.

Invalid

:25Z

Column value must be specified.

Invalid

32753:21,8

Invalid — column value must be less
than 32753.

Invalid

5:10:2,5

Column values cannot be adjacent.

Invalid

20,10,6:C'AB'

Column value overlaps previous field.

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 input record. It can be specified before or after any input field. Consecutive separation fields can 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 input records. n can range from 1 to 4095. If n is omitted, 1 is used.
Examples of valid and invalid blank separation are shown in Table 2.
Table 2. Examples of Valid and Invalid Blank Separation
Examples of Valid and Invalid Blank SeparationValidity
Specified Result
Valid X or 1X 1 blank
Valid 4095X 4095 blanks
Invalid 5000X Too many repetitions. Use two adjacent separation fields instead (2500X,2500X, for example)
Invalid 0X 0 is not allowed.
nZ
Binary zero separation. n bytes of binary zeros (X'00') are to appear in the reformatted input records. n can range from 1 to 4095. If n is omitted, 1 is used.
Examples of valid and invalid binary zero separation are shown in Table 3.
Table 3. Examples of Valid and Invalid Binary Zero Separation
Examples of Valid and Invalid Binary Zero SeparationValidity
Specified Result
Valid Z or 1Z 1 binary zero
Valid 4095Z 4095 binary zeros
Invalid 4450Z Too many repetitions. Use two adjacent separation fields instead (4000Z,450Z for example).
Invalid 0Z 0 is not allowed.
nC'xx...x'
Character string separation. n repetitions of the character string constant (C'xx...x') are to appear in the reformatted input 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'
Examples of valid and invalid character string separation are shown in Table 4.
Table 4. Examples of Valid and Invalid Character String Separation
Examples of Valid and Invalid Character String SeparationValidity
Specified Result Length
Valid C'John Doe' John Doe 8
Valid C'JOHN DOE' JOHN DOE 8
Valid C'$@#' $@# 3
Valid C'+0.193' +0.193 6
Valid 4000C'  ' 8000 blanks 8000
Valid 20C'**FILLER**' **FILLER** repeated 20 times 200
Valid C'Frank''s' Frank's 7
Invalid C''''' Apostrophes not paired n/a
Invalid 'ABCDEF' C identifier missing n/a
Invalid C'ABCDE Apostrophe missing n/a
Invalid 4450C'1' Too many repetitions. Use two adjacent separation fields instead (4000C'1',450C'1', for example). n/a
Invalid 0C'ABC' 0 is not allowed n/a
Invalid C'' No characters specified n/a
Invalid C'Frank's' Two single apostrophes needed for one n/a
nX'yy...yy'
Hexadecimal string separation. n repetitions of the hexadecimal string constant (X'yy...yy') are to appear in the reformatted input 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. Examples of valid and invalid hexadecimal string separation are shown in Table 5.
Table 5. Examples of Valid and Invalid Hexadecimal String Separation
Examples of Valid and Invalid Hexadecimal String SeparationValidity
Specified Result Length
Valid X'FF' FF 1
Valid X'BF3C' BF3C 2
Valid 3X'00000F' 00000F00000F00000F 9
Valid 4000X'FFFF' FF repeated 8000 times 8000
Invalid X'ABGD' G is not a hexadecimal digit n/a
Invalid X'F1F' Incomplete pair of digits n/a
Invalid 'BF3C' X identifier missing n/a
Invalid 'F2F1'X X in wrong place n/a
Invalid 8000X'01' Too many repetitions. Use two adjacent separation fields instead (4000X'01',4000X'01', for example). n/a
Invalid 0X'23AB' 0 is not allowed n/a
Invalid X'' No hexadecimal digits specified n/a
DATEn, DATEn(c), DATEnP
Constant for current date. The current date of the run is to appear in the reformatted input 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 input 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 input 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 input 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 input 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 input 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 input 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 input 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 input 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 input 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 input 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 input 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 input 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 4 bytes contain the RDW). All fields must start on a byte boundary, and no field can extend beyond byte 32752. For special rules concerning variable-length records, see INREC statement notes.
m
Specifies the length of the input field. It must include the sign if the data is signed, and must be an integer number of bytes. See INREC statement notes for more information.
a
Specifies the alignment (displacement) of the input field in the reformatted input record relative to the start of the reformatted input record.
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 two (that is, position 1, 3, 5, and so forth).
F
Fullword aligned. The displacement is a multiple of four (that is, position 1, 5, 9, and so forth).
D
Doubleword aligned. The displacement is a multiple of eight (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 will always be padded with binary zeros.

%nn
specifies that an unedited parsed input field is to appear in the reformatted input 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 termination).
p
specifies that the unedited variable part of the input record (that part beyond the minimum record length), is to appear in the reformatted input 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 input 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:
  INREC FIELDS=(5:21,8,ZD,M19,X,46,5,ZD,M13,
                31:(35,6,FS),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 input 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 input 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, or CSF/FS fields.

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

Sample Syntax:
  INREC FIELDS=(21,5,ZD,TO=PD,X,(8,4,ZD),FI,LENGTH=2,X,55,4,FL,TO=FS)
%nn,f,to or (%nn,f),to
specifies that a converted numeric parsed input field is to appear in the reformatted input 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 input 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:
  INREC FIELDS=(5:+5000,EDIT=(T,TTT),X,
    (-25500),M18,LENGTH=8)
deccon,to or (deccon),to
specifies that a converted decimal constant is to appear in the reformatted input 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:
  INREC FIELDS=(+0,TO=PD,LENGTH=6,3Z,(-512000),FI)
arexp,edit or (arexp),edit
specifies that the edited result of an arithmetic expression is to appear in the reformatted input 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:
  INREC FIELDS=(C'**',27,2,FI,MIN,
                      83,4,PD,EDIT=(STTTTTTT),SIGNS=(+,-),
    15:(((15,5,ZD,ADD,+1),MUL,+100),DIV,62,2,PD),M25,LENGTH=10)
arexp,to or (arexp),to
specifies that the converted result of an arithmetic expression is to appear in the reformatted input 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:
  INREC FIELDS=((15,6,FS,SUB,+5),ADD,(-1,MUL,36,6,FS),ZD,X,
     3,2,FI,MIN,-6,LENGTH=4,TO=PD)
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:
  INREC 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:
  INREC 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:
  INREC 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
  INREC 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(/) 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.
  INREC 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:
  INREC 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 input 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:
  INREC 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 input 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:

INREC FIELDS=(1,10,
   21,20,JFY=(SHIFT=RIGHT),5X,
   52,12,JFY=(SHIFT=LEFT,PREBLANK=C'()',LEAD=C'VOL=SER=',
          LENGTH=16)) 
%nn,justify
specifies that a left-justified or right-justified parsed input field is to appear in the reformatted input 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 input 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-squeezed 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:

INREC FIELDS=(21,20,SQZ=(SHIFT=LEFT),5X,
   152,18,SQZ=(SHIFT=RIGHT,PREBLANK=X'00',
     LEAD=C'<',MID=C',',TRAIL=C'>',PAIR=APOST))
%nn,squeeze
specifies that a left-squeezed or right-squeezed parsed input field is to appear in the reformatted input 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 input record. The sequence numbers are assigned in the order in which the records are received for INREC 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:
  INREC FIELDS=(1,80,SEQNUM,8,ZD)

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

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:
  INREC 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:
  INREC 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:
  INREC 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.

See INREC FIELDS for details of the items listed in the OVERLAY syntax diagram previously. 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 fields 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:
  INREC 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:
  INREC OVERLAY=(5:X'0001',28:C'Date is ',YDDDNS=(4D),
           17:5C'*')

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

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
  INREC FINDREP=(IN=C'Goodbye',OUT=C'Bye')

Default for FINDREP: None; must be specified. See 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 overlay existing columns in the same way for every record, use OVERLAY 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 and 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:
  INREC 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:
  INREC 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 INREC 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 INREC IFTHEN clauses, you can override the INREC LRECL determined by DFSORT with the INREC 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:
  INREC 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.
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:
  INREC 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:
  INREC 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 INREC.

Sample Syntax:
   INREC 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 INREC.

Sample Syntax:
  INREC 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 INREC.

Sample Syntax:
 INREC 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. See Appendix B, "Specification/Override of DFSORT Options".

Applicable Functions: See Appendix B, "Specification/Override of DFSORT Options".

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

Overrides the INREC LRECL (or reformatted record length if the INREC record is further modified) determined by DFSORT from your INREC 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 INREC LRECL. When you use INREC IFTHEN clauses, you can override the INREC LRECL determined by DFSORT with the INREC 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 INREC LRECL (or for the reformatted record length if the INREC 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:
  INREC 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 your E15 user exit reformats the record, p must refer to the record as reformatted by the exit.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014