How to join two files



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to join two files

Postby Carlo » Fri Sep 03, 2010 5:27 pm

Hi
I would appreciate it if someone can tell me if the following can be done with DFSORT:

I have two files:
File1
AAA11111
AAA22222
AAA33333
BBB22222
BBB44444

File2
AAAMMM
AAANNN
BBBOOO
BBBPPP
(The last three characters in File2 are unique.)

I need a join between the two files that will produce the following:
File3:
AAA11111MMM
AAA22222MMM
AAA33333MMM
AAA11111NNN
AAA22222NNN
AAA33333NNN
BBB22222OOO
BBB44444OOO
BBB22222PPP
BBB44444PPP

Each record in File2 is 'expanded' via the first three characters with the corresponding records in File1. The resultant file has 10 records (2x3 + 2x2).

I would appreciate any help/advice with this query.

Thanks
Carlo
Carlo
 
Posts: 4
Joined: Fri Sep 03, 2010 4:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to join two files

Postby Carlo » Fri Sep 03, 2010 5:37 pm

BTW - I tried to download the following manual but the web address does not seem valid:

ftp://ftp.software.ibm.com/storage/dfso ... rtugpg.pdf

Does someone have an alternative address I can try?

Thanks
Carlo
Carlo
 
Posts: 4
Joined: Fri Sep 03, 2010 4:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to join two files

Postby MrSpock » Fri Sep 03, 2010 5:43 pm

Carlo wrote:BTW - I tried to download the following manual but the web address does not seem valid:

ftp://ftp.software.ibm.com/storage/dfso ... rtugpg.pdf

Does someone have an alternative address I can try?

Thanks
Carlo


I don't know. Works OK for me.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: How to join two files

Postby Carlo » Fri Sep 03, 2010 7:46 pm

Hi MrSpock
Thanks - I think it was the company firewall that blocked me. I managed to get to the manual when I linked via my home network.

I hope someone has done this type of join before and can give me a couple of pointers.

Regards
Carlo
Carlo
 
Posts: 4
Joined: Fri Sep 03, 2010 4:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to join two files

Postby Frank Yaeger » Fri Sep 03, 2010 10:57 pm

Here's a DFSORT JOINKEYS job that will do what you asked for.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
AAA11111
AAA22222
AAA33333
BBB22222
BBB44444
/*
//IN2 DD *
AAAMMM
AAANNN
BBBOOO
BBBPPP
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  JOINKEYS F1=IN2,FIELDS=(1,3,A),SORTED
  JOINKEYS F2=IN1,FIELDS=(1,3,A),SORTED
  REFORMAT FIELDS=(F2:1,6,F1:4,5)
  OPTION COPY
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: How to join two files

Postby Carlo » Sat Sep 04, 2010 12:15 am

Hi Frank Yeager
Your prompt feedback is much appreciated - I will give it a try.
Carlo
Carlo
 
Posts: 4
Joined: Fri Sep 03, 2010 4:46 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post