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

Merge data of 2 files into one using SPLICE


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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:

Use [URL] BBCode for External Links
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
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
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
Reply with quote

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

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: 68

PostPosted: Mon Jul 09, 2007 5:43 pm
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
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: 68

PostPosted: Tue Jul 10, 2007 4:05 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
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
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top