Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to remove spaces between fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to remove spaces between fields
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    Post subject:
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    Post subject: Reply to: How to remove spaces between fields
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    Post subject: Reply to: How to remove spaces between fields
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am
No new posts Remove Special Characters from Mainfr... Rodger Zhang All Other Mainframe Topics 6 Wed Jul 06, 2016 1:12 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us