Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract Even numbers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Extract Even numbers
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    Post subject:
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 Moderator


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

PostPosted: Thu Nov 12, 2009 10:57 pm    Post subject:
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: 1506
Location: Chennai

PostPosted: Sat Nov 14, 2009 2:31 am    Post subject:
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 Moderator


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

PostPosted: Sat Nov 14, 2009 2:51 am    Post subject:
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: 1506
Location: Chennai

PostPosted: Sat Nov 14, 2009 12:21 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us