2 input files sorted into 1 output file

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
dkirk@sungard
Member
Posts: 1
Joined: Sat Feb 03, 2007 3:03 am

2 input files sorted into 1 output file

Post by dkirk@sungard » Sat Feb 03, 2007 3:15 am

I have two input files with the same key values. I need to sort on the key and write one output file containing both records from the input files on the same output record.

I.E. File1/rec1 key = 123
File2/rec1 key = 123

output
outfile1/rec1 containing file1/rec1 and file2/rec1

Is this a merge function or and outfil/outrec function?

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Sat Feb 03, 2007 4:52 am

dkirk@sungard,

We can do it using ICETOOL, please find the test job below.

I/P->
*****

FILEA

10 11

FILEB

10 12

FINALOUT
********

10 11 12 -> I think this is ur requirement


//TESTSPLC JOB (TEST,04,T,0000),'SORTT',CLASS=C,MSGCLASS=T, JOB45059
// NOTIFY=AAAAA
//*
/*JOBPARM L=9999
//*
//JOBLIB DD DSN=LOADLIB,DISP=SHR
//*
//JS010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//*
//IN1 DD *
10 11
//*
//IN2 DD *
10 12
//* here use a temp dataset bcoz ihave used mod
//TMP1 DD DSN=TEMPFILE, /* OUTPUT
// DISP=(MOD,PASS),
// UNIT=SYSDA,
// SPACE=(CYL,(1,2),RLSE),
// DCB=(RECFM=FB,BLKSIZE=0)
//OUT DD DSN=SPLOUT, /* OUTPUT
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(1,2),RLSE),
// DCB=(RECFM=FB,LRECL=8,BLKSIZE=800)
//LIST1 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1) USING(CPY1)
COPY FROM(IN2) TO(TMP1) USING(CPY2)
SPLICE FROM(TMP1) TO(OUT) ON(1,2,CH) WITH(7,2)
//CPY1CNTL DD *
OUTREC FIELDS=(1:1,2,4:4,2,7:2X)
//CPY2CNTL DD *
OUTREC FIELDS=(1:1,2,7:4,2)

Let us know if this doesn meet your requirements, we can tailor accordingly.

Thanks
Veera

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Sat Feb 03, 2007 9:14 pm

If you want fields from each file in the same output record, you can use the technique discussed in the "Join fields from two files on a key" Smart DFSORT Trick at:

http://www.ibm.com/systems/support/stor ... vs/tricks/

If you need more specific help, please show an example of the records in your input files and the records you expect for output. Tell us the RECFM and LRECL of the input files and the starting position, length and format of the key in each input file.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others