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

Output should contain records in file1 that not in file2


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Wed Aug 20, 2008 10:49 pm
Reply with quote

The requirement is to compare file1 with file2. Records in file2 also occur in file1. Output file3 should contain records in file1 that do not exist in file2.

Duplicate records may exist within each file and that is ok.

Record length = 138 and it is fixed block.

file1 (lrecl = 138)

test1aaa
test1bbb
test1bbb
test1ccc
test1ddd
----------------------------------------

file2 (lrecl = 138)

test1aaa
test1bbb
test1bbb
--------------------------------------
output file3 (lrecl=138) should contain

test1ccc
test1ddd
Back to top
View user's profile Send private message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Wed Aug 20, 2008 11:08 pm
Reply with quote

....one more thing, there are no key values in the file, the comparison is to be made over the entire record length of 138.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 20, 2008 11:12 pm
Reply with quote

Suresh,

Suppose file-1 has duplicate records which are not present in file-2.
Do you want all those duplicate records into your output file?

Thanks,
Arun
Back to top
View user's profile Send private message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Wed Aug 20, 2008 11:16 pm
Reply with quote

Arun, yes, if file-1 has duplicate records that are not present in file-2, then those records are also required in the output file.

thanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Aug 21, 2008 1:02 am
Reply with quote

ssk,

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/138)
//IN2 DD DSN=...  input file2 (FB/138)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/138)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,138,CH) -
  KEEPBASE KEEPNODUPS WITHALL WITH(1,139) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(139:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(139:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(139,2,CH,EQ,C'VV'),
    BUILD=(1,138)
/*
Back to top
View user's profile Send private message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Thu Aug 21, 2008 1:12 am
Reply with quote

Thanks Frank, it works !! icon_lol.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top