Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SPL Statements > SYSTEM >

Executing the SYSTEM Statement on UNIX

The SYSTEM statement in the following example of an SPL routine causes the UNIX operating system to send a mail message to the system administrator:

CREATE PROCEDURE sensitive_update()
   ...
   LET mailcall = 'mail headhoncho < alert';
   -- code to execute if user tries to execute a specified
   -- command, then sends email to system administrator
   SYSTEM mailcall;
   ...
END PROCEDURE; -- sensitive_update

You can use a double-pipe symbol ( || ) to concatenate expressions with a SYSTEM statement, as the following example shows:

CREATE PROCEDURE sensitive_update2()
   DEFINE user1 char(15);
   DEFINE user2 char(15);
   LET user1 = 'joe';
   LET user2 = 'mary';
   ...
   -- code to execute if user tries to execute a specified
   -- command, then sends email to system administrator
   SYSTEM 'mail -s violation' ||user1 || ' ' || user2
                || '< violation_file';
   ...
END PROCEDURE; --sensitive_update2 
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]