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

removing duplicates in sequential files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Oct 18, 2007 4:52 pm
Reply with quote

Hi,

Can someone help me in the following requirement

I have two sequential files of length 133. The file has only values in the first 11 positions all other are spaces

The files looks like

file1..
A0000008060
A0000009980
A0000018060

file2...

A0000008060
A0000009980
A0000018060
A0000019980
A0000108060
A0000109980

The requirement is to delete the records in file2 if they are present in file1.

Now my output should be

A0000019980
A0000108060
A0000109980

Can some one could help me out...


Thanks,
Dharani
Back to top
View user's profile Send private message
Aaru

Senior Member


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

PostPosted: Thu Oct 18, 2007 4:59 pm
Reply with quote

Use the SELECT operator and the NODUPS option of ICETOOL .
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Oct 18, 2007 5:08 pm
Reply with quote

I tried the following code.

//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,1,CH,2,10,ZD) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(133:C'1')
/*
//CTL2CNTL DD *
INREC OVERLAY=(133:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(133,1,CH,EQ,C'2'),
BUILD=(1,132,1X)
/*


It gave me a syntax error in

OUTFIL FNAMES=OUT,INCLUDE=(133,1,CH,EQ,C'2'),

Can you pls tell me what is the error in this...

Thanks,
Dharani
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Thu Oct 18, 2007 5:16 pm
Reply with quote

Did you used OUT as your dd name?
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Oct 18, 2007 5:20 pm
Reply with quote

Yes Nuthan

IN1 & IN2 are DD names for input file1 and file2
OUT is the DD name for ouput file.

Thanks,
Dharani
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Oct 18, 2007 5:24 pm
Reply with quote

Instead of BUILD=(1,132,1X), try OUTREC=(1,132,1X).
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Oct 18, 2007 5:32 pm
Reply with quote

no luck for me superk.
Back to top
View user's profile Send private message
Aaru

Senior Member


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

PostPosted: Thu Oct 18, 2007 5:33 pm
Reply with quote

nagarajan,

Use the below code

Code:

//S1    EXEC  PGM=ICETOOL                                           
//TOOLMSG DD SYSOUT=*                                               
//DFSMSG  DD SYSOUT=*                                               
//IN1 DD DSN=HLQ.ONE.ONX,DISP=SHR                               
//IN2 DD DSN=HLQ.TWO.TWX,DISP=SHR                               
//OUT  DD DSN=HLQ.T1T2TE,DISP=(,CATLG,DELETE)                   
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)       
//TOOLIN DD *                                                       
COPY FROM(IN1) TO(T1) USING(CTL1)                                   
COPY FROM(IN2) TO(T1) USING(CTL2)                                   
  SELECT FROM(T1) TO(OUT) ON(1,11,CH) NODUPS USING(CTL3)           
/*                                                                 
//CTL1CNTL DD *                                                     
  INREC OVERLAY=(133:C'1')                                         
/*                                                                 
//CTL2CNTL DD *                                                     
  INREC OVERLAY=(133:C'2')                                         
/*                                                                 
//CTL3CNTL DD *                                                     
  OUTFIL FNAMES=OUT,INCLUDE=(133,1,CH,EQ,C'2'),                     
     BUILD=(1,132)                                                 
 /*


output:

Code:
A0000019980
A0000108060
A0000109980
Back to top
View user's profile Send private message
Aaru

Senior Member


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

PostPosted: Thu Oct 18, 2007 5:36 pm
Reply with quote

use the below control card for CTL3 to get an output with LRECL 133

Code:
 //CTL3CNTL DD *                                     
   OUTFIL FNAMES=OUT,INCLUDE=(133,1,CH,EQ,C'2'),     
      BUILD=(1,132,133:X)                             
 /*                                                   
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Oct 18, 2007 6:00 pm
Reply with quote

Thanks a lot Aaru.

It worked for my requirement


Thanks,
Dharani
Back to top
View user's profile Send private message
Aaru

Senior Member


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

PostPosted: Thu Oct 18, 2007 6:04 pm
Reply with quote

You are welcome icon_biggrin.gif
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Oct 18, 2007 6:29 pm
Reply with quote

Hi Aaru,

Could you help me again with another one.

My requirement is the same to delete the records in file2 if they are present in file1. This should be done based on the emp-no.

First file has

A0000008060
A0000009980
A0000018060

Second one has

0000008060
0000009980
0000018060
0000019980
0000108060
0000109980

The emp-no is of 10 digits length. In first file it is from 2-11 positions
and in the second one it is from 1-10 positions.

Can this be done using icetool.
Back to top
View user's profile Send private message
Aaru

Senior Member


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

PostPosted: Thu Oct 18, 2007 6:48 pm
Reply with quote

Nagarajan,

Use this sort card for your new requirement. Try and let me know if this works.

Code:

//TOOLIN DD *                                                           
COPY FROM(IN1) TO(T1) USING(CTL1)                                       
COPY FROM(IN2) TO(T1) USING(CTL2)                                       
  SELECT FROM(T1) TO(OUT) ON(2,10,CH) NODUPS USING(CTL3)               
/*                                                                     
//CTL1CNTL DD *                                                         
  INREC OVERLAY=(133:C'1')                                             
/*                                                                     
//CTL2CNTL DD *                                                         
  INREC OVERLAY=(2:1,10,132:X,133:C'2')                                 
/*                                                                     
//CTL3CNTL DD *                                                         
  OUTFIL FNAMES=OUT,INCLUDE=(133,1,CH,EQ,C'2'),                         
     BUILD=(1:2,10,133:X)                                               
/*                                                                     
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Thu Oct 18, 2007 7:44 pm
Reply with quote

Aaru, It worked fine for me.. Thanks again for your help
Back to top
View user's profile Send private message
Aaru

Senior Member


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

PostPosted: Fri Oct 19, 2007 8:19 am
Reply with quote

Glad that i was able to help you icon_biggrin.gif
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top