Wsh Interfaces and $# Hooks

How to use Wsh

  • edit macro** for adhoc evaluation or programming
    • either block selection: q or qq and b or a
    • oder mit Directives ($#...) im Text
  • wsh i: rexx/wsh interpreter
  • wsh s: sql interface (spufi++)
  • batch
  • wsh ?: for link auf docu

EditMacro

the most intuitive interface. enter wsh ... on the command line

  • wsh: the edited data is compiled as kind code (@) and executed
  • wsh =: the edited data is compiled as kind skeleton (=) and executed
  • use $#out to limit input and send output to the edit session
  • use lineCommands q, or qq ... qq to limit input
  • wsh s ...: the edited data is compiled as kind sekelton (=) and executed and executed as sql statements (spufi++)
  • wsh >v s 2f: ditto, but sqls executed in rz2/dbof and output sent to temporary variable length Dataset, which will be shown in editor

tso

online e.g. tso i

batch
//S1       EXEC PGM=IKJEFT01,DYNAMNBR=200,TIME=99,             
//             PARM='%WSH'
//SYSPROC   DD DSN=DSN.DB2.EXEC,DISP=SHR                    
//SYSPRINT  DD SYSOUT=*                                        
//SYSUDUMP  DD SYSOUT=*                                        
//SYSTSPRT  DD SYSOUT=*                                        
//SYSTSIN   DD DUMMY           
//OUT       DD SYSOUT=*,DCB=(RECFM=VB,LRECL=3000,BLKSIZE=30000)    wsh standard output, if missing goes to SYSTSPRT       
//WSH       DD *                                                       
wsh script 

Hooks

Hooks are interpreted, the may decide to compile the following wsh code an use it (e.g. execute it as sql).

hook = '<' dsn
| '>' ('e' | 'v')? ('f' | 'v')? ('>' dsn)?
| kind
| wsh
| ('*' | 'out' | 'end') textLi+ ) )*

hooks can appear after a $# at the beginning of a line, or as argument to wsh, $# is not needed for the first hook in the argument

'<' and '>' redirect standard input or output. Output can be Edited or Viewed and/or go to a temporary Dataset with fix or variable record length

a wsh is compiled with last kind specified (or defaulted) before

$#out redirects the output to the following lines, use if you use wsh as edit macro

$#end ends the wsh input, only $#out will be recognized afterwards

name designates a named hook, which must be implemented by a rexx function calles wahHook_name, the rest of the line are arguments to the hook. Hooks currently implemented

  • i: interpret rexx or wsh code entered interactively
  • s rz? '/'? dbSys kind? : execute the contents of the following as sql statements in the given rz and dbSys which may be abbreviated e.g. ze for rzz/de0g
  • t: test for wst
  • outFmt, sqlRdr, sqlsOut hooks needed to send sqls or wsh to other rz's
hook = name noNl*
wshInt = nl'$#version'version)? (nl wsh)? ( nl'$#' ( kind (spCom* nl)? wsh | hook nl wsh | ('*' | 'out' | 'end') textLi+ ) )*
hook = name noNl*

What wsh can use

this side of wsh is not documented in detail,

  • you need to consult then source {RZ4+dsn.source.div(wsh)}
  • or even better, {RZ4+dsn.source.div(wsT)}, which contains the full wsh code plus all test cases

Datasets

The low level interface is found in copy adrTso, e.g. dsn2jcl, dsnAlloc, writeDD. dsnAlloc helps to specify attributes by transforming short syntax into correct allocation, e.g. dsnAlloc('dsn.abc.efg(ikl) ::f') will create a fixBlock recl=80 Library with a decent management class, if the dsn does not exist yet. If you prefix a dsn with rz/ the DSN is transparently handled on another sysplex

copy dsnList uses the csi interface for catalog search, mbrList to list the members of a library

copy fileTso implements a smooth interface to objects, classes and wah, as shown in Tutorials,

dsnCopy, dsnExists etc. offer an easy way to copy member or datasets (mostly) using CSM

CSM

CSM ist integrated for transparently accessing DSN over sysplexes, starting of Jobs, synchronous exuting of SQLs, Rexx or Wsh on another Plex

SQL

as shown in the tutorial, easy SQL is a major point in wsh

Scanning

there are flexible scanners for SQL Syntax, Utility Syntax etc.. Inheritance is used for flexibility

small helpers

  • z/os time support (stored clock, lrsn support)
  • formatting of single fields and whole tables, including timestamp conversion, binary and decimal units, e notation etc..
  • match (like like or a small subset of regular expression)
  • sort (in memory)
  • mail