How to send WRITE formatted output to a variable
I'm trying to keep all writes in local memory.
If you have S %A="""HI THERE"",!,#,33.33,"" "",$ZTIMESTAMP"
and you O 2 U 2 W @%A C 2 ZW ^SPOOL
^SPOOL(1,1)="HI THERE"_$c(13,10)
^SPOOL(1,2)=$c(13,12)
^SPOOL(1,3)="33.33 67016,59246.6188873"
It works just fine and the output is in the ^SPOOL global.
However, I'm trying to avoid writing to disk.
I can't find anything besides using the SPOOL device that will allow the use of the "@" indirection.
I tried using streams but it will not allow @indirection. Neither will set, or execute, or anything.
Is there any easy way to just set a variable to the formatted write output that the @indirection creates??
Thanks!
Comments
Have a look at the IO-Redirect application in Open Exchange.
The @ (indirection) is not used only to write to a device (spool is a special type of device with number 2).
You may use the @ (indirection) to set any variable, array, list, object property or stream, while keeping this in memory:
S %B=@A
S %C("key1","key2")=@A
Sorry but that is just not true. You cannot SET %B=@%A, you always get a syntax error.
because of output formatting with !, # , ?n