I'm having a file containing some records with duplicates. I need to write a JCL to write unique records in one output file and duplicates in another output file. This has to be done through JCL alone. How to code Jcl for this????
My requirement is to splitt a file having duplicates such that one output file should contain unique records and the other one contains duplicate records.
The jcl which Mr.vicky has sent will retrieve unique records from the input file. That's fine. along with that i need one more output file which contains duplicated records that has been omitted in first output file.
suppose let the i/p file contents are like this
A,B,C,D,A,E,F,B (A,B apperars twice)
O/P 1 should be A,B,C,D,E,F
O/P 2 should be A,B
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Padma,
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
A
B
C
D
A
E
F
B
/*
//FIRST DD DSN=... output file1
//REST DD DSN=... output file2
//TOOLIN DD *
SELECT FROM(IN) TO(FIRST) ON(1,1,CH) FIRST DISCARD(REST)
/*
FIRST will have:
Code:
A
B
C
D
E
F
REST will have:
Code:
A
B
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from: