i am trying to MOVE last 4 digits from WS-AB to WS-B .I tried the above code , it works to see the value in FILE-AID only
when i changed the declaration from COMP-3 to numeric in record structure for the field (WS-B) (i,e) PIC 9(4).
can any one help me to see the same value without changing declaration?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
The most-used way would probably be to multiply by 10 and then divide by 10. The first truncates the leading digit, the second corrects the scale of the field.
This works in-place because the length of the packed field is the same as the number of digits required, otherwise it would need to extend the record this way, and the calculation may turn out better (it would have to be tested, and depend on FB vs VB, lengths, size of file, which way the prevailing wind blows at your site, etc).