|
View previous topic :: View next topic
|
| Author |
Message |
ideas
New User

Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| 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:
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:
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 |
|
 |
ideas
New User

Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
ideas
New User

Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
| Thanks Frank. I will try and revert. |
|
| Back to top |
|
 |
jituitbhu
New User
.jpg)
Joined: 03 Jun 2005 Posts: 3 Location: Pune,India
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 ([email protected]). Please put "DFSORT" somewhere in your Subject line to catch my attention. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|