Page 1 of 1

What is the difference between Inrec fields and outrec?

Posted: Sun Oct 13, 2013 9:53 pm
by alpna
Hi,

What is the difference between Inrec fields and outrec fields? I know that INREC is processed before the SORT is done and OUTREC is after SORTing? But is there any reference using which we can understand which verb will be accessed first among many verbs of DFsort.

Hope my question is clear...

Re: What is the difference between Inrec fields and outrec?

Posted: Mon Oct 14, 2013 4:30 am
by William Collins
See if this link helps. If not, I think you need to make your question clearer.

Re: What is the difference between Inrec fields and outrec?

Posted: Mon Apr 07, 2014 2:48 pm
by alpna
Thanks William. Link is very helpful.

Re: What is the difference between Inrec fields and outrec?

Posted: Tue May 27, 2014 10:21 pm
by MartinPacker
INREC reformats records on the way into a sort. OUTREC (and OUTFIL OUTREC) reformats them on the way out.

General guidance:

1) If you're going to cut down the record length do it on the INREC - if at all possible.

2) You can use INREC with e.g PARSE and IFTHEN to reformat records so that sort fields are in fixed positions. This might be handy for certain types of data - such as CSV.

Re: What is the difference between Inrec fields and outrec?

Posted: Sun Sep 13, 2015 10:44 am
by alpna
MartinPacker wrote:INREC reformats records on the way into a sort. OUTREC (and OUTFIL OUTREC) reformats them on the way out.
All these "reformats" are done temporarily right and is this the reason we include the WORK-FILES in SORT?

Re: What is the difference between Inrec fields and outrec?

Posted: Sun Sep 13, 2015 11:11 am
by enrico-sorichetti
All these "reformats" are done temporarily right and is this the reason we include the WORK-FILES in SORT?
NOPE, the work file are needed due to the architecture of the sort algorithm

Re: What is the difference between Inrec fields and outrec?

Posted: Sun Sep 13, 2015 12:15 pm
by William Collins
Reformatting is only temporary if you make it so, by unwinding it later in the code. You make temporary changes because you need some intermediate value for your task.

If all changes were temporary, there would be no point in running the step.

If there is a SORT and changes have been made in INREC, then the data will be on the sort-work files (if sort-work is needed for the sort), but that is because it is how the sorting of data works, not anything to do with any changes made (or not).

Re: What is the difference between Inrec fields and outrec?

Posted: Tue Sep 22, 2015 5:09 pm
by alpna
Thanks!

But many a times I don't supply the SORTWK files in the job but that still works, if they are needed why don't we get en error/

Re: What is the difference between Inrec fields and outrec?

Posted: Tue Sep 22, 2015 5:13 pm
by William Collins
Either the amount of data is too small to require work-files or, more likely, you are using DFSORT's dynamic allocation of work datasets which, generally, is the best way to do it. Dynamic allocation is overridden if SORTWKn files are present in the step, which you may want for large datasets with many records of similar size and a few of a greatly different size.

Re: What is the difference between Inrec fields and outrec?

Posted: Fri Sep 25, 2015 9:01 pm
by alpna
Ok, thanks William.