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

Identifying Unique rows in a PS


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Karthikeyan J

New User


Joined: 19 Dec 2006
Posts: 16
Location: Mumbai

PostPosted: Tue Dec 26, 2006 7:46 pm
Reply with quote

Hi,

I have a PS with thousands of records. Let each record be in a format say

NAME ROLL-NO MARKS ADDRESS
1-30 31-35 36-38 39-60

I want to see only unique values of ROLL-NO. Is there any ISPF/TSO command that will help me in this regard? Is there any optional attribute that can be used along with SORT command to acheive this task?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Dec 26, 2006 7:58 pm
Reply with quote

If you sort on ROLL-NO after appending a field (big enough) of 1 and sum on that field, you should be able to omit /include leaving just those with a sum of 1 to output.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Dec 26, 2006 8:03 pm
Reply with quote

Unfortunately, the SORT command under ISPF can only resequence the records of your dataset.

If you run a batch SORT job using the following parameters, the records in the resulting output file will indicate the unique values of ROLL-NO in positions 31-35.

Code:

 SORT FIELDS=(31,5,CH,A)         
 SUM FIELDS=NONE                 


These control cards will sort your dataset starting in position 31 for 5 positions and will remove all duplicates (according to the sort field).
Back to top
View user's profile Send private message
Karthikeyan J

New User


Joined: 19 Dec 2006
Posts: 16
Location: Mumbai

PostPosted: Tue Dec 26, 2006 9:20 pm
Reply with quote

Thanks william for your quick reply,

Please elaborate on your message to help me understand better. Does that 1 in first line refer to first colum i.e NAME and does OMIT and INCLUDE you refer to are in ISPF.

It would be great if you can post a sort of step by step instruction indicating the commands to try out.

Thanks cpuhawg for that tip on SORT,

But i am looking for an ISPF command or something like that.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Dec 26, 2006 9:26 pm
Reply with quote

I think this process is going to require a custom-written ISPF EDIT Macro, employing the technique(s) described above.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Dec 26, 2006 9:28 pm
Reply with quote

Karthikeyan J wrote:
Does that 1 in first line refer to first colum i.e NAME and does OMIT and INCLUDE you refer to are in ISPF.
Quote:
The "1" is an added field at the end of your record defined in the INREC.
The INCLUDE/OMIT refer to your choice, include all recs which the summed field = 1 or omit those that are not = 1.
I was seeing that you would need to batch execute a SORT job.
It would be great if you can post a sort of step by step instruction indicating the commands to try out.
This is more Frank's area.
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts How to compare two rows of same table DB2 11
Search our Forums:

Back to Top