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

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 ?

6 Answers   L&T,


what is the advantage of sync class

3 Answers   ACS,


How many maximum number of procedures can we write in one COBOL program?

6 Answers  


What is SET TO TRUE all about, anyway?

5 Answers  


What the difference is between continue and next sentence?

0 Answers  






how to code in cobol while using variable block file?

1 Answers  


what is label record is standard or omitted in file description of data division?

3 Answers   IBM, TCS,


here is my requirement A1 is alphanumeric with value 'A1B2C3D4' as defined below 05 A1 PIC X(8) VALUE IS 'A1B2C3D4' but i need to have A2,A3 as ABCD & 1234 repectively...... A2 = ABCD A3 = 1234 Can you please explain me what are the different ways to do it?

2 Answers   IBM,


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

2 Answers   TCS,


what is a load module ?

3 Answers   TCS,


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?

0 Answers  


I got user abend U4038 while compiling my runjcl.. can anyone help me?

10 Answers   CGI,


Categories