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

Re: SQR puzzle o' the week



Nick's solution looks like a good one.  I don't think you will find more 
efficient solutions than this when using SQR3.  Two points though:  SYS owns 
the Dual table and the last line utilizes an undocumented "feature".  Look at 
the syntax for end-procedure in the manual, and you will see that there is not 
supposed to be a procedure name.  Although it won't break under SQR3 either, 
it is unsupported, so there is no guarantee for future releases.  I recommend:

begin-procedure get_column
end-procedure ! get_column

>
>!  Nick Moscaritolo
>!  Bentley College
>!  >>>>>  for SQR 2.x - we do not have SQR 3 yet
>
>BEGIN-REPORT
>  move '' to $new_str_var
>  move 1 to #char_ctr
>  DO get_column
>  show (15,1) cs $new_str_var
>END-REPORT
>
>BEGIN-PROCEDURE get_column
>BEGIN-SELECT
>'HOWDY'              &str_var
>  WHILE #char_ctr <= length(&str_var)
>    let $new_str_var = $new_str_var||substr(&str_var,#char_ctr,1)||' '
>    add 1 to #char_ctr
>  END-WHILE     
>FROM system.dual
>END-SELECT
>END-PROCEDURE get_column
>
>



-- 
------------------------------------------------------------------------------
Mark Johnson                  markjo@ix.netcom.com
Ray Ontko & Co.               (415)397-7152                   Have a nice day.