Just an idea and some old emails from past (Dawn Hast,Paul B. etc..) But you
could get the word count and separate the string out and using gateway put
it all into a temp table and treat it like Unicode (because each word is now
in a separate row).  

 

set var vstring2 text = (SRPL(.vstring,' ',',',0)) -- replace the spaces
with the delimiter (rather than changing the delimiter - either way I guess)

 

set var vwordcount integer = (itemcnt(.vstring2)) -- total number of words

 

vwordcount would give you a way to check your results.

 

 

Or you could parse (sic) the string of text and using sget multi time based
off you . vwordcount - 2 (depending on the string and no char that are empty
from the start and end or sstrip them?)   I think gateway would be faster.

 

 

 

I did a similar project way back and sense destroyed the db.  But it was
about the way I handled it.   Unless you grab the location of paragraphs or
indents those are gone.  So I guess it depends on what the string looks like
exactly.  

 

 

 

 

I suppose others will speak up. 

 

Sincerely,

Paul D 

www.SystemNets.com

 

 

 

 

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Luc
Delcoigne
Sent: Thursday, July 08, 2010 11:18 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - re: chop up ascii file

 

Hi, 

 

the following lets me chop up a ascii file in bits of 73 characters.

 

"

PLUGINS rrtftotxt vresult +
  |input_type variable +
  |input_variable vprotocolblob +
  |output_type variable +
  |output_variable vprotocolblobtxt +
  |output_data_type text

 

  SET VAR vtxtlength INTEGER= (SLEN(.vprotocolblobtxt))
  SET VAR vtxtlength1 TEXT = (CTXT(.vtxtlength))
  SET VAR vaantallijnen REAL = (.vtxtlength/73)
  SET VAR vaantallijnen1 INTEGER = (AINT(.vaantallijnen))
  IF vaantallijnen > vaantallijnen1 THEN
    SET VAR vaantallijnen INTEGER = (.vaantallijnen1 + 1)
  ELSE
    SET VAR vaantallijnen INTEGER = .vaantallijnen1
  ENDIF
  SET VAR vaantallijnen TEXT = (CTXT(.vaantallijnen))
  SET VAR vloop INTEGER = 1
  SET VAR vposition INTEGER = 1

 

  WHILE vloop <= .vaantallijnen THEN
    SET VAR vprotocolblobtext = (SGET(.vprotocolblobtxt,73,.vposition))
    SET VAR vwrite = (SPUT(.vwrite, .vprotocolblobtext, 1))
    OUTPUT &vqfile APPEND
    WRITE .vwrite
    OUTPUT SCREEN
    SET VAR vwrite = (SFIL((CHAR(32)),128))
    SET VAR vposition = (.vposition + 73)
    SET VAR vloop = (.vloop +1)
  ENDWHILE

"

 

 

However I can't prevent the code to chop up even in the middle of a word.

 

Is there a more elegant way to do things and to preserve the integrity of
the words, so to chop up before or after a word and not in the middle of
word ?

 

Luc Delcoigne

 

Reply via email to