View previous topic :: View next topic
|
Author |
Message |
p.m.s.Reddy Warnings : 1 New User
Joined: 20 Sep 2005 Posts: 11 Location: chennai
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
ideas
New User
Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
Hi Frank, thanks for the enlightening reply!! |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Thanks a Lot Frank..... For the enhanced solution.....
Regards,
Priyesh. |
|
Back to top |
|
|
|