View previous topic :: View next topic
|
Author |
Message |
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
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 |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Thanks buddy....
I have finally written the sort card for my specific file layout.
Thanks for all ur support.
-Kapil. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
Back to top |
|
|
ravikumar15
New User
Joined: 27 Mar 2006 Posts: 68
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
ravikumar15
New User
Joined: 27 Mar 2006 Posts: 68
|
|
|
|
It was there before, I copied this from the spool. Its saying statement did not begin with a valid operator. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
|