View previous topic :: View next topic
|
Author |
Message |
man_pat
New User
Joined: 16 Dec 2003 Posts: 3 Location: India
|
|
|
|
I am having 2 flat files A & B with size as 25 & 35 respectively. I want to merge the records of the 2 files in such a way that Record 1 of file A + Record 1 of file B giving a total size of 60 for every record.[/b] |
|
Back to top |
|
|
bluebird
Active User
Joined: 03 Feb 2004 Posts: 127
|
|
|
|
Do u have documentation on icetool ?
I believe icetool can help u there ...
if u need this doc, I have it pdf format, post a msg there with your mail address and I'll try to send it. |
|
Back to top |
|
|
bluebird
Active User
Joined: 03 Feb 2004 Posts: 127
|
|
Back to top |
|
|
mdtendulkar
Active User
Joined: 29 Jul 2003 Posts: 237 Location: USA
|
|
|
|
Hello man_pat,
Page no 13 of the above manual contains the solution you are looking for.
Hope this helps
Regards
Mayuresh Tendulkar |
|
Back to top |
|
|
mvs_butta
New User
Joined: 23 Dec 2003 Posts: 13
|
|
Back to top |
|
|
man_pat
New User
Joined: 16 Dec 2003 Posts: 3 Location: India
|
|
|
|
Thanks for the useful info.
Can I do it without using ICETOOL?? |
|
Back to top |
|
|
bluebird
Active User
Joined: 03 Feb 2004 Posts: 127
|
|
|
|
can u do it wihout icetool (standard IBM utility) ?
YYYESS !!!
thing is u'll need to know about programming languages like cobol...
or REXX (a little bit easier than grumpy COBOL).
is this the way u wanna go ? |
|
Back to top |
|
|
man_pat
New User
Joined: 16 Dec 2003 Posts: 3 Location: India
|
|
|
|
Yes... programetically with out using any utility directly |
|
Back to top |
|
|
bluebird
Active User
Joined: 03 Feb 2004 Posts: 127
|
|
|
|
Quote: |
I am having 2 flat files A & B with size as 25 & 35 respectively. I want to merge the records of the 2 files in such a way that Record 1 of file A + Record 1 of file B giving a total size of 60 for every record
|
so basically you want to merge to file vertically ?
as I said you can do this using either cobol or more directly REXX.
DO U EXPECT US to GIVE u SOME CODE ? |
|
Back to top |
|
|
bluebird
Active User
Joined: 03 Feb 2004 Posts: 127
|
|
|
|
here is some rexx code that do what u want. but note that
- combi01 should be the bigger file allocated
- if you want to relieve from this situation you'll have to modify the present code
- there is some sort (utility) statement that may help u to achieve this. (I've not look into the matter) .
- you still need to code your file name (your-file1 and yourfile2
anyway here goes
Code: |
/* REXX */
"delete '"userid()".exo.combo'"
"alloc fi(combi01) da('your-file1') shr reuse"
"alloc fi(combi02) da('your-file2') shr reuse"
"alloc fi(combo) dataset('"userid()".exo.combo') new catalog",
"SPACE(2,1) CYL RECFM(F B) BLKSIZE(27960) LRECL(80)"
"execio * diskr combi01 (stem combi01. finis"
"execio * diskr combi02 (stem combi02. finis"
queue substr(combi01.1,1,25) !!substr(combi02.1,1,35)
cb2c=combi02.0
cb1c=combi01.0
select
when cb1c> cb2c then call cb1c_bigger
when cb2C> cb1c then call cb2c_bigger
when cb2c=cb1c then call even_process
otherwise call error_process
end
"execio " queued() " diskW combo (finis "
"free fi(combi01 combi02 combo)"
say 'bye bye '
exit 1
cB1c_bigger:
/* combi01 is bigger */
"execio * diskr combi01 (stem combi01. finis"
do I=2 to combi01.0
if I>cb2c then queue substr(combi01.i,1,25)
else do
if i=2 then sk=i
else sk=i-1
"execio 1 diskr combi02 (stem combi02."
queue substr(combi01.i,1,25) !!substr(combi02.i,1,35)
end
end
"execio 0 diskr combi02 (finis"
return
even_process:
/* same number of records */
"execio * diskr combi01 (stem combi01. finis"
"execio * diskr combi02 (stem combi02. finis"
do I=2 to combi01.0
queue substr(combi01.i,1,25) !!substr(combi02.i,1,35)
end
end
Error_process:
say 'error ' sourceline(sigl)
say ' * ' sigl
exit 2
|
as you can see from the code, if u have combi02 allocated as bigger file it will fail (no sub-routine included).
It is up to u to do it. |
|
Back to top |
|
|
|