Verify if a sequentila file is sorted or not?

IBM's Sort Product, ICETOOL, ICEMAN and ICEGENER.
Post Reply
Girish Kannad
New Member
Posts: 3
Joined: Thu Jul 31, 2014 2:57 pm

Verify if a sequentila file is sorted or not?

Post by Girish Kannad »

Hi,

I have this doubt from so many days: I have a sequentila file with say millions of records. Now, how can I verify whether it is sorted or not? One way I can think of that manually I can check the dataset but how many records will I check for the order so is there any other way out?

Any help in this regard is appreciated.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Verify if a sequentila file is sorted or not?

Post by William Collins »

Best thing to do is wherever the file is read, check the order at the time. Then you won't have to do it separately (save resources = money) and you'll be confident that the file is in order.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Verify if a sequentila file is sorted or not?

Post by Robert Sample »

If you have a sequential data set with millions of records, how do you NOT know if the data set is sorted? Most applications sort data as needed, and a data set will not unsort itself.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Verify if a sequentila file is sorted or not?

Post by Anuj Dhawan »

Another way to determine if a file is sorted or not, you can do a one-file merge with SORT as follows. I used a BI sort key in positions 1-11 for the example.

Code: Select all

//STEP1 EXEC PGM=ICEMAN 
//SYSOUT DD SYSOUT=* 
//SORTIN01 DD DSN=...  input file 
//SORTOUT DD DUMMY 
//SYSIN DD * 
  MERGE FIELDS=(1,11,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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DFSort, ICETOOL, ICEMAN, ICEGENER.”