Consider the following COBOL entries
05 X PIC 99 VALUE 10.
ADD 40 X TO X.
COMPUTE X = 3 * X - 40.
The result in X is
Answers were Sorted based on User's Feedback
Answer / muhammad abdul aleem
I doubt if 05 level number will work or not.
But if it works the here is the answer.
Add 40,x to x means X = 10 + 40 + 10 =60
then
x = 60*3 -40
x=180-40
= 140
Since X = 99 so value will be 40
Therefore, Value of X will be 40...
Is This Answer Correct ? | 26 Yes | 0 No |
Answer / rama krishna
Answer is again 10.
Add 40 to x :
x + 40 : 10 + 40 = 50
X = 3*X - 40
3 * x = 50 * 3 = 150, but since x declared as PIC 99, 1
will be truncated from 150. so now the value of x would be
50. so 50 - 40 is again 10.
Is This Answer Correct ? | 22 Yes | 6 No |
Answer / varun v
I agree with Ans #4. I also checked the same..Value of X
will be 40...
Please please verify it thouroughly before publishing the
answers...Wrong answers will mislead people..
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / neelam
I agree with all of them who have answered 40.
It is a simple statement in cobol that
ADD A B TO C. (Means (A+B)+C moved in C)
Here,
ADD 40 X TO X ()
Value of X is 10
So, ADD 40 10 TO 10 (Gives 40+10+10 = 60)
Now, COMPUTE X = 3 * X - 40
Means X = 3 * 60 - 40 (Gives 180 - 40 = 140 )
Since PIC clause for X is 99, hence 140 can't be store in
variable X.
So answer is : 40
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / akhilesh
FRIENDS HAVE ATTENTION
DIRECTLY CODING 05 LEVEL ENTRY WILL SHOW ERROR
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / ram g
compiler wont support 05 level direct coding ..assuming
that its a 01 level .. ans is 40.
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / kumar l
ADD 40 X to X means : 40+X will add to X and result will
be stored in X - Result is 60
Compute X = 3 * X - 40 means : 3*60-40 = 140.
So X value is 140.
Is This Answer Correct ? | 5 Yes | 6 No |
Answer / suputhru
I agree with Rama Krishna ans: 10
05 X PIC 99 VALUE 10.
ADD 40 X TO X. ----------- x=x+40 x=10+40 x=50
COMPUTE X = 3 * X - 40.------x=(3*50)-40 x=150-40 x=110 since x pic 99--
finally x=10
antheeeeeeeee.
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / geetanjali
ADD 40 X TO X
***********ADD 40 10 TO X
***********X=X+40+10=60
***********COMPUTE X=3*60-40=120
X=120
Is This Answer Correct ? | 0 Yes | 1 No |
what is dynamic array in cobol? what is the difference b/w array and table in cobol?
I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue
How to resolve the soc4 & soc7 other than following answers. Soc4 can resolved using mispleed dd name and dd name is not matching with file and soc7 check the sysdump and copy the offest address then correct it in the program.
10 Answers ADP, Amdocs, Cap Gemini, Keane India Ltd, Super Value, TCS,
SUPPOSE I HAVE 60 CHARACTERS STING. IN THAT I WANT FIND OUT HOW MANY TIMES 'A'(ASSUME)WILL REPEATED AND I HAVE TO PASS 'E' IN PLACE OF 'A'ALONG THAT STRING.
What will happen if a variable is declared as below.. Explain with an example? Working storage section:- 01 WS-VARX PIC X(9) VALUE SPACES. 01 WS-VARN REDEFINES WS-VARX PIC 9(9).
What is the difference between COMP & COMP-3 ?
how will u find out 3rd week's 2nd day using occurs ?
What are ISOLATION LEVELS? Where do we need to specify them in compiling JCL (Exactly which statement and what is syntax for it)?
What is an explicit scope terminator?
Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?
6 Answers ABC, IBM, Mphasis, Wipro,
IDENTIFICATION DIVISION. PROGRAM-ID. MOVEPGM. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-I PIC 9(2). PROCEDURE DIVISION. A1000-MAIN-PARA. PERFORM PARA-X WITH TEST BEFORE UNTIL WS-I= 5 STOP RUN. PARA-X. DISPLAY "BEST2". I m getting error s722,while executing the program, seems getting in loop, can anybody tell me why
What is the difference between a subscript and an index in a table definition?