|
|
Using STDIN/STDOUT/STDERR
STDIN, STDOUT and STDERR are short names for the standard input, standard output and standard error streams, respectively.
Windows/UNIX-style Examples
In the commands below, STDIN is denoted by '<' (this is short for '0<', equal to reading from file descriptor number 0 which is the standard input). STOUT is denoted by '>' (this is short for '1>', equal to writing to file descriptor number 1 which is the standard output) and STDERR is denoted by '2>' (equal to writing to file descriptor number 2 which is the standard error).
In the following example, the generated output from UNLOAD is written to standard output, which in this case is redirected to the file store_db.unl. The log information is written to standard error, which is redirected to the file store_db.log.
mimload -d store -u store_adm -p store_pwd "unload to stdout log stderr from databank store_db" > store_db.unl 2> store_db.logIn the following example, input to LOAD is taken from standard input, i.e. from the file store_db.unl, and log information is written to standard error, in this case to the file store_db_load.log.
mimload -d store -u store_adm -p store_pwd "load from stdin log stderr" < store_db.unl 2> store_db_load.logVMS-style Examples
In the OpenVMS environment, you can use STDIN, STDOUT and STDERR in two ways, either by defining SYS$INPUT, SYS$OUTPUT and SYS$ERROR or by using pipe mode which gives the UNIX behavior for use of file redirection. Both methods are shown below.
In the following example, the generated output from UNLOAD is written to standard output, which in this case is redirected to the file D1:<DATA>STORE_DB.UNL. The log information is written to standard error, which is redirected to the file D1:<LOG>STORE_DB.LOG.
Example using SYS$OUTPUT and SYS$ERROR:
DEFINE/USER SYS$ERROR D1:<LOG>STORE_DB.LOG DEFINE/USER SYS$OUTPUT D1:<DATA>STORE_DB.UNL MIMLOAD /DATABASE=STORE /USER=STORE_ADM /PASSWORD=store_pwd "UNLOAD TO STDOUT LOG STDERR FROM DATABANK STORE_DB"PIPE MIMLOAD /DATABASE=STORE /USER=STORE_ADM /PASSWORD=store_pwd "UNLOAD TO STDOUT LOG STDERR FROM DATABANK STORE_DB" > D1:<DATA>STORE_DB.UNL 2> D1:<LOG>STORE_DB.LOGIn the following example, input to LOAD is taken from standard input, i.e. from the file D1:<DATA>STORE_DB.UNL, and log information is written to standard error, in this case to the file D1:<LOG>STORE_DB_LOAD.LOG.
Example using SYS$OUTPUT and SYS$ERROR:
DEFINE/USER SYS$ERROR D1:<LOG>STORE_DB_LOAD.LOG DEFINE/USER SYS$INPUT D1:<DATA>STORE_DB.UNL MIMLOAD /DATABASE=STORE /USER=STORE_ADM /PASSWORD=store_pwd "LOAD FROM STDIN LOG STDERR"PIPE MIMLOAD /DATABASE=STORE /USER=STORE_ADM /PASSWORD=store_pwd "LOAD FROM STDIN LOG STDERR" < D1:<DATA>STORE_DB.UNL 2> D1:<LOG>STORE_DB_LOAD.LOG
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|