MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
nishantrk Beginner Joined: 24 Mar 2006 Posts: 32 Topics: 16
Posted: Fri Nov 12, 2010 8:43 pm Post subject: Sort card to eliminate dupes and keep specific record
This should be a general problem , but i couldn't figure it out nor find the right solution , though have searched various forums
Record length 80 , VB
Code: 111111A20101008
111111S20101008
222222S20101008
333333A20101010
333333U20101010
333333S20101010
444444A20101010
444444U20101010
555555U20101010
666666A20101012
Output should eliminate duplicate based of first 6 char and Keep one of the record based on the 7th char
Rules 'S" has highest priority then "U" then "A"
So the output should be
Code: 111111S20101008
222222S20101008
333333S20101010
444444U20101010
555555U20101010
666666A20101012
Am open to any utilities DFSORT ,SYNCSORT or FILE AID ??
Thanks in advance for your valuable inputs
Back to top
nishantrk Beginner Joined: 24 Mar 2006 Posts: 32 Topics: 16
Posted: Fri Nov 12, 2010 8:52 pm Post subject:
Sorry missed a thing the output should have a additional indicator telling that the record had dupes
Code: 111111S20101008 I
222222S20101008
333333S20101010 I
444444U20101010 I
555555U20101010
666666A20101012
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Nov 12, 2010 10:34 pm Post subject:
nishantrk ,
Try the following untested DFSORT/ICETOOL JCL which will give you the desired results
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=Your Input VB File,DISP=SHR
//T1 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(5,6,CH) LAST USING(CTL2)
//CTL1CNTL DD *
SORT FIELDS=(5,6,CH,A,11,1,AQ,A),EQUALS
ALTSEQ CODE=(E2F9,E4F8)
OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,2,ZD,RESTART=(5,6),5)),
IFTHEN=(WHEN=(5,2,ZD,GT,1),OVERLAY=(23:C'I'))
OUTFIL FNAMES=T1,BUILD=(1,4,7)
//*
//CTL2CNTL DD *
SORT FIELDS=COPY
//*
_________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
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