Anda di halaman 1dari 84

Meenakshi Baskeran

What is REXX?
REstructured eXtended eXecutor Developed almost single handedly by Michael Cowlishaw of IBM.

Features
Common Programming Structure
Readability, Ease of Use most instructions are meaningful English words Free Format
Unlike other mainframe languages there is no restrictions to start an instruction in a particular column You can skip spaces in a line or can skip entire lines Multiple instructions in a single line or single instruction in multiple lines No need to pre define variables Instructions can be upper case, lower case or mixed case

REXX
Powerful & Convenient built-in Functions Debugging capabilities Using TRACE instruction. No need of external debugging tools Interpreted language REXX interpreter is a built in component of TSO installation on any mainframe. Compilers are also available but not widely used Extensive Parsing Capabilities for character manipulation

REXX Features
Extremely Versatile Common Programming Structure Readability, Ease of Use most instructions are meaningful English words Free Format
Unlike other mainframe languages there is no restrictions to start an instruction in a particular column You can skip spaces in a line or can skip entire lines Multiple instructions in a single line or single instruction in multiple lines No need to pre define variables Instructions can be upper case, lower case or mixed case

REXX
Program structure Need to start with /*REXX*/ Terminate with exit Program execution Online->Run Batch->Interpreted or compiled

Variables
Symbols Group of characters selected from Alphabetic characters, numeric characters . Fred WHERE? If a symbol does not begin with digit or ., it can be used as a variable and values can be assigned to it.

Variables
Compound variables are a way to create a one-dimensional array or a list of variables in REXX. Subscripts do not necessarily have to be numeric. A compound variable contains at least one period with characters on both sides of it. E.g. var.5 Array.Row.Col When working with compound variables, it is often useful to initialize an entire collection of variables to the same value. You can do this easily with a stem. A stem is the first variable name and first period of the compound variable. Thus every compound variable begins with a stem. The following are stems: Var. Array. Employee. = Nobody (Entire array is initialized with value Nobody)

Variables
Assignment

Default value assigned is the characters of the symbol


a=3 /* assigns '3' to the variable A */ z=4 /* '4' to Z */ c='Fred' /* 'Fred' to C */ a.c='Bill' /* 'Bill' to A.Fred */ c.c=a.fred /* '5' to C. Fred */ y.a.z='Annie' /* 'Annie' to Y.3.4 *

Variables
Re-Initialising Variables
DROP unassigns variables DROP var/varlist
DROP A X.3 Z mylist='c d e' drop (mylist) f /* Drops the variables C, D, E, and F */ /* Does not drop MYLIST */ Drop z. /* Drops all variables with names starting with Z. */

Variables
Concatenating Variables (blank) Concatenate with one blank in between || Concatenate without an intervening blank
Fred = 37.4 and Perc = % Fred||Perc result in 37.4%
Fred Perc results in 37.4 %

Variables
Sending Data To Terminal Say Outputs line to output stream In TSO/E foreground writes to terminal In TSO/E background, writes to SYSTSPRT DD Say This will be output Msg = Test Message Say Msg

Variables
Getting Data From the Terminal
PULL Inputs from external data queue Terminal (TSO/E foreground) Input stream, which is SYSTSIN (TSO/E background)
Say 'Do you want to erase the file? Answer Yes or No:' Pull answer if answer='NO' then say 'The file will not be erased.'

Variables
Continuation COMMA (,) is the continuation character

It is functionally replaced by a single blank Examples


Say You can use comma, to continue this clause You can use comma to continue this clause

Variables
Arithmetic + Add Subtract * Multiply / Divide % Integer divide (divide and return the integer part of the result) // Remainder (divide and return the remainder--not modulo, because result may be negative) ** Power (raise a number to a wholenumber power) Prefix - Same as the subtraction: 0 - number Prefix + Same as the addition: 0 + number

Text Parsing
PARSE assigns data to one or more variables according to rules of parsing PARSE UPPER ARG EXTERNAL NUMERIC SOURCE VALUE exp WITH VAR name PULL VERSION

Text Parsing
PARSE ARG
parses the string or strings passed to a program or internal routine as input arguments Similar to ARG instruction ARG converts arguments to uppercases before parsing, but PARSE ARG does not convert arguments to uppercases

Text Parsing
Op1 = 10 Op2 = 20 Res = Add(Op1,Op2) Exit 0 Add: Procedure Parse arg op1,op2 Res = op1+op2 Return Res

Text Parsing
PARSE UPPER Translates to upper cases PARSE UPPER ARG is same as using ARG statement ARG is a short representation of PARSE UPPER ARG UPPER can be used along with all other attributes i.e. VAR, VALUE, VERSION, SOURCE, etc

Text Parsing
PARSE EXTERNAL/PULL
Reads from input data stream
TSO/E Foreground Terminal TSO/E Background SYSTSIN Similar to PULL instruction Difference between External and Pull Pull first reads from DATA STACK. If DATA STACK is empty then reads from Terminal or SYSTSIN
say 'Enter Yes or No' parse external answer . say 'You entered : ' answer

Text Parsing
PARSE SOURCE
Describes the source of running program Returns
TSO Command/Function/Subroutine depending on how program was called Name of exec in upper case if name not known then ? DD from which exec was loaded DSN from which exec was loaded Name of exec as it was called, not uppercases

Text Parsing
Initial host environment in uppercases Name of address space in uppercases Eight character user token parse source sourcestr wil return the following data "TSO COMMAND @TRGSKK SYS00117 TRGS KK.IA005BAS.SRCREX ? TSO ISPF

Text Parsing
PARSE VALUE
Parses data that is result of evaluating expression WITH is a sub keyword If No Keyword specified string is used
parse value Date() with Date Month Year say Fname say Mname say Lname

Text Parsing
PARSE VAR
Parses the value of the variable name
Name = HCL Technolgies Ltd parse var name fname mname lname say fname mname lname

Text Parsing
String Patterns
Literal String Patterns One or more characters within quotes Variable String Patterns A variable within parentheses with no +/-/= before left parentheses
Str = Smith , Jones Parse var str name1 , name2 /* name1 Smith and name2 = Jones */ pat1 = , Parse var str name1 (pat1) name2 /* same result as above */

Program Flow and Control


IF
If expression Then instruction Else Instruction
If A=B Then say Value matched If A=B Then say Value Matched Else say Value Not Matched If A=B Then Do
Say xxxx X=X+1

End Else Do
Y=Y1 X=X1

End

Program Flow and Control


DO
Used for Looping Do 5 say 'Hello' end

Program Flow and Control


ITERATE
Alters flow within DO Loop ITERATE name
do i=1 to 4
if i=2 then iterate say i

end /* Displays the numbers: "1" "3" "4" */ Do I =1 to 10


Do J = 1 to 20 If J = 5 then iterate I Say I J End

End

Program Flow and Control


LEAVE
Exits From DO Loop LEAVE name
do i=1 to 4
if i=2 then LEAVE say i

end
Do I =1 to 10
Do J = 1 to 20 If J = 5 then leave I Say I J End

End

Program Flow and Control


RETURN
Returns control RETURN exp

EXIT
Leaves program EXIT exp

EXIT and RETURN same when invoked in EXTERNAL sub-routines EXIT specified in internal sub-routine will stop program execution.

Program Flow and Control


NOP
No operation
If A=B then nop Else do ------End

Program Flow and Control


SELECT
Equivalent to CASE SELECT WHEN exp THEN instruction OTHERWISE instruction END
Select
When A then do ---End Otherwise nop

End

Program Flow and Control


SELECT
Equivalent to CASE SELECT WHEN exp THEN instruction OTHERWISE instruction END
Select
When A then do ---End Otherwise nop

End

Subroutines
PROCEDURE
PROCEDURE name or PROCEDURE EXPOSE name/list Within internal subroutine protects variables
/* This is the main REXX program */ j=1; z.1='a' call toft say j k m /* Displays "1 7 M" */ exit /* This is a subroutine */ toft: procedure expose j k z.j say j k z.j /* Displays "1 K a" */ k=7; m=3 /* Note: M is not exposed */ return

Functions
String Functions Word Functions Alignment Functions Storage Functions Format Functions Date/Time Functions

Functions-String Functions
SUBSTR
SUBSTR(string,n, length, pad)

SUBSTR returns the substring of string that begins at the nth character and is of length length, padded with pad if necessary. The n must be a positive whole number. If you omit length, the rest of the string is returned. The default pad character is a blank.

Functions-String Functions
SUBSTR
SUBSTR(string,n, length, pad)

SUBSTR returns the substring of string that begins at the nth character and is of length length, padded with pad if necessary. The n must be a positive whole number. If you omit length, the rest of the string is returned. The default pad character is a blank. SUBSTR('abc',2) -> 'bc' SUBSTR('abc',2,4) -> 'bc ' SUBSTR('abc',2,6,'.') -> 'bc....'

Functions-String Functions
DELSTR
DELSTR(string,n, length)

DELSTR returns string after deleting the substring that begins at the nth character and is of length characters. If you omit length the function deletes the rest of string (including the nth character).
DELSTR('abcd',3) -> 'ab' DELSTR('abcde',3,2) -> 'abe' DELSTR('abcde',6) -> 'abcde'

Functions-String Functions
LENGTH
LENGTH(string)

LENGTH returns the length of a string. Examples for LENGTH Function


LENGTH('abcdefgh') -> 8 LENGTH(var1) -> 4 *var1=1234+ LENGTH('') -> 0

Functions-String Functions
POSITION
POS(xyz,abc, start)

POS returns the position of one string xyz,in another string abc. Returns 0 if xyz is the null string or is not found or if start is greater than the length of abc. By default the search starts at the first character of haystack (ie start = 1 default) POS('day','Saturday') -> 6 POS('x','abc def ghi') -> 0 POS(' ','abc def ghi') -> 4 POS(' ','abc def ghi',5) -> 8

Functions-String Functions
LASTPOS
LASTPOS(xyz,abc, start)

LASTPOS returns the last position of one string xyz,in another string abc. Returns 0 if xyz is the null string or is not found. By default the search starts at the last character of haystack [ie start = length(abc) default] LASTPOS(' ','abc def ghi') -> 8 LASTPOS(' ','abcdefghi') -> 0 LASTPOS('xy','efgxyz') -> 4 LASTPOS(' ','abc def ghi',7) -> 4

Functions-String Functions
INSERT
INSERT(new,target, n, length, pad)

INSERT inserts the string new, padded or truncated to length length, into the string target after the nth character. The default value for n is 0, which means insert before the beginning of the string.
INSERT(' ','abcdef',3) -> 'abc def' INSERT('123','abc',5,6) -> 'abc 123' INSERT('123','abc',5,6,'+') -> 'abc++123+++' INSERT('123','abc') -> '123abc' INSERT('123','abc',,5,'-') -> '123--abc'

Functions-String Functions
OVERLAY
OVERLAY(new,target, n, length, pad)

OVERLAY returns the string target, which, starting at the nth character, is overlaid with the string new, padded or truncated to length length. The overlay may extend beyond the end of the original target string. Default pad character is a blank, and the default value for n is 1

Functions-String Functions
OVERLAY(' ','abcdef',3) -> 'ab def' OVERLAY('.','abcdef',3,2) -> 'ab. ef' OVERLAY('qq','abcd') -> 'qqcd' OVERLAY('qq','abcd',4) -> 'abcqq' OVERLAY('123','abc',5,6,'+') -> 'abc+123+++'

Functions-String Functions
COMPARE
COMPARE(string1,string2, pad)

COMPARE returns 0 if the strings, string1 and string2, are identical. Otherwise, returns the position of the first character that does not match. The shorter string is padded on the right with pad if necessary. The default pad is blank

Functions-String Functions
REVERSE
REVERSE(string)

REVERSE returns the string in swapped form Examples for REVERSE function
REVERSE('ABc.') -> '.cBA' REVERSE('XYZ ') -> ' ZYX

Functions-String Functions
STRIP
STRIP(string, option, char)

STRIP returns string with leading or trailing characters or both removed, based on the option we specify. The following are valid options.
Both ---- Removes both leading and trailing characters from string. This is the default. Leading -- removes leading characters from string Trailing -- removes trailing characters from string

Functions-String Functions
STRIP(' ab c ') -> 'ab c' STRIP(' ab c ','L') -> 'ab c ' STRIP(' ab c ','t') -> ' ab c' STRIP('12.7000',,0) -> '12.7' STRIP('0012.700',,0) -> '12.7

Functions-Word Functions
WORD WORD(string,n)

WORD returns the nth blank-delimited word in string or returns the null string if fewer than n words are in string. n must be a positive whole number.
WORD('Now is the time',3) -> 'the WORD('Now is the time',5) -> ''

Functions-Word Functions
WORDS
WORDS(string)

WORDS returns the number of blank-delimited words in a string Examples for WORDS function
WORDS('Now is the time') -> 4 WORDS(' ') -> 0

Functions-Word Functions
WORDPOS
WORDPOS(phrase,string, start)

WORDPOS returns the word number of the first word of phrase found in string or returns 0 if phrase contains no words or if phrase is not found. By default the search starts at the first word in string.

Functions-Word Functions
WORDPOS('the','now is the time') WORDPOS('The','now is the time') WORDPOS('is the','now is the time') WORDPOS('is the','now is the time') WORDPOS('is time ','now is the time') WORDPOS('be','To be or not to be') WORDPOS('be','To be or not to be',3) -> -> -> -> -> -> -> 3 0 2 2 0 2 6

Functions-Word Functions
WORDLENGTH
WORDLENGTH(string,n)

WORDLENGTH returns the length of the nth blankdelimited word in string or returns 0 if fewer than n words are in string. n must be a positive whole no. Examples for WORDLENGTH function
WORDLENGTH('Now is the time',2) -> 2 WORDLENGTH('Now comes the time',2) -> 5 WORDLENGTH('Now is the time',6) -> 0

Functions-Word Functions
SUBWORD
SUBWORD(string,n, length)
SUBWORD returns the substring of string that starts at the

nth word, and is up to length blank-delimited words. The n must be a positive whole number.

If we omit length, it defaults to the number of remaining words in string.


SUBWORD('Now is the time',2,2) -> 'is the' SUBWORD('Now is the time',3) -> 'the time' SUBWORD('Now is the time',5) ->

Functions-Word Functions
DELWORD
DELWORD(string,n, length)

DELWORD returns string after deleting the

substring that starts at the nth word and is of length blank-delimited words. If we omit length, the function deletes the remaining words in string (including the nth word).
DELWORD('Now is the time',2,2) -> DELWORD('Now is the time ',3) -> DELWORD('Now is the time',5) -> DELWORD('Now is the time',3,1) -> 'Now time' 'Now is ' 'Now is the time' 'Now is time'

Functions-Allignment Functions
RIGHT
RIGHT(string,length, pad)
RIGHT returns a

string of length length containing the rightmost length characters of string. The string returned is padded with pad characters (or truncated) on the left as needed. The default pad character is a blank
RIGHT('abc d',8) -> ' abc d' RIGHT('abc def',5) -> 'c def' RIGHT('12',5,'0') -> '00012'

Functions-Allignment Functions
LEFT
LEFT(string,length, pad LEFT returns a string of length length, containing the

leftmost length characters of string. The string returned is padded with pad character (or truncated) on the right as needed. The default pad character is blank. length must be a positive whole number or zero. LEFT('abc d',8) -> 'abc d ' LEFT('abc d',8,'.') -> 'abc d...' LEFT('abc def',7) -> 'abc de'

Functions-Allignment Functions
CENTER
CENTER(string,length, pad)

CENTER returns a string of length length with string centered

in it, with pad characters added as necessary to make up length. If the string is longer than length, it is truncated at both ends to fit. If an odd number of characters are truncated or added, the right-hand end loses or gains one more character than the left-hand end. CENTER(abc,7) -> ' ABC ' CENTER(abc,8,'-') -> '--ABC---' CENTRE('The blue sky',8) -> 'e blue s' CENTRE('The blue sky',7) -> 'e blue '

Functions-Allignment Functions
JUSTIFY
JUSTIFY(string,length, pad)

JUSTIFY returns string formatted by adding pad

characters between blank-delimited words to justify to both margins. This is done to width length (length must be a positive whole number or zero). The default pad character is a blank.
JUSTIFY('The blue sky',14) JUSTIFY('The blue sky',8) JUSTIFY('The blue sky',9) JUSTIFY('The blue sky',9,'+') -> -> -> -> 'The blue sky' 'The blue' 'The blue' 'The++blue'

Functions-Date & Time Functions


DATE
DATE(date_format1, input_Date, date_format2)

DATE returns, by default, the local date in the format: dd mon yyyy The string input_date is converted to the format specified by date_format1. date_format2 can be specified to define the current format of input_date. The default for date_format1 and date_format2 is Normal.

Functions-Date & Time Functions


Base Returns no of completed days. Days Returns no of days including the current day in the same year. European Date in format dd/mm/yy. Julian - Date in format mmddd. Month - full English name of the current month. Normal Date in format dd mon yyyy. Ordered Date in format yy/mm/dd. Standard Date in format yyyymmdd.

Functions-Date & Time Functions


Usa Date in format - mm/dd/yy. Weekday - English name for the day of the week. Examples for DATE function
DATE() -> '20 Nov 2001' DATE(,'20020609','S') -> '9 Jun 2002' DATE('B') -> '730808' DATE('E') -> '20/11/01' DATE('J') -> '01324' DATE('M') -> 'November' DATE('N') -> '20 Nov 2001' DATE('N','1438','C') -> '8 Dec 2003' DATE('O') -> '01/11/20' DATE('S') -> '20011120' DATE('U') -> '11/20/01'

Functions-Date & Time Functions


TIME
TIME(Option)

TIME returns the time depending upon the option specified. By default provides 24-hour clock format: hh:mm:ss [for example, 04:41:37].
Civil hh:mmxx [where xx=am/pm] Hours hh Long - hh:mm:ss.uuuuuu [uuuuuu = fraction of seconds, in microseconds] Minutes mmmm Normal - hh:mm:ss Seconds sssss

Functions-Date & Time Functions


Examples for TIME function, while the current time is 4:54 p.m.
TIME() -> '16:54:22' TIME('C') -> '4:54pm' TIME('H') -> '16' TIME('L') -> '16:54:22.123456' TIME('M') -> '1014' /* 54 + 60*16 */ TIME('N') -> '16:54:22' TIME('S') -> '60862' /* 22 + 60*(54+60*16) */

Functions-Formatting Functions
Binary \Hexadecimal Conversions
B2X X2B B2X('11000011') -> 'C3' B2X('10111') -> '17' B2X('101') -> '5' B2X('1 1111 0000') -> '1F0' X2B('C3') -> '11000011' X2B('7') -> '0111' X2B('1 C1') -> '000111000001

Functions-Formatting Functions
Binary \Hexadecimal Conversions
B2X X2B B2X('11000011') -> 'C3' B2X('10111') -> '17' B2X('101') -> '5' B2X('1 1111 0000') -> '1F0' X2B('C3') -> '11000011' X2B('7') -> '0111' X2B('1 C1') -> '000111000001

Functions-Formatting Functions
Character \Hexadecimal Conversions
C2X X2C C2X('72s') -> 'F7F2A2' /* 'C6F7C6F2C1F2'X in EBCDIC */ C2X('0123'X) -> '0123' /* 'F0F1F2F3'X in EBCDIC */ X2C('F7F2 A2') -> '72s' /* EBCDIC */ X2C('F7f2a2') -> '72s ' /* EBCDIC */ X2C('F') -> ' ' /* '0F' is unprintable EBCDIC */

Functions-Formatting Functions
Character \Decimal Conversions
C2D D2C C2D(string, n)

C2C returns the decimal value of the binary representation of string. If we do not specify n, string is processed as an unsigned binary number. If we specify n, the string is taken as a signed number expressed in n characters. The number is positive if the leftmost bit is off (0), and negative, in two's complement notation, if the leftmost bit is on(1).

Functions-Formatting Functions
C2D('09'X) -> C2D('81'X) -> C2D('FF81'X) -> C2D('') -> C2D('a') ->
C2D('81'X,1) C2D('81'X,2) C2D('FF81'X,2) C2D('FF81'X,1) C2D('F081'X,2) C2D('0031'X,0)

9 129 65409 0 129

-> -127 -> 129 -> -127 -> -127 -> -3967 -> 0

Functions-Formatting Functions
D2C
D2C(wholenumber, n)
D2C returns a string, in character format, that

represents wholenumber, a decimal number, converted to binary. If we specify n, it is the length of the final result in characters; after conversion.
D2C(9) -> ' ' /* '09'x is unprintable in EBCDIC D2C(129) -> 'a' /* '81'x is an EBCDIC 'a' D2C(129,1) -> 'a' /* '81'x is an EBCDIC 'a' D2C(129,2) -> ' a' /* '0081'x is EBCDIC ' a' D2C(257,1) -> ' ' /* '01'x is unprintable in EBCDIC D2C(-127,1) -> 'a' /* '81'x is EBCDIC 'a' D2C(-127,2) -> ' a' /* 'FF'x is unprintable EBCDIC;

Functions-Formatting Functions
Decimal\Hexadecimal Conversions D2X D2X(wholenumber, n)

D2X returns a string, in character format, that represents

wholenumber, a decimal number,converted to hexadecimal. If we specify n, it is the length of the final result in characters; after conversion the input string is sign-extended to the required Length.
D2X(9) -> '9' D2X(129) -> '81' D2X(129,1) -> '1' D2X(129,2) -> '81' D2X(129,4) -> '0081' D2X(257,2) -> '01' D2X(-127,2) -> '81' D2X(-127,4) -> 'FF81' D2X(12,0) ->

Functions-Formatting Functions
X2D
X2D(hexstring, n)
X2D returns the decimal representation of hexstring.

The hexstring is a string of hexadecimal characters. If we do not specify n, hexstring is processed as an unsigned binary number.
X2D('0E') X2D('81') X2D('F81') X2D('FF81') X2D('F0') X2D('c6 f0'X) -> -> -> -> -> -> 14 129 3969 65409 240 240

Functions-Formatting Functions
X2D('81',2) X2D('81',4) X2D('F081',4) X2D('F081',3) X2D('F081',2) X2D('F081',1) X2D('0031',0) -> -> -> -> -> -> -> -127 129 -3967 129 -127 1 0

TSO Interface
Allocating Datasets
TSO Alloc Command ALLOC SHR FILE(ddname) DATASET(datasetname)"

Deallocationg Datasets
TSO Free Command FREE FILE(ddname)

TSO Interface
Processing Datasets
EXECIO: An exec uses the EXECIO command to perform the input and output (I/O) of information to and from a data set. The information can be stored in the data stack for serialized processing or in a list of variables for random processing. Before using EXECIO, the data set must first be allocated to a ddname using TSO command ALLOC. "ALLOC DA(userid.input.dataset) F(myindd) SHR REUSE"

TSO Interface
Processing Datasets
Reading all records from the dataset into a compound variable:
"EXECIO * DISKR myindd (FINIS STEM newvar. newvar.0 will contain the total number of records populated in the stem.

Reading all records from the dataset into the data stack:
"EXECIO * DISKR myindd (FINIS" QUEUED() function will give the total number of records populated in the stem.

TSO Interface
Processing Datasets
Reading all records starting from record 100:
"EXECIO * DISKR myindd 100 (FINIS

Reading 6 records starting from record 50:


"EXECIO 6 DISKR myindd 50 (FINIS

Open a dataset without reading:


"EXECIO 0 DISKR myindd (OPEN"

Read a record from dataset for updating:


"EXECIO 1 DISKRU myindd (OPEN"

TSO Interface
Processing Datasets
Skip 24 record without reading and place file pointer on next record:
"EXECIO 24 DISKR myindd (SKIP"

To read the information in LIFO order onto the stack. In other words, use the PUSH instruction to place the information on the stack :
"EXECIO * DISKR myindd (LIFO"

To read the information in FIFO order onto the stack. In other words, use the QUEUE instruction to place the information on the stack :
"EXECIO * DISKR myindd (FIFO Note: FIFO is the default if no option is specified

TSO Interface
Processing Datasets
Write records from a data stack into the dataset:
"EXECIO * DISKW myoutdd (FINIS" When you specify *, the EXECIO command will continue to pull items off the data stack until it finds a null line. If the stack becomes empty before a null line is found, EXECIO will prompt the terminal for input until the user enters a null line. Thus when you do not want to have terminal I/O, queue a null line at the bottom of the stack to indicate the end of the information. QUEUE ''

Write all records from a stem into the dataset:


"EXECIO * DISKW myoutdd (FINIS STEM newvar."

Write 25 records from a data stack into the dataset:


"EXECIO 25 DISKW myoutdd (FINIS STEM newvar."

TSO Interface
Processing Datasets
Return Code 0 1 2 Meaning Normal completion of requested operation. Data was truncated during DISKW operation. End-of-file reached before the specified number of lines were read during a DISKR or DISKRU operation. (This return code does not occur when * is specified for number of lines because the remainder of the file is always read.) An empty data set was found within a concatenation of data sets during a DISKR or DISKRU operation. The file was not successfully opened and no data was returned. Severe error. EXECIO completed unsuccessfully and a message is issued.

20

TSO Interface
Rename a file RENAME oldname newname Copying files REPRO INDATASET(input dataset name) OUTDATASET(output dataset name')

TSO Interface
Attributes of a file LISTDS datasetname List member name in PDS LISTDS PDSname MEMBERS OUTTRAP TSO commands normally display something on the screen. This function traps the displayed output, and lets you access it line by line in your REXX program.

TSO Interface
SYSDSN
The SYSDSN function determines if a specified data set is available for your use. If the data set is available for your use, it returns "OK". x = SYSDSN('USERID.TEST.DATASET) /* x could be set to "OK" */ When a data set is not correct as specified or when a data set is not available, the SYSDSN function returns one of the following messages:
MEMBER SPECIFIED, BUT DATASET IS NOT PARTITIONED MEMBER NOT FOUND DATASET NOT FOUND ERROR PROCESSING REQUESTED DATASET PROTECTED DATASET VOLUME NOT ON SYSTEM UNAVAILABLE DATASET INVALID DATASET NAME, data-set-name MISSING DATASET NAME

Error Handling
SIGNAL

Similar to GOTO in COBOL SIGNAL Label SIGNAL ON/OFF ERROR/NOVALUE/HALT/FAILURE/SYNTAX NAME label main use of "signal" is to jump to an error handling routine when something goes wrong, so that the program can clean up and exit

Error Handling
TRACE
Used for debugging, traces as per option Cant be used for CEXEC that have not been compiled with SOURCE option TRACE All/Commands/Error/Failure/Intermediates/Result/Labels /Off/Scan All All clauses before execution Commands All commands before execution Error All commands resulting in error/failure Failure All commands resulting in failure Scan Used for syntax checking