Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
compare two files and write output file with unmatched recor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
Author Message
sumannaidu

New User


Joined: 21 May 2005
Posts: 13
Location: mumbai

PostPosted: Tue May 06, 2008 6:40 pm    Post subject: compare two files and write output file with unmatched recor
Reply with quote

i want a JCL that will compare two files with similar record length and similar fields and create one output file that contains only unmatched records
Back to top
View user's profile Send private message
References
PostPosted: Tue May 06, 2008 6:40 pm    Post subject: Re: compare two files and write output file with unmatched recor Reply with quote

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 3804
Location: San Jose, CA

PostPosted: Tue May 06, 2008 9:51 pm    Post subject:
Reply with quote

You need to give more details of what you want to do.

Please show an example of the records in each input file (relevant fields only) and what you expect for output. If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it, show that in your example. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of each input file.
Back to top
View user's profile Send private message
ajithgeorvar

New User


Joined: 01 Apr 2005
Posts: 1

PostPosted: Wed May 07, 2008 9:20 am    Post subject: Reply to: compare two files and write output file with unmat
Reply with quote

I too was interested in knowing how to use DFSORT and write out unmatched records.
Say there are 2 files File A and File B of which first 10 chars is key data. We need to find the records in File A which arent in File B or vice versa (means unmatched).

Data in File A (80chars long):
1111111111 RECORD1XXXXXXXXXXXXXXXXXXXXXXX
2222222222 RECORD2YYYYYYYYYYYYYYYYYYYYYYYYYY

Data in File B (80chars long):
1111111111 RECORD1AAAAAAAAAAAAAAAAAAAAAAA
3333333333 RECORD2BBBBBBBBBBBBBBBBBBBBBBB


The output file if its Records in A, but not in B need to have:
2222222222 RECORD2YYYYYYYYYYYYYYYYYYYYYYYYYY


Can we do it with DFSORT?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 3804
Location: San Jose, CA

PostPosted: Wed May 07, 2008 9:16 pm    Post subject:
Reply with quote

Ajith,

For the example you show, where there are no duplicates within fileA and no duplicates within fileB, you can use a DFSORT/ICETOOL job like this:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1    DD DSN=...  input fileA (FB/80)
//IN2    DD DSN=...  input fileB (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT    DD DSN=...  output file (FB/80)
//TOOLIN  DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,10,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'A')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'B')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'A'),
    BUILD=(1,80)
/*


If you do have duplicates within either input file, show a better example of the records in each input file for that situation and what you expect for output.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1