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

Concatenate two files of variable record in to a single file


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

New User


Joined: 21 Aug 2019
Posts: 1
Location: India

PostPosted: Wed Aug 21, 2019 11:53 pm
Reply with quote

Hi,

I want to concatenate two files in to a single file. File does not have any key but both have same number of records. only problem is the record length varies.

For example,
File 1: - FB, LRECL=8
12345678
123456
1234567
123456

File 2: - FB, LRECL = 10
ABCDEFGH
ABCDEFGHIJ
ABCDEFG
ABCDEF

Output should be: (LRECL =18)
12345678ABCDEFGH
123456ABCDEFGHIJ
1234567ABCDEFG
123456ABCDEF

I have seen some examples of using ICETOOl and SLICE functions, but all having same fixed record length in the file.

If Someone help on this scenario it would be grateful.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Wed Aug 21, 2019 11:58 pm
Reply with quote

Thiru S wrote:
I want to concatenate two files in to a single file. File does not have any key but both have same number of records. only problem is the record length varies.


1) In your example the record length is fixed for each of files. Nothing varies.

2) Your task is the most primitive task described with tons of examples in multiple guides, and manuals. Did you read any?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Aug 22, 2019 12:24 am
Reply with quote

Code:
//*===========================================================
//*                                                           
// SET DEBUG='SYSOUT=*'                                       
//*SET DEBUG=DUMMY                                           
// SET LOG='SYSOUT=*'                                         
//*SET LOG=DUMMY                                             
//*                                                           
//*===========================================================
//CONSQUIZ EXEC PGM=SYNCTOOL                                 
//*                                                           
//SORTF1   DD  *                                             
12345678                                                     
123456                                                       
1234567                                                       
123456                                                       
//SORTF2   DD  *                                             
ABCDEFGH                                                     
ABCDEFGHIJ                                                   
ABCDEFG                                                       
ABCDEF                                                       
//*                                                           
//TOOLMSG  DD  &DEBUG                                         
//SSMSG    DD  &DEBUG                                         
//*                                                           
//*                                                           
//SEQ1@    DD  &LOG                                           
//SEQ1     DD  UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE)           
//SEQ2@    DD  &LOG                                           
//SEQ2     DD  UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE)           
//REPORT   DD  &LOG                                           
//OUTPUT   DD  DISP=(NEW,PASS),                               
//             UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),           
//             DSN=&&OUTPUT                                   
//*                                                           
//TOOLIN   DD  *                                             
 COPY FROM(SORTF1)  TO(SEQ1,SEQ1@)       USING(S001)         
 COPY FROM(SORTF2)  TO(SEQ2,SEQ2@)       USING(S002)         
 COPY JKFROM        TO(REPORT,OUTPUT)    USING(S003)         
//*                                                           
//S001CNTL DD  *                           
 INREC BUILD=(SEQNUM,4,BI,1,8)             
//*                                         
//S002CNTL DD  *                           
 INREC BUILD=(SEQNUM,4,BI,1,10)             
//*                                         
//S003CNTL DD  *                           
 JOINKEYS F1=SEQ1,                         
          FIELDS=(1,4,A),                   
          SORTED                           
 JOINKEYS F2=SEQ2,                         
          FIELDS=(1,4,A),                   
          SORTED                           
 REFORMAT FIELDS=(F1:5,8,                   
                  F2:5,10)                 
 INREC BUILD=(1,18,SQZ=(SHIFT=LEFT))       
//*     

Code:
********************************* TOP OF DATA *******
12345678ABCDEFGH                                     
123456ABCDEFGHIJ                                     
1234567ABCDEFG                                       
123456ABCDEF                                         
******************************** BOTTOM OF DATA *****


Quote:
“The method employed I would gladly explain,
While I have it so clear in my head,
If I had but the time and you had but the brain—
But much yet remains to be said.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Thu Aug 22, 2019 1:10 am
Reply with quote

Please use the code tags while representing the code/data.
Quote:
I have seen some examples of using ICETOOl and SLICE functions, but all having same fixed record length in the file.
It is actually SPLICE.

Join fields from two files record-by-record
Look at the two methods and code provided on page-17, Bookmark this for any such DFSORT tricks required for you in future.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top