MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

removing duplicates in VB file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
coolguy
Beginner


Joined: 01 Dec 2004
Posts: 82
Topics: 28

PostPosted: Sat Jun 24, 2006 3:44 am    Post subject: removing duplicates in VB file Reply with quote

i am having the VB file 1000 lrecal in that I want to remove the duplicates from the file, i don't want to sort the file records should be in the same order

How do with Sort any help

Cool
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Sat Jun 24, 2006 7:41 am    Post subject: Reply with quote

Coolguy,

I have worked considering a FB File to remove duplicates as well to get back the records in original order only and i have done in two steps but i guess it can also be done in one step also.I will try out for VB File and come back with my results.

Try this code and hope it helps:
Code:

//STEP010  EXEC PGM=SORT                                               
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN DD *                                                           
SHEKAR  1                                                               
KOLUSU  2                                                               
MERVYN  3                                                               
SHEKAR  4                                                               
COOLGUY 5                                                               
FRANK   6                                                               
BEEPBOP 7                                                               
KOLUSU  8                                                               
COOLGUY 9                                                               
SHEKAR 10                                                               
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//FIRST    DD DSN=SHEKAR.TEST.FIRST,DISP=(NEW,CATLG,CATLG),           
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA                         
//SYSIN    DD *                                                         
  INREC FIELDS=(1,80,SEQNUM,8,ZD)                                       
  SORT FIELDS=(1,7,CH,A)                                               
  SUM FIELDS=NONE                                                       
  OUTFIL FNAMES=OUT
/*                                                                     
//STEP020  EXEC PGM=SORT                                               
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=SHEKAR.TEST.FIRST,DISP=SHR                           
//SORTOUT  DD DSN=SHEKAR.TEST.SECOND,DISP=(NEW,CATLG,CATLG),           
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,                       
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)                       
//SYSIN    DD *                                                         
  SORT FIELDS=(81,8,CH,A)                                               
  OUTREC FIELDS=(1,80)                                                 
/*                                                                     
//

OUTPUT
Code:

SHEKAR  1                                                                       
KOLUSU  2                                                                       
MERVYN  3                                                                       
COOLGUY 5                                                                       
FRANK   6                                                                       
BEEPBOP 7                                                                       

Use this consideration for VB File:
Code:

If you use the BUILD, FIELDS, or IFTHEN BUILD parameter, you must begin your INREC or OUTREC statement fields by specifying 1,4 (starting position is 1 and length is 4) to represent the RDW in your VB records.

For example: INREC FIELDS=(1,4,8,25)

If you want your first field to include input data bytes immediately after the RDW (that is, starting with position 5), you can use 1,n (starting position is 1 and length is n, with n greater than 4) instead of 1,4.

For example: OUTREC BUILD=(1,10,21,30)

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Sun Jun 25, 2006 12:12 am    Post subject: Reply with quote

Coolguy,

Try this code for VB File keeping the contents same as for FB File.
Code:

//STEP010  EXEC PGM=SORT                                               
//SORTIN   DD DSN=SHEKAR.TEST.INPUTV,DISP=SHR                         
//OUT1     DD DSN=SHEKAR.TEST.OUT1,DISP=(NEW,CATLG,CATLG),             
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA                         
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  INREC FIELDS=(1,4,5,80,SEQNUM,8,ZD)                                   
  SORT FIELDS=(5,7,CH,A)                                               
  SUM FIELDS=NONE                                                       
  OUTFIL FNAMES=OUT1,REMOVECC                                           
/*                                                                     
//STEP020  EXEC PGM=SORT                                               
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=SHEKAR.TEST.OUT1,DISP=SHR                           
//OUT2     DD DSN=SHEKAR.TEST.OUT2,DISP=(NEW,CATLG,CATLG),             
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA                         
//SYSIN    DD *                                                         
  SORT FIELDS=(85,8,CH,A)                                               
  OUTREC FIELDS=(1,11,12,73)                                           
  OUTFIL FNAMES=OUT2,REMOVECC                                           
/*                                                                     
// 


SHEKAR.TEST.INPUTV

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
SHEKAR  1                                                                       
KOLUSU  2                                                                       
MERVYN  3                                                                       
SHEKAR  4                                                                       
COOLGUY 5                                                                       
FRANK   6                                                                       
BEEPBOP 7                                                                       
KOLUSU  8                                                                       
COOLGUY 9                                                                       
SHEKAR 10                                                                       


SHEKAR.TEST.OUT1

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+---
********************************* Top of Data ******************************************
BEEPBOP 7                                                                       00000007
COOLGUY 5                                                                       00000005
FRANK   6                                                                       00000006
KOLUSU  2                                                                       00000002
MERVYN  3                                                                       00000003
SHEKAR  1                                                                       00000001

SHEKAR.TEST.OUT2

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
SHEKAR  1                                                                       
KOLUSU  2                                                                       
MERVYN  3                                                                       
COOLGUY 5                                                                       
FRANK   6                                                                       
BEEPBOP 7   

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Sun Jun 25, 2006 11:59 pm    Post subject: Reply with quote

Coolguy,

Also Please check this link to remove duplicates using ICETOOL...
http://www.mvsforums.com/helpboards/viewtopic.php?t=4156&highlight=duplicates+remove

Use can use the select option FIRST to keep just the first record for each unique field value.

Thanks,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group