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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Eastrieve merging 2 files, only produces "1st hit"
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    Post subject:
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

Moderator Team Head


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

PostPosted: Thu Feb 14, 2008 3:18 am    Post subject: Reply to: Eastrieve merging 2 files, only produces "1st
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Thu Feb 14, 2008 9:49 pm    Post subject: Reply to: Eastrieve merging 2 files, only produces "1st
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

Moderator Team Head


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

PostPosted: Thu Feb 14, 2008 10:51 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CA Products 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 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 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 hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm


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