I guess I am not understanding what you want to achieve.
I thought you wanted _each_ value in a separate variable.
If you are going to just concantenate each value to a string (text), then 
Dawn's first suggestion (ListOf) is the proper way to do it.  A cursor would be 
a kludge by comparison.

The caveat here is that you are limited to 4k in length for the Note Datatype.

----- Original Message ----- 
From: "Dawn Oakes" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[email protected]>
Sent: Friday, September 09, 2005 2:58 PM
Subject: [RBG7-L] - Re: Variable from the contents of an ascii file


Claudine,

How about the Select...LISTOF command

SELECT LISTOF(my_field) into varname from tablename where whatever

This results in a note data type, but can easily be converted to text if
needed.

As Mike suggested, you could also use a cursor; I have an example
similar to something I do:

set var varlist text
set var vitem integer
DECLARE cursor1 CURSOR FOR SELECT my_field FROM my_table WHERE whatever
OPEN cursor1
FETCH cursor1 INTO vitem INDICATOR ivitem
WHILE SQLCODE <> 100 THEN
  SET VAR varlist =(.varlist + (ctxt(.vitem)) + ',')
  FETCH cursor1 INTO vitem INDICATOR ivitem
ENDWHILE
Return

You'll end up with an extra comma, again depending on what you're doing
with the variable could be important.

Dawn



-----Original Message-----
From: Claudine Robbins [mailto:[EMAIL PROTECTED]
Sent: Friday, September 09, 2005 3:36 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - Re: Variable from the contents of an ascii file

Mike,

I'm getting the ascii file from the following command:

Unload data for my_table using my_field as ascii where my_other_field =
whatever

How can I construct this to equal variables?

> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of MikeB
> Sent: Friday, September 09, 2005 2:27 PM
> To: RBG7-L Mailing List
> Subject: [RBG7-L] - Re: Variable from the contents of an ascii file
>
> when you write the values to the ascii file, construct code on the fly

> that will set the values to variables as you want like:
>
> out test.asc
> write 'Set var v1 int = 53'
> write 'set var v2 text = ''SomeText'''   -- single quotes
> write 'Return'
> out scr
> run test.asc
>
>
>
> This is displayed this way for simplicity.  You can construct the
> values for the write statements in code as variables and then write
> that to the file as well...
>
>
> ----- Original Message -----
> From: "Claudine Robbins" <[EMAIL PROTECTED]>
> To: "RBG7-L Mailing List" <[email protected]>
> Sent: Friday, September 09, 2005 2:16 PM
> Subject: [RBG7-L] - Variable from the contents of an ascii file
>
>
> >
> > Hi everyone,
> >
> > I want to create a variable which will contain one or more values
> extracted
> > from a table, i.e.: 53, 45, 101.
> >
> > So far, I can create an ascii file, test.asc with "53","45","101" if

> > I
> first
> > reset the quotes to ".
> >
> > Now, I want to put these values in a variable.  I can't figure out
> > what
> to
> > do next.
> >
> > TIA,
> >
> > Claudine :)
> >
> > --- RBG7-L
> > ================================================
> > TO POST A MESSAGE TO ALL MEMBERS:
> > Send a plain text email to [email protected]
> >
> > (Don't use any of these words as your Subject:
> > INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH, REMOVE, SUSPEND, RESUME,
> > DIGEST, RESEND, HELP)
> > ================================================
> > TO SEE MESSAGE POSTING GUIDELINES:
> > Send a plain text email to [email protected] In the message SUBJECT,
> > put just one word: INTRO
> > ================================================
> > TO UNSUBSCRIBE:
> > Send a plain text email to [email protected] In the message SUBJECT,
> > put just one word: UNSUBSCRIBE
> > ================================================
> > TO SEARCH ARCHIVES:
> > Send a plain text email to [email protected] In the message SUBJECT,
> > put just one word: SEARCH-n (where n is the number of days). In the
> > message body, place any text to search for.
> > ================================================
> >

Reply via email to