Rather than sending a message directly from an application when something important happens, it might be better to use a phantom to send the message, especially when the process that needs to send the message is a file trigger. Sending a message sometimes pauses a process, especially when sending to multiple recipients. You don't want this kind of pause to occur in an intense transaction processing loop, or with Web Services or other internet transactions. The code below can be used as a base for a little notification module. Please submit enhancements back to Nebula R&D so that everyone can benefit. In your application code use these two lines: MSG = "User ":@USER:" did something on ":@PIB CALL NOTIFY.ADMIN(MSG,"","") You can use the test program below to see how it works. This should be as simple as compile-catalog and run from the dm account using: TEST.NOTIFY.ADMIN Have a nice day or to get a default message: TEST.NOTIFY.ADMIN The GET.CURRENT.ADMIN program is something you can supply which will provide a user name (dm, bobjones, d3admin) or the current port to which you want messages sent (like "!5"). TEST.NOTIFY.ADMIN: * * * Nebula Research and Development * http://Nebula-RnD.com/freeware * TCLREAD TCL MSG = OCONV(TRIM(TCL),'G1 999') IF MSG = "" THEN MSG = "Event from ":@USER:" on line ":@PIB END OPTIONS = "" *OPTIONS = "..R1.." CALL NOTIFY.ADMIN(MSG,"",OPTIONS) IF OPTIONS # "" THEN CRT MSG END NOTIFY.ADMIN: SUB NOTIFY.ADMIN(MSG,ACCT,OPTIONS) * * Tony Gravagno, Nebula Research and Development * http://Nebula-RnD.com * * Open Source v1.0 for D3 : 26 nov 2007 * * Please e-mail comments, enhancements, and other platform-specfic * versions to Freeware@Nebula-RnD.com. * * Updates may be available at http://Nebula-Rnd.com/freeware * * Responsibility for implementation and use of this program rests * entirely with the user. Nebula R&D will not be liable for any * time, data, financial, or other loss incurred as a result of * execution of this program. This software is distributed as-is * with no warranties or guarantees, explicit or implied. * * Please be sure to include comments for changes, note * conventions being used for Mod 1. * Author: Tony Gravagno (TG) * Contributors: xxxxxxxxxxxx * * Mod-001 TG 071126 Add call to GET.CURRENT.ADMIN * Mod-00n XX yymmdd text.... * * MSG: single attribute message to go to admin * ACCT: account to send _from_ or null from current * OPTIONS: (so far) includes R1 to return output IF ACCT = "" THEN ACCT = @ACCOUNT ADMIN = "dm" ; * hardcoded for demo * MOD-001 START-INSERT * CALL GET.CURRENT.ADMIN(ADMIN); * more selective * MOD-001 END-INSERT CMD = "MSG ":ADMIN:" ":MSG STMT = "ZS" STMT<1,-1> = "" STMT<1,-1> = ACCT * accomodate D3 bug pre-v7.4 * IF @USER # "dm" THEN STMT<1,-1> = "" STMT<1,-1> = CMD STMT<1,-1> = "" STMT<1,-1> = "" EXECUTE STMT CAPTURING OUT RETURNING ERR IF INDEX(OPTIONS,'R1',1) THEN MSG = ERR ; * single attribute MSG<2> = OUT ; * might be multiple attributes END ** ... build e-mail details *CALL NEBULAMAIL(...) ; * or some other mechanism :) RETURN END