Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Finding unmatching records in one step

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Finding unmatching records in one step
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 Moderator


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

PostPosted: Thu Jan 25, 2007 9:43 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Jan 30, 2007 9:32 pm    Post subject:
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    Post subject:
Reply with quote

yes , i do not want duplicates
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Jan 31, 2007 9:43 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Feb 01, 2007 9:40 pm    Post subject:
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

Site Director


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

PostPosted: Thu Feb 01, 2007 9:43 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Feb 02, 2007 9:03 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us