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
What is static and dynamic call in cobol?
I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?
Why occurs cannot be used in 01 level in COBOL?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
How do u write test cases?
How do define dynamic array in cobol.
How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?
What is the default value(s) for an initialize and what keyword allows for an override of the default?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
How do we get current date from system with century in COBOL?
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
What are declaratives and what are their uses in cobol?
Explain the configuration section of a cobol program with examples of syntax.
How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
how do you reference the printer file formats from cobol programs