Wsh Tutorial: File and Pipe

  • syntax: pipe
  • beispiel: {RZ4+dsn.beispiel.wsh(wshTut37)}

Class JRW implements open read/write close cycles. Wsh uses a stdInput and stdOutput. The for statement loops over stdInput. A single read can be done by rexx in(), jRead(m.j.in) or wsh ${>abc}

You can redirect stdInput or stdOutput or pipe to functions together, i.e. send stdOutput of one function to the input of the second function.

$#@
$$ --- file and pipe ---
$= dsn = ~tst.wshtut(t36) ::f
$=n1=eins
$$ write to dsn
$<>
$>~tst.wshtut(t36) ::f
$$ zeile eins n1=$n1
$$ zeile zwei
$<>
$<~tst.wshtut(t36) ::f
$$ read from dsn
call pipeWriteAll
$<>
$$ copy dsn to buffer
$= b =. jBuf()
$<>
$<~tst.wshtut(t36) ::f
$>.b
$for i $$ fromDsn $i
$|
$$ vorher
cc = 0
$for i $@¢
    cc = cc + 1
    $$ from pipe $-¢cc$!: $i
    $!
$$ nachher
$<>
$$ write buffer
call pipeWriteAll $b
$$ use single reads from buffer
$<>
$<.b
$do while in() $@¢
    q = m.in
    if ${>abc} then
        q = q '{<='left($abc, 20)
    ii = m.j.in
    if jRead(ii) then
        q = q 'jRead='left(m.ii, 20)
    $$- q
    $!
$#out                                              20161127 12:33:47
--- file and pipe ---
write to dsn
read from dsn
zeile eins n1=eins
zeile zwei
copy dsn to buffer
write buffer
vorher
from pipe 1: fromDsn zeile eins n1=eins
from pipe 2: fromDsn zeile zwei
nachher
use single reads from buffer
vorher {<=from pipe 1: fromDsn jRead=from pipe 2: fromDsn
nachher
$#out                                              20161127 12:29:04

character set problems

wikiz/osname
¢![]square brackets
|!exclamation mark