move to archive
It is a classic Global Mapping exercise presenting ^SPOOL as Class / Table
Device #2 named SPOOL dates back to the predecessors of Caché and IRIS
It was the first ”%Stream” like option to buffer output before printing.
It is also the first and till today the most simplest way of output redirection.
This is also an example of a mapped Global.
USE 2 redirects the output into the Global ^SPOOL
You can read the global manually or with some ancient utilities
or use this mapping to access it as class or a SQL table.
Details: The Spool Device
Make sure you have git and Docker desktop installed.
Clone/git pull the repo into any local directory
git clone https://github.com/rcemper/SPOOL-demo-ZPM.git
Open the terminal in this directory create teh container and run it:
docker-compose up -d
Open a session in your container
docker-compose exec iris iris session iris -U IRISAPP
IRISAPP>set file="/irisdev/app/lorem.txt" open file:"RS":1 else write "no file",! quit
IRISAPP>open 2 for i=1:1 u file read line quit:line="" use 2 write line,!
IRISAPP>close 2 zwrite ^SPOOL
IRISAPP>
Now you can see your SPOOLed text either from SMP or directly from your session
IRISAPP>do $system.SQL.Shell() SQL Command Line Shell ---------------------------------------------------- The command prefix is currently set to: <<nothing>>. Enter <command>, 'q' to quit, '?' for help. [SQL]IRISAPP>>SELECT TOP 12 ID,* FROM SPOOL 1. SELECT TOP 12 ID,* FROM SPOOL
ID Document LineNumber Text
1||1 1 1 Lorem ipsum dolor sit amet, consectetuer adipiscing
1||2 1 2 elit, sed diam nonummy nibh euismod tincidunt ut laoreet
1||3 1 3 dolore magna aliquam erat volutpat. Ut wisi enim ad minim
1||4 1 4 veniam, quis nostrud exercitation ulliam corper suscipit lobortis
1||5 1 5 nisl ut aliquip ex ea commodo consequat.
1||6 1 6 Duis autem veleum iriure dolor in hendrerit in vulputate
1||7 1 7 velit esse molestie consequat, vel willum lunombro dolore
1||8 1 8 eu feugiat nulla facilisis
1||9 1 9 at vero eros et accumsan
1||10 1 10 et iusto odio dignissim qui blandit praesent
1||11 1 11 luptatum zzril delenit augue duis dolore te feugait nulla
1||12 1 12 facilisi. Li Europan lingues es membres12 Rows(s) Affected
statement prepare time(s)/globals/cmds/disk: 0.0732s/37737/175514/0ms
execute time(s)/globals/cmds/disk: 0.0008s/13/1786/0ms
cached query class: %sqlcq.IRISAPP.cls2
[SQL]IRISAPP>>quit
IRISAPP>