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

How to remove spaces between fields


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

New User


Joined: 05 Sep 2008
Posts: 15
Location: Hyderabad

PostPosted: Thu Mar 10, 2011 11:02 am
Reply with quote

Hi All,

Can you help me, how to remove the spaces between the fields.

There is a table field of VARCHAR(254) which need to be written to an output VB file.

Example:
Actual table value: PRUDENTIAL (ten spaces) 5.875% NOTES 11/5/2029 GBP(VAR)

Expected output value: PRUDENTIAL 5.875% NOTES 11/5/2029 GBP(VAR)

Please help me how to code it in a cobol program.

Thank you
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Mar 10, 2011 12:18 pm
Reply with quote

well db2 tables do not have fields, they have columns.

and when varchar columns are selected by imbedded sql in a cobol program,
the length of the varchar is placed in the first 49-level and the actual data is placed in the second 49-level.

now, if the varchar column was correctly inserted/updated the length should provide you the necessary information.

in addition, you say you want to remove spaces between the fields.
what are you talking about?
suggest you provide a data description (use CODE tags) for the output variable length record,
and exactly what are your expectations?
Back to top
View user's profile Send private message
sureshmanokar

New User


Joined: 21 Dec 2010
Posts: 11
Location: Bangalore

PostPosted: Thu Mar 10, 2011 6:12 pm
Reply with quote

I think you are fetching column values from table (which has excess spaces) and using those values in your program.

If yes, pass those values to the local variables and remove the spaces using

UNSTRING L-VAR-UNSTR DELIMITED BY SPACES INTO L-VAR-NAME-1, L-VAR-NAME-2, ....etc
Back to top
View user's profile Send private message
pavanchandana

New User


Joined: 05 Sep 2008
Posts: 15
Location: Hyderabad

PostPosted: Fri Mar 11, 2011 5:09 pm
Reply with quote

Thank you. I have built an logic...it met my requirement....
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Cobol program with sequence number ra... COBOL Programming 5
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
Search our Forums:

Back to Top