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

Merging of More than two files


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

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 2:03 pm
Reply with quote

Hi all,

I have two or more files with two colums say, Reason Code as Primary key, Quantity in each file. And I want generate an output file containing all Reason Code with All the quanties in row.

Here Hyphen is the delimiter for column values.

File A

Reason Code / A-Quantity
101 - 34
102 - 45
103 - 90
105 - 45
120 - 34
.
.
.

File B

Reason Code / B-Quantity
101 - 33
102 - 46
103 - 23
105 - 01
120 - 23
.
.
.

File C

Reason Code / C-Quantity
101 - 88
102 - 12
103 - 09
105 - 12
120 - 99
.
.
.

File D


Reason Code / D-Quantity
101 - 01
102 - 65
103 - 12
105 - 30
120 - 12
.
.
.


I want one output file like,

Output File.

Reason Code / A-Quantity / B-Quantity / C-Quantity / D-Quantity
101 - 34 - 33 - 88 - 01
102 - 45 - 46 - 12 - 65
103 - 90 - 23 - 09 - 12
105 - 00 - 01 - 12 - 30
120 - 45 - 23 - 99 - 12
.
.
.


Here Reason code is the Priamry Key in all files. Say Reclength as 80 and Rec Format as FB.
Sometimes Input file may also have an extra quantity column,
say,

File E

Reason Code /A1-Quantity / A2-Quantity

101 - 34 - 33
102 - 45 - 46
103 - 90 - 23
105 - 30 - 01
120 - 45 - 23
.
.
.

At that time, both A1-Quantity and A2-Quantity should be added to Outputfile.

What utility can I use for this?
Please help me. Thanks.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 2:11 pm
Reply with quote

Gnans,

Quote:
Sometimes Input file may also have an extra quantity column,

In such cases, doesn't the file attribs changes. Also how will identify 'extra' quantity.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 2:14 pm
Reply with quote

Vasanth,

You can use REPRO- REPLACE command.

Please note your suggestion is not going to suite for the original requirement.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 2:18 pm
Reply with quote

Thanks Muruli, Vasanth.

Really only one file will have two quantity columns. All other files will have only one Quantity column with Reason code.

Let me know if you need any information.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 2:21 pm
Reply with quote

gnanas,

But you dint reply reg file attribs.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 2:22 pm
Reply with quote

File attributes will be the same.
Thanks.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 2:41 pm
Reply with quote

Vasanth,
Thanks for your reply.

Quote:
You can use REPRO- REPLACE command.


I couldn't get the point. Could you please explain in detail.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 3:01 pm
Reply with quote

Gnans,

Please note that your requirement is not clear till now.

Quote:
103 - 90 - 23

What should be the O/P of 90+23? '113' needs to be considered or '13' (after data trunction).

Please please note we cant proceed further with the provided details. Put as much as info possible.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Fri Nov 23, 2007 3:04 pm
Reply with quote

Hi,


Plz try it out and let me knw, i ont have time to test it.

Code:
//STEP EXEC PGM=IDCAMS
//INDD1          DD DSN=DATASETNAME1,DISP=SHR
//OUTDD1         DD DSN=DATASETNAME1,DISP=SHR
//OUTDD2         DD DSN=DATASETNAME2,DISP=SHR
//OUTDD3         DD DSN=DATASETNAME3,DISP=SHR
//OUTDD4         DD DSN=DATASETNAME4,DISP=SHR
//SYSIN DD *

     REPRO-
     INFILE(INDD1)     OUTFILE(OUTDD1)   REPLACE-
     LASTCC=00
     REPRO-
     INFILE(INDD1)     OUTFILE(OUTDD2)   REPLACE-
     LASTCC=00
     INFILE(INDD1)     OUTFILE(OUTDD3)   REPLACE-
     LASTCC=00
     INFILE(INDD1)     OUTFILE(OUTDD4)   REPLACE-
/*
//


REPLACE: when copying in to an NON-EMPTY KSDS or RRDS,REPLACE specifies any resource record which has a key for a target record is to replace the target record DEFAULT-No REPLACE.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 3:20 pm
Reply with quote

Muruli,

Okay. Fine.


Quote:
What should be the O/P of 90+23? '113' needs to be considered or '13' (after data trunction).



Reason Code /A1-Quantity / A2-Quantity

101 - 34 - 33
102 - 45 - 46
103 - 90 - 23
105 - 30 - 01
120 - 45 - 23


If this is input file, those two quanities should be physically in output file, not summing up of those two quantities as 90+23=113 for 103 REson Code.

Could you understand the requirement?
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Fri Nov 23, 2007 3:22 pm
Reply with quote

Hi Gnanas

Correcting the above code, just inter change the INDD and OUTDD statements in the REPRO command.

Like as below.

OUTDD on left side and INDD on right side. in all the REPLACE command.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 3:26 pm
Reply with quote

Vasanth,

Input files are PS files only, not VSAM files. Will this work with PS files?

Please clarify me.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 4:03 pm
Reply with quote

Gnanas,

Quote:
At that time, both A1-Quantity and A2-Quantity should be added to Outputfile.

Misunderstood your OP because of the word 'added'.

Try this -

Code:
//STEP@@@@  EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                       
//FILEA DD DSN=.....                                       
//FILEB DD DSN=.....                                       
//FILEC DD DSN=.....                                       
//FILED DD DSN=.....                                       
//TEMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS)                     
//TEMP2 DD DSN=&&TEMP2,DISP=(MOD,PASS)                     
//FINAL DD SYSOUT=*                                         
//*                                                         
//TOOLIN DD *                                               
  COPY FROM(FILEA) TO(TEMP1)                               
  COPY FROM(FILEB) TO(TEMP1) USING(CTL2)                   
  COPY FROM(FILEC) TO(TEMP1) USING(CTL3)                   
  COPY FROM(FILED) TO(TEMP1) USING(CTL4)                   
  SPLICE FROM(TEMP1) TO(TEMP2) ON(1,3,CH) WITH(15,5) -     
             WITH(20,5) WITH(25,5) WITHEACH                 
  COPY FROM(TEMP2) TO(FINAL) USING(CTL5)     
/*                                           
//CTL2CNTL DD *                               
  OUTREC FIELDS=(1,3,10X,4,5)                 
/*                                           
//CTL3CNTL DD *                               
  OUTREC FIELDS=(1,3,15X,4,5)                 
/*                                           
//CTL4CNTL DD *                               
  OUTREC FIELDS=(1,3,20X,4,5)                 
/*                                           
//CTL5CNTL DD *                               
   OUTREC IFTHEN=(WHEN=(10,5,CH,EQ,C' '),     
                 BUILD=(1,9,15,15))           
/*                                           


O/P:
Case I : (one qty in FILEA):
I assumed 'qty2' is blank in this case.
Code:
101 - 34 - 33 - 88 - 01       
102 - 45 - 46 - 12 - 65       
103 - 90 - 23 - 09 - 12       
105 - 30 - 01 - 12 - 30       
120 - 45 - 23 - 99 - 12       


Case II - (two qtys in FILEA):
Code:
101 - 34 - 33 - 33 - 88 - 01         
102 - 45 - 46 - 46 - 12 - 65         
103 - 90 - 23 - 23 - 09 - 12         
105 - 30 - 01 - 01 - 12 - 30         
120 - 45 - 23 - 23 - 99 - 12
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Fri Nov 23, 2007 4:06 pm
Reply with quote

Hi,

Quote:
I have two or more files with two colums say, Reason Code as Primary key, Quantity in each file


Due to above reason, i gave u the code, the code works if u have key concept such as KSDS file, after that you can sum the fields according to the requirement.

Why cann't you use KSDS file for this requirement?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 4:32 pm
Reply with quote

Vasanth,

Quote:
Why cann't you use KSDS file for this requirement?


I receive PS files only. And output is expected in PS file only. Thats why...
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 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 Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top