Page 1 of 1

How to Separate Odd or Even numbers using DFSORT

Posted: Fri Oct 04, 2013 4:40 pm
by devegouda.chage
Hi All,
Is that possible to separate even numbers into one file and odd numbers into another file using DFSORT
Example:
my input file is
102
125
045
224
155
176
my output files should be

ODD output file
125
045
155

EVEN output file
102
224
176

Please can anyone help on this.

Posted: Fri Oct 04, 2013 5:16 pm
by NicC
You got 2 solutions yesterday on another forum and, today, a clarification from a DFSort developer as to why one was better than the other. Why are you posting again today here? That is not very polite and is, essentially, against the rules.

Posted: Fri Oct 04, 2013 7:15 pm
by devegouda.chage
HI Nic,
Before putting into forum,i have searched the web,but i got answer for position wise i.e odd records will be in one file and evenrecords in another file,but i want to separation on numbers not a position wise.:(

if you are specifying about the separation by numbers ,could you please paste the link.
Thanks in advance

Posted: Fri Oct 04, 2013 9:43 pm
by DikDude
Suggest you re-read the other answers.

IIRC, there was an explanation of how to do what you want . . .

Posted: Fri Oct 04, 2013 9:56 pm
by William Collins
I think this is not a cross-posting, but a co-incidence.

Code: Select all

 OUTFIL FNAMES=EVEN,INCLUDE=(3,1,BI,EQ,B'.......0')
 OUTFIL FNAMES=ODD,SAVE
This is looking at the right-most bit of the right-most byte of your number. If that bit is zero, your number is even. Otherwise it is odd (as bits can only be zero or one).

Posted: Mon Oct 07, 2013 10:47 am
by devegouda.chage
Thanks a lot William Collins :)
its working!!!!

once again thanks for your quick reply:) :) :) :)