swirl Guide to OmniMark 6   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesOMX VariablesErrors
 
      Other Library Functions  
function   SYSOUTSystemCall   Available in:
Professional
Enterprise

Library: omsysout - external program execution
Include: omsysout.xin
Return type: Source
Returns:       

A source containing the standard output and standard error from 'Command'.


Declaration

  define external source function SYSOUTSystemCall
     value stream command
     input-from value stream command-input optional
  where
command
The command to be executed, containing any required parameters.
command-input
A stream which is to be written to command's standard input.


Purpose

This function is used to execute the external program specified in 'Command'.

If 'CommandInput' is specified, then that is streamed to Command's standard input.

This function returns a source containing the standard output and standard error from 'Command', which can then be used by repeat scan, do scan, set, submit and similar OmniMark keywords.

Example:

The following OmniMark program executes an external program called 'hello'. Two lines of input are streamed to its standard input, containing '2' and 'OmniMark'. The output from 'hello' is then scanned and echoed to the screen.


  include "omsysout.xin"
  global stream command initial {'hello'}
  global stream cmd-args initial {'2%nOmniMark%n'}

  process
     repeat scan SYSOUTSystemCall command input-from cmd-args
        match value-start | line-end
        output '<%n'
        match any-text*=>line
        output '<<!%x(line)>%n'
        match any
     again

This program will copy the output from the external program named "hello", and surround each line of output with angle brackets.

The following example can be used on a UNIX system to execute the command "ls" and output the filenames and dates that it finds:


  include "omsysout.xin"
  global stream command initial {'ls -lF'}

  process
     repeat scan SYSOUTSystemCall command
        match any-text{10} white-space+ digit+ white-space+ any++ white-space+
           any++ white-space+ digit+ white-space any-text{12}=>filedate
           white-space any-text+=>filename '%n'
        output 'date: %x(filedate) name: %x(filename)%n'
        match any-text* '%n'
     again

        Other Library Functions
   SYSOUTIsVersionCompatible
   SYSOUTLibraryVersion
   SYSOUTSystemCall
 
----  

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ OMX ] [ ERRORS ]

OmniMark 6.5 Documentation Generated: December 23, 2002 at 6:25:40 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-2002.