Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to know that whether a FILE is sorted or not

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to know that whether a FILE is sorted or not
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: 1452
Location: Chicago, IL

PostPosted: Wed Sep 21, 2005 1:16 pm    Post subject: Re: about sorting
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 Moderator


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

PostPosted: Fri Sep 23, 2005 4:03 am    Post subject:
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: 53
Location: India

PostPosted: Fri Sep 23, 2005 12:50 pm    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Fri Sep 23, 2005 3:20 pm    Post subject: Re: How to know that whether a FILE is sorted or not
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us