Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Merging of More than two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Gnanas N

Active Member


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

PostPosted: Fri Nov 23, 2007 2:03 pm    Post subject: Merging of More than two files
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 2:11 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 2:14 pm    Post subject:
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: 788
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 2:18 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 2:21 pm    Post subject:
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: 788
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 2:22 pm    Post subject:
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: 788
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 2:41 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 3:01 pm    Post subject:
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: 276
Location: Bang,iflex

PostPosted: Fri Nov 23, 2007 3:04 pm    Post subject:
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: 788
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 3:20 pm    Post subject:
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: 276
Location: Bang,iflex

PostPosted: Fri Nov 23, 2007 3:22 pm    Post subject:
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: 788
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 3:26 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Nov 23, 2007 4:03 pm    Post subject:
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: 276
Location: Bang,iflex

PostPosted: Fri Nov 23, 2007 4:06 pm    Post subject:
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: 788
Location: Chennai, India

PostPosted: Fri Nov 23, 2007 4:32 pm    Post subject:
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    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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us