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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store in Decimal format, but display number showing the decimal 1

Status
Not open for further replies.

SiouxCityElvis

Programmer
Jun 6, 2003
228
US
I am confused on how to read in raw data decimal values store them, and then retrieve them in a different program and send them to output back with the decimal showing.

Raw Data: 166.00
When I store this Data: WS-DECI-NBR PIC S9(6)V9(2)

So, right now when I do a test read on the data I've stored and output that to a Sequential File, I see the above number in this format:
1669000}

But, the problem is I want to send it out so it looks like:
166.00
That way when the Java guy picks it up, it makes sense to him.

Thanks in advance.
-David
 
I also wanted to make certain that you understand that

"Thou SHALT NOT redefine a numeric-edite field as Numeric"

and expect "good results"

If your field (in storage) has a "." (explicit decimal point) you will ALWAYS get in trouble if you try and redefine that storate with a "V" rather than a "." in the picture clause.

You *move* fields, not redefine them, to CHANGE from numeric-edited to numeric.

Bill Klein
 
Elvis,

A couple of points to ponder:

1) Please learn to use the "(code) ...data... (/code)" presentation method (use square brackets [] instead of parens), then you can ...

2) Present data as it appears in memory, for example, "the data with the picture S9(8)V9(2) appears in memory as
Code:
 FFFFFFFFFC  
 0000387395
when I print it appears as 000038739E".

3) Don't show a decimal point if it doesn't appear in the data. It tends to confuse; just show the picture, along with the data as it appears in memory.

Now back to your data. When DISPLAY NUMERIC data is "signed" as you show it in the PIC, the rightmost digit of the field is adjusted to accommodate the sign, "C" for pos, "D" for neg. So a pos "5" becomes "C5" in hex, or an "E".

Look in the Appendix or the index to find the chart that lists the various hex chars and their related printable counterparts. Keep an eye out for EBCDIC/ASCII when searching.

You say your users have layouts of the data you send them. Do yourself a favor and do whatever you have to to get a copy for yourself. Use those layouts to design your output.
If they use S9(08).99, you use it. Simplifies your life.

You say they expect to see 0000387395 in that field, not 000038739E, so that means they don't expect a neg number in that field. If so it should be defined as 9(8)V9(2), not
S9(8)V9(2). But, then again, are you sure they don't expect a neg value? That's where those layouts come in handy.
 
hI
If you want to edit AND left shift the edited number.

01 FORMAT-19 PIC ---,---,---,---,--9.

MOVE FLSR-NUBER-OF-RECORDS TO FORMAT-19.
MOVE 0 TO I.
INSPECT FORMAT-19 TALLYING I FOR LEADING SPACES.
ADD 1 TO I.
DISPLAY "NUBER OF RECORDS:" FORMAT-19(I:).

THE RESULT:
NUBER OF RECORDS:3,856


 
hI
If you want to edit AND left shift the edited number.

01 FORMAT-19 PIC ---,---,---,---,--9.

MOVE FLSR-NUBER-OF-RECORDS TO FORMAT-19.
MOVE 0 TO I.
INSPECT FORMAT-19 TALLYING I FOR LEADING SPACES.
ADD 1 TO I.
DISPLAY "NUBER OF RECORDS:" FORMAT-19(I:).
THE RESULT:
NUBER OF RECORDS:3,856


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top