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

Finding unmatching records in one step


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

New User


Joined: 24 Jan 2007
Posts: 11
Location: chennai

PostPosted: Thu Jan 25, 2007 12:28 pm
Reply with quote

i have two files.. i need to get the values that are present in file 1 but not file2...i am able to do it in two steps... is ther any way the utility can be used to do this in a single step...
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 Jan 25, 2007 9:43 pm
Reply with quote

Please show an example of the records in each input file and the expected output records. If file1 can have duplicates within it, show that in the example. If file2 can have duplicates within it, show that in the example.

What is the starting position, length and format of the value you want to compare on?

What is the RECFM and LRECL of the input files?
Back to top
View user's profile Send private message
nivethitha_kumar

New User


Joined: 24 Jan 2007
Posts: 11
Location: chennai

PostPosted: Tue Jan 30, 2007 10:05 am
Reply with quote

a sample file 1

aaaaa11111
aaaaa11111
bbbbb22222
cccccc33333
ddddd44444

a sample file 2

bbbbbb22222
cccccc333333
ddddd444444
eeeee555555

files 1 and 2 can have duplicates . My required output should be aaaaa1111.(ie the records present in file1 and not in file 2)

the record format of the files are 171

my actual data runs from pos 1 to 171 it consists of date, names etc space separated .. so i need to consider the entire record for comparison.
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: Tue Jan 30, 2007 9:32 pm
Reply with quote

For each set of records in file1 that doesn't have a match in file2, you only want the first record? For example, you just want the first aaaaa1111 record, not both aaaaa1111 records?
Back to top
View user's profile Send private message
nivethitha_kumar

New User


Joined: 24 Jan 2007
Posts: 11
Location: chennai

PostPosted: Wed Jan 31, 2007 3:02 pm
Reply with quote

yes , i do not want duplicates
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: Wed Jan 31, 2007 9:43 pm
Reply with quote

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/171)
//IN2 DD DSN=...  input file2 (FB/171)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/171)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,171,CH) -
  WITH(1,172) KEEPNODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(172:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(172:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(172,2,CH,EQ,C'BB'),
    BUILD=(1,171)
/*
Back to top
View user's profile Send private message
nivethitha_kumar

New User


Joined: 24 Jan 2007
Posts: 11
Location: chennai

PostPosted: Thu Feb 01, 2007 10:20 am
Reply with quote

Thank you.. i came up with a similar thing.. though i used as the third condition i used select with nodups... what might be the difference between that and splice???
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 Feb 01, 2007 9:40 pm
Reply with quote

SELECT with NODUPS will not work if you have duplicates within each file. The SPLICE job I showed you will.

In your example, you show these records in input file1:

aaaaa11111
aaaaa11111

and you want this for output:

aaaaa11111

NODUPS won't give you that record for output because the input records are duplicates.

I gave you a DFSORT job that works for the example you gave which had duplicates within the input file. If NODUPS worked for you, then you don't have duplicates within the input file.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 01, 2007 9:43 pm
Reply with quote

Or some number of records was "lost". . . .
Back to top
View user's profile Send private message
nivethitha_kumar

New User


Joined: 24 Jan 2007
Posts: 11
Location: chennai

PostPosted: Fri Feb 02, 2007 10:11 am
Reply with quote

This is what i had used and this worked even when there werte duplicates in the files.

SELECT FROM(INA1) TO(TE01) ON(1,171,CH) FIRST USING(CTL1)
COPY FROM(INA2) TO(TE01) USING(CTL2)
SELECT FROM(TE01) TO(OUT01) ON(1,171,CH) NODUPS USING(CTL3)

CTL1CNTL DD *
INREC OVERLAY=(172:C'1')

CTL2CNTL DD *
INREC OVERLAY=(172:C'2')
CTL3CNTL DD *
OUTFIL INCLUDE=(172,1,CH,EQ,C'1'),BUILD=(1,171)

so i was wondering what difference splice brings in .
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: Fri Feb 02, 2007 9:03 pm
Reply with quote

Quote:
This is what i had used and this worked even when there werte duplicates in the files.

SELECT FROM(INA1) TO(TE01) ON(1,171,CH) FIRST USING(CTL1)


Well, no there weren't any duplicates in the first file because you eliminated them with the SELECT FIRST operator.

So you did SELECT (sort), COPY (copy) and SELECT (sort) whereas I did COPY (copy), COPY (copy) and SPLICE (sort). copy is more efficient than sort so doing two SELECTs instead of one SPLICE is usually less efficient. But you can certainly use your method if you like it better for some reason.
Back to top
View user's profile Send private message
nivethitha_kumar

New User


Joined: 24 Jan 2007
Posts: 11
Location: chennai

PostPosted: Sat Feb 03, 2007 9:28 am
Reply with quote

Thank you so much!!!
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 only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts VB to FB - Finding LRECL SYNCSORT 4
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top