IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

include records not found in second of the compared files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Jun 07, 2006 11:44 am
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Jun 07, 2006 12:00 pm
Reply with quote

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
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Wed Jun 07, 2006 12:01 pm
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Jun 07, 2006 12:05 pm
Reply with quote

I appriciate your concern and thank you for the quick reply .I will try it and let you know the result
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Jun 07, 2006 12:32 pm
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Jun 07, 2006 1:24 pm
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Jun 07, 2006 2:31 pm
Reply with quote

Thanks Hi ap_mainframes , your JCL helped resolve my problem.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Wed Jun 07, 2006 2:54 pm
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed Jun 07, 2006 3:17 pm
Reply with quote

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
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Wed Jun 07, 2006 9:41 pm
Reply with quote

Hi Prasad,
You are most welcome.

Thanks
Krishy
Back to top
View user's profile Send private message
hipatnaik

New User


Joined: 16 Aug 2005
Posts: 7
Location: NewJersey

PostPosted: Thu Feb 01, 2007 12:16 pm
Reply with quote

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
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Wed Feb 14, 2007 1:08 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top