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

SORT to extract data from production


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

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Mon May 05, 2008 10:39 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 05, 2008 12:14 pm
Reply with quote

Hello,

There is no blue in your post?

Post the output you want from that input.
Back to top
View user's profile Send private message
Raja12752

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Mon May 05, 2008 12:51 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon May 05, 2008 12:57 pm
Reply with quote

Hello again,

Forgot to ask icon_redface.gif

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
View user's profile Send private message
Raja12752

New User


Joined: 18 Jul 2006
Posts: 28

PostPosted: Mon May 05, 2008 2:26 pm
Reply with quote

it is FB and consider LRECL = 80.

Thanks,
Raja.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon May 05, 2008 9:29 pm
Reply with quote

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
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top