View previous topic :: View next topic
|
Author |
Message |
kanisha_prabha
New User
Joined: 10 Mar 2006 Posts: 26
|
|
|
|
Hi,
I have 2 datasets. Each has a record length of 99 bytes. I need to pick up a record from file 2 if first 10 characters of any record in file 1 match with first 10 characters of the record in file 2. Can I do this using sort? (not ICEMAN/ICETOOL).
example.
File 1
------
AAAAAAAAAA?????????????
BBBBBBBBBBdont pull record from here since it is file 1
CCCCCCCCC?????????????
File 2
------
XXXXXXXXXXthis record should not be pulled
BBBBBBBBBBthis record should be pulled
Output file
------------
BBBBBBBBBBthis record should be pulled
Thanks,
Kanisha |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Kanisha,
You can use this DFSORT/ICETOOL job to do what you asked for. Note that input file2 is concatenated before input file1 so we can use FIRSTDUP which is generally more efficient than LASTDUP.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=... input file2
// DD DSN=... input file1
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(CON) TO(OUT) ON(1,10,CH) FIRSTDUP
/*
|
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:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
Selva-kumar
New User
Joined: 01 Mar 2007 Posts: 52 Location: chennai
|
|
|
|
Frank,
The ICETOOL method you have suggested for copying the records from two files is working fine for flat files? But it is not working for VSAM files. Its showing VSAM open errorWhat change needs to be done for using the same for vsam file? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
S.Selvakumar,
The system does not allow VSAM data sets to be concatenated. You'll need to copy each VSAM file to a MOD flat file and then use the flat file for the SELECT operator. Assuming the VSAM files have the same attributes and the records are fixed length, you could use a DFSORT/ICETOOL job something like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... VSAM input file1
//IN2 DD DSN=... VSAM input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(IN1) TO(T1) VSAMTYPE(F)
COPY FROM(IN2) TO(T1) VSAMTYPE(F)
SELECT FROM(T1) TO(OUT) ON(1,10,CH) FIRSTDUP
/*
|
|
|
Back to top |
|
|
|