COBOL Moving Decimal to Numeric Best Example

Recently in our project we got an issue. That is in a receiving field value getting is incorrect.

Move Ws-data-1   to Ws-data-2

From field:

01 WS-data-1     pic 9(4)v99999 value 0000.77779

To field:

01 Ws-data-2    pic 9(08) ==> After move getting value as ‘0’ (zero). But, we need decimal value into pic 9(08) field.

Even though, both are numeric related, but exactly not the same. How to get correct value.


Compute Ws-data-2 = Ws-data-1 * 100000.

This way we resolved the issue.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.