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

Combine three files using DFSORT


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

New User


Joined: 16 Jul 2008
Posts: 22
Location: Bangalore

PostPosted: Fri Jun 05, 2009 4:03 pm
Reply with quote

Hi,

I have three files like below.
AAABangalore
BBBFrankfurt
CCCIslamabad


File - B

AAAIndia
BBBGermany
CCCPakistan

File - C

AAAGold
BBBSilver
CCCBronze

I wanted to combine three files and get output as

AAABangaloreIndiaGold
BBBFrankfurtGermanySilver
CCCIslamabadPakistanBronze
Back to top
View user's profile Send private message
harijax

New User


Joined: 16 Jul 2008
Posts: 22
Location: Bangalore

PostPosted: Fri Jun 05, 2009 4:50 pm
Reply with quote

A slight changes. I wanted in this way. Can you please help me.

INFILE - A

AAABangalore
BBBFrankfurt
CCCIslamabad
DDDColombo
EEETokyo

INFile - B

AAAIndia
BBBGermany
CCCPakistan
DDDSrilanka

INFile - C

AAAGold
BBBSilver
CCCBronze
EEEDiamond

Output:
AAABangaloreIndiaGold
BBBFrankfurtGermanySilver
CCCIslamabadPakistanBronze
DDDColomboSrilanka
EEETokyo Diamond


Regards
harijax
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: Fri Jun 05, 2009 9:09 pm
Reply with quote

What is the rule by which the EEE record has blanks after Tokyo but the other records don't? I'm going to assume that you really don't want the fields squeezed together like that. If you do, then you're going to have to explain the rules for that. I also assumed the maximum length for a field is 10 characters.

You can use a DFSORT job like the following to do what I think you want.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD *
AAABangalore
BBBFrankfurt
CCCIslamabad
DDDColombo
EEETokyo
/*
//IN2 DD *
AAAIndia
BBBGermany
CCCPakistan
DDDSrilanka
/*
//IN3 DD *
AAAGold
BBBSilver
CCCBronze
EEEDiamond
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/40)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
COPY FROM(IN3) TO(T1) USING(CTL3)
SPLICE FROM(T1) TO(OUT) ON(1,3,CH) KEEPNODUPS WITHANY -
  WITH(16,10) WITH(27,10)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(40:X)
/*
//CTL2CNTL DD *
  INREC BUILD=(1,3,16:4,10,40:X)
/*
//CTL3CNTL DD *
  INREC BUILD=(1,3,27:4,10,40:X)
/*



OUT would have:

Code:

AAABangalore   India      Gold     
BBBFrankfurt   Germany    Silver   
CCCIslamabad   Pakistan   Bronze   
DDDColombo     Srilanka             
EEETokyo                  Diamond   
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top