[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: running SQR (produces reports) on Unix box



Scotty,

Your requirement to wrap on the second space makes this a little more
complex than a simple wrap.  I think you will need to evaluate each
character and the previous character to get your logic to work.

Something like the code below should get you going in the direction you
want, I didn't test it.  It may need some tuning such as maximum number of
lines, print locations and string lengths.

Hope this helps....
Scott.


encode '<032>' into $space
encode '<013>' into $cr
encode '<010>' into $lf

begin-select

cn.descrlong                        &descrlong

   move 1 to #lastbreak
   move 1 to #current

   move 0 to #start
   move 0 to #space

   let #total = length(&descrlong)

   while #start < #total

      add 1 to #start
      add 1 to #current
      let $current_char = substr(&descrlong, #start, 1)

      if $current_char = $space
         add 1 to #space
         if #space = 2
            let $print_line =
rtrim(ltrim(substr(&descrlong,#lastbreak,#current),' '), ' ')
            print $print_line                            (+1,10)
            let #lastbreak = #start + 1
            move 0 to #current
            move 0 to #space
         end-if
      else
         move 0 to #space
      end-if

      if (($current_char = $cr) or ($current_char = $lf)) and (#lastbreak <
#start)
         let $print_line =
rtrim(ltrim(substr(&descrlong,#lastbreak,#current),' '), ' ')
         print $print_line                               (+1,10)
         let #lastbreak = #start + 1
         move 0 to #current
      end-if

   end-while

from ps_class_notes cn
   where  cn.strm = &ct.strm
       and cn.crse_id = &ct.crse_id

end-select




>From: Scott Barnes <sbarnes@MAIL.WESLEYAN.EDU>
>Reply-To: sqr-users@list.iex.net
>To: SQR-USERS@list.iex.net
>Subject: Re: running SQR (produces reports) on Unix box
>Date: Tue, 11 Jul 2000 11:59:09 -0400
>
>Hello everyone,
>
>I have some class notes I am reading with junk in them, carriage returns,
>spaces, etc.
>I want to print them with the wrap and strip the line feeds or carriage
>return line feeds, and places were there are more than two spaces, and not
>have ON default to line feed,  I tried <0> = null but that produced an
>error.  I am on oracle eight and not sure which version of SQR I am new
>here.
>
>thanks for any help
>
>scotty
>
>
>BEGIN-SELECT LOOPS = 1
>
>CN.DESCRLONG  (,10)  WRAP 55 5   LINE-HEIGHT = 2 STRIP=<13><32><10> ON=<07>
>        DISPLAY ' SELECTED NOTE'
>FROM
>PS_CLASS_NOTES CN
>WHERE
>&CT.STRM = CN.STRM AND
>&CT.CRSE_ID = CN.CRSE_ID
>END-SELECT

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com