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 ?
Answers were Sorted based on User's Feedback
Answer / minhaj
01 p pic 9(02) value zero.
01 q pic 9(02) value 99.
01 r pic 9(02) value 1.
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 then use justifications
Is This Answer Correct ? | 8 Yes | 1 No |
Answer / reddy kanupuru
u will get 00 only.
Because any numeric move will start from decimal pont
for exp : as per the given ques
compute p = q+r =100
here the decimal point is placed at the right side .
100.
so if u move that to 99 , means before point two digits
(00) will be moved .
another exp:
q = 99v99
01 r pic 99v99 value 100.345
move r to q
the value is 00v34
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / 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 |
Answer / minhaj
p = q+r actuall result is p = 10 but u want p = 10 so we
right the code as p = q+r justified right
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / nataraj
q value is 01
r value is 99
after compute p value is 100
normally value is printed left to right so u get 10
place of p
Is This Answer Correct ? | 0 Yes | 5 No |
simple always remember that for numeric it's Left
Justification ie TAKE FROM LEFT PLACE FIRST IN LEFT
SO P=100 but as per you it shd be 00 but it will be 10
1 IS FROM LEFT SIDE MOST THEN 00 so if we move as per above
then
p is pic9(02)
so 10 first 1 is moved from left to left then 0 is moved
but since pic 9(02) only to digits get moved
Is This Answer Correct ? | 0 Yes | 5 No |
hi dudes.....can any one help me..... what is SET TO TRUE all about,anyway?
The order of precedence of arithmetic operators in an expression can be overridden with the use of (a) [] (b) () (c) {} (d) Any of the above
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?
I have one column say 'X' defined as VARCHAR Can anyone tell me What are the different ways to update this column thru COBOL-DB2 program?
What is the difference between PIC 9.99 and 9v99 in COBOL?
0 Answers SwanSoft Technologies,
what is the size of W-REC in the following 01 W-REC 05 A PIC 9(4)V99 05 B READLINES A 10 C PIC XX 10 D PIC S9(4) 05 E OCCURS 7 PIC ZZ.ZZ 05 F OCCURS 5 10 G PIC ZZ.ZZZ99 10 H OCCURS 3 15 J PIC 9(3) 15 K PIC V99
without performing any operations on a file how can i know whether it contains data or not
Is It Possible to Update or change in VIEW Mode?
how do you reference the printer file formats from cobol programs
What is the significance of the PROGRAM-ID paragraph? If this name doesnt match with the name of the COBOL program, does it make a difference? Is the name specified in the PROGRAM-ID paragraph used as a name for the load module or any such thing?
how will u code parm parameter and where pls ?
What is the difference between PIC 9.99 and 9v99?