[comp.os.vms] How to remove all spaces in FORTRAN

dsroberts@biivax.dp.beckman.com (04/03/91)

Alright, FORTRAN gurus, you have been so helpful so far, let's try another.

I want to concatenate four strings to make an smtp mail address out of.  Each
string comes from a fixed length indexed data file in VMS RMS.  Each string
potentially has trailing (or leading) spaces.  This spaces, as far as I can
tell, are not valid for my mailer.  So, I can:

	result = 'SMTP%"'//string1//string2//string3//string4//'"'

and if there were no spaces, this would be fine.  

I know I can perform a STR$TRIM on each string and get its length, change the 
concat to:

	result = 'SMTP%"'//string1(1:len1)//string2(1:len2)//
     1		string3(1:len3)//string4(1:len4)//'"'

But that won't deal with leading spaces and seems like a lot of code for 
what in DCL would simply be:

result := f$edit ("SMTP:""''string1'''string2'''string3'''string4'""", -
	"COLLAPSE")

So does fortran have a function (of VMS a library routine) that eliminates all
embedded spaces in a string?

And please, mail to me, we don't need to clutter up the newsgroups.  I'll post a
summary, ok?
-- 
---------------------------------------------------------------------------
   Don Roberts                   Internet:  dsroberts@beckman.com
   Beckman Instruments, Inc.     Yellnet:   714/961-3029
   2500 Harbor Bl. Mailstop X-12 FAX:       714/961-3351
   Fullerton, CA  92634          Disclaimer:  Always
---------------------------------------------------------------------------

dsroberts@biivax.dp.beckman.com (04/04/91)

In article <1991Apr2.144757.247@biivax.dp.beckman.com>, dsroberts@biivax.dp.beckman.com writes:
> So does fortran have a function (of VMS a library routine) that eliminates all
> embedded spaces in a string?
> 
> And please, mail to me, we don't need to clutter up the newsgroups.  I'll post a
> summary, ok?

And here is the promised summary:

It seems that the concensus response has been some form of DO-LOOP that checks
each character for a space and writes to the string if it is non-space.  The
counter used to place in the string is then your length.  A simple hack, but
not nearly so much fun as an actual function.

Anyway, thanks to all.  Especially those submitting code fragments.  Certainly
saves on the typing.  Now if I could just cobble up a user interface that
maintains my domain name server files...
-- 
---------------------------------------------------------------------------
   Don Roberts                   Internet:  dsroberts@beckman.com
   Beckman Instruments, Inc.     Yellnet:   714/961-3029
   2500 Harbor Bl. Mailstop X-12 FAX:       714/961-3351
   Fullerton, CA  92634          Disclaimer:  Always
---------------------------------------------------------------------------