MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Rahull Beginner Joined: 29 Jan 2004 Posts: 62 Topics: 19
Posted: Thu Aug 03, 2006 1:27 pm Post subject: Replacing highest valued record using Sort
Hi,
Looking solution for the below problem.
Input file : Policy number (20), count(2),Name(5)
Code:
P1234567890 10 ROB
P1234567890 11 RYAN
P1234567891 05 MYAN
P1234567891 11 MYAN
P1234567891 06 ROB
P1234567892 06 ROB
Output file:
Code:
P1234567890 10 ROB
P1234567890 11 Test
P1234567891 05 MYAN
P1234567891 11 Test
P1234567891 06 ROB
P1234567892 06 Test
Output file <name> should be replaced with <Test> only for the same policy highest count value record.
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Thu Aug 03, 2006 1:56 pm Post subject:
Rahull ,
The following DFSORT JCL will give you the desired results.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
P1234567890 10 ROB
P1234567890 11 RYAN
P1234567891 05 MYAN
P1234567891 11 MYAN
P1234567891 06 ROB
P1234567892 06 ROB
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(01,20,CH,A,
21,02,CH,D)
OUTREC FIELDS=(01,27,
28:SEQNUM,8,ZD,RESTART=(1,20))
OUTFIL IFOUTLEN=27,
IFTHEN=(WHEN=(28,8,ZD,EQ,1),
OVERLAY=(24:C'TEST'))
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Rahull Beginner Joined: 29 Jan 2004 Posts: 62 Topics: 19
Posted: Thu Aug 03, 2006 2:39 pm Post subject:
Hi Kolusu,
My Shop supports only SYNCSORT. Below are the error messages I m getting.
Code:
SYNCSORT FOR Z/OS 1.1CR TPF3A U.S. PATENTS: 42
PRODUCT LICENSED FOR CPU SERIAL NUMBER 32BDD, MODE
SYSIN :
SORT FIELDS=(01,20,CH,A,
21,02,CH,D)
OUTREC FIELDS=(01,27,
28:SEQNUM,8,ZD,RESTART=(1,20))
*
OUTFIL IFOUTLEN=27,
*
IFTHEN=(WHEN=(28,8,ZD,EQ,1),
OVERLAY=(24:C'TEST'))
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Can we do it in some other way ?
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Thu Aug 03, 2006 2:59 pm Post subject:
Rahull ,
try this job
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
P1234567890 10 ROB
P1234567890 11 RYAN
P1234567891 05 MYAN
P1234567891 11 MYAN
P1234567891 06 ROB
P1234567892 06 ROB
//T1 DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//T2 DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//SYSIN DD *
SORT FIELDS=(01,20,CH,A,
21,02,CH,A)
OUTREC FIELDS=(1,27,SEQNUM,8,ZD)
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
SECTIONS=(1,20,TRAILER3=(1,23,C'TEST',28,8))
OUTFIL FNAMES=T2
/*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&T1,DISP=SHR
// DD DSN=&T2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(28,08,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(01,27)
/*
Hope this helps...
Cheers
Kolusu _________________ 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