Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where is Decimal point in Comp-3 format ?

Status
Not open for further replies.

manishkaduskar

Programmer
Sep 6, 2001
5
IN
I converted the comp-3 format data to hex and then displayed it by removing the C(for +ve ) and D(for -ve). But I am unable to find the position of the decimal point in the variable.
Eg:
The data format :
SALARY PIC S9(4)V9(2) USAGE COMP-3 value 12.34
will have 01234C But the position of Decimail point is not there.

I want to generalise it for any decimal place.

Also, How do I know the data type of a variable which may be in binary, comp, comp3 , char, varchar etc any DB2 format.

I am writing a program in REXX that reads a flat file that has DB2 data, converts the data to some other form(char and integers and floats) which may be easily deciphered and writing the converted data to another flat file.

Thanks a lot ,

Manish.
 
Hello Manish,

This is regarding the numeric format you had specified.
The edited field 'V' is an indicator of the location of the assumed decimal point. It may appear only once in a character-string. The V does not represent a character position and, therefore, is not counted in the size of the elementary item.

If you want to see the decimal point, then you'll have to move that S9(4)V9(2) Comp-3 variable to S9(4).9(2) comp-3 variable and display it. Have i made it clear?

With Best Regards,
Sudha.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top