9. in='xx'  Input for action blocks

in

An action block may read an input dataset. General order in is to be assigned the name of such a dataset.

In very general, the action scheme in RXS is the following: Each record or unit (message, row, element...) in input will trigger the action block once. As default, input is seen as a collection of records. That is, if an input dataset contains four records, the action block will be executed four times.

As default, data from actual input record can be accessed inside the action block by the following variables:

unit.1

The variable (which is a stem with one element) unit.1 is assigned the value of the actual input record

word.x

The 'words' of the actual input record is put into variables (stem) word.1, word.2, word.3,... depending on the number of words in the actual record. By 'word' is meant a string of non-blank characters. Say actual records contain three words, then word.4, word.5 etc. will be assigned with strings of length zero.

(A 'stem' in RXS is - as mentioned in section 2 - an array or a one-dimensional table).

Example 9.1:

)action in='myuser.myinput'

)&      out='myuser.myout'

'Square of' word.1 'is' word.1**2

)endaction

If the first 'word' of each record in the dataset 'myuser.myinput' is numeric, RXS creates a stream of linies in output clarifying how these input numerics are squared. If any record exists in input having a non numeric first 'word', RXS terminates with an error message and nothing is written.


Reading datasets is the default form of input to action blocks. In section 19 is discussed how to access other kinds of input like DB2, MQSeries etc.

in may also denote an internal queue. This core feature of RXS is discussed in section 11.

 

readlim

If only a part of the file is to be read, then specify readlim

Example 9.2:

)action in='myuser.myinput'

)&      readlim=10

'Square of' word.1 'is' word.1**2

)endaction

This works like example 8.1, but only the first 10 records of 'myuser.myinput' is read. Output is written to stdout (see section 4)

 

readfrst

To skip reading of the start of the, then specify readfrst.

Example 9.3:

)action in='myuser.myinput'

)&      readfrst=11

'Square of' word.1 'is' word.1**2

)endaction

This works like example 8.1, but  the first 10 records of 'myuser.myinput' is skipped. Reading starts on record number 11.

The file concept in RXS is generalized. The table below lists the different file-types which RXS is able to read:

 

If in contains...

...and the file is...

then this happens...

example...

in contains:

section:

...at least one '.'

a mainframe file (FB, VB, U, spanned). (VSAM files are not supported in RXS)

the file is read

'myuser.myinput'

 

anything compatible to MQ naming standards

a MQSeries queue

the queue is read

'our.xx_queue_'

27

...at least one '.'

a partitioned mainframe file (FB, VB, spanned).

a member list is created

'myuser.cntl'

 9.1

...at least one '.' and one '(' and one ')'

a member in a partitioned mainframe file (FB, VB, U, Spanned)

the member is read

'r2d2.c.text(yrsa)'

 

... one or several '*'

a search argument for creating a list of mainframe files

a list of files is created

'r2d2.c*.*'

9.2

...at least one '/'

A UNIX (HFS) file on mainframe

the file is read

'/home/r2d2/xx.txt'

29

...at least one '/'

A UNIX (HFS) directory on mainframe

a list of files is created

'/home/r2d2/'

29

...at least one '\'

a PC file or local area network file

the file is read

'c:\diverse\xx.txt'

28

...none of these

an internal queue in RXS

the queue is read

'very_bad_movies'

11

 

9.1 Reading a member

If in names a partitioned mainframe file and a member name - example  in='r2d2.c.text(yrsa)' - the member is read, and variables zlcdate, zlmdate, zlmtime, zlmsec, zluser are given values according to the description in section 9.2:

9.2 Reading a member list

If in names a partitioned mainframe file, and in does not contain a member name, then unit.1 will form a list of the members in the partitioned file - one member name per triggering of the action block. In the triggering, the ISPF member statistics will be available in variables:

zlcdate

Creation date for the member. Formatted in the 'national' date format by ISPF

zlmdate

Modification date in 'national' date format

zlmtime

Modification time, hour and minute. tt:mm

zlmsec

Modifikation time, seconds, ss

zluser

User­ ident for the user who did the latest modification of the member

unit.2 will contain 'MEM' as a hint that a member list is being communicated.

9.3 Reading a generic list of mainframe files

If in points to a generic name for a mainframe file list, then unit.1 will form a list of the files adhering to the generic name - one file name per triggering of the action block.

A "generic name for at mainframe file list" is a file name containing one or several placeholders: '*'. Each '*' means that characters in the file name up to the next '.' or up to the end of the name is ignored, that is: any value here will qualify for adding the file-name to the list.

unit.2 will contain 'FIL' as a hint that a file list is being communicated.

9.4 Reading a UNIX directory

To read a UNIX file, you have to specify the path and the file name in one string.

Specifying only a path in in results in a reading of the directory, that is, a list of files and directories in the actual directory.

unit.2 will contain 'FIL' of 'DIR' as a hint of whether the current unit.1 is a file name or a directory name.