MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compare Signed numeric value

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
SK2007
Beginner


Joined: 25 Jan 2007
Posts: 40
Topics: 17

PostPosted: Thu Jan 07, 2010 12:31 pm    Post subject: Compare Signed numeric value Reply with quote

Hi,

I have some problem while comparing signed value. I wondenr if you could help me.

My input is

Code:

----+----1----+----2----+----3--
//SORTIN   DD *                 
AAAA      100      ADD         
BBBB      10       CHECK       
AAAA      -8.57    XXXX         
BBBB      -40.57   YYYY         


Now I will have to extract records if second column value is less than '-10'.
So the output would be

Code:

BBBB      -40.57   YYYY       


I tried like this..

Code:

OPTION ZDPRINT                                     
INREC BUILD=(1,10,11,10,SFF,TO=ZD,LENGTH=10,39:17,5)
SORT FIELDS=COPY                                   


And in next step,
Code:

//SYSIN    DD *                   
 SORT FIELDS=COPY                 
 INCLUDE COND=(11,10,ZD,LT,-10)   

But I am getting below records to output

Code:

AAAA      -8.57    XXXX         
BBBB      -40.57   YYYY   
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jan 07, 2010 1:56 pm    Post subject: Reply with quote

Your problem is that your values are unnormalized. Some have decimal places and some don't. So you have to normalize the values to all have the same number of decimal places before you can do the INCLUDE. You would normalize the values with INREC and then use OUTFIL INCLUDE on the normalized values.

Some questions before I can show you how to do this:

You're using 11,10 for the numeric value, but it appears that it is really in 11,9. What position does the third field actually start in - it looks like it's in 20 - is it really in 21?.

Can your values have more than two decimal places (e.g. 10.053?). If so, what is the maximum number of decimal places a value can have?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SK2007
Beginner


Joined: 25 Jan 2007
Posts: 40
Topics: 17

PostPosted: Thu Jan 07, 2010 2:11 pm    Post subject: Reply with quote

Hi Frank,

Thanks for quick response.
Yes, the third field starts from 21st position. I hvae only 2 decimal places.

Thanks
SK2009
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jan 07, 2010 3:46 pm    Post subject: Reply with quote

I believe these DFSORT control statements will give you what you want:

Code:

  OPTION COPY                                                       
  ALTSEQ CODE=(40F0)                                               
  INREC PARSE=(%01=(ABSPOS=11,FIXLEN=10,ENDBEFR=C'.',ENDBEFR=C' '),
       %02=(FIXLEN=2)),                                             
    OVERLAY=(81:%01,JFY=(SHIFT=RIGHT),%02,TRAN=ALTSEQ)             
  OUTFIL INCLUDE=(81,12,SFF,LT,-1000),BUILD=(1,80)                 

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group