MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Join two files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
jajularamesh
Beginner


Joined: 14 Apr 2006
Posts: 87
Topics: 33

PostPosted: Thu Apr 19, 2007 11:42 pm    Post subject: Join two files Reply with quote

i have a requirement to join two files.

The operation should be similar to left outer join can anyone please let me know how can this be done without writing a cobol program.

Suppose File1 has 4 fields and file2 has 4fileds

field4 of file1 can have duplicate values and field1 of file2 has no duplicate values.

So how can we combine these two files and the output file should contain seven field the data in the output file should be like the resultant of Leftouter join.

Can anyone let me know how to solve this problem.
Regards,
Ramesh
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Fri Apr 20, 2007 12:17 am    Post subject: Reply with quote

Ramesh,

Pls post your sample input and expected output.
Back to top
View user's profile Send private message Send e-mail
jajularamesh
Beginner


Joined: 14 Apr 2006
Posts: 87
Topics: 33

PostPosted: Fri Apr 20, 2007 1:07 am    Post subject: Reply with quote

Phani,

First File
Code:

Field1 Field2 Field3 field4
11      222    333    aaa
12      222    333    aaa
111     222    333    bbb
2        11    1      ccc
 

Second File
Code:

Field1 Field2 Field3 field4
aaa      22     333    aaa1
bbb      222    333    aaa
ddd      222    333    bbb



Out put should be
Code:


                                       second file fields
Field1 Field2 Field3 field4 Field2 Field3 field4
11      222    333    aaa    22    333    aaa1
12      222    333    aaa    22    333    aaa1
111     222    333    bbb    222   333    aaa
2        11    1      ccc   

In the above given format i want the result

The last record has spaces in field2,3,4 as no match is found those values are nulls
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Fri Apr 20, 2007 4:50 am    Post subject: Reply with quote

jajularamesh,

Did you search the forums?

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Fri Apr 20, 2007 11:22 am    Post subject: Reply with quote

jajularamesh,

The following SyncSort control statements will give you the desired output:
Code:
//STEP1    EXEC PGM=SORT                       
//SORTOUT  DD   SYSOUT=*                       
//SORTJNF1 DD   *                               
11       222       333       AAA               
12       222       333       AAA               
111      222       333       BBB               
2        11        1         CCC               
//SORTJNF2  DD  *                               
AAA      22        333       AAA1               
BBB      222       333       AAA               
DDD      222       333       BBB               
//SORTOF01  DD  SYSOUT=*                       
//SYSOUT    DD  SYSOUT=*                       
//SYSIN     DD  *                               
 JOINKEYS FILES=F1,FIELDS=(30,4,A)             
 JOINKEYS FILES=F2,FIELDS=(1,4,A)               
 JOIN UNPAIRED,F1                               
 REFORMAT FIELDS=(F1:1,40,F2:10,30)             
 SORT FIELDS=COPY
/*

_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
jajularamesh
Beginner


Joined: 14 Apr 2006
Posts: 87
Topics: 33

PostPosted: Sat Apr 21, 2007 6:39 am    Post subject: Reply with quote

This is not working in my shop
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Apr 21, 2007 9:58 am    Post subject: Reply with quote

Ramesh,

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 *
11      222    333    aaa
12      222    333    aaa
111     222    333    bbb
2        11    1      ccc
/*
//IN2 DD *
aaa     22     333    aaa1
bbb     222    333    aaa
ddd     222    333    bbb
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN   DD    *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(23,3,CH) KEEPNODUPS -
  WITHALL WITH(1,22) WITH(50,1) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(23:1,27,50:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(50:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(50,1,CH,EQ,C'BB'),
    BUILD=(1,49)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Mon Apr 23, 2007 9:00 am    Post subject: Reply with quote

Quote:

This is not working in my shop

The JOIN application requires SyncSort for z/OS 1.2. What sort utility and release are you running?
Back to top
View user's profile Send private message Send e-mail
rama krishna reddy
Beginner


Joined: 18 Sep 2006
Posts: 31
Topics: 13
Location: Hyderabad

PostPosted: Thu Jul 17, 2008 7:35 am    Post subject: JOINKEYS to join 3 files Reply with quote

Hi ,

I need to join 3 files using syncsort ,is it possible to join 3 files using

JOIN KEYS of syncsort , if not is there any other option in sync sort where

i can join 3 files and i can write matching records into an output file


Please help me regarding the same

Thanks

Rama krishna reddy
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Jul 17, 2008 11:22 am    Post subject: Reply with quote

What's the answer to Amargulies question?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Thu Jul 17, 2008 1:04 pm    Post subject: Reply with quote

Rama krishna reddy,

A new thread was already started with this EXACT same question...
http://www.mvsforums.com/helpboards/viewtopic.php?t=10003
_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group