You are on page 1of 27

What is Host Environment ?

What is Stack
Stack Commands(PUSH,QUEUE,PULL)
Functions (Built-in / Manual)
Subroutines
Some External Functions

An environment for executing commands is called
a host command environment.
TSO - the environment in which TSO/E commands
and TSO/E REXX commands execute in the TSO/E
address space
ISPEXEC - the environment in which ISPF
commands execute.
ISREDIT - the environment in which ISPF/PDF EDIT
commands execute.
This environment can be set through ADDRESS
command. Ex :- ADDRESS TSO
An expandable data
structure to store the
information.
Manipulation of
elements in the stack
can be done through
PULL,PUSH, QUEUE
commands.

PUSH
puts one item of data on the top of the data stack
Syntax : PUSH VAR1

QUEUE
puts one item of data on the bottom of the data
stack
Syntax : QUEUE VAR1

Remove one element
from the top of the
data stack.
Syntax : PULL VAR1

Built-in functions These functions are built into
the language processor

User-written functions These functions are
written by an individual user

Arithmetic
Comparison
Conversion
Formatting
String Manipulating
Miscellaneous
LEFT
POS/INDEX
INSERT
REVERSE
STRIP
SUBSTR
LENGTH
WORD
LEFT
Returns a string of the specified length,
truncated or padded on the right as needed.
Syntax :
LEFT(INPUT STREAM, Length)
Example :-
LEFT(COLLABERA,3) = COL
POS
Returns the character position of one string in
another.
Syntax :
POS(<Search string>,INPUT STREAM)
Example :-
POS(COL,COLLABERA) = 1
POS(COLA,COLLABERA) = 0

INSERT
Returns a character string after inserting one input
string into another string after a specified character
position.
Syntax :
INSERT(<string>,INPUT STREAM,<position>)
Example :-
INSERT( ,HICOLLABERA,2) = HI COLLABERA

REVERSE
Returns a character string, the characters of which
are in reverse order (swapped end for end).
Syntax :
REVERSE(INPUT STREAM)
Example :-
REVERSE(COLLABERA) = AREBALLOC

SUBSTR
Returns a portion of the input string beginning at a
specified character position.
Syntax :
SUBSTR(INPUT STREAM,<Begin position>,<length>)
Example :-
SUBSTR(COLLABERA,4,5) = LABER

WORD
Returns the nth word in the given input string.
Syntax :
WORD(INPUT STREAM, n)
Example :-
WORD(VALUE ACCELERATED, 1) = VALUE

STRIP
Cuts off the spaces in the given input string.
Will not cut the internal spaces
Syntax :
STRIP(INPUT STREAM)
Example :-
STRIP( COLLABERA ) = COLLABERA
STRIP(HI COLLABERA) = HI COLLABERA

LENGTH
Returns the length of given input string.
Counts the spaces also in the given string.
Syntax :
LENGTH(INPUT STREAM)
Example :-
LENGTH(COLLABERA) = 9
LENGTH(HI SRI) = 6
DATE Returns date in DD MON YYYY format
(Ex :- 28 Aug 2011)
TIME Returns time in HH:MM:SS format
(Ex: 22:33:57 )
TRACE - Used for debugging
Ex : <TRACE R> is used for line by line debug .
USERID Returns user id of a particular user.
TRANSLATE Translates the case (of the inbuilt-
functions output like DATE).
Syntax :
function(argument1,
argument2,...)
OR
Function ()

Example :-
X=Function(argument1,
argument2,...)


/*REXX*/
Part1 = COLLAB
Part2 = ERA
X = JOINFN ()
Say X
Exit

JOINFN :
Total = Part1||part2
RETURN Total

The CALL instruction interrupts the flow of an exec
by passing control to a sub routine.

The RETURN instruction returns control from a
subroutine back to the calling exec and optionally
returns a value.
/*REXX*/
Part1 = COLLAB
Part2 = ERA
CALL JOINFN
Say Total
Exit

JOINFN :
Total = Part1||part2
RETURN

Checks whether a dataset is cataloged or not.
Returns OK if the dataset is cataloged.
Syntax :
SYSDSN(DATASET)

Example :-
PULL DSN
If SYSDSN(DSN) = OK then
Say Valid dataset
LISTS the properties of a dataset.
Syntax :
LISTDS DATASET MEMBERS
Output :-
--RECFM-LRECL-BLKSIZE-DSORG
FB 80 32720 PO
--VOLUMES--
ARN015
--MEMBERS--
LISTDSI
SYSDSN
Returns a function code and retrieves information
about a dataset into pre-defined variables.
Syntax :
X = LISTDSI (DATASET)
SYSDSNAME - Dataset Name
SYSDSORG Organization
SYSLRECL Record Length
SYSRECFM Record Format
SYSMSGLVL1 First Level Message
SYSMSGLVL2 Second level message
Traps the output of a particular TSO command .
Output will be trapped into the variable
mentioned.
It has to be set to OFF once trap is done.
Syntax :
X = OUTTRAP(OUT.)
LISTDS DATASET MEMBERS
X = OUTTRAP(OFF)

You might also like