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
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 |
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 |
Answer / naba kishore
I am not clear this questions. Please clarify your question.
Is This Answer Correct ? | 0 Yes | 0 No |
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 |
i have the following varibles in the working storage 05 ws-A PIC X(30) VALUE 'ABCDEFGHIJKLMNOPQRESTUVWXYZ ' 05 WS-B REDEFINES WS-A 10 WS-B1 PIC X(10). 10 WS-B2 PIC 9(10). 10 WS-B3 PIC X(10). If I Display B1, B2 and B3 respectively, what is the value displayed in B2
How can we pass data from cobol to JCl?
which one is better among static call and dynamic call?
In an EVALUATE statement, can I give a complex condition on a when clause?
What care has to be taken to force program to execute above 16 Meg line?
I've one string with spaces ( I N D I A ). My question is I want remove the spaces & combine in to single string without space (INDIA).How we can write the cobol program & wich options we need to use. Please let me know.
how do you reference the printer file formats from cobol programs
How can i write a comp-3 variable into a sequential file should i declara the field in the file description as comp- 3?
what are difference organizations in cobol and access mode in cobol? can you expalin what organization means while declaring for ksds,esds,rrds?
What is difference between COBOL and VS COBOL II?.
How do get the result of your program directly on your pc?
what if any ,is the syntex error in the following piece of code 01 B PIC A(7) 02 C PIC 9(4) ........ IF(B NUMERIC) ADD 10 TO C a.the condition in the if statement is wrong b.noting is wrong c.because C is initialised.ADD 10 TO C is wrong d.both B and C shoud have same size.