Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merge/Concatenation of files

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

New User


Joined: 25 May 2005
Posts: 53
Location: India

PostPosted: Thu Jun 02, 2005 5:03 pm    Post subject: Merge/Concatenation of files
Reply with quote

Dear Frank,

How can we accomplish (called as LATERAL I guess)concatenation of files. My scenario is:
file-1, file-2 and file-3 have some data of diff LRECLs and I need to
combine them. Can you pls enlighten me on this. Should I use MERGE or
can SPLICE/DFSORT help. One crude way I have is to have file-1, then file-2 with spaces till LRECL of file-1, file-3 with SPACES for LRECL of file-1+LRECL of file-2. Later concatenate them. I think theres much better way to do it.
Also, can you pls guide me to the useful IBM links where I can learn more about SORT Utils.

Thanks a lot.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jun 02, 2005 8:39 pm    Post subject:
Reply with quote

Quote:
can you pls guide me to the useful IBM links where I can learn more about SORT Utils.


For complete information on DFSORT and DFSORT's ICETOOL, use this link:

http://www.ibm.com/servers/storage/support/software/sort/mvs/srtmprd.html

I'd suggest going through "z/OS DFSORT: Getting Started" to learn about DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it, and all of the DFSORT books and papers, at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

As for concatenating files: With SORT or COPY, you can use SORTIN concatenation. If the files have RECFM=VB, you can concatenate them directly even if they have different LRECLs. If the files have RECFM=FB, they can only be concatenated if they all have the same LRECL. So you would have to pad the shorter files out to the length of the longest file before you can concatenate them.

Quote:
Should I use MERGE


You can only use MERGE if each file is already in the correct sorted order. For MERGE, separate SORTINnn DDs are used rather than concatenation, but the same rules apply for RECFM=VB and RECFM=FB that apply for concatenation.

How exactly you would concatenate the files (using SORT, COPY, MERGE, SPLICE, etc) depends on exactly what you mean by concatenation.

If you give me the specific details of what you want to do (RECFM and LRECL of files, an example of the input and output records, etc), I can show you how to do it.
Back to top
View user's profile Send private message
ideas

New User


Joined: 25 May 2005
Posts: 53
Location: India

PostPosted: Fri Jun 03, 2005 9:48 am    Post subject:
Reply with quote

Dear Frank,

thanks for answering. My reqmt is as follows:

file-1:
abc12
file-2:
def34
file-3:
ijk56

now after concatenation they are abc12def34ijk56 in a single row (with the new file having LRECL the SUM of LRECL of all the files). assume that RECFM is FB and LRECL is same for all the files. Please suggest the way to do it using a SORT Uitlity.
I hope its made crystal clear now.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jun 03, 2005 8:01 pm    Post subject:
Reply with quote

Ok. We call that splicing. Here's a DFSORT/ICETOOL job to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/5)
//IN2 DD DSN=...  input file2 (FB/5)
//IN3 DD DSN=...  input file3 (FB/5)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/15)
//TOOLIN DD *
* IN1->T1:  Reformat records to:
* |f1dta|bbbbb|bbbbb|b|
COPY FROM(IN1) TO(T1) USING(CTL1)
* IN2->T1:  Reformat records to:
* |bbbbb|f2dta|bbbbb|b|
COPY FROM(IN2) TO(T1) USING(CTL2)
* IN3->T1:  Reformat records to:
* |bbbbb|bbbbb|f3dta|b|
COPY FROM(IN3) TO(T1) USING(CTL3)
* Splice on last b (common key) to get:
* |f1dta|f2dta|f3dta|b|
* Remove last b.
SPLICE FROM(T1) TO(OUT) ON(16,1,CH) -
  WITHEACH WITH(6,5) WITH(11,5) USING(CTL4)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,5,16:X)
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(6:1,5,16:X)
/*
//CTL3CNTL DD *
  OUTREC FIELDS=(11:1,5,X)
/*
//CTL4CNTL DD *
  OUTFIL FNAMES=OUT,OUTREC=(1,15)
/*
Back to top
View user's profile Send private message
ideas

New User


Joined: 25 May 2005
Posts: 53
Location: India

PostPosted: Mon Jun 06, 2005 4:18 pm    Post subject:
Reply with quote

Thanks Frank. I will try and revert.
Back to top
View user's profile Send private message
jituitbhu

New User


Joined: 03 Jun 2005
Posts: 3
Location: Pune,India

PostPosted: Mon Jun 06, 2005 4:39 pm    Post subject:
Reply with quote

Hi Frank,
I tried with your code, but it's giving output file empty. I think, this is because of the key value at the 16th position used for the SPLICE.

Please check the code and help me for the same.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Jun 06, 2005 9:23 pm    Post subject:
Reply with quote

My job works fine with the data I used (one 5-byte record in each of three input files and one 15-byte output record) which was based on what you showed me. The byte at position 16 is set up as a blank in all records so they all have the same key to splice on.

If the job doesn't work for you, then something is different on your end. You would need to show me your exact input records, tell me the RECFM and LRECL of your input file, and show me your //TOOLMSG and //DFSMSG output in order for me to help you figure out what's different and what has to be changed. Feel free to e-mail me this information offline (yaeger@us.ibm.com). Please put "DFSORT" somewhere in your Subject line to catch my attention.
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 FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am

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