I had a similar problem a few months ago while converting from D3 to UD.
UniBasic lacks the FOLD() function that D3 had.  Lots of folks here offered
great advice and I put together this subroutine from the best pieces form
all of it.

SUBROUTINE FOLDER(DATA.IN,COL.WIDTH,DELIM,DATA.OUT)
*    ** break monolithic string on word space nearest desired
*    ** column width and return data with delimiters
     DATA.IN = TRIM(DATA.IN)
     DATA.OUT = ""
     TEMP = ""
     LINE.CNT = 0
     NUMWORD = DCOUNT(DATA.IN," ")
     FOR X = 1 TO NUMWORD
        WORD = FIELD(DATA.IN," ",X)
        WORDLEN = LEN(WORD)
        TEMPLEN = LEN(TEMP)
        IF (TEMPLEN + WORDLEN + 1) > COL.WIDTH THEN
           LINE.CNT += 1
           IF LINE.CNT > 1 THEN DATA.OUT := DELIM
           DATA.OUT := TEMP
           TEMP = ""
        END
        IF TEMP # "" THEN TEMP := " "
        TEMP := WORD
     NEXT X
     IF TEMP # "" THEN
        LINE.CNT += 1
        IF LINE.CNT > 1 THEN DATA.OUT := DELIM
        DATA.OUT := TEMP
        TEMP = ""
     END
     RETURN

Perhaps you could use this by taking your data, stripping all @TM, @SVM, @VM
to leave a big chunk of just text and feed it through the subroutine.

===========================================================
Norman Morgan <> [EMAIL PROTECTED] <> http://www.brake.com
===========================================================
Vegetables are what food eats.
===========================================================



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Al DeWitt
> Sent: Wednesday, August 24, 2005 6:59 PM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] Formatting Data
>
>
> Part of the problem, I believe is that our ECLTYPE and BASICTYPE are P,
> Pick.  Commands are not working the way I expect because I'm approaching
> this from a UV mindset (I can't help it, it's what I know).
>
> I'm being told that NEWLINE = FMT(TRIM(LINE),'55T') would turn
> 'Fourscore and seven years ago our fathers brought forth on this
> continent a new nation,' into 'Fourscore and seven years ago our fathers
> brought [EMAIL PROTECTED]
> 'on this continent a new nation,'  However, the command: NEWLINE =
> FMT(TRIM(LINE),'55T') does not work.  It just gives me the letter T.
>
> The command: NEWLINE = FMT(TRIM(LINE),'T#55') sort of works.
> If LINE = 'Fourscore and seven years ago our fathers brought forth on
> this continent a new nation,',
> the FMT command produces 'TFourscore and seven years ago our fathers
> brought forth' but loses 'on this continent a new nation,'
>
> I don't think UniData's Pick flavor is up to the task, but I'm open to
> any ideas.
> --Al
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Brutzman, Bill
> Sent: Wednesday, August 24, 2005 6:02 PM
> To: 'u2-users@listserver.u2ug.org'
> Subject: RE: [U2] Formatting Data
>
> Consider "Socratic" Programming... that is, break the problem down into
> elemental pieces.
>
> Please consider broadcasting a few lines of the bug-laden code.
>
> --Bill
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.10.14/79 - Release Date: 8/22/2005
>
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.15/81 - Release Date: 8/24/2005
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to