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

How to know that whether a FILE is sorted or not


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
p.m.s.Reddy
Warnings : 1

New User


Joined: 20 Sep 2005
Posts: 11
Location: chennai

PostPosted: Wed Sep 21, 2005 12:49 pm
Reply with quote

Hi all,

I have this doubt from so many days,i have ps file with i million records,How come i know that whether it is sorted or not?I know manually we can check that dataset.

But i would like to know any other alternate.

Help will be appreciated?[/i]
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed Sep 21, 2005 1:16 pm
Reply with quote

Hi Reddy,

Quote:
i have ps file with i million records,How come i know that whether it is sorted or not?


Suppose you want to know whether your file is sorted or not based on a field starting from position 1 to 10.
1> First sort your file by SORT in a Job & create another Dataset.
2> Now you can compare both the datasets to find out.
a) If both are same, file was sorted already.
b) If they have any difference, file was not sorted.

Regards,

Priyesh.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Sep 23, 2005 4:03 am
Reply with quote

To determine if a file is sorted or not, you can do a one-file merge with DFSORT as follows. I used a BI sort key in positions 11-15 for the example.

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=...  input file
//SORTOUT DD DUMMY
//SYSIN DD *
  MERGE FIELDS=(11,5,BI,A)
/*


If the file is already sorted, you'll get return code 0. If the file is not already sorted, you'll get an error message and return code 16.

Note that this is more efficient than the method suggested by Priyesh.
Back to top
View user's profile Send private message
ideas

New User


Joined: 25 May 2005
Posts: 52
Location: India

PostPosted: Fri Sep 23, 2005 12:50 pm
Reply with quote

Hi Frank, thanks for the enlightening reply!! icon_biggrin.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Sep 23, 2005 3:20 pm
Reply with quote

Thanks a Lot Frank..... For the enhanced solution.....

Regards,

Priyesh.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts IGYPG3178-I when compiling a pgm read... COBOL Programming 6
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
Search our Forums:


Back to Top