01 ws-p pic 9(2).
01 ws-q pic 9(2) value 01.
01 ws-r pic 9(2) value 99.

p.d.

compute p = q + r
what will be result of p ans(00) but my question is that

how i got 10 on the place of 00.
(truncation will ocuure on right side not left).

please tell me ?


Answer Posted / sam

01 p pic 9(02) value zero.
01 p1 pic 9(03) value zero
01 q pic 9(02) value 99.
01 r pic 9(02) value 1.
01 s pic x(02) value spaces.

p = q+r.
actual p value = 100. but p value is numeric so it writes
from right to left tuncations will be taken left side.
so p value = 00 if u want p = 10
but we cann't use justifications
since justification claue works on alphanumeric field.
so compute p1 = q+r.
move p1 to s . ( here s will contain value 10)
now move s to p.then p will be 10.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is amode(24)?

684


How do you define a variable of comp-1 and comp-2?

707


how do you reference the ksds vsam file formats from cobol programs

666


What is redefines clause in COBOL?

851


What is the Purpose of POINTER Phrase in STRING command in COBOL?

721






What is the utilization of copybook in cobol?

657


Discuss about changing dataset name in proc.

763


) what is the difference between AID and HANDLE AID?

1637


What are declaratives and what are their uses in cobol?

714


i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com

1773


What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?

681


How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?

1946


Which division and paragraphs are mandatory for a COBOL program?

709


In COBOL, what is the different between index and subscript?

763


What is the difference between binary search and sequential search?

643