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

Want to merge these two files with sort utility vertically


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

New User


Joined: 08 Mar 2005
Posts: 62
Location: Basildon

PostPosted: Tue Jun 07, 2005 5:54 pm
Reply with quote

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

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jun 08, 2005 4:34 am
Reply with quote

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

DFSORT Developer


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

PostPosted: Wed Jun 08, 2005 6:03 am
Reply with quote

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

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
View user's profile Send private message
narayan_sug
Warnings : 1

New User


Joined: 08 Jun 2005
Posts: 1

PostPosted: Wed Jun 08, 2005 10:35 am
Reply with 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?
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Wed Jun 08, 2005 12:51 pm
Reply with quote

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
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
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
Search our Forums:

Back to Top