View previous topic :: View next topic
|
Author |
Message |
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
My requirement is to compare two files if the record is not found in the second include that record in another file. This should happen for all records in the first and second files. Can anyone provide a sort job to achieve this purpose. |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
Let me explain my requirement further :
Let us say my file1 has the following records:
aaaaaa
bbbbbb
ccccccc
ababab
and file2 has following records
bbbbbb
ababab
dddddd
then my file3 should contain
aaaaaa
ccccccc
Hope I made myself clear in explaining my problem |
|
Back to top |
|
|
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
What I understand is , whatever records are there in file A but not in file B, needs to be written in another file.
If this is the requirement then this ICETOOL job would do it.
Since you have not given the LRECL etc..I have written it according to my files ...
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=XXXXXXXXXXXXXXX,DISP=SHR
//IN2 DD DSN=YYYYYYYYYYYYYYYYY,DISP=SHR
//OUT12 DD SYSOUT=*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),
// DISP=(MOD,PASS)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT12) ON(1,16,CH) -
WITH(66,1) KEEPNODUPS USING(CTL3)
//CTL1CNTL DD *
OUTREC FIELDS=(1,64,65:C'11')
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1,64,65:C'22')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT12,INCLUDE=(65,2,CH,EQ,C'11'),
OUTREC=(1,64)
/*
// |
|
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
I appriciate your concern and thank you for the quick reply .I will try it and let you know the result |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
My first file has record length 80 with FB and following key
01 RAADMS01-RECORD.
10 ADM-NPT-HOME PIC S9(5) COMP-3.
10 ADM-NPT-PAT-NO PIC S9(5) COMP-3.
Second has length 362 with VB and following key
01 DETL-LNK-RECORD.
05 DETL-LNK-SECTION1.
10 DETL-LNK-HOME PIC S9(05) COMP-3.
10 DETL-LNK-PAT-NO PIC S9(05) COMP-3.
I need to compare both for combination of the above given two fields.
Third file should of same format as first.
Can you just supply the modified job for the these details. |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
Hi ap_mainframes
I got the following messages when I used your JCL:
CTL1CNTL :
OUTREC FIELDS=(1,80,81:C'11')
*
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER001A COL 1 OR 1-15 NOT BLANK
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Can you kindly let me know where I am wrong |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
Thanks Hi ap_mainframes , your JCL helped resolve my problem. |
|
Back to top |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Hi,
If you are having the latest release of SYNCSORT,the following JCL will work for you.
Code: |
//PS030 EXEC PGM=SORT
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD *
aaaaaa
bbbbbb
ccccccc
ababab
//SORTJNF2 DD *
bbbbbb
ababab
dddddd
//SORTOUT DD DSN=XXX.XXX.COMB,
// DISP=(,CATLG,DELETE),
// UNIT=XXX,
// SPACE=(CYL,(55,55),RLSE)
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,6,A)
JOINKEYS FILES=F2,FIELDS=(1,6,A)
Join unpaired,f1,only
REFORMAT FIELDS=(F1:1,6)
SORT FIELDS=COPY
//*
|
Thanks
Krishy |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
Krishy,
I dont know how to thank you but your solution worked fine and I need not write a file matching program to get the third file.
Thanks once again |
|
Back to top |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Hi Prasad,
You are most welcome.
Thanks
Krishy |
|
Back to top |
|
|
hipatnaik
New User
Joined: 16 Aug 2005 Posts: 7 Location: NewJersey
|
|
|
|
HI,
If i want to keep the matching recods in another file then what commands we need to give?
Thanks in advance. |
|
Back to top |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
hipatnaik,
Please remove the unpaired command and run the job.You will get all the matched records in the sortout file.
I was not looking to the forum for long time.
Thanks
Krishy |
|
Back to top |
|
|
|