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

Two File Match Challenge


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

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Wed Aug 23, 2006 7:09 pm
Reply with quote

Frank ,
I seen a few examples of matching two files but the matching keys are usually same record position in the record.

I have a bit more of a challenge that I have to complete.
I want to match FILE1 to FILE2 and write out FILE2 matches to FILE3 ...simple eh icon_confused.gif .

Here is what the files look like
FILE 1

X08/21/06AM18:18:46ABCEDFG00000001534
M08/20/06AM16:15:53ABCEDFG00000003235
X08/20/06AX16:16:54ABCEDFG00000003235
M08/20/06AX16:17:54ABCEDFG00000003235
X08/18/06AF11:24:44ABCEDFG00000003873
M08/18/06AG15:39:50ABCEDFG00000003873
X08/18/06AH11:30:45ABCEDFG00000003873
M08/19/06AM14:46:48ABCEDFG00000004818
X08/19/06AK14:54:48ABCEDFG00000004818

FILE 2
2006-08-21-18.18.45.88812900000001534C
2006-08-20-16.15.53.02024300000003235C
2006-08-20-16.16.53.12438200000003235C
2006-08-20-16.17.53.00542400000003235C
2006-08-20-16.15.53.02024300000003235C
2006-08-20-16.16.53.12438200000003235C
2006-08-20-16.17.53.00542400000003235C
2006-08-17-15.23.28.31572700000003873C

Firstly, the date in File 1 DATE POS 2-8, has to be edited to YYYY-MM-DD so it is in same date format as File 2

Then FILE 1 has to be matched on
POS 26 For 11, AND POS 2 for 10, (REMEMBER DATE HAS BEED MODIFIED TO MATCH FORMAT OF FILE2) AND 13 for 8

to FILE 2 on
POS 27 for 11 AND POS 1 for 10 AND POS 12 for 8.

Can this be done ? Please help
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 Aug 23, 2006 8:37 pm
Reply with quote

Quote:
I seen a few examples of matching two files but the matching keys are usually same record position in the record.


There are plenty of examples of matching keys in different positions.

Quote:
I want to match FILE1 to FILE2 and write out FILE2 matches to FILE3


I'm not sure what you mean by "FILE2 matches". Do you mean the output should have the records in file2 with a match in file1? Or something else? Please explain and show the expected output records.

Quote:
Then FILE 1 has to be matched on POS 26 For 11, ... AND 13 for 8


In 26,11 of the first record for File1 I see:

G0000000323

Don't you really mean 27,11 which has:

00000003235

In 13,8 of the first record for File1, I see:

6:15:53A

Don't you really mean 12,8 which has:

16:15:53

In the future, please try to be clear and accurate when stating requirements. That will help both of us.
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Wed Aug 23, 2006 8:44 pm
Reply with quote

Frank,
I apologise for wasting your time icon_neutral.gif I should have checked the positions
Quote:

Do you mean the output should have the records in file2 with a match in file1?
Yes...

Quote:
Don't you really mean 27,11 which has:

00000003235

Yes...

Quote:
Don't you really mean 12,8 which has:

16:15:53

and Yes.
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 Aug 23, 2006 10:27 pm
Reply with quote

Please show the expected output for your example.

Also, what is the RECFM and LRECL of the input files.
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Wed Aug 23, 2006 11:01 pm
Reply with quote

I'll give simpler record examples, but still asking the same scenario.

The output file should contain the records from File 2 that match File 1 after making the date edit to File 1 = YYYY-MM-DD. e.g. The first record in File1 is 08/21/06, so it should be formatted to 2006-08-21 to match the same format as the date in File 2

The output File 3 length is 38 bytes long

File 1
X08/21/06AM18:18:46ABCEDFG00000001534
M08/20/06AM16:17:53ABCEDFG00000003235
X08/18/06AF11:24:44ABCEDFG00000003873
M08/17/06AM14:46:48ABCEDFG00000004818

FILE 2
2006-08-21-18.18.46.88812900000001534C
2006-08-20-16.15.04.02022300000003235C
2006-08-20-16.17.53.00542400000003235C
2006-08-20-22.17.53.00542400000003235C
2006-08-18-17.16.54.12438200000003873C
2006-08-17-14.46.48.31572700000004818C


Output File 3 should have records 1, 3 and 6 from File 2
2006-08-21-18.18.46.88812900000001534C
2006-08-20-16.17.53.00542400000003235C
2006-08-17-14.46.48.31572700000004818C

I hope this helps you figure a solution...
Thanx in advance
Steven
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 Aug 23, 2006 11:42 pm
Reply with quote

I figured out the solution a long time ago. I just wanted to make sure I understood the requirements correctly. 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
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=...  input file2
//    DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
SELECT FROM(CON) TO(OUT) -
  ON(27,11,CH) ON(1,10,CH) ON(12,8,CH) -
  FIRSTDUP
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(C'20',8,2,C'-',2,2,C'-',5,2,
   12:12,8,UFF,EDIT=(TT.TT.TT),
   27:27,11,38:X)
/*
Back to top
View user's profile Send private message
srj1957

New User


Joined: 15 Dec 2005
Posts: 72
Location: RALEIGH NC, USA

PostPosted: Thu Aug 24, 2006 12:33 am
Reply with quote

EXCELLENT !!! Thank you Frank

Steven
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 FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top