MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Check Trailing Spaces

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
slingam
Beginner


Joined: 20 Apr 2005
Posts: 1
Topics: 1

PostPosted: Wed Apr 20, 2005 7:47 pm    Post subject: Check Trailing Spaces Reply with quote

Hi,

I am trying to calculate the number of trailing spaces in a field. I get data from a database and had to write it into a sequential file with ~ as delimiter. But the data should not contain any trailing spaces although it can contain spaces in between.

For example, if a field is defined as X(30), and value in the filed is
"MVS Forums Web-----------", I just have to remove the trailing spaces and move "MVS Forms Web" to the output file. (I used - for space as it is removing spaces while posting) Is there a way to use this efficiently so that the job does not take much time. The file that I read are huge and contain records in millions.

Right now I am doing perform test from the end of the variable and checking byte by byte by reducing one byte till I get a non space character. This is taking too much time for the job to run.

I tried to use "Length of"option to check if it gives just the character length but it is giving me the full length of the field declared in WS.
Is there any other way that I can count the number of trailing spaces or get the length of the variable till the character exists.

I searched in this forum but could not find anybody asking same type. I aslo tried to use INSPECT but it does not count only trailing spaces. It can count either leading spaces or all spaces.

Thanks in advance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Apr 20, 2005 8:45 pm    Post subject: Reply with quote

slingam,

Function Reverse can be used to trim the trailing spaces. Check these links

http://www.mvsforums.com/helpboards/viewtopic.php?t=1214&highlight=function+reverse ( 2nd topic from bottom)

http://www.mvsforums.com/helpboards/viewtopic.php?t=525&highlight=reverse

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group