"Porter, Allen H" wrote:
> OK, I know I could do this easily with QEdit, but I'm wondering if there is
> a straight MPE way.
(hehehe)
> What I want is to be able to do a listf and have the result returned to a
> system variable as a delimited string.
> For example, if I do a listf I get the following
> FILENAME
>
> A B C D E F
> G H I
>
> I would like to create a variable that would look like:
> 'a,b,c,d,e,f,g,h,i'
<put on my super scripting cape!> (hehehe)
try this..... (i call it 'string')
parm inparm=?, delim=','
if '!inparm' = '?' or dwns('!inparm') = 'help'
echo
echo ![basename(hpfile)] [parm_name] [delimiter] !< [inputfile]
echo req. opt. req.
echo
echo ![basename(hpfile)] is designed to 'stringify' a vertical list
echo of {things} -- presented to the script in a plain,
echo ascii file -- into a CI variable. There are practical
echo limits to this script. In particular, CI string
echo variables can only be 1024 characters long.
echo
echo [parm_name]:= any valid CI variable name
echo
echo [delimiter]:= the default value is a comma
echo
echo The contents on the input file can be anything that needs
echo converted into a CI string. Take care if submitting un-
echo printable characters.
return
endif
setvar _st_eof finfo(HPSTDIN,"eof")
setvar _st_delim "!delim"
setvar _st_parm ''
while setvar(_st_eof,_st_eof-1) >= 0
input _st_rec
setvar _st_rec rtrim(_st_rec)
#--- add the contents of _st_rec to our temporary variable
setvar _st_parm _st_parm+rtrim(_st_rec)
#--- is there more to add?
if _st_eof > 0
setvar _st_parm _st_parm+_st_delim
endif
endwhile
setvar !inparm _st_parm
=======================
for your situation, you'd
listfile @,6 > myfile
string myvar < myfile
assuming that the results of your listfile aren't too big, that is :-)
- d 'yes, all that i do is write scripts' :-)
--
Donna Garverick Sr. System Programmer
925-210-6631 [log in to unmask]
>>>MY opinions, not Longs Drug Stores'<<<
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|