Cobol soll eine S9(10)V99 Zahl Ausgeben?
Ich möchte einen Wert negativ oder Positiv im SYSOUT ausgeben.
BSP:
In diesen Beispiel wollte ich einfach nur versuchen eine Negative Zahl auszugeben, aber leider klappt das nicht wie ich es mir vorgestellt habe:
SYSOUT
Wie bekomme ich es hin das der Wert als Negativ oder Positiv ausgegeben wird mit dezimal Zahlen?
z.B. -10.13 oder +10.13
To output an S9(10)V99 number in the COBOL program as a positive or negative value with decimal places, you can take the following steps:
Below you will find a code section that demonstrates this:
In this example, the number -10,13 is assigned to the variable MY-NUMBER. Then it is checked whether the number is negative, and the corresponding sign (+ or -) is assigned to the variable MY-STRING. The number MY-NUMBER is then converted to MY-STRING with the image instruction 'Z9.99' and output together with the sign in the SYSOUT. The output should be "+10.13".
Please note that the exact code may vary depending on the requirements of your program.