View previous topic :: View next topic
|
Author |
Message |
natarajanibm Warnings : 1 New User
Joined: 21 Mar 2009 Posts: 9 Location: chennai
|
|
|
|
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 |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
HOMEWORK ??? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Other than having someone write this for you, what help are you looking for?
What have you done so far? Where are you stuck? |
|
Back to top |
|
|
smijoss
Active User
Joined: 30 Aug 2007 Posts: 114 Location: pune
|
|
|
|
look at the STRING function in COBOL
in case you want to process 1 field at a time, you could use
STRING WITH POINTER CLAUSE
but your title seems confusing
" How to elimate space in fle "
could you explain it in better way |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
smijoss wrote: |
look at the STRING function in COBOL |
more likely UNSTRING into n-number of char fields,
where n = length of input / 2 (1 for the char, 1 for the space)
then all the char fields defined in a table,
PSEUDO CODE
Code: |
move spaces to display-key
perform varying index
IF field(index) NUMERIC
then
add field(index) to display-counter
else
if display-key > spaces
display display-key display-counter
end-if
move field(index) to display-key
move zero to display-counter
end-if
end-perform
|
|
|
Back to top |
|
|
|