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

how to join two files into a single file using splice


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

New User


Joined: 17 Nov 2010
Posts: 7
Location: India

PostPosted: Wed Nov 17, 2010 12:25 pm
Reply with quote

Hi,
Could you please help me in this.

i have two files
File1
0000000100
File2
0000000107

i need this two files should be joined like
File3
0000000100 0000000107
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Wed Nov 17, 2010 2:51 pm
Reply with quote

Hi shyam,

Please check this link. Hope this helps you. If you need more help, let us know.
Back to top
View user's profile Send private message
shyamprasad37

New User


Joined: 17 Nov 2010
Posts: 7
Location: India

PostPosted: Wed Nov 17, 2010 3:43 pm
Reply with quote

Hi Nelson,
i have tried the link. but i could not get an idea. i am new to ICETOOL. could you please get me the code for my requirement.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Nov 17, 2010 3:51 pm
Reply with quote

Click HERE to see the DFSORT smart tricks document which shows exactly how this can be achieved.
Back to top
View user's profile Send private message
shyamprasad37

New User


Joined: 17 Nov 2010
Posts: 7
Location: India

PostPosted: Wed Nov 17, 2010 3:56 pm
Reply with quote

The document provides the syntax. but i colud not unsderstand the logic behind the scene. Could you please share me the code and explain the logic.. i was very much confused icon_confused.gif
Back to top
View user's profile Send private message
shyamprasad37

New User


Joined: 17 Nov 2010
Posts: 7
Location: India

PostPosted: Wed Nov 17, 2010 4:01 pm
Reply with quote

HI,
i have used Merge and i combined the files like
0000000100
0000000107

But i wanted it to be in a single line. No matter if i get spaces or special characters in between also.

Is it poosible to do it.
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Wed Nov 17, 2010 4:06 pm
Reply with quote

Hi shyam,

Do you have the latest Version (V1R12 PTF UK90026 (Oct 2010)) of DFSORT/ICETOOL in your shop?
Will you have only 1 record in both of your input file? or if not, what are the rules to achieve your output?
What is you INPUT/OUTPUT - LRECL & RECFM?
Back to top
View user's profile Send private message
shyamprasad37

New User


Joined: 17 Nov 2010
Posts: 7
Location: India

PostPosted: Wed Nov 17, 2010 4:08 pm
Reply with quote

Hi Nelson,
Z/OS DFSORT V1R10
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Wed Nov 17, 2010 4:20 pm
Reply with quote

Hi Shyam,

The below DFSORT/ICETOOL job will give you the desired output. Assumed your both Input files of LRECL=10, OUTPUT File LRECL=20 & RECFM=FB. Job attributes can be changed accordingly.
Code:
//S1 EXEC PGM=ICETOOL                                       
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG DD SYSOUT=*                                       
//IN DD *                                                   
0000000100                                                 
0000000107                                                 
//OUT DD SYSOUT=*                                           
//TOOLIN DD *                                               
SPLICE FROM(IN) TO(OUT) ON(21,1,CH) -                       
   WITHEACH WITH(11,10) WITH(21,10) USING(CTL1)             
/*                                                         
//CTL1CNTL DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(21:C'A',22:SEQNUM,1,ZD)),
   IFTHEN=(WHEN=(22,1,ZD,EQ,+2),OVERLAY=(11:1,10))         
  OUTFIL FNAMES=OUT,BUILD=(1,10,1X,11,10)                   
/*                                                         

OUTPUT:
Code:
0000000100 0000000107

Hope this helps you.
Back to top
View user's profile Send private message
shyamprasad37

New User


Joined: 17 Nov 2010
Posts: 7
Location: India

PostPosted: Wed Nov 17, 2010 5:55 pm
Reply with quote

Hi,
Thanks a lot!
I got it
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Nov 17, 2010 8:12 pm
Reply with quote

shyamprasad37 wrote:
Z/OS DFSORT V1R10
If you have z/OS DFSORT V1R10 PTF UK90025, using RESIZE parameter would be a neat choice, I believe.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Nov 17, 2010 8:35 pm
Reply with quote

Anuj.

Are you sure "RESIZE" will achieve this?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Nov 17, 2010 10:33 pm
Reply with quote

Arun Raj wrote:
Anuj.

Are you sure "RESIZE" will achieve this?


Well assuming there is a header record to differentiate the records from 2 different files then yes , RESIZE can be used to merge records. However Joinkeys would be an apt choice for such requests. Resize works better on single files

Assuming that you want to merge 10 byte lrecl into 20 byte records , the following DFSORT/ICETOOL JCL will give you the desired results


Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD *                                                     
HDR                                                                 
F1-REC# 1                                                           
F1-REC# 2                                                           
F1-REC# 3                                                           
F1-REC# 4                                                           
F1-REC# 5                                                           
//         DD *                                                     
HDR                                                                 
F2-REC# 1                                                           
F2-REC# 2                                                           
F2-REC# 3                                                           
F2-REC# 4                                                           
F2-REC# 5                                                           
//OUT      DD SYSOUT=*       
//TOOLIN   DD *                                                 
  RESIZE FROM(IN) TO(OUT) TOLEN(36) USING(CTL1)                 
//CTL1CNTL DD *                                                 
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,10)),                       
  IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(11:SEQ=8)) 
  SORT FIELDS=(11,8,CH,A),EQUALS                               
  OUTFIL FNAMES=OUT,BUILD=(1,10,19,10)                         
//*


The output from this job is
Code:

HDR       HDR       
F1-REC# 1 F2-REC# 1
F1-REC# 2 F2-REC# 2
F1-REC# 3 F2-REC# 3
F1-REC# 4 F2-REC# 4
F1-REC# 5 F2-REC# 5
Back to top
View user's profile Send private message
shyamprasad37

New User


Joined: 17 Nov 2010
Posts: 7
Location: India

PostPosted: Wed Nov 24, 2010 10:49 am
Reply with quote

INREC IFTHEN=(WHEN=INIT,OVERLAY=(21:C'A',22:SEQNUM,1,ZD)),
IFTHEN=(WHEN=(22,1,ZD,EQ,+2),OVERLAY=(11:1,10))
OUTFIL FNAMES=OUT,BUILD=(1,10,1X,11,10)


Hi,
Could you please tell me why we use OVERLAY=(21:C'A',22:SEQNUM,1,ZD)),
I tried in OVERLAY=(22:SEQNUM,1,ZD)),
its working fine. but could you please tell me ,why we need to use 21:C'A'
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Wed Nov 24, 2010 12:13 pm
Reply with quote

Hi Shyam,

Quote:
i have two files
File1
0000000100
File2
0000000107


For combining two files using splice we need a common key in both the file records. So overlayed 21:C'A'.
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 How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top