Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Combine three files using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Combine three files using DFSORT
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    Post subject:
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jun 05, 2009 9:09 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts Formatting using DFsort Guru Nandu DFSORT/ICETOOL 5 Thu Nov 30, 2017 7:33 am
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us