IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract Even numbers


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nazia.lalani
Warnings : 1

New User


Joined: 20 Mar 2009
Posts: 25
Location: hyderabad

PostPosted: Thu Nov 12, 2009 2:19 pm
Reply with quote

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
View user's profile Send private message
Kumar Saraboji

New User


Joined: 15 Sep 2009
Posts: 8
Location: India

PostPosted: Thu Nov 12, 2009 7:56 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 12, 2009 10:57 pm
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Sat Nov 14, 2009 2:31 am
Reply with quote

Hi,

May I know why my post was deleted? icon_eek.gif

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? icon_rolleyes.gif

Thanks,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 14, 2009 2:51 am
Reply with quote

It's not an efficient solution compared to the bit test.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Sat Nov 14, 2009 12:21 pm
Reply with quote

Roger that.

Thanks,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Generate random number from range of ... COBOL Programming 3
No new posts optim extract file - SAS DB2 2
Search our Forums:

Back to Top