Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Concatenate two files of variable record in to a single file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Concatenate two files of variable record in to a single file
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

Active Member


Joined: 29 Apr 2008
Posts: 541
Location: Maryland

PostPosted: Wed Aug 21, 2019 11:58 pm    Post subject: Re: Concatenate two files of variable record in to a single file
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

Active Member


Joined: 29 Apr 2008
Posts: 541
Location: Maryland

PostPosted: Thu Aug 22, 2019 12:24 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2244
Location: NY,USA

PostPosted: Thu Aug 22, 2019 1:10 am    Post subject:
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    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 Pack to Unpack conversion for sending... A_programmers COBOL Programming 13 Wed Sep 11, 2019 10:46 pm
No new posts Can we pass the value of Symbolic par... Poha Eater JCL & VSAM 5 Thu Sep 05, 2019 2:21 pm
This topic is locked: you cannot edit posts or make replies. Compare two files logic in COBOL Nishant Singhal COBOL Programming 4 Sun Aug 25, 2019 2:25 am
No new posts Search the strings present in ps file... Bhuvana Narasimhan All Other Mainframe Topics 8 Thu Aug 22, 2019 8:20 pm
No new posts CICS VSAM file max volumes socker_dad JCL & VSAM 4 Tue Aug 20, 2019 1:28 am

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