input:- A 10 20 30 40 B 5 7 10 14 C 8 12 14 16....
output:- A = 100,B=36,C=50.
Here spaces are considered between numbers.
When we give input as above, the numbers should be added n
displayed.So please help me out.

Answers were Sorted based on User's Feedback



input:- A 10 20 30 40 B 5 7 10 14 C 8 12 14 16.... output:- A = 100,B=36,C=50. Here spaces are con..

Answer / lalitha

Use Delimiter option in STRING function - COBOL to unstring
the numbers to variables and then sum it up.

Is This Answer Correct ?    2 Yes 0 No

input:- A 10 20 30 40 B 5 7 10 14 C 8 12 14 16.... output:- A = 100,B=36,C=50. Here spaces are con..

Answer / princeking

lalitha can u just make it clear ...... n can u type the program if its possible.thanks anyways..


and dineshj ur answer is 50% correct n its not fully correct.I want to display the output at once.

Is This Answer Correct ?    0 Yes 0 No

input:- A 10 20 30 40 B 5 7 10 14 C 8 12 14 16.... output:- A = 100,B=36,C=50. Here spaces are con..

Answer / naba kishore

I am not clear this questions. Please clarify your question.

Is This Answer Correct ?    0 Yes 0 No

input:- A 10 20 30 40 B 5 7 10 14 C 8 12 14 16.... output:- A = 100,B=36,C=50. Here spaces are con..

Answer / dineshj

coding for that Here.
W-S SEC.
01 A.
05 FILLER PIC X(80) VALUES SPACES.
05 NUM1 PIC 9(3).
05 FILLER PIC X(80) VALUE SPACES.
05 NUM2 PIC 9(3).
05 FILLER PIC X(80) VALUE SPACES.
05 NUM3 PIC 9(3).
05 FILLER PIC X(80) VALUE SPACES.
05 NUM4 PIC 9(3).
05 FILLER PIC X(80) VALUE SPACES.
01 NUM5 PIC 9(4).
PRO-DIV.
ACCEPT NUM1.
ACCEPT NUM2.
ACCEPT NUM3.
ACCEPT NUM4.

COMPUTE NUM5 = NUM1 + NUM2 + NUM3 + NUM4 .
DISPLAY A.

This is the coding for your answer plese check it out
If it is wrong. Pls do let me know...

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More COBOL Interview Questions

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

1 Answers  


How arrays can be defined in COBOL?

0 Answers  


01 var1 pic x(10) 01 var2 redefines var1 pic 9(10). then in procedure division move 'abcde' to var1 then waht is the value of var1 and var2

9 Answers   HSBC,


Have you code any new programs in COBOL ? What is the functionality of the programs?

2 Answers   Patni, Xansa,


What are 77 levels used for?

0 Answers  






How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

0 Answers  


What was removed from COBOL in the COBOL II implementation?

0 Answers  


What does the INITIALIZE verb do?

1 Answers  


What are the different rules to perform a Search?

0 Answers  


how do u indetify files succesfully executed or not ?

4 Answers   TCS,


How would the number +1234 be stored if a PIC clause of PICTUREs9(4) comp-3 were used?

6 Answers  


How to define variable 9(20) in COBOL, because compiler does not allow us to declare variables with Pic 9(18). Can anyone please let me know the answer... I know one answer to this question which is to use Compiler option Arith (Extend) during Compilation. It extends the maximum limit to 9(32)..Just wanted to know if there is any other way to extend this?

4 Answers   CSC, TCS,


Categories