开发者

What does the datatype specification '9(7)V9T' mean?

In some functional specs I'm reading they are talking about a numeric format with a 9(7)V9T presentation. -How do I interprete this k开发者_StackOverflow中文版ind of format notations? -How is this type physically stored in a flatfile (e.g. numeric?, signs? separators?)

Thank you for your wise answers!


A COBOL PICTURE string, such as 9(7)V9T specifies the general characteristics and editing requirements of an elementary data item. A 9 represents a decimal digit, the (7) is a repetition factor for the preceding character. In this case a 9. The V is an implied decimal point. This is all standard COBOL. So far we have an 8 digit decimal number with an implied decimal point between the 7th and 8th digits.

The T is a bit of a curve ball. I have never actually come across it before. However, I Goolged up this reference. It states that a T in a PICTURE string "... indicates that a display numeric field should only insert the sign into the upper half of the last byte if the value is negative". Unfortunately, the author doesn't provide a reference so I can't give you the source of this convention.

A COBOL picture of PIC S9(7)V9 USAGE DISPLAY on an IBM platform conforms to the 9(7)V9T description you have. This data item takes 8 bytes to represent. Each of the 8 digits are represented in the low 4 bits of each byte with the sign recorded in the upper 4 bits of the low order byte. This just happens to be the way IBM choose to implement zoned-decimal. Using a 9(7)V9T representation makes the representation explicit.


An alternative to the other answers is that the T is a character to be displayed or printed after the numeric value to represent a specific state, similar to use of CR for credit value or a trailing '-' to indicate a negative value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜