Please explain with syntax and an example, the Inrec fields
and Outrec build in sort.

Answer Posted / cd

In most cases INREC and OUTREC statements can be used
interchangeably..

The difference between them is more of a performance issue
than anything else.

For Example:

INPUT
------

Name Regn. No. School ADDRESS
____ _________ _______ __________________________

DINA 1657565511 SSV sadadadadadadadadadadadada
EALA 1264546461 SADADADA ddwaedsagfdsdsadadagfdsdsw
ARUN 1214231211 DADARDCA kjhdsakjhgkjdagtsagdsakjhd
SUDA 1212121211 DRADS kiyeakjhsdakjgdajgshaskgsa
RINI 1275655345 AFAASFAF kadhlkjdabgsagkjashksaoksa


Assume, you want to have the sorted names of the people from
this file in the output.

What Inrec would do:

//SYSIN DD *
SORT FIELDS=(1,4,CH,A)
INREC FIELDS=(1,4)
/*


Step 1.

Name
____
DINA
EALA
ARUN
SUDA
RINI

Step 2.

Name
____
ARUN
DINA
EALA
RINI
SUDA


If outrec was used, the steps 1 and 2 would be reversed.


thanks

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name a few IBM utility programs, and explain its function.

4538


Explain the function of a dd statement?

750


in ways data can be passed to a COBOL program from JCL?

738


How to submit jcl through a cobol program?

777


what happens when COND is coded in JOB statement and when COND is coded inside EXEC statement?

886






I want to JCL sort for Non-COMP and COMP-3 fields SORT FIELDS=(1,5,A,6,11,A,12,11,A,19,1,A,20,1,A),FORMAT=BI,EQUALS Length of comp bytes is 11 bytes which start at 6byte and 12 byte considering 11 bytes in comp-3 is 6 bytes. Can anyone tell if the above sort work SORT FIELDS=(1,5,A,6,6,A,12,6,A,19,1,A,20,1,A),FORMAT=BI,EQUALS does not works OK

1592


How to compare two files in SYNCSORT and on the mismatch record should be deleted from second file.

5167


why should SYSIN DD * statement should not be included inside a PROCedure snippet??? please answer this.. i need to know.

2047


define cond parameter in jcl?

874


Does jcl support automatic restart?

855


My Question is 1. How to cound no. of records in JCL. Please explain with an example. 2. How to execute only odd steps in JCL? I know EDIT TYPE = Inculde, Step Name = 1,3,5 and COND code for all even step. Anyone knows other than this.

2089


which utility is used to run a cobol-db2 program?

914


1) SORT FIELDS=(20,4,CH,D,10,3,CH,D) OUTREC FIELDS=(7:20,4,C' FUTURE ',20,2,10,3,1Z,1,9,13,7, 24,57,TRAN=LTOU,6X'FF') This example illustrates how a fixed-length input data set can be sorted and reformatted for output. The SORTIN LRECL is 80 bytes. The reformatted output records are fixed length with a record size of 103 bytes. SOLRF (the IBM-supplied default) is in effect, so unless the SORTOUT LRECL is specified or available, it will automatically be set to the reformatted record length of 103. in the above example i have some doubts that a) sort fields=(20,4,CH,D,10,3,CH,D) -what exactly it does and this fields related to output record fields or input record fields b)outrec used to refprmat the records after sorting that means could please reply me as soon as possible Thanks. Venkat

7255


Is automatic restart possible in jcl?

848


i want to store 20 digits . how will u do it in cobol ?

960