View previous topic :: View next topic
|
Author |
Message |
vidyasaraswathi
New User

Joined: 10 May 2005 Posts: 72
|
|
|
|
Hi,
I have 2 files. I want to compare them by using a key and if the records are present in either file1 or file2 but not in both files, then I want to write those records to an output file.
I heard that that this can be done through ICETOOL and SPLICE operator.
Please any one tell me how exactly this can be done.
Thanks and Regards,
Vidya Bhat |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
 |
vidyasaraswathi
New User

Joined: 10 May 2005 Posts: 72
|
|
|
|
Thank you Frank.
I saw this link. But I am not able to run this successfully.
1)In the following piece of code,
SPLICE FROM(T1) TO(OUT12) ON(1,10,CH) WITH(13,1) -
USING(CTL3) KEEPNODUPS
can you please explain what exactly ON(1,10,CH) , WITH(13,1) and
USING(CTL3) refer to?
2)I have 2 files with record length 133.
I want to compare 2 files based on the key Rep-No which is in the disposition 2 in the file and declared as PIC Z9(16).
Please tell me what values I have to use in SPLICE and OUTREC in the later steps?
Thanks in Advance,
Vidya Bhat |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
ON(1,10,CH) tells SPLICE that the key is a 10-byte character field in positions 1-10. WITH(13,1) tells SPLICE to overlay the byte at position 13 in the overlay record on to the base record at the same position. USING(CTL3) tells SPLICE to use the DFSORT control statements in the //CTL3CNTL data set.
For complete documentation on SPLICE, with lots of examples, see Chapter 6 of "z/OS DFSORT Application Programming Guide". Here's a link:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.13?DT=20050222160456
I don't know what PIC Z9(16) is. If you mean PIC S9(16), that's the equivalent of a 16-byte ZD field. If it starts in position 2, then the ON field would be ON(2,16,ZD).
If you need me to provide the DFSORT/ICETOOL job for you, then you need to give me more information. What is the RECFM and LRECL of the input files? What is the starting position, length and format of the key? Can input file1 have duplicates? Can input file2 have duplicates? Show me an example of the input records in each file, and what you want for the output files. Include duplicates in the example where relevent. |
|
Back to top |
|
 |
vidyasaraswathi
New User

Joined: 10 May 2005 Posts: 72
|
|
|
|
Hi Frank,
The link provided by you is very informative.
But still I could not get the result what I expected.
My requirement is:
-----------------------------
1)OUT1 should contain the records which are present only in IN1, but not in IN2.
2)OUT2 should contain the records which are present only in IN2, but not in IN1.
3)OUT12 should contain the records which are present in both IN1 and IN2.
This is my JCL
------------------
Code: |
//*-----------------------------------------------------------------
//S1 EXEC PGM=ICETOOL
//*-----------------------------------------------------------------
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=B052VAP.REP.SRTX1,DISP=SHR
//IN2 DD DSN=B052VAP.REP.SRTX2,DISP=SHR
//OUT12 DD DSN=B052VAP.OUT12,
// DISP=(OLD,CATLG),UNIT=SYSDA,
// VOL=SER=US3003,
// SPACE=(TRK,(500,250),RLSE),
// DCB=(B0.DSCB,RECFM=FB,LRECL=16,BLKSIZE=0)
//OUT1 DD DSN=B052VAP.OUT1,
// DISP=(OLD,CATLG),UNIT=SYSDA,
// VOL=SER=US3003,
// SPACE=(TRK,(500,250),RLSE),
// DCB=(B0.DSCB,RECFM=FB,LRECL=16,BLKSIZE=0)
//OUT2 DD DSN=B052VAP.OUT2,
// DISP=(OLD,CATLG),UNIT=SYSDA,
// VOL=SER=US3003,
// SPACE=(TRK,(500,250),RLSE),
// DCB=(B0.DSCB,RECFM=FB,LRECL=16,BLKSIZE=0)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
// DISP=(MOD,PASS)
//TOOLIN DD *
* ADD '11' IDENTIFIER FOR FILE1 RECORDS.
COPY FROM(IN1) TO(T1) USING(CTL1)
* ADD '22' IDENTIFIER FOR FILE2 RECORDS.
COPY FROM(IN2) TO(T1) USING(CTL2)
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR
* APPROPRIATE OUTPUT FILES.
SPLICE FROM(T1) TO(OUT12) ON(8,11,ZD) WITH(20,2) -
USING(CTL3) KEEPNODUPS
/*
//CTL1CNTL DD *
* MARK FILE1 RECORDS WITH '11'
OUTREC FIELDS=(8,11,20:C'11')
/*
//CTL2CNTL DD *
* MARK FILE2 RECORDS WITH '22'
OUTREC FIELDS=(8,11,20:C'22')
/*
//CTL3CNTL DD *
* MARK FILE3 RECORDS WITH '12'
OUTREC FIELDS=(8,11,20:C'12')
* WRITE MATCHING RECORDS TO OUT12 FILE. REMOVE ID.
OUTFIL FNAMES=OUT12,INCLUDE=(20,2,CH,EQ,C'12'),OUTREC=(2,16)
* WRITE FILE1 ONLY RECORDS TO OUT1 FILE. REMOVE ID.
OUTFIL FNAMES=OUT1,INCLUDE=(20,2,CH,EQ,C'11'),OUTREC=(2,16)
* WRITE FILE2 ONLY RECORDS TO OUT2 FILE. REMOVE ID.
OUTFIL FNAMES=OUT2,INCLUDE=(20,2,CH,EQ,C'22'),OUTREC=(2,16)
|
IN1 and IN2 contain valid input data.
Can you please tell me what is wrong with this JCL?
Thanks,
Vidya Bhat |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
No, I can't tell you what's wrong with the JCL, because I don't know what your data looks like.
In my previous post, I asked:
Quote: |
What is the RECFM and LRECL of the input files? What is the starting position, length and format of the key? Can input file1 have duplicates? Can input file2 have duplicates? Show me an example of the input records in each file, and what you want for the output files. Include duplicates in the example where relevent. |
I can't help you until you provide this information. |
|
Back to top |
|
 |
vidyasaraswathi
New User

Joined: 10 May 2005 Posts: 72
|
|
|
|
Hi,
RECFM and LRECL of both input files are same.Also both files do not contain duplicate records.
RECFM=FB
LRECL= 133
starting position of the key:8
Length of the key:11
Data type of the key :numeric (PIC 9)
Input files contain the following data:
IN1
====
00000006319452271 0000000000000000 010 03/25/05 88.00
00000006321701130 4308517430358832 010 03/28/05 30.80
00000006321704385 4308517410068641 010 03/29/05 25.20
00000006321857033 4308517431316193 010 03/29/05 3.15
00000006321897787 4308517430280473 010 04/01/05 49.00
00000006321922625 4308517431185820 010 03/26/05 50.45
00000006321945560 4308517430273544 010 03/30/05 65.00
00000006321964611 4308517430048086 010 03/26/05 22.50
00000006322486179 4308517430161897 010 04/15/05 12.62
00000006322646052 4308517430103063 010 03/24/05 63.00
IN2
====
00000006321922625 4308517431185820 010 03/26/05 50.45
00000006321945560 4308517430273544 010 03/30/05 65.00
00000006321964611 4308517430048086 010 03/26/05 22.50
00000006322486179 4308517430161897 010 04/15/05 12.62
00000006322646052 4308517430103063 010 03/24/05 63.00
00000006322742450 4308517430190342 010 04/11/05 50.99
00000006322760270 4308517410017887 010 03/26/05 50.00
00000006322768794 4308517430275630 010 03/24/05 17.25
00000006322796542 4308517430741227 010 04/04/05 9.98
00000006322884360 0000000000000000 010 04/22/05 185.00
I dont want to include duplicates in the output file.
Thank you,
Vidya Bhat |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You didn't show what you wanted the output to look like, as I asked.
Offhand, I see lots of problems with your job such as:
1) You say you have an 11-byte ZD key, but actually the last byte is always blank. It looks like a 10-byte ZD key to me.
2) You have OUTREC FIELDS=(8,11,20:C'11') which moves the key to positions 1-11. But then you use ON(8,11,ZD) instead of ON(1,11,ZD).
3) You use WITH(20,2) instead of WITH(21,1)
4) For some unknown reason, you added:
* MARK FILE3 RECORDS WITH '12'
OUTREC FIELDS=(8,11,20:C'12')
5) You use OUTREC=(2,16) which eliminates the first byte of the key.
I don't know if you want the entire record in the output file or just the key. You showed an example of the IN1 and IN2 records. Now, if you show me what the records should look like in OUT12, OUT1 and OUT2, I can show you the correct DFSORT/ICETOOL job. |
|
Back to top |
|
 |
vidyasaraswathi
New User

Joined: 10 May 2005 Posts: 72
|
|
|
|
Hi Frank,
I want just the key in the output file:
Key Length is = 10
1)OUT1 should contain the records which are present only in IN1, but not in IN2.
That is,
6319452271
6321701130
6321704385
6321857033
6321897787
2)OUT2 should contain the records which are present only in IN2, but not in IN1.
6322742450
6322760270
6322768794
6322796542
6322884360
3)OUT12 should contain the records which are present in both IN1 and IN2.
6321922625
6321945560
6321964611
6322486179
6322646052
Please give me the correct DFSORT/ICETOOL job.
Thanks,
Vidya Bhat |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's the DFSORT/ICETOOL job to do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//OUT12 DD DSN=... output file (F1/F2)
//OUT1 DD DSN=... output file (F1 only)
//OUT2 DD DSN=... output file (F2 only)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
// DISP=(MOD,PASS)
//TOOLIN DD *
* ADD '11' IDENTIFIER FOR FILE1 RECORDS.
COPY FROM(IN1) TO(T1) USING(CTL1)
* ADD '22' IDENTIFIER FOR FILE2 RECORDS.
COPY FROM(IN2) TO(T1) USING(CTL2)
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR
* APPROPRIATE OUTPUT FILES.
SPLICE FROM(T1) TO(OUT12) ON(1,10,ZD) WITH(12,1) -
KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
* MARK FILE1 RECORDS WITH '11'
OUTREC FIELDS=(8,10,11:C'11')
/*
//CTL2CNTL DD *
* MARK FILE2 RECORDS WITH '22'
OUTREC FIELDS=(8,10,11:C'22')
/*
//CTL3CNTL DD *
* WRITE MATCHING RECORDS TO OUT12 FILE. REMOVE ID.
OUTFIL FNAMES=OUT12,INCLUDE=(11,2,CH,EQ,C'12'),OUTREC=(1,10)
* WRITE FILE1 ONLY RECORDS TO OUT1 FILE. REMOVE ID.
OUTFIL FNAMES=OUT1,INCLUDE=(11,2,CH,EQ,C'11'),OUTREC=(1,10)
* WRITE FILE2 ONLY RECORDS TO OUT2 FILE. REMOVE ID.
OUTFIL FNAMES=OUT2,INCLUDE=(11,2,CH,EQ,C'22'),OUTREC=(1,10)
/*
|
|
|
Back to top |
|
 |
vidyasaraswathi
New User

Joined: 10 May 2005 Posts: 72
|
|
|
|
Hi Frank,
Thank you very much for your help.
I ran the Job and got the expected results.
Thanks,
Vidya Bhat |
|
Back to top |
|
 |
|
|