Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rutgers!sri-spam!ames!ucbcad!ucbvax!JPL-VLSI.ARPA!xrjjm%scint.span
From: xrjjm%scint.span@JPL-VLSI.ARPA
Newsgroups: comp.os.vms
Subject: UTILITY TO TRUNCATE TRAILING BLACKS... REVISITED...
Message-ID: <870723080207.056@Jpl-VLSI.ARPA>
Date: Thu, 23-Jul-87 11:02:06 EDT
Article-I.D.: Jpl-VLSI.870723080207.056
Posted: Thu Jul 23 11:02:06 1987
Date-Received: Sat, 25-Jul-87 07:38:48 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: world
Organization: The ARPA Internet
Lines: 54

Comment:   Begin User Supplied Mail Headers.
*Site:     NASA Goddard Space Flight Center - Greenbelt, Maryland, USA.
*Position: 76 Deg. 52' 28.5" West, 38 Deg. 59' 59.8" North.
*From:     John J. McMahon, Systems Programmer, STX - ST Systems Corporation.
*Project:  COBE Science Data Room (CSDR), Code 401.1
*Reply-To: (Arpa-Internet)       XRJJM%CSDR.SPAN@JPL-VLSI.ARPA [Old Format]
*Reply-To: (Arpa-Internet)       XRJJM%CSDR.SPAN@VLSI.JPL.NASA.GOV [New Format]
*Reply-To: (Bitnet)              ZMJJM@SCFVM
*Reply-To: (Span/Physnet/Hepnet) 6173::XRJJM = CSDR::XRJJM (Node 6.29)
*Reply-To: (TEXnet)              UTADNX::UTSPAN::CSDR::XRJJM

X> From: uunet!mnetor!utzoo!utgpu!water!watmath!julian!peter@seismo.css.gov
X> 
X> Is there a utility for VMS that truncates trailing blanks from a fixed line
X> length file?  On our Tops-10 system we did it with PIP.  I was hoping for a
X> switch to type or copy or convert, but I can't see anything.
X> 
X> Peter Marshall, Data Comm. Manager
X> CCS, U. of Western Ontario, London, Canada N6A 5B7

Hi... I'm a hacker... and I'm here to help...  (I figured I would get my two
cents in on the "hacker" commentary).

Well, first for your information... COPY does have a /TRUNCATE qualifier.
However that doesn't do what you want.  /TRUNCATE will truncate the file
at the end-of-file, as opposed to the end-of-allocation.

One possibility, which may help, is to use the Lexical fuction 'F$EDIT'.
F$EDIT has an argument called "TRIM" which "Removes leading and trailing
spaces and tabs from the string." (VMS DCL Dictionary, V4.4, Page DCL-358).

What you can do is something like the following (In a command procedure):

$ OPEN/READ F1 
$ OPEN/WRITE F2 
$ Loop:
$ Read/End_Of_File=X F1 Dataline
$ Dataline_T = F$Edit(Dataline,"TRIM")
$ Write F2 Dataline_T
$ Goto Loop
$ X:
$ Close F1
$ Close F2

(This is not a tested procedure, I just created it in the Mail Editor)

Now the problem with this is that the leading blanks and tabs will also be
removed.  This may not be what you want...

Regards,
^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
John J. McMahon (Fast-Eddie)                     
Disclaimer: Views expressed in this letter are my own, 
            and are not meant to represent the views of my employers.