Hi All,
Can anyone tell me how we can MOVE value of a X(19)
variable to a S9(17) COMP-3 variable?
Answer with an Example will be of great help.

Answer Posted / nk

05 MY-NUM-ALPHA PIC X(9).
05 MY-NUM REDEFINES MY-NUM-ALPHA PIC S9(17) COMP-3.
MOVE 'ABCDEFGHI' to MY-NUM-ALPHA.
note that comp-3 stores 2 numbers per byte so 17 digits
takes 9 bytes (half of one byte stores the sign.) So you
could move a 19-character variable to a 9-byte field but it
will be truncated.

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how can i see junk values in dclgen or in hostvariable of comp ?

2540


What is the difference between comp and comp-3?

694


Explain how you can characterize tables in cobol?

636


What is the Purpose of Pointer in the string?

641


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

892






What are various search techniques in cobol? Explain.

641


Explain what you understand by passing by value.

692


Write some characteristics of cobol as means of business language.

615


What is the default value(s) for an initialize? What keyword will allow for an override of the default?

654


Define cobol?

856


What are all the divisions of a COBOL program?

660


What are the different data types in cobol?

786


how do you reference the variable unblock file formats from cobol programs

743


What is difference between static and dynamic call in cobol?

773


What rules are to be followed while using the corresponding options?

634