View previous topic :: View next topic
|
Author |
Message |
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
I am in a situation, wherein i need to extract data from production.
Please find in the below the sample data.
Name Department Marks
Sam physics 30
Sam maths 40
Sam chemistry 40
Sam english 40
Sam geography 40
Arun physics 10
Arun maths 20
Arun chemistry 30
Arun english 50
Arun geography 50
Arun history 50
Arun hindi 50
Imran english 50
Imran Maths 60
jose English 50
Here in the above example, i need to extract data [in blue] from production using either SORT or some other utlities.
[ extraction condition - Matching names, with highest marks ] |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
There is no blue in your post?
Post the output you want from that input. |
|
Back to top |
|
|
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
Sam maths 40
Sam chemistry 40
Sam english 40
Sam geography 40
Arun english 50
Arun geography 50
Arun history 50
Arun hindi 50
Imran Maths 60
jose English 50
This is the output should be.
i.e. on basis of Name & Marks, need to get output for Highest marks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello again,
Forgot to ask
Are the name and subject fields variable length (as shown) or are they fixed length in the actual data?
Also, please post the recfm and lrecl of the files. |
|
Back to top |
|
|
Raja12752
New User
Joined: 18 Jul 2006 Posts: 28
|
|
|
|
it is FB and consider LRECL = 80.
Thanks,
Raja. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Assuming that the name is 10 bytes and the marks are 2 bytes which start at position 30 here is a DFSORT/ICETOOL JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
----+----1----+----2----+----3----+----4----+----5----+----6
SAM PHYSICS 30
SAM MATHS 40
SAM CHEMISTRY 40
SAM ENGLISH 40
SAM GEOGRAPHY 40
ARUN PHYSICS 10
ARUN MATHS 20
ARUN CHEMISTRY 30
ARUN ENGLISH 50
ARUN GEOGRAPHY 50
ARUN HISTORY 50
ARUN HINDI 50
IMRAN ENGLISH 50
IMRAN MATHS 60
JOSE ENGLISH 50
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,10,CH) WITH(01,80) WITHALL -
KEEPBASE KEEPNODUPS USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:30,2))
SORT FIELDS=(1,10,CH,A,
81,2,CH,D)
OUTFIL FNAMES=OUT,BUILD=(01,80),
INCLUDE=(81,2,ZD,EQ,30,2,ZD)
/*
|
Hope this helps...
Cheers |
|
Back to top |
|
|
|