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

Duplicates in i/p written into the output file on SPLICE.


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

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Tue Nov 11, 2008 3:06 pm
Reply with quote

Hi,

I have a huge file containing 250000 records(File-1) also there are duplicate a/c no in this and second file containing records 2000(File-1). I have to make sure that records present in File-1 having a match with the records present in File-2 to be written into the output file. (i.e all the matched records from file-2 are to be written)
Field on which match is to be performed is :
File-1 : Position 18 - CH
File-2 : Position 18 - CH

Here are the control cards I have used :
File -1 containing records 250000 :-
Code: CTL1
INREC OVERLAY=(35:C'11')

File -2 containing 2000 records
Code: CTL2
INREC OVERLAY=(35:C'22')

CTL3:
OUTFIL FNAMES=OUT12,INCLUDE=(35,2,CH,EQ,C'12'),BUILD=(1,34)

Here's the splice :
Code:

COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT12) ON(18,17,CH) WITH(34,2) -
USING(CTL3) KEEPBASE


Now the problem is :
The output file contain matched records from File-1 & File-2. But there are no duplicate records present in the output file.

Please Help.
Back to top
View user's profile Send private message
ssk1711

New User


Joined: 16 Jun 2008
Posts: 40
Location: bangalore

PostPosted: Tue Nov 11, 2008 5:10 pm
Reply with quote

Quote:
But there are no duplicate records present in the output file


you want the duplicates in file-2 also to be populated in the output ?

Thanks,
Back to top
View user's profile Send private message
nelson.pandian

Active User


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

PostPosted: Tue Nov 11, 2008 5:27 pm
Reply with quote

Try this one... This will write all the duplicates from file1

Code:
//STEP10A  EXEC PGM=ICETOOL 
//*                         
//SYSOUT       DD  SYSOUT=* 
//TOOLMSG      DD  SYSOUT=* 
//DFSMSG       DD  SYSOUT=* 
//*                         
//I1           DD  *
----+----1----+----2----+----3----       
AAAAAAAAAA AAAAA 11111111   
BBBBBBBBBB BBBBB 22222222   
CCCCCCCCCC CCCCC 33333333   
DDDDDDDDDD DDDDD 44444444   
EEEEEEEEEE EEEEE 55555555   
GGGGGGGGGG GGGGG 11111111   
HHHHHHHHHH HHHHH 33333333   
IIIIIIIIII IIIII 55555555   
JJJJJJJJJJ JJJJJ 11111111   
KKKKKKKKKK KKKKK 22222222   
LLLLLLLLLL LLLLL 77777777   
/*                           
//I2           DD  *
----+----1----+----2----+----3----       
                 11111111                       
                 22222222                       
                 33333333                       
                 55555555                       
                 99999999                       
/*                                               
//T1           DD  DSN=&&T1,                     
//            DISP=(MOD,PASS),                   
//            UNIT=SYSDA,SPACE=(CYL,(10,10),RLSE)
//*                                             
//O1           DD  DSN=OUTfile--->(34 Length),     
//            DISP=(NEW,PASS),                           
//           UNIT=SYSDA,5),SPACE=TRK200,200),RLSE)                         
//*                                                       
//TOOLIN   DD  *    *** CONSTANT CONTROL CARDS ***         
  COPY FROM(I2) TO(T1) USING(CTL1)                         
  COPY FROM(I1) TO(T1) USING(CTL2)                         
  SPLICE FROM(T1) TO(O1) ON(18,17,CH) KEEPNODUPS KEEPBASE -
    WITHALL WITH(1,35) USING(CTL3)                         
/*                                                         
//CTL1CNTL DD *                                           
  INREC OVERLAY=(35:C'11')                                 
/*                                                         
//CTL2CNTL DD *                                           
  INREC OVERLAY=(35:C'22')                                 
/*                                                         
//CTL3CNTL DD *                                           
  OUTFIL FNAMES=O1,INCLUDE=(35,2,CH,EQ,C'21'),
    BUILD=(1,34)             
/*                     


OUTPUT
Code:
----+----1----+----2----+----3----
AAAAAAAAAA AAAAA 11111111         
GGGGGGGGGG GGGGG 11111111         
JJJJJJJJJJ JJJJJ 11111111         
BBBBBBBBBB BBBBB 22222222         
KKKKKKKKKK KKKKK 22222222         
CCCCCCCCCC CCCCC 33333333         
HHHHHHHHHH HHHHH 33333333         
EEEEEEEEEE EEEEE 55555555         
IIIIIIIIII IIIII 55555555         

Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Tue Nov 11, 2008 6:10 pm
Reply with quote

The Output mentioned is exactly same but somehow i couldn't get the output using the same trick.

I even tried with different options in CTL3CNTl.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Nov 11, 2008 6:12 pm
Reply with quote

Narasimha,

Quote:
The Output mentioned is exactly same but somehow i couldn't get the output using the same trick.


Did you get any error message? If yes, do post it.

Version and the SORT product that u r using?
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Tue Nov 11, 2008 6:30 pm
Reply with quote

I didnot get any error message but i got the output without any duplicates

like
----+----1----+----2----+----3----
AAAAAAAAAA AAAAA 11111111
BBBBBBBBBB BBBBB 22222222
CCCCCCCCCC CCCCC 33333333
EEEEEEEEEE EEEEE 55555555
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Tue Nov 11, 2008 6:32 pm
Reply with quote

i am using Z/OS DFSORT V1R5
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Nov 11, 2008 11:40 pm
Reply with quote

Naraismha,

Nelson's job was missing BUILD=(1,34) on the OUTFIL statement, so I updated his post to add it. When I run his job with your input, it gives your desired output. So either "your" input is not what you showed here, or your version of Nelson's job is different than Nelson's version.

If your input is the same as you posted here, then post the complete JCL and control statements that YOU used.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 12, 2008 10:37 am
Reply with quote

Hello,

Please re-post your info using copy/paste and the "Code" tag. Many of the people who provide answers here are not permitted to download atachments. Once the material is copied/pasted into the reply editor, use the "Code" tag for readability/alignment. Use Preview to see how your post will appear to the forum rather than how it appears in the reply editor.

When you are satisfied with the how the post looks, Submit.

Screenshots should also not be used - they are deleted.
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 12, 2008 10:41 am
Reply with quote

Naraismha

Can you show me, how you need the output to be present in the output file, for the input which you have uploaded.
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Wed Nov 12, 2008 10:59 am
Reply with quote

I hope this would give the picture of what is required

Code:

//RxxxxxYF JOB (RET),'COPY FILE',REGION=0M,MSGCLASS=T,
//             MSGLEVEL=(1,1),USER=R1493,CLASS=R,NOTIFY=&SYSUID
//S1      EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN1       DD DSN=xxxxx.Rxxxx.WHD.ACCTNBR.A1,DISP=SHR
//IN2       DD DSN=xxxxx.Rxxxx.WD.REWDACCT.A1,DISP=SHR
//T1        DD DSN=&&TEMP1,
//             DISP=(MOD,PASS)
//OUT12     DD DSN=TSTRE.R1493.WHD.DEPTACCT.T4.A5,
//             DISP=(NEW,CATLG,DELETE),
//             LIKE=TSTRE.R1493.WD.REWDACCT.A1
//TOOLIN    DD *
  COPY FROM(IN1) TO(T1) USING(CTL1)
  COPY FROM(IN2) TO(T1) USING(CTL2)
  SPLICE FROM(T1) TO(OUT12) ON(18,17,CH) KEEPNODUPS KEEPBASE -
  WITHALL WITH(1,35) USING(CTL3)
//CTL1CNTL  DD *
  INREC OVERLAY=(35:C'11')
/*
//CTL2CNTL  DD *
  INREC OVERLAY=(35:C'22')
/*
//CTL3CNTL  DD *
  OUTFIL FNAMES=OUT12,INCLUDE=(35,2,CH,EQ,C'21'),BUILD=(1,34)
/*                     



Input file: IN1

----+----1----+----2----+----3----
*********************************
.... ........  C 0000000000
.Ý ´ .......*  C 00000000000
.Ý { ........  C 00000000000
.v¬² ........  C 0000000012
.vÎ. ......&.  C 0000000078
..H§ .....Â..  C 0000000100
..H§ .....Â..  C 0000000100
..HÝ .....Â..  C 0000000100
..HÝ .....Â..  C 0000000100
..H´ .....Â..  C 0000000100
..H´ .....Â..  C 0000000100
..ôë .....Â..  C 0000000100
..ôë .....Â..  C 0000000100
.uÕ. ........  C 0000000123
...T .....fÃ%  C 0000001234
...T .....fÃ%  C 0000001234
.vɾ ....Ââ %  C 0000001363
.vË{ .....ÎÎ*  C 0000002284
.vÁ. ......&.  C 0000002444
..¯ñ .....Ëqæ  C 0000010313
..¯. ......ïð  C 0000010313
..¯( ......Ç@  C 0000010313
..]~ .....bä.  C 0000010313
.vËE .....bä.  C 0000010313
..¯. .......*  C 0000012345
..¯. .......*  C 0000012345
..¯ä .......*  C 0000012345
..¯¾ .......<  C 0000012345
..¯A ...&...*  C 0000012345

Input file: IN2

----+----1----+----2----+----3----
*********************************
                 0000000051
                 0000000078
                 0000000318
                 0000000772
                 0000002284
                 0000010049
                 0000010313
                 0000010794
                 0000012685


Required output: OUT12

----+----1----+----2----+----3----
*********************************
.vÎ. ......&.  C 0000000078
.vË{ .....ÎÎ*  C 0000002284
..¯ñ .....Ëqæ  C 0000010313
..¯. ......ïð  C 0000010313
..¯( ......Ç@  C 0000010313
..]~ .....bä.  C 0000010313

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 12, 2008 11:01 am
Reply with quote

Change ur TOOLIN statement like this and try it. It should work.

Code:
COPY FROM(I2) TO(T1) USING(CTL1)
COPY FROM(I1) TO(T1) USING(CTL2)
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Wed Nov 12, 2008 11:07 am
Reply with quote

Thanks Nelson this worked for me.

it was a good leason.

Got the required output
Code:

Required output: OUT12

----+----1----+----2----+----3----
*********************************
.vÎ. ......&.  C 0000000078
.vË{ .....ÎÎ*  C 0000002284
..¯ñ .....Ëqæ  C 0000010313
..¯. ......ïð  C 0000010313
..¯( ......Ç@  C 0000010313
..]~ .....bä.  C 0000010313
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 12, 2008 11:27 am
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

Hopefully, the "code" tag has become your ally. . . icon_wink.gif

d
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Wed Nov 12, 2008 11:37 am
Reply with quote

using the same input in the similar way can we get write the unmatched items to another output file

like the output file should be
Code:


----+----1----+----2----+----3----
*********************************
.... ........  C 0000000000
.Ý ´ .......*  C 00000000000
.Ý { ........  C 00000000000
.v¬² ........  C 0000000012
..H§ .....Â..  C 0000000100
..H§ .....Â..  C 0000000100
..HÝ .....Â..  C 0000000100
..HÝ .....Â..  C 0000000100
..H´ .....Â..  C 0000000100
..H´ .....Â..  C 0000000100
..ôë .....Â..  C 0000000100
..ôë .....Â..  C 0000000100
.uÕ. ........  C 0000000123
...T .....fÃ%  C 0000001234
...T .....fÃ%  C 0000001234
.vɾ ....Ââ %  C 0000001363
.vÁ. ......&.  C 0000002444
..¯. .......*  C 0000012345
..¯. .......*  C 0000012345
..¯ä .......*  C 0000012345
..¯¾ .......<  C 0000012345
..¯A ...&...*  C 0000012345



can this logic be written in the same job
i.e, wrting both matched and unmatched recordsto be written in output using the same input files

Thanks,
Narasimha
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 12, 2008 11:55 am
Reply with quote

Use this Control card. You will get the unmatched records in the output file2

Code:
//CTL3CNTL DD *                                           
  OUTFIL FNAMES=O1,INCLUDE=(35,2,CH,EQ,C'21'),BUILD=(1,34)
  OUTFIL FNAMES=O2,INCLUDE=(35,2,CH,EQ,C'22'),BUILD=(1,34)
/*                                                       
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Wed Nov 12, 2008 12:24 pm
Reply with quote

Thanks Nelson even this worked fine
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 12, 2008 1:02 pm
Reply with quote

Quote:
Thanks Nelson even this worked fine


You are Welcome icon_smile.gif
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Wed Nov 12, 2008 1:14 pm
Reply with quote

Hi All,

With the current output we got can we write the count of dulicates at the end (adding one more column for the count)

The output required :
out12
Code:

----+----1----+----2----+----3------
*********************************
.vÎ. ......&.  C 0000000078
.vË{ .....ÎÎ*  C 0000002284
..]~ .....bä.  C 0000010313        04



out22
Code:

----+----1----+----2----+----3------
*********************************
.... ........  C 0000000000        03
.v¬² ........  C 0000000012        01
..ôë .....Â..  C 0000000100        07
.uÕ. ........  C 0000000123        01
...T .....fÃ%  C 0000001234        02
.vɾ ....Ââ %  C 0000001363        01
.vÁ. ......&.  C 0000002444        01
..¯. .......*  C 0000012345        05

[/code]
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Nov 13, 2008 1:04 am
Reply with quote

Naraismha Reddy,


Did you want to show spaces if there is only 1 record per key in OUT12? Also you have 5 records for key 0000010313 in file 1 and yet you show only 4 as duplicate count. So the first key record is not considered as dup? If that is true then Change your CTL3CNTL control cards to the following which will give you the desired results.

Code:

//CTL3CNTL DD *                                       
  OUTFIL FNAMES=OUT12,INCLUDE=(35,2,CH,EQ,C'21'),     
  REMOVECC,NODETAIL,BUILD=(1,34,2X),SECTIONS=(18,17, 
  TRAILER3=(1,34,COUNT-1=(EDIT=(II))))               
                                                     
  OUTFIL FNAMES=UNMATCH1,INCLUDE=(35,2,CH,EQ,C'22'), 
  REMOVECC,NODETAIL,BUILD=(1,34,2X),SECTIONS=(18,17, 
  TRAILER3=(1,34,COUNT=(EDIT=(TT))))                 
/*


OUT12 will have
Code:

.V . ......&.  C 0000000078         
.V { .....  *  C 0000002284         
.V E .....B .  C 0000010313        4


and UNMATCH1 will have
Code:

.Ý { ........  C 0000000000       03
.V¬  ........  C 0000000012       01
..   ..... ..  C 0000000100       08
.U . ........  C 0000000123       01
...T .....F %  C 0000001234       02
.V   ....   %  C 0000001363       01
.V . ......&.  C 0000002444       01
.. A ...&...*  C 0000012345       05
Back to top
View user's profile Send private message
Naraismha Reddy

New User


Joined: 23 Apr 2008
Posts: 39
Location: Hyderabad

PostPosted: Sat Nov 15, 2008 10:29 am
Reply with quote

Hi Kolusu,

Thanks for the perfect control card.
It worked fine.

i have got the required output

Out12
Code:

----+----1----+----2----+----3------
*********************************
.vÎ. ......&.  C 0000000078
.vË{ .....ÎÎ*  C 0000002284
..]~ .....bä.  C 0000010313        04



Out22
Code:

----+----1----+----2----+----3------
*********************************
.... ........  C 0000000000        03
.v¬² ........  C 0000000012        01
..ôë .....Â..  C 0000000100        07
.uÕ. ........  C 0000000123        01
...T .....fÃ%  C 0000001234        02
.vɾ ....Ââ %  C 0000001363        01
.vÁ. ......&.  C 0000002444        01
..¯. .......*  C 0000012345        05



Once again thanks for the support
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top