Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

how to join two files into a single file using splice

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: how to join two files into a single file using splice
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    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 17, 2010 3:51 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

Senior Member


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

PostPosted: Wed Nov 17, 2010 8:12 pm    Post subject:
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: 2163
Location: @my desk

PostPosted: Wed Nov 17, 2010 8:35 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us