View previous topic :: View next topic
|
Author |
Message |
nazia.lalani Warnings : 1 New User
Joined: 20 Mar 2009 Posts: 25 Location: hyderabad
|
|
|
|
Hi,
My requirement is
I have input file with one filed PIC 9(02) I want only those numbers in my output file which are even
Input file:
Number PIC 9(02)
02
03
04
05
10
OUTPUT FILE:
02
04
10
Is there any way to perform this using sort??? |
|
Back to top |
|
|
Kumar Saraboji
New User
Joined: 15 Sep 2009 Posts: 8 Location: India
|
|
|
|
Hi,
You can use the below for getting only the records with EVEN numbers - for your given scenario
Code: |
OMIT COND=(2,1,BI,EQ,B'.......1')
OPTION COPY
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Kumar has the right idea. However, I would suggest the following DFSORT statements which INCLUDE the even numbers instead of omitting the odd numbers. Just a bit easier to understand:
Code: |
OPTION COPY
INCLUDE COND=(2,1,BI,EQ,B'.......0')
|
This looks for a binary zero as the last bit of the last byte, which indicates an even number. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hi,
May I know why my post was deleted?
I posted something like,
Code: |
OPTION COPY
INCLUDE COND=(2,1,SS,EQ,C'2,4,6,8,0') |
Does it consume more CPU or something?
Thanks, |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It's not an efficient solution compared to the bit test. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Roger that.
Thanks, |
|
Back to top |
|
|
|