A slick way to wait for output data

Changes to html on 25/feb/08 ./. code on 12/feb/08
POWER does offer a device-driver interface. This is used by PSF, RCF and some vendors. It is an excellent way to wait for arrival of data without causing any extra overhead. Here is this very interface explored for REXX-developers.

All it needs is a PSTART command to activate it. From that point on you can use WAITFOR in a never ending REXX to perform some actions with arriving data. This action can range from simple changing to a different class to creating new jobs that process the just arrived work.

Here is a sample REXX, that just alters the incoming output to class B
001    ADDRESS LINK "DTRIATTN S DEV,WAITFOR,WAITFOR,GH"
002 a=assgn(stdout,syslog)
003 DO UNTIL REASON="QUIT"
004 JNUM = "xxxxx" /* ALL TO SET A LENGTH FOR... */
005 JNAM = "XXXXXXXX" /* ... THE LINKPGM */
006 QNUM = "XXXXXXXX"
007 USERID = "XXXXXXXX"
008 REASON = "XXXX"
009 CLASS = "X"
010 ADDRESS LINKPGM "WAITFOR REASON CLASS USERID JNUM JNAM QNUM"
011 /* WATCH THE QUOTES */
012 JNAM=STRIP(JNAM)
013 SAY 'JUST WOKE UP WITH' REASON
014 IF REASON = 'DATA' THEN DO
015 SAY 'JOBNUMMER:'JNUM ',NAME='JNAM
016 ADDRESS LINK 'DTRIATTN A PRT,'JNAM','JNUM',CLASS=B'
017 END
018 END
019 SAY 'EXIT NOW'
This REXX has everything in it. Even the initial starting of the driver for POWER (line 001). The setting of  the variables to their maximum length (line 4 thru 009) is viable, because this way (and LINKPGM) the values can be returned to the REXX in these variables. An other way would have been to set variables in the program, but that would require you to use exactly these names.

Attention: If your DTRIATTN is the standard from IBM (and therefore not using linkage-conventions but EOJ macro)  you need an entry in the ARXEOJTB for DTRIATTN. Or you can use your own flavour of SVC 30 pgm (which certainly does use the linkage conventions).

The installation material consists of only the PHASE. You need to install it, and write a REXX that uses it.