IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to elimate space in fle


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
natarajanibm
Warnings : 1

New User


Joined: 21 Mar 2009
Posts: 9
Location: chennai

PostPosted: Tue Aug 03, 2010 3:36 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Aug 03, 2010 3:40 pm
Reply with quote

HOMEWORK ???
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Aug 04, 2010 4:27 am
Reply with quote

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
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Wed Aug 04, 2010 11:54 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 04, 2010 12:14 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
No new posts Allocated space calculation from DCOL... PL/I & Assembler 3
No new posts split a name based on space in ASM PL/I & Assembler 9
No new posts Adding space to a dataset - getting D37 ABENDS & Debugging 10
Search our Forums:

Back to Top