slingam Beginner
Joined: 20 Apr 2005 Posts: 1 Topics: 1
|
Posted: Wed Apr 20, 2005 7:47 pm Post subject: Check Trailing Spaces |
|
|
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. |
|