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

Eastrieve merging 2 files, only produces "1st hit"


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mike 01Hawk

New User


Joined: 02 Oct 2006
Posts: 4
Location: Tulsa

PostPosted: Thu Feb 14, 2008 3:06 am
Reply with quote

Input File 1 (list of everyone)
1 Mary New York
2 Jon New York
3 Sally New York
4 Tom London
5 Jack London

Input File 2 (Master State/Country)
New York - US
London - UK

Output-
What I'm getting
1 Mary US
4 Tom UK

But what I really want
1 Mary US
2 Jon US
3 Sally US
4 Tom UK
5 Jack UK

My code:
002400,FILE FILEA FB(18 27990)
002500,FA-FILLER 1 10 A
002600,FA-KEY 11 8 A
002700,****************************************
002800,FILE FILEB FB(10 27990)
002900,FB-KEY 1 8 A
003000,FB-FILLER 9 2 A
003100,****************************************
003200,FILE FILEC FB(12 27996)
003300,FILLER-A 1 10 A
003400,FILLER-B 11 2 A
003500,****************************************
003600,JOB INPUT (FILEA KEY(FA-KEY) +
003700, FILEB KEY(FB-KEY))
003800,IF MATCHED
003900, MOVE FA-FILLER TO FILLER-A
004000, MOVE FB-FILLER TO FILLER-B
004100, PUT FILEC
004200,END-IF

Many thanks in advance,
Mike
Back to top
View user's profile Send private message
Mike 01Hawk

New User


Joined: 02 Oct 2006
Posts: 4
Location: Tulsa

PostPosted: Thu Feb 14, 2008 3:15 am
Reply with quote

And what sucks is I could get this finished in 2 seconds if I could use Ideal Dataquery
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4651
Location: Raleigh, NC, USA

PostPosted: Thu Feb 14, 2008 3:18 am
Reply with quote

... or even quicker if you were to use a SORT job ...
Back to top
View user's profile Send private message
Mike 01Hawk

New User


Joined: 02 Oct 2006
Posts: 4
Location: Tulsa

PostPosted: Thu Feb 14, 2008 3:46 am
Reply with quote

Sort can do a 1-to-many merge???
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Feb 14, 2008 5:00 am
Reply with quote

I believe that changing:
Code:
JOB INPUT (FILEA KEY(FA-KEY) +
           FILEB KEY(FB-KEY))

To:
Code:
JOB INPUT (FILEB KEY(FB-KEY) +
           FILEA KEY(FA-KEY))

Will do what you want.

For matching the order of the files does affect how duplicates are handled.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Feb 14, 2008 5:03 am
Reply with quote

Sorry I was wrong.
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 14, 2008 5:31 am
Reply with quote

Hello,

Quote:
And what sucks is I could get this finished in 2 seconds if I could use Ideal Dataquery
Is the data already in Datacom tables? Easytrieve will run directly against Datacom (as do IDEAL and DataQuery).
Back to top
View user's profile Send private message
Mike 01Hawk

New User


Joined: 02 Oct 2006
Posts: 4
Location: Tulsa

PostPosted: Thu Feb 14, 2008 9:02 pm
Reply with quote

Mr. Scherrer

They are extracted datasets from Datacom tables, I don't believe our company has it setup to were we can access the tables directly themselves.

Regardless... I'll just set up an IDEAL program to read an input file and bounce against our tables, I have other validations/derivations and I'm more comfortable doing them w/ a pgm.

Thanks
Mike
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Feb 14, 2008 9:04 pm
Reply with quote

My prior solution works only if the files are both sorted by city, in this case both files are in order by city (descending) so it works fine. Just switch the order of the file as I specified before.
Back to top
View user's profile Send private message
lcmontanez

New User


Joined: 19 Jun 2007
Posts: 50
Location: Chicago

PostPosted: Thu Feb 14, 2008 9:42 pm
Reply with quote

Another possible solution is to code the second file as an external table
use

SEARCH xxxxxx WITH FA-KEY GIVING FILLER-B

No sort needed.
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 14, 2008 9:49 pm
Reply with quote

Hi Mike,

Quote:
Regardless... I'll just set up an IDEAL program to read an input file and bounce against our tables, I have other validations/derivations and I'm more comfortable doing them w/ a pgm.

Thanks
Mike
You're welcome icon_smile.gif

Personally, i like the IDEAL alternative. Having Database dataviews and sequential dataviews that use the same "coding" is quite handy icon_cool.gif

d
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4651
Location: Raleigh, NC, USA

PostPosted: Thu Feb 14, 2008 10:51 pm
Reply with quote

Mike 01Hawk wrote:
Sort can do a 1-to-many merge???


Sure. Here's one scenario I worked out using DFSORT:

Code:

//STEPXXXX EXEC PGM=ICETOOL                                     
//IN       DD   *                                               
NEW YORK  - US                                                 
LONDON    - UK                                                 
/*                                                             
//         DD   *                                               
1 MARY   NEW YORK                                               
2 JON    NEW YORK                                               
3 SALLY  NEW YORK                                               
4 TOM    LONDON                                                 
5 JACK   LONDON                                                 
/*                                                             
//T1       DD   DSN=&&T1,DISP=(,PASS),UNIT=VIO                 
//T2       DD   DSN=&&T2,DISP=(,PASS),UNIT=VIO                 
//OUT      DD   SYSOUT=*                                       
//DFSMSG   DD   SYSOUT=*                                       
//TOOLMSG  DD   SYSOUT=*                                       
//TOOLIN   DD   *                                               
SORT FROM(IN) USING(CTL1)                                       
SPLICE FROM(T1) TO(T2) ON(10,10,CH) WITH(1,9) WITH(81,8) WITHALL
SORT FROM(T2) USING(CTL2)                                   
/*                                                           
//CTL1CNTL DD   *                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,80,81:SEQNUM,8,ZD)),     
    IFTHEN=(WHEN=(11,1,CH,EQ,C'-'),BUILD=(10:1,10,22:13,2)) 
  SORT FIELDS=(10,10,CH,A)                                   
  OUTFIL FNAMES=T1                                           
/*                                                           
//CTL2CNTL DD   *                                           
  SORT FIELDS=(81,8,BI,A)                                   
  OUTFIL FNAMES=OUT,BUILD=(1,80)
/*                                                           
//*
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
No new posts COBOL program logic for comparisipn o... COBOL Programming 2
No new posts Sort with JOINKEYS using two VB files DFSORT/ICETOOL 1
This topic is locked: you cannot edit posts or make replies. Compare files with duplicates in one ... DFSORT/ICETOOL 11
No new posts Join files where value in one is betw... DFSORT/ICETOOL 6
Search our Forums:

Back to Top