Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trim leading and trailing spaces : how can I do ?

Status
Not open for further replies.

Revuzdan

Programmer
Dec 12, 2003
2
FR
Hi,

I'm looking for a equivalent of the function TRIM of others languages.

I have to write data from a structure into a file, each field separate by a ; (CSV file), but without leading and trailing spaces.

Thanx in advance,
Dan
 
There isn't an equivalent of a trim function in cobol because strings in cobol have a fixed size. For trimming leading spaces see thread209-665289. for trimming trailing spaces you can use
Code:
string ... delimited by ... into ...
 
Ok thanx pour the leading spaces. But for the trailing i think i'll use STR$TRIM on VMS, to have the real length of my differents strings...
 
Dan, we decided to ask the “Gray Fox” (our Boss’ father) if he had a solution that would deal with leading and trailing spaces for each of the fixed length fields in a record. We asked if he could create a comma-delimited file with variable length fields with the leading and trailing spaces removed and it had to be done with COBOL? Within two hours he created the following example using Micro Focus Net Express (the source code is also included at the following location).


Just for grins we imported the comma-delimited file into Excel as a test and it worked like a charm.


Saginaw
helpdesk@simotime.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top