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
 

 

Merge data of 2 files into one using SPLICE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Jul 05, 2007 7:13 pm    Post subject: Merge data of 2 files into one using SPLICE
Reply with quote

Hi,

I am trying to merge data of 2 files into one using SPLICE.

I have gone thru lot many examples of splice.
I am still not clear about the options used with splice.
like - Withall, with.
also tried SELECT
and faced same prob. with options like - dups, no dups, and many other.

Can some body explain a bit on this. It would be really helpful.
Thanks,
-Kapil.
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Jul 05, 2007 7:40 pm    Post subject:
Reply with quote

hikaps14
Quote:
I am trying to merge data of 2 files into one using SPLICE.

Could you be more clear, as to how is your i/p's,
LRECL,RECFM, Rules to merge?
Show some sample i/p's and expected o/p's.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Jul 05, 2007 7:46 pm    Post subject: Re: Help on splice!!
Reply with quote

To be more clear.
My exact requirement.

FileA (YYY is key)

XXX YYY DDD


FileB ( YYY,ZZZ is key)
YYY ZZZ WWW

Output should be: (

XXX YYY WWW

I guess we can ignore ZZZ of FileB. and then we will have duplicates in FileB. This we will have to handle.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Jul 05, 2007 8:33 pm    Post subject:
Reply with quote

hikaps14
Try this code,
Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
XXX YYY DDD                                                             
/*                                                                     
//IN2      DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
YYY ZZZ WWW                                                             
YYY ZZZ WWW                                                             
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//BOTH     DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COPY FROM(IN1)  TO(TMP1) USING(CP01)                                   
 COPY FROM(IN2)  TO(TMP1) USING(CP02)                                   
 SPLICE FROM(TMP1) TO(BOTH) ON(5,3,CH) WITH(13,1) WITH(9,3)-           
          WITHALL           USING(CP03) KEEPNODUPS                     
/*                                                                     
//CP01CNTL DD   *                                                       
  OUTREC BUILD=(1,11,12:C'11')                                         
/*                                                                     
//CP02CNTL DD   *                                                       
  OUTREC BUILD=(4X,1,4,9,3,12:C'22')                                   
/*                                                                     
//CP03CNTL DD   *                                                       
  OUTFIL FNAMES=BOTH,INCLUDE=(12,2,CH,EQ,C'12'),BUILD=(1,11)           
/*                                                                     


O/p BOTH contains
Code:
----+----1-
XXX YYY WWW
XXX YYY WWW


and regarding
Quote:
I am still not clear about the options used with splice.
like - Withall, with.
also tried SELECT
and faced same prob. with options like - dups, no dups, and many other.

Start understanding the basics of DFSORT/ICETOOL from "z/OS DFSORT: Getting Started " and other DFSORT books at:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Fri Jul 06, 2007 5:23 pm    Post subject: Re: Merge data of 2 files into one using SPLICE
Reply with quote

Thanks a lot for ur reply...
still i need a bit of ur help.

There is a slight change in file format.

FileA (80)
X Key1(22) data1(57)

FileB (84)
Key2(27) data2(57)
-- ( we have to ignore last 5 bytes of key2 to match it with key1.)

File Out (80)
X Key2(22) data2(57).

We have to get all key and data from FileB except the first byte (X) , this first byte of output file will come from FileA.

I tried to manipulate ur given sort card. but for me its a bit too complicated to handle it....

Note: i also couldn't the use of assigning '11' or '22' at end of rec.
Could u explain on that too.

I would be really thankful , if u have time to look into this .
:)
Thanks,
-Kapil.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Fri Jul 06, 2007 7:06 pm    Post subject: Re: Merge data of 2 files into one using SPLICE
Reply with quote

Thanks buddy....

I have finally written the sort card for my specific file layout.

Thanks for all ur support.
-Kapil.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 06, 2007 8:33 pm    Post subject:
Reply with quote

hikaps14
Check for the topic "Create files with matching and non-matching records" under "Smart DFSORT tricks" here

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

to understand

Quote:
Note: i also couldn't the use of assigning '11' or '22' at end of rec.
Could u explain on that too.
Back to top
View user's profile Send private message
ravikumar15

New User


Joined: 27 Mar 2006
Posts: 64

PostPosted: Mon Jul 09, 2007 5:43 pm    Post subject:
Reply with quote

I tried this code, but i am getting the following error:

SYT020I SYNCSORT CALLED WITH IDENTIFIER "0001"
SYT030I OPERATION COMPLETED WITH RETURN CODE 0

* REFORMAT THE IN2 DATA SET SO IT CAN BE SPLICED
COPY FROM(IN2) TO(TMP1) USING(CTL2)
SYT020I SYNCSORT CALLED WITH IDENTIFIER "0002"
SYT030I OPERATION COMPLETED WITH RETURN CODE 0

* SPLICE RECORDS WITH MATCHING SEQUENCE NUMBERS.
SPLICE FROM(TMP1) TO(BOTH) ON(5,3,CH) WITH(13,1) WITH(9,3)
WITHALL USING(CTL3) KEEPNODUPS
SYT048E STATEMENT DOES NOT BEGIN WITH A VALID OPERATOR


In our shop, we are using SYNCTOOL instead of ICETOOL. I think SPLICE command is not being recognised.

Please let me know, what could be the problem.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jul 09, 2007 6:01 pm    Post subject:
Reply with quote

ravikumar15

Quote:
In our shop, we are using SYNCTOOL instead of ICETOOL. I think SPLICE command is not being recognised.

SYNCTOOL does supports SPLICE.

Try adding '-' at end of the SPLICE for continuation,as shown here
Code:
SPLICE FROM(TMP1) TO(BOTH) ON(5,3,CH) WITH(13,1) WITH(9,3) -
WITHALL USING(CTL3) KEEPNODUPS
Back to top
View user's profile Send private message
ravikumar15

New User


Joined: 27 Mar 2006
Posts: 64

PostPosted: Tue Jul 10, 2007 4:05 pm    Post subject:
Reply with quote

It was there before, I copied this from the spool. Its saying statement did not begin with a valid operator.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Jul 10, 2007 4:25 pm    Post subject:
Reply with quote

ravikumar15.
Code:
SPLICE FROM(TMP1) TO(BOTH) ON(5,3,CH) WITH(13,1) WITH(9,3)
WITHALL USING(CTL3) KEEPNODUPS
SYT048E STATEMENT DOES NOT BEGIN WITH A VALID OPERATOR

You are starting an statement with WITHALL, which is not valid, actually its an continuation of SPLICE operator statement.

So, if you use an continuation symbol '-', as i have suggested above, it should work for you.

Quote:
It was there before
If it was there before then it will also show in the SPOOL too.
Please check the syntax!
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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