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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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