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
 

 

matching two different files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Mon Mar 13, 2006 7:46 pm    Post subject: matching two different files
Reply with quote

I've this problem to solve.
two files with the same lenght and the same structure.
how can I extract only the different records from the first or the second file??
INREC1=(LENGHT=330)
INREC2=(LENGHT=330)
when they are different I want to save the record from INREC2....
thank you.
sorry for my english.....
Back to top
View user's profile Send private message

martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Mon Mar 13, 2006 7:57 pm    Post subject:
Reply with quote

hy miosne,

com? stai?
try the following,
make a sort step and include only those records,
which have the same contents from file1 to file2.
concatenate both files in SORTIN and make sure,
that the full record is given in your condition...

martin9
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Mon Mar 13, 2006 8:06 pm    Post subject: Re: matching two different files
Reply with quote

Hi miosne,

There is an excellent DFSORT Trick for the problem you are looking for...ofcourse if you use DFSORT...

You'll have to accomodate changes as per your requirements... If any problem... Get back to us...

Quote:
sorry for my english.....

I dont see any reason for that.

Regards,
Priyesh.
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Mon Mar 13, 2006 9:01 pm    Post subject:
Reply with quote

CIAO A TUTTI.....
I'm so tired.... coz I've understand the metod....
thanks a lot to all
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Mon Mar 13, 2006 9:23 pm    Post subject: I've understand.....
Reply with quote

the post of pryiesh "? ci? che dio fece" but
the starting conditions are not te sames... follow me :-)
INFILE1=(330)
INFILE2=(330)
SO THE MATCHING UP RECORDS ARE NOT INTERESTING, I WANNA WROTE ONLY THE DIFFERENT BYTES FROM 10,321 THAT MATCHING THE KEY 1,9 AND SAVING ONLY THE RECORDS FROM INFILE2
EXAMPLE
INFILE1
00000000SIMONE
00000001STEFANO

INFILE2
00000000SIMON1
00000001STEFANO

OUTFILE
00000000SIMON1

HOW CAN I DO IT???
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: Mon Mar 13, 2006 10:46 pm    Post subject: Re: matching two different files
Reply with quote

Do all of the records in file1 have a matching key in file2? Or can there be records in file1 without a matching key in file2 and vice versa. If so, what do you want to do with those records?

Please give a more detailed example of your input records and what you want for output, showing all of the possible variations of matching and non-matching records.
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Mon Mar 13, 2006 11:13 pm    Post subject: I'M SORRY...
Reply with quote

yes avery key in infile1 have the same key but not also the same data, so when the condition is not verifyied i must wrote the record in outfile....

INFILE1
00000000SIMONE
00000001STEFANO

INFILE2
00000000SIMON1
00000001STEFANO

OUTFILE
00000000SIMON1
desperate househusbands
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: Mon Mar 13, 2006 11:43 pm    Post subject:
Reply with quote

Where did the desperate househusbands record come from? I don't see it in INFILE1 or INFILE2.

Also, I forgot to ask. Can there be duplicate keys within INFILE1? Can there be duplicate keys within INFILE2? If so, please include that in your example.

And what is the RECFM and LRECL of INFILE1 and INFILE2?
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Mon Mar 13, 2006 11:53 pm    Post subject: I'm desperate househusbands ... :-)
Reply with quote

INFILE1
LRECL=330
000000000SIMONE
000000001STEFANO
000000002ROBETRO
000000003GIORGIO
000000004ANDREA

INFILE2
LRECL=330
000000000SIMON1
000000001STEFANO
000000003GIORGIO
000000004ANDRES

OUTFILE
LRECL=330
000000000SIMON1
000000002ROBERTO
000000004ANDRES
NO DUPLICATE KEYS IN INFILE1 AND INFILE2
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 Mar 14, 2006 12:15 am    Post subject:
Reply with quote

Quote:
when they are different I want to save the record from INREC2....


In INFILE1, you have:

000000002ROBETRO

In OUTFIL, you have:

000000002ROBERTO

I assume you meant for this to be the same record for output (ROBETRO instead of ROBERTO) as for input. But if you only want to save records from INREC2, why are you saving this record from INREC1? And what about records that are in INREC2, but not in INREC1?

I'm trying to help, but you need to be more careful in describing your requirements so I can understand what you want to do.
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Tue Mar 14, 2006 1:28 pm    Post subject: yes.... I'm happy that are man like you....
Reply with quote

but my english not bad like then your!!!!
I'll try another time.
I'va to save the different records from INFILE2 that matching in INFILE! by the key but with the data NE so like the exmples that I've explained in the previous posts.... and like this one.....

INFILE1
LRECL=330
000000000SIMONE
000000001STEFANO
000000002ROBETRO
000000003GIORGIO
000000004ANDREA

INFILE2
LRECL=330
000000000SIMON1
000000001STEFANO
000000003GIORGIO
000000004ANDRES

OUTFILE
LRECL=330
000000000SIMON1
000000002ROBERTO
000000004ANDRES

in the outfile i want to save the records that matching between infile1 and infile 2 by the key but have the data patitions different....

thank you a lot....
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Tue Mar 14, 2006 2:24 pm    Post subject: o my god
Reply with quote

I've make a mistake .... :-(
my english is not good like then your.... excuse me....
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 Mar 14, 2006 10:05 pm    Post subject:
Reply with quote

You keep saying that you want to save the records from file2, but in your example output, you are saving a record from file1 (000000002ROBERTO ). So I can't figure out what you really want. You sent me an even more confusing example by e-mail - in that one, you saved one record from file1 that didn't match, but didn't save another one.

Let's try this. If you had these input records:

File1
000000000SIMONE
000000001STEFANO
000000002ROBETRO
000000003GIORGIO
000000004ANDREA
000000007FRANK

File2
000000000SIMON1
000000001STEFANO
000000003GIORGIO
000000004ANDRES
000000006CHARLIE

What would you want for output?

When I look at these input records, I see the following mismatched records:

Key 0 - in file1 and file2, so write file2 record to output
Key 2 - only in file1 - write it to output or not?
Key 4 - in file1 and file2, so write file2 record to output
Key 6 - only in file2 - write it to output or not?
Key 7 - only in file1 - write it to output or not?

Now what do you want for output and why?
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Tue Mar 14, 2006 10:31 pm    Post subject: I'll try another time... but I think...
Reply with quote

the problem is that my english is like the english of an analphabeta man... :-(
What would you want for output?


When I look at these input records, I see the following mismatched records:

Key 0 - in file1 and file2, so write file2 record to output YES
Key 2 - only in file1 - write it to output or not? NO
Key 4 - in file1 and file2, so write file2 record to output YES
Key 6 - only in file2 - write it to output or not? YES
Key 7 - only in file1 - write it to output or not? NO

your patient is like the pope.....
thank you a lot I'll make you a present!!!!!!!!!....
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 Mar 14, 2006 11:01 pm    Post subject:
Reply with quote

Ok, based on what you said in your last post, the following DFSORT/ICETOOL job should do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/330)
//IN2 DD DSN=...  input file2 (FB/330)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/330)
//TOOLIN DD *
* IN1->T1:  Copy records and add '1'.
COPY FROM(IN1) TO(T1) USING(CTL1)
* IN2->T1:  Copy records and add '2'.
COPY FROM(IN2) TO(T1) USING(CTL2)
* T1->OUT:  SELECT records that are not the same anywhere
* in 1-330 (do not match).  This eliminates the records that are
* the same in IN1 and IN2.  The remaining records are either
* records that are different in file1 and file2, or only appear in
* file1 or file2.  A '2' indicates the records from file2, so keep
* only those.
SELECT FROM(T1) TO(OUT) ON(1,330,BI) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,330,331:C'1')
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(1,330,331:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(331,1,CH,EQ,C'2'),
    OUTREC=(1,330)
/*


With the input shown in my previous post, OUT will have:

000000000SIMON1
000000004ANDRES
000000006CHARLIE
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Tue Mar 14, 2006 11:33 pm    Post subject: o my god.... tou are a god....
Reply with quote

you have make a miracle!!! but I've also another question, if possible, can you explain me the meaning of the parameters that you have inserted in the sort card????
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Tue Mar 14, 2006 11:44 pm    Post subject: per dio.......... one more question....
Reply with quote

T1 DD DSN=&&ENFTR03,UNIT=SYSDA,
SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
why in this parameter the jcl response is :
JSORTA11 STEP1 OUT - DATA SET NOT FOUND
JSORTA11 STEP1 - STEP WAS NOT EXECUTED

why why why?!?! I know I'm a ASINO.... translate it from italian....
[/img]
Back to top
View user's profile Send private message
miosne
Warnings : 1

New User


Joined: 13 Mar 2006
Posts: 63
Location: italy

PostPosted: Tue Mar 14, 2006 11:46 pm    Post subject: don't read the last post please....
Reply with quote

.......... and nothing more....
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 Mar 15, 2006 12:35 am    Post subject:
Reply with quote

Quote:
T1 DD DSN=&&ENFTR03,UNIT=SYSDA,
SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
why in this parameter the jcl response is :
JSORTA11 STEP1 OUT - DATA SET NOT FOUND
JSORTA11 STEP1 - STEP WAS NOT EXECUTED


The message says that the data set referenced by the OUT DD statement is missing. I don't know what you put in for //OUT DD, but you need to check it to make sure it's either new, or an existing data set if old. I'd have to see your actual JCL to help you more.
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 Mar 15, 2006 12:42 am    Post subject:
Reply with quote

Quote:
if possible, can you explain me the meaning of the parameters that you have inserted in the sort card????


I went back and added comments to my job to explain what I'm doing.

You can look up all of the parameters in "z/OS DFSORT Application Programming Guide", but instead I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


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