MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to merge few bytes from file1 and few bytes from file2

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
madhuroyus
Beginner


Joined: 09 Jan 2006
Posts: 45
Topics: 14
Location: Bangalore

PostPosted: Mon Jan 09, 2006 6:52 am    Post subject: How to merge few bytes from file1 and few bytes from file2 Reply with quote

I have two files file1 and file2. I wanted to take few bytes from file1 and few bytes from file2 and write in to fileout.

Like:

file1
------

Multi talented Guy
New Versus Old
Macnaus Gold

file2:
-------
Old is Gold
New is platinum
Devine leads to God

Note: Input is taken 4 bytes from 3rd byte in file1 and 2 bytes from 5th byte in file2 and written to fileout.

FileOut:
--------
lti is
w Ve is
cnaune

Can some one help me on this problem by using ICETOOL and DFSORT/SYNCSORT.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Jan 09, 2006 8:05 am    Post subject: Reply with quote

madhuroyus,

What is the key for merging? 1st record of file1 must be attaced to 1st record of file2 and so on ..?

Please post DCB properties of both the files and rules for merging them.

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Jan 09, 2006 11:09 am    Post subject: Reply with quote

See the "Join fields from two files record-by-record" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Thu Sep 07, 2006 6:40 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
madhuroyus
Beginner


Joined: 09 Jan 2006
Posts: 45
Topics: 14
Location: Bangalore

PostPosted: Tue Jan 10, 2006 1:27 am    Post subject: Reply with quote

Hi Kolusu,

First record of the first file must be attached with the first record of the second file.

All files are FB.

Thanks for your response.

Madhu.
_________________
Self confidence is something that says U will do it, when the rest of the world has exactly opposite view.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Jan 10, 2006 5:10 am    Post subject: Reply with quote

madhuroyus,

Frank's Link will get you the desired results.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
madhuroyus
Beginner


Joined: 09 Jan 2006
Posts: 45
Topics: 14
Location: Bangalore

PostPosted: Tue Jan 10, 2006 5:18 am    Post subject: Reply with quote

Hi Frank Yaeger,

I used the following jcl.
Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1    DD DSN=...  file1
//IN2    DD DSN=...  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)
* Reformat the IN2 data set so it can be spliced
 COPY FROM(IN2) TO(TMP1) USING(CTL2)
* Splice records with matching sequence numbers.
 SPLICE FROM(TMP1) TO(OUT) ON(11,8,PD) WITH(6,5) USING(CTL3)
/*
//CTL1CNTL DD *
* Use OUTREC to create: |f1fld|blank|seqnum|
  OUTREC FIELDS=(1:1,5,11:SEQNUM,8,PD)
/*
//CTL2CNTL DD *
* Use OUTREC to create: |blank|f2fld|seqnum|
  OUTREC FIELDS=(6:1,5,11:SEQNUM,8,PD)
/*
//CTL3CNTL DD *
* Use OUTFIL OUTREC to remove the sequence number
 OUTFIL FNAMES=OUT,OUTREC=(1,10)
/*

I wanted to know that how this line will work.
" SPLICE FROM(TMP1) TO(OUT) ON(11,8,PD) WITH(6,5) USING(CTL3)"

I tryed with diff i/p combinations by changing the "ON(11,8,PD) WITH(6,5)" to some other numbers, but I could not understand how this works.

This JCL takes whole record from the i/p files but I need to take only some part of the record only.

Ex:

If FILE1 contains:
ABCDE
FGHIJ

and FILE2 contains:
01234
56789

Then my output file should contain:
(2nd and 4th byte from file1 and 3rd and 5th byte from file2)
BD24
GI79

Thanks
Madhu.
_________________
Self confidence is something that says U will do it, when the rest of the world has exactly opposite view.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Jan 10, 2006 5:51 am    Post subject: Reply with quote

Quote:

Then my output file should contain:
(2nd and 4th byte from file1 and 3rd and 5th byte from file2

madhuroyus,

Change your CTL3CNTL to the following which will gice you the desired results.
Code:

//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OUTREC=(2,1,4,1,8,1,10,1)
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
madhuroyus
Beginner


Joined: 09 Jan 2006
Posts: 45
Topics: 14
Location: Bangalore

PostPosted: Tue Jan 10, 2006 6:19 am    Post subject: Reply with quote

Hi Kolusu,

I understood the following code.
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OUTREC=(2,1,4,1,8,1,10,1)
/*

I tried to understand the below code but I am not.
" SPLICE FROM(TMP1) TO(OUT) ON(11,8,PD) WITH(6,5) USING(CTL3)"

Can you please explain me how it works.

Thanks
Madhu.
_________________
Self confidence is something that says U will do it, when the rest of the world has exactly opposite view.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
madhuroyus
Beginner


Joined: 09 Jan 2006
Posts: 45
Topics: 14
Location: Bangalore

PostPosted: Tue Jan 10, 2006 6:24 am    Post subject: Reply with quote

Hi Kolusu,

I understood it now after some experiments I did.

Thanks a ton.
And Frank's to you also.

Thanks
Madhu.
_________________
Self confidence is something that says U will do it, when the rest of the world has exactly opposite view.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 10, 2006 11:20 am    Post subject: Reply with quote

Madhu,

I just got in and saw your post. I'm glad you were able to figure it out yourself.

For complete information on how the SPLICE operator of DFSORT's ICETOOL works, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.13?DT=20050222160456

The doc uses lots of examples.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
madhuroyus
Beginner


Joined: 09 Jan 2006
Posts: 45
Topics: 14
Location: Bangalore

PostPosted: Thu Jan 12, 2006 3:06 am    Post subject: Reply with quote

Hi Frank,

I gone thru the link you provided and it is so help full for me.

I am thank full to you.

Thanks
Madhu
_________________
Self confidence is something that says U will do it, when the rest of the world has exactly opposite view.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group