Filter based on a COMP field



Compuware's data management products: File-AID for IMS, File-AID/MVS, File-AID for DB2 and DBA-XPERT for DB2

Filter based on a COMP field

Postby maragatham pp » Fri Jun 24, 2011 1:00 pm

I have a file with a particular field X defined as s9(4) COMP.
My goal is to filter records based on this filed with values greater than 5.

I am using mode V and trying to search with the copybook layout.

5 WS-DAY-COUNT 2/BI > ???

What should be the value that I have to provide as above?
I tried 5 - Records with values less than 5 also gets selected.
I tried 101(Binary 5) - Records with decimal values greater thatn 101 are selected.

Please help.
maragatham pp
 
Posts: 19
Joined: Fri May 20, 2011 12:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Filter based on a COMP field

Postby BillyBoyo » Fri Jun 24, 2011 1:56 pm

You are saying > 101 works (in that it shoes all values greater than 101 decimal) and > 5 doesn't? Would seem odd.

Are you displaying the same field you are filtering on (ie, does the copybook definition you are using match the data). Double check. Check the manual. If one works the other doesn't, it is going to be something "obvious" when you know the answer. Try to take a break, then look at the problem again assuming that you know nothing about it. Do everything from scratch. Something has led you astray this time, so by starting again you might avoid it/find out what it is.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Filter based on a COMP field

Postby maragatham pp » Fri Jun 24, 2011 2:44 pm

Hi, let me put it this way.
When filtering for comp-3 values we specify - Relational operator and value like x'NNNNc'
Similarly, do we have something for Binary values?
maragatham pp
 
Posts: 19
Joined: Fri May 20, 2011 12:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Filter based on a COMP field

Postby BillyBoyo » Fri Jun 24, 2011 2:53 pm

OK, so X'xxxx' is specifying the value in hexadecimal for you packed fields, so hexadecimal for your binary as well.

Try x'0005', which is what the value five is going to look like in comp pic s9(4). A = 10, B = 11 etc.

If you have bigger numbers, look for a HEX calculator, Windows has it, if you find out how to swap it (view scientific).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Filter based on a COMP field

Postby Ed Goodman » Fri Jun 24, 2011 10:23 pm

Wait...

You are (or at least seem to be) trying comp-3 formats instead of COMP format. You don't want that trailing "C" that you showed in your example.

If you are trying to find the equivalent of +5 in an S9(4) COMP field, the layout would be: x'0005'

For COMP-3, it would be X'000005C'.

I have made some assumptions here, like your COBOL compiler is using 2 bytes for an s9(4) comp field.

If you want to be certain, use File-Aid to create/edit a record using the copybook, then look at that record in hex.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times


Return to File-AID

 


  • Related topics
    Replies
    Views
    Last post