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

Merge two files of different record length


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

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Sun Aug 29, 2010 6:43 pm
Reply with quote

I have two inputs

INPUT FILE1 --> RECLEN (60)
INPUT FILE2 --> RECLEN (40)


I want output file merging these two files.
Contents of Input File1 should come first then followed by Second file contents.

I have tried SORT but because of Different RECLEN, Its not getting worked out.

Can someone help
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Aug 29, 2010 7:15 pm
Reply with quote

Hello,

You need to show some sample input from both files and the output you want from the sample input. You need to explain any "rules" that are to be used.

If this is really a merge, you need to show the "keys" to be used for the merge. How should duplicates in either/both files be handled?
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Sun Aug 29, 2010 7:45 pm
Reply with quote

Hi,

There is no rule I just want to append second file content after first file content.


There are no duplicates in both the files and no common key to join
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Sun Aug 29, 2010 8:10 pm
Reply with quote

I have used

IN1 File contents
Code:

JOBNAME,CPU TIME,ELAPSED TIME,START TIME,END TIME


IN2 File Contents
Code:

G1246SE9,  7.81, 31.16,00.07.47,00.38.57
G1246SEI,  7.97, 45.05,00.07.52,00.52.55


I have used code
Code:

//STEP1 EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN1      DD DSN=SS5661.STATS.PULL.TOOL.SRTHDR,DISP=SHR   
//IN2      DD DSN=ABCD.STATS.PULL.TOOL.SARSRT,DISP=SHR 
//OUT      DD DSN=ABCD.STATS.PULL.TOOL.SARSRT1,         
//            DISP=(MOD,CATLG,DELETE),UNIT=SYSDA,         
//            DCB=(LRECL=80,RECFM=FB)                     
//TOOLIN DD *                                             
COPY FROM(IN1) TO(OUT)                                     
COPY FROM(IN2) TO(OUT) USING(CTL1)                         
//CTL1CNTL DD *                                           
  INREC FIELDS=(1,80)                                     
/*                                 
                       

Its getting MAXCC = 16
And generating Output file as
[code]
JOBNAME,CPU TIME,ELAPSED TIME,START TIME,END TIME
[\code]

Can someone tell why its not adding second file contents
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Aug 29, 2010 10:57 pm
Reply with quote

Hello,

The longer you wait to post what is needed, the longer it will take to get your process running. . .

Is there some reason that you did not post the diagnostic output including the message ids?

Without seeing the actual error(s), i can only guess that you have specified 80 for a record that is only 60. You need to copy the 60 and pad the remainder with 20 spaces.

If the process does run successfully, you will need to make sure the output file is deleted before running it again.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun Aug 29, 2010 11:20 pm
Reply with quote

I wonder why the contents of those two files look familiar.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Aug 30, 2010 1:09 am
Reply with quote

most probably because the TS does not have a clear idea of the requirements
and asks different questions for each aspect of the issue at hand
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 30, 2010 2:35 am
Reply with quote

Hello,

One would hope that after more than 2 years, TS would have learned that if all of the requirement is explained on the initial post, the result happens almost immediately.

All this approach (bits and pieces spread across multiple topics) does is to add clutter to the forum and take much longer to reach/do what is needed. . .
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Aug 30, 2010 9:45 am
Reply with quote

Hi,

try this

Code:
//TOOLIN   DD *                                             
COPY FROM(IN1) TO(OUT) USING(CTL1)                           
COPY FROM(IN2) TO(OUT) USING(CTL2)                           
//CTL1CNTL DD *                                             
  OUTREC FIELDS=(1,60,80:X)                                 
/*                                                           
//CTL2CNTL DD *                                             
  OUTREC FIELDS=(1,40,80:X)                                 
/*                                                           


Gerry
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Aug 30, 2010 9:44 pm
Reply with quote

scorp_rahul23,

Is this request any way related to other request where you want to append a header? If so it can be done in the same job itself.

If this is different request, then the following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//FB60     DD DSN=Your input FB 60 byte file,DISP=SHR
//FB40     DD DSN=Your input FB 40 byte file,DISP=SHR       
//OUT      DD DSN=Your output FB 60 byte file,
//            DISP=(MOD,CATLG,DELETE),
//            UNIT=SYDA,
//            SPACE=(CYL,(X,Y),RLSE)   
//TOOLIN   DD *
  COPY FROM(FB60) TO(OUT)
  COPY FROM(FB40) TO(OUT) USING(CTL1)
//CTL1CNTL DD *
  OUTREC OVERLAY=(60:X)
//*
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 Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top