IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Want to merge these two files with sort utility vertically

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
View previous topic :: View next topic  
Author Message
rsshanmugam



Joined: 08 Mar 2005
Posts: 53
Location: Chennai

Posted: Tue Jun 07, 2005 5:54 pm    Post subject: Want to merge these two files with sort utility vertically  

Important interview question.

i have two vsam file one with 100 bytes length and other with 50 byte length,

i want to merge these two files only with sort utility in vertical manner and the resultant file should have 150 bytes only.

can any one suggest ans for this, this should be done only thru jcl ie to use only sort utility.
Back to top  
superk



Joined: 26 Apr 2004
Posts: 3304
Location: Charlotte,NC USA

Posted: Wed Jun 08, 2005 4:34 am    Post subject: Re: jcl interview question  

I'm going to move this post to the DFSORT forum. But, FYI, this same question was just asked and answered yesterday and, I believe, last week. Try a search in the DFSORT forum for SPLICE.
Back to top  
Frank Yaeger



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

Posted: Wed Jun 08, 2005 6:03 am    Post subject:  

You can do this with the SPLICE operator of DFSORT's ICETOOL. This Smart DFSORT Trick shows the technique to use:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmst03.html#t01

In your case, with input file1 having 100 byte records and input file2 having 50 byte records, the job would look like this. Note that I've used VSAMTYPE(F) to tell DFSORT to process the VSAM files as fixed (I'm assuming all of the records in file1 have 100 bytes and all of the records in file2 have 50 bytes):

Code:
//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1    DD DSN=...  input file1
//IN2    DD DSN=...  input file2
//TMP1   DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT    DD DSN=...  output file
//TOOLIN DD *
* Reformat the IN1 data set so it can be spliced
 COPY FROM(IN1) TO(TMP1) USING(CTL1) VSAMTYPE(F)
* Reformat the IN2 data set so it can be spliced
 COPY FROM(IN2) TO(TMP1) USING(CTL2) VSAMTYPE(F)
* Splice records with matching sequence numbers.
 SPLICE FROM(TMP1) TO(OUT) ON(151,8,PD) WITH(101,50) USING(CTL3)
/*
//CTL1CNTL DD *
* Use OUTREC to create: |f1fld|blank|seqnum|
  OUTREC FIELDS=(1:1,100,151:SEQNUM,8,PD)
/*
//CTL2CNTL DD *
* Use OUTREC to create: |blank|f2fld|seqnum|
  OUTREC FIELDS=(101:1,50,151:SEQNUM,8,PD)
/*
//CTL3CNTL DD *
* Use OUTFIL OUTREC to remove the sequence number
 OUTFIL FNAMES=OUT,OUTREC=(1,150)
/*
Back to top  
narayan_sug



Joined: 08 Jun 2005
Posts: 1

Posted: Wed Jun 08, 2005 10:35 am    Post subject: give me answer for it  

hello, i have done my b.tech and also completed my mainframe course.
i am looking for a job. i think. not much opportunities on mainframes skills?
what do you think about it? sis it right or not?
Back to top  
mcmillan



Joined: 18 May 2003
Posts: 922
Location: India

Posted: Wed Jun 08, 2005 12:51 pm    Post subject:  

Quote: hello, i have done my b.tech and also completed my mainframe course.
i am looking for a job. i think. not much opportunities on mainframes skills?
what do you think about it? sis it right or not?

Start a New Topic for that in "Off Topic" Forum...Before that Read Forum Rules now to avoid getting any more warnings in future.
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM