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

Want to merge the records of the 2 files


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

New User


Joined: 16 Dec 2003
Posts: 3
Location: India

PostPosted: Mon Apr 19, 2004 4:10 pm
Reply with 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.[/b]
Back to top
View user's profile Send private message
bluebird

Active User


Joined: 03 Feb 2004
Posts: 127

PostPosted: Mon Apr 19, 2004 4:14 pm
Reply with quote

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
View user's profile Send private message
bluebird

Active User


Joined: 03 Feb 2004
Posts: 127

PostPosted: Mon Apr 19, 2004 4:18 pm
Reply with quote

I won't send it here is the link to the PDF icetool miniuserguide paper :
www.storage.ibm.com/software/sort/mvs/uq90053/pdf/sortpaug.pdf
read on the splice operator section
Back to top
View user's profile Send private message
mdtendulkar

Active User


Joined: 29 Jul 2003
Posts: 237
Location: USA

PostPosted: Mon Apr 19, 2004 4:33 pm
Reply with quote

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
View user's profile Send private message
mvs_butta

New User


Joined: 23 Dec 2003
Posts: 13

PostPosted: Mon Apr 19, 2004 9:59 pm
Reply with quote

check this link

www.storage.ibm.com/software/sort/mvs/tricks/srtmst02.html#t3a
Back to top
View user's profile Send private message
man_pat

New User


Joined: 16 Dec 2003
Posts: 3
Location: India

PostPosted: Tue Apr 20, 2004 7:18 am
Reply with quote

Thanks for the useful info.

Can I do it without using ICETOOL??
Back to top
View user's profile Send private message
bluebird

Active User


Joined: 03 Feb 2004
Posts: 127

PostPosted: Tue Apr 20, 2004 12:28 pm
Reply with quote

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
View user's profile Send private message
man_pat

New User


Joined: 16 Dec 2003
Posts: 3
Location: India

PostPosted: Tue Apr 20, 2004 12:44 pm
Reply with quote

Yes... programetically with out using any utility directly
Back to top
View user's profile Send private message
bluebird

Active User


Joined: 03 Feb 2004
Posts: 127

PostPosted: Tue Apr 20, 2004 4:18 pm
Reply with quote

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
View user's profile Send private message
bluebird

Active User


Joined: 03 Feb 2004
Posts: 127

PostPosted: Tue Apr 20, 2004 4:32 pm
Reply with quote

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
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top