Sunday, 10 August 2014

SYNCSORT || SORT INREC || INREC and OUTREC || SORT INREC Examples.

OUTREC
SORT INREC and OUTREC 

In today's blog, I will talk about SORT INREC and OUTREC control statements. These are significant control parameters that is use to improve the efficiency of the JCL SORT. 

Let's start with INREC and OUTREC tutorial.  

SORT INREC and OUTREC Overview. 


The best way to improve SORT/MERGE efficiency is to include only those fields that is required in the output file thus reducing the number of bytes that SORT INREC required to process. 

To do that, you can use the SORT INREC control statement. The INREC control statement re formats the input records. You can use the INREC control statement to perform various data operations such as add, delete, or reformat fields before the records are sorted or merged.

In the similar term, you can use the OUTREC statement to write only certain fields to the sorted output file. In fact, You can also use the INREC and OUTREC statements to reformat the sort/merge records. 

Important Point:

  • The same result may be achieved in some cases by changing the data format of certain fields. For example, if you need to change the format of a ZD field to PD, which reduces the number of bytes for the field, it is more efficient to use INREC rather than OUTREC for the conversion. Additionally, for SORT/MERGE processing PD fields are processed more efficiently than ZD fields. 
  • The OUTREC processing isn’t done until the sorting or merging is finished. So while it still improves I/O operations by limiting the amount of output that’s written, it doesn’t have as big an effect on processing efficiency as using the INREC statement does.


The syntax of the INREC and OUTREC statements 

INREC  FIELDS=([c:][separation-fld,]position,length[,align,]…)
OUTREC FIELDS=([c:][separation-fld,]position,length[,align,]…)

INREC/OUTREC Parameter explanation: 



c:
Describe the column (byte) in which a data field or separation field should be placed, relative to the start of the record. If the column settings that are coded skip over any bytes, those bytes are filled with spaces.

separation-fld
Tells the sort/merge utility to insert a constant value into the record. The constant can be specified in one of these forms:

nX

Inserts n repetitions of spaces

nZ

Inserts n repetitions of binary zeros

nC’text’

Inserts n repetitions of the specified text

nX’hex’

Inserts n repetitions of the specified hex value

If n is omitted, one repetition of the specified constant is inserted.

position

The location of the first byte of the field.

length

The length of the field in bytes.

align

Tells the sort/merge utility to align the field on a halfword (H), fullword (F), or doubleword (D) boundary, but this shouldn’t be necessary on a modern system.


SORT INREC Example: 

//RCMX01   JOB  (JOB CARD...)          Gives the Jobname
//         EXEC PGM=SORT               Identifies the Program
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD DSN=RC01.PAYROL.JAN,DISP=SHR 
//SORTOUT  DD SYSOUT=* 
//SORTWK01 DD SPACE=(CYL,10),UNIT=SYSDA 
//SYSIN DD *
  INREC FIELDS=(1,9,74,2)
  SORT FIELDS=(10,2,PD,D) 
/*


INREC Example: Just use the data in bytes 1-50 of the input records.

INREC FIELDS=(1,50)

Example 1: Just use the data in bytes 1-50, 75-99, and 125-174 of the input records.

INREC FIELDS=(1,50,75,25,125,50)

Example 2: The output records contain only the data in bytes 1-80 and bytes 100-124 of the input records.

OUTREC FIELDS=(1,80,100,25)

Example 3: The output records start with the data in bytes 100-124 of the input records, followed by the data in bytes 1-80.

OUTREC FIELDS=(100,25,1,80)

Example 4: The output records start with four blank spaces followed by the character E in byte 5, followed by another blank space, then the data from bytes 1-80 of the input records starting in byte 7, and finally, ten blank spaces.

OUTREC FIELDS=(5:C'E',7:1,80,10X)

No comments:

Post a Comment

New In-feed ads