IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

INREC and OUTREC in Sort JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Hemant B.

New User


Joined: 05 Oct 2006
Posts: 8

PostPosted: Thu Oct 12, 2006 9:52 am
Reply with quote

Why we use INREC and OUTREC in JCL SORT?

and
what it means....
Code:
sortrec fields= (1:25,10)
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Oct 12, 2006 10:13 am
Reply with quote

Hi There.

You can change the layout of a record both before and after it is sorted using the INREC and OUTREC keywords. You simply specify the fields to be included in the new record.
INREC reformats the record layout before it is passed through the sort, while OUTREC will reformat the record layout after the record has been sorted.


Here's some examples:
SORT FIELDS=(1,10,CH,A)
INREC=(1,10,CH,50,4,PD,40,4,PD)


SORT FIELDS=(1,10,CH,A)
OUTREC=(1,10,50,4,40,4)

Both examples will reformat the record so that it consists of the first 10 bytes of the input record, followed by the 4 bytes starting at position 50, followed by the 4 bytes starting at position 40.
Back to top
View user's profile Send private message
Hemant B.

New User


Joined: 05 Oct 2006
Posts: 8

PostPosted: Thu Oct 12, 2006 10:33 am
Reply with quote

means there is no difference between inrec and outrec.
inrec for before pass it to sort and outrec for after sort..

and whats the
outrec fields=(1:25,10) means?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Oct 12, 2006 9:02 pm
Reply with quote

Code:

   OUTREC FIELDS=(1:25,10)


This OUTREC statement writes output records with input positions 25-34 in output positions 1-10.

Quote:
means there is no difference betn inrec and out rec.
inrec for before pass it to sort and outrec for after sort..


INREC and OUTREC can both reformat records in the same way and are often interchangeable. However, if you need SORT to see the reformatted records, you would use INREC. For example:

Code:

   INREC OVERLAY=(81:SEQNUM,8,ZD)
   SORT FIELDS=(81,8,ZD,A)


Here we're adding a sequence number to each record so we can sort on it. INREC works for this because it add the sequence numbers before the records are sorted. OUTREC would not work for this because it would add the sequence numbers after the records are sorted.

Quote:
Here's some examples:
SORT FIELDS=(1,10,CH,A)
INREC=(1,10,CH,50,4,PD,40,4,PD)


SORT FIELDS=(1,10,CH,A)
OUTREC=(1,10,50,4,40,4)

Both examples will reformat the record so that it consists of the first 10 bytes of the input record, followed by the 4 bytes starting at position 50, followed by the 4 bytes starting at position 40.


Lots of errors here. INREC= and OUTREC= are invalid. It should be:

Code:

   INREC FIELDS=(...) 

and

   OUTREC FIELDS=(...)


The CH in the first INREC statement is invalid. It should be 1,10,50,... rather than 1,10,CH,50,... CH is not allowed (or needed).

The explanation for what the OUTREC statement does is correct. But the INREC statement works differently because of the PD fields. 50,4,PD indicates input positions 50-53 has a PD field to be converted using the M0 edit mask. Likewise, 40,4,PD indicates input positions 40-43 has a PD field to be converted using the M0 edit mask. The results of the INREC statement and the OUTREC statement would be very different.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts FB to .CSV conversion using sort DFSORT/ICETOOL 7
Search our Forums:

Back to Top