Null Device Examples

This section contains examples of null device usage.

Example:

    SET dev="nl:"
    OPEN dev USE dev
    SET x="" WRITE hdr,!,$ZDATE($h),?30,$J,!
    FOR SET x=$O(^tmp($J,x)) q:x="" DO REPORT
    CLOSE dev
    

This program produces a report derived from the information in the global variable ^tmp. The unspecified routine REPORT may potentially contain a large amount of code. To see that the basic program functions without error, the programmer may wish to simply discard the output involved in favor of watching the function. To run the program normally, the programmer simply has to change the variable dev to name another device.

Example:

    JOB ^X:(INPUT="NL:":OUTPUT="NL:"ERROR="ERROR.LOG"
    

This issues an M JOB command to execute the routine ^X in another process. This routine simply processes a large number of global variables and produces no output. In the example, the JOBbed process takes its INPUT from a null device (it shouldn't ask for any), and sends its OUTPUT to a null device (it shouldn't produce any). If the JOBbed process encounters an error, it directs the error message to ERROR.LOG.