Examples:
The QUERYALL macro results seen here [TSO code] can be invoked from a MACRO during testing to generate DATALINES at the end of your test. Do not save the changed macro or data being tested as you will have added lines that you probably do not want to keep.
================================================================================
Appendix V Appendix V
Author: David McRitchie
formatted on 1995/04/01 06:54
dmcritchie.. at ..hotmail.com
--------------------------------------------------------------------------------
Appendix V.
users. ISPF CLIST creators
type. Sample clist used herein resides in IS03.LIBR.CLIST(QUERYALL)
manual. SC34-4253 EDIT MACROS (check by using clist %MANUALS before ordering)
related document members. NCLIST entire manual, REXX, CLISTS, DOCLIST.
--------------------------------------------------------------------------------
Appendix-V Sample of CLIST variables available
--------------------------------------------------------------------------------
related see EDITOR material beginning on first page.
--------------------------------------------------------------------------------
REXX material
REXX Control Variables
REXX LISTDSI Information, and ALLOCATE
REXX Stacks, PUSH, PULL, QUEUE
REXX Translate Function
TSO Symbolic Variables
[Appendix-V INDEX]
refer to manual GC28-1274 TSO Terminal User's Guide for more specific
information (may be an old manual or number).
+------------------------------------------------------------------------------+
| |
| Symbolic value Use |
| &DATATYPE(expression) To determine if an expression is entirely |
| numeric. Returns either NUM or CHAR. |
| e.g. &datatype(3*2/4) results in NUM |
| &EVAL(expression) To determine the result of an arithmetic |
| expression. |
| &LENGTH(expression) To determine the number of characters in the |
| result of an evaluated expression. |
| &NRSTR(string) To define a non-rescannable character string |
| for symbolic substitution. Use to |
| prevent removal of first ampersand when |
| when a character string is prefixed with |
| double ampersands. Use to prevent more |
| than one level of symbolic substitution |
| of a variable. |
| &STR(string) To use a string of characters as a real |
| value. |
| |
| Since square brackets are not available, optional |
| material is enclosed in European brackets <...>. | <
| |
|&SUBSTR(expression<:expression>,string) To use a portion of a character string|
| as a real value. |
|&SYSCAPS(string) Change string to uppercase |
|&SYSDSN(data set name) Check if dataset exits, returns "OK" or |
| other value. See page NCAPXB-1. (in REXXS
|
| AA use STREAM) |
|&SYSINDEX(index,string,<,start>) an argument within a string |
Locate
| e.g. = &SYSINDEX(.,&dsname.) + 1 |
|&SYSLC(string) Change string to lowercase. CONTROL ASIS or NOCAPS
|
| must be |
Z&SYSNSUB(level,expression)Limit the level of symbolic substitution. Level can
| be set from zero to 99. |
+------------------------------------------------------------------------------+
These CLIST variables are available during the running of any CLIST. For more
information refer to SC28-1304 TSO Extensions CLISTs.
+---------------+------------+----------------------------------------+--------+
|Category | Symbolic | Information Represented by Variable | Example|
| | Variable | | |
+---------------+------------+----------------------------------------+--------+
|User-oriented | &SYSUID | Current User's identification | IS03 |
| | &SYSPROC | LOGON procedure name | TECHT |
| | &SYSPREF | Data set name prefix | IS03 |
| | | | |
|Current ... | &LASTCC | Most recent return code | 0 |
| procedure | &MAXCC | Highest return code | 8 |
| | &SYSDLM | Termination delimiter | 0 |
| | &SYSDVAL | Terminal parameters | |
| | &SYSLTERM | Contains number of lines avail./screen | 27 |
| | &SYSWTERM | Width of the screen | 132 |
| | | | |
|System ... | &SYSCPU | CPU time (session) secs.hundredths | 6.24 |
| Environment | &SYSHSM | Level of HSM available to the clist | |
| | &SYSISPF | Whether ISPF management services avai. | ACTIVE |
| | &SYSLRACF | Level of RACF available to the clist | 1070 |
| | &SYSRACF | Indicates whether RACF installed | AVAILABL
|
| | &SYSSRV | Number of SRM serv. units used (session).92058 |
|
| | &SYSTSOE | Level of TSO/E installed | 1040 |
| | | | |
|CLIST ... | &SYSENV | Foreground or background execution | FORE |
| related | &SYSICMD | Implicit execution member name | QUERYALL
|
| | &SYSNEST | Nested procedure indicator | NO |
| | &SYSPCMD | Current primary command name | EXEC |
| | &SYSSCAN | Symbolic substitution rescan limit | 16 |
| | &SYSSCMD | Current subcommand name | VERSION|
| | | | |
|Current date | &SYSTIME | Current time hh:mm:ss | 20:39:58
|
| and time | &SYSDATE | Current date mm/dd/yy | 01/02/86
|
|(different | &SYSSTIME | Date form hours:minutes | 13:23 |
| variables | &SYSSDATE | Date format year/month/day. | 88/01/02
|
| in REXX) | &SYSJDATE | Julian date format year.days. | 88.002 |
+---------------+------------+----------------------------------------+--------+
|REXX exec for the above basically omit the ampersand and are in the |
|form: SAY SYSVAR(syspref) |
+------------------------------------------------------------------------------+
| ISP@MSTR -- MASTER, and ISR@PRIM -- ISPF/PDF PRIMARY OPTION |
| ISPF Dialog Management Guide and Reference SC |
| ISPEXEC VGET(........) SHARED|PROFIL |
+------------------------------------------------------------------------------+
Check out the following also: (found Nov 1997)
appclu = MVSVAR('sysappclu')
for more information see my list of manuals at end of this section.
+---------------+---------------------------+-------------------------+--------+
|Category | ISPEXEC | Description | Examp |
+---------------+---------------------------+-------------------------+--------+
|System | ISPEXEC VGET (ZUSER ) | Userid | IS03 |
| Variables | ISPEXEC VGET (ZPREFIX) | Prefix | IS03 |
| | ISPEXEC VGET (ZTIME ) | Time | 20:1 |
| | ISPEXEC VGET (ZTERM ) | Terminal | 3278 |
| | ISPEXEC VGET (ZCHARLM) | Terminal characteristic | ISP32 |
| | ISPEXEC VGET (ZDATE ) | Date | 89/0 |
| | ISPEXEC VGET (ZJDATE ) | Date | 89.2 |
| | ISPEXEC VGET (ZKEYS ) | PF Keys | 24 |
| | ISPEXEC VGET (ZPFSHOW) | PFSHOW ON/OFF | OFF |
| | ISPEXEC VGET (ZPFCTL) | User Authorization | |
| | | to use PFSHOW | |
| | | USER|ON|OFF | |
| | ISPEXEC VGET (ZPFFMT) | Format of PFSHOW | MAX |
| | | PRI (13-24), ALT(1-12)| |
| | | ALL (1-24) | |
| | ISPEXEC VGET (ZPF01 ) | PF01 | HELP |
| | ISPEXEC VGET (ZPF03 ) | PF03 | END |
| | ISPEXEC VGET (ZPF04 ) | PF04 | :ts |
| | ISPEXEC VGET (ZPF012) | PF012 | curs |
| | ISPEXEC VGET (ZPF024) | PF024 | retr |
| | ISPEXEC VGET (ZPL01 ) | PF01 show | |
| | ISPEXEC VGET (ZPL03 ) | PF03 show | |
| | ISPEXEC VGET (ZPL04 ) | PF04 show | |
| | ISPEXEC VGET (ZPL012) | PF012 show | |
| | ISPEXEC VGET (ZPL024) | PF024 show | |
| | ISPEXEC VGET (ZLOGON ) | PROC | TECH |
| | ISPEXEC VGET (VVER ) | Version | ISPF |
| | ISPEXEC VGET (ZAPPLID) | Application | ISR |
+---------------+---------------------------+-------------------------+--------+
|REXX exec for ISPEXEC and ISREDIT Environments |
| ADDRESS "ISPEXEC" "SELECT service" |
| ADDRESS "ISPEXEC" "VGET (variable) shared|profile" |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| word for word from Chapt 5 ISPF Customization SC34-4117-0 page 81 (???) |
| Invoking a ISPSTART or SELECT service from a clist |
| |
| |
| Tablename This is the name of an input table that resides |
| in the table input library (ddname ISPTLIB). This table |
| drives the update process, eliminating the need for user |
| interaction. |
| |
| INSTALL Use of this keyword parameter indicates that input |
| for the update process (in this case, an add, delete, or |
| replace function) resides in the sequential input data s |
| (ddname ISPPIN). |
| |
| BACKOUT Use of this keyword parameter indicates that input for |
| the update process (in this case a restore function) res |
| in the sequential input data set (ddname ISPPIN). |
| |
| Examples: |
| |
| |
| ISPEXEC LIBDEF ISPPLIB DATASET ID('_____'); |
| from a command list dialog |
| |
| CALL ISPLINK ('SELECT',buflen,'PGM(ISPPUP) PARM(tablename)'); |
| from a module dialog |
| |
| |
| ISPEXEC SELECT PGM(ISPPUP) PARM(INSTALL)'); |
| from a command list dialog |
| |
| |
| &ZSEL = 'PGM(ISPPUP) PARM(tablename)' |
| from a selection panel |
| |
| |
| ISPSTART PGM(ISPPUP) PARM(BACKOUT)'); |
| directly from the host system |
| |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| STEPLIB function without use of a STEPLIB in the TSO PROC. |
| |
| ISPEXEC LIBDEF ISPLLIB DATASET ID('TECH.QW.V23.LINKLIB') |
| |
| Other libraries |
| |
| ISPEXEC LIBDEF ISPMLIB DATASET ID('TECH.QW.V23.MESSAGES') |
+------------------------------------------------------------------------------+
+---------------+------------+----------------------------------------+--------+
|Current date | DATE('U') | Current date mm/dd/yy | 01/02 |
| and time | DATE('O') | Date format year/month/day. | 88/01 |
| functions | DATE('J') | Julian date format year.days. | 88002 |
| in REXX | TIME('N') | Current time hours:minutes:seconds 13:23 |
|
| | TIME() | Current time (same as above, but above|form n |
+---------------+------------+----------------------------------------+--------+
&SYSDSN(data set name) -- Determining Whether a Data Set Exists
OK /*the data sets exists or the data set and memb
MEMBER NOT FOUND
MEMBER SPECIFIED, BUT THE DATASET IS NOT PARTITIONED
DATASET NOT FOUND
ERROR PROCESSING REQUESTED DATASET
PROTECTED DATASET /* the dataset is RACF-protected*/
VOLUME NOT ON SYSTEM
INVALID DATASET NAME, dsname
MISSING DATA SET NAME
UNAVAILABLE DATASET
CLIST syntax: x = &SYSDSN('sys1.userproc')
x = &SYSDSN('&filename(&member)')
REXX syntax: x = SYSDSN("'sys1.userproc'")
x = SYSDSN("'"fulldsn"("member")'")
or x = SYSDSN('''sys1.userproc''')
unqualified as x = SYSDSN('libr.exec')
or x = SYSDSN(libr.exec)
REXXSAA on a PC x = stream('...\file.txt','c','query exists')
return full pathname if file exists, null string i
OS/2 syntax: DIR /S filespec < filespec
LIBRARIAN equivalent for SYSDSN
The following code has not been tested but was supplied by LIBRARIAN under
tracking #1668787 11/1192 by James Mim. LIBRARIAN must be at least
level 9202 the current level is 9207, and ours is 9102 (so we can't use yet).
To find level get into ELIPS and enter OPTION on the command line.
SELECT PGM(ELIPS) DSN('librarian.dataset') CMD('B module;end')
will return RC=14 if member not found.
refer to manual SC28-1304 TSO Extensions CLISTs for more specific info
See also DIALOG error interception on page NCAPXB-1.
default
CONTROL NOPROMPT NOSYMLIST NOLIST NOCONLIST CAPS MSG FLUSH
options
CONTROL PROMPT SYMLIST LIST CONLIST NOCAPS|ASIS NOMSG NOFLUSH MAIN
descriptions of selected items
SYMLIST, list statements before symbolic substitution
LIST, list statements after symbolic substitution
CONLIST, list CLIST statements after symbolic substitution but before
FLUSH,NOFLUSH control of input stack when an error occurs
MAIN, cannot be flushed (NOFLUSH is assumed regardless of specific
PROMPT, ...
ERROR DO
...
END
ERROR OFF to turn off error processing
DIALOG error interception
For more information refer to SC34-4266 "ISPF Dialog Management Guide and
Reference" Chapter 17 Miscellaneous Services page 481 in SC34-4266-0.
Control Service -- prefixed by ISPEXEC CONTROL
DISPLAY LOCK Allow next display without unlocking keyboard
NONDISPL Do not diplay the next panel, and simulate Enter key
or END.
DISPLAY REFRESH Refresh entire screen display
DISPLAY LINE Refresh entire screen after expected line-mode output
SPLIT Enable or disable split-screen operations.
ERRORS CANCEL Errors - terminate with return code or higher.
ERRORS RETURN Errors - return control to function. Message id is
stored in ZERRMSG. RETURN applies only to the current
(next) function and then reverts back to the default
of CANCEL.
An example within REXX exec
Address "ISPEXEC" "CONTROL ERRORS RETURN"
Address "ISPEXEC" "EDIT DATASET("||DSNAME||") MACRO"||MACRO||")" "
If RC <> 0 then ...
Address "ISREDIT"
"LINE_BEFORE .ZF = MSGLINE """||time('n')||,
"-- ERROR in your parameters --" zerrsm""""
"LINE_BEFORE .ZF = MSGLINE """||zerrmsg zerrlm||"""" "
ZEDSMSG = zerrsm
ZEDLMSG = zerrmsg zerrlm
Address "ISPEXEC" "SETMSG MSG(ISRZ000)"
END
An example within CLIST language
ISPEXEC CONTROL ERRORS RETURN
ISPEXEC EDIT DATASET(&DSNAME.) &MACRO. &PANEL.
SET RC = &LASTCC.
IF &RC ª= 0 THEN IF &STR() ª= &STR(&ZEDLMSG.) THEN DO
SET &ZEDSMSG = &STR(&ZERRSM)
SET AAA = &ZERRLM
SET AAA = &AAA.
SET AAA = &STR(RC=&RC., &AAA. -- &RMEMBER.)
SET &ZEDLMSG = &STR(&AAA.)
ISPEXEC SETMSG MSG(ISRZ000)
END
EXIT CODE(&RC.)
One more REXX example, DISPLAY LOCK only applies to the next DISPLAY, it
must be reinstated for each display. It remains in effect until the execute
ends or another DISPLAY LOCK occurs. (The following in the SPELL macro.) If
ISRZ001 is used instead of ISRZ000 the color of the message will be yellow
instead of white and the alarm will sound. Quiet is preferred.
ZEDSMSG =
ZEDLMSG = '** Spell checking in progress **'
ADDRESS 'ISPEXEC' 'CONTROL DISPLAY LOCK'
ADDRESS 'ISPEXEC' 'DISPLAY MSG(ISRZ000)'
- - - - - - - - - - - - - - - - - - - - -
ZEDSMSG =
ZEDLMSG = '** SCRIPT/VS checking words **'
ADDRESS 'ISPEXEC' 'CONTROL DISPLAY LOCK'
ADDRESS 'ISPEXEC' 'DISPLAY MSG(ISRZ000)'
- - - - - - - - - - - - - - - - - - - - -
ZEDSMSG =
ZEDLMSG = '** SPELL CHECKING IN PROGRESS ** -- FINAL PHASE'
ADDRESS 'ISPEXEC' 'CONTROL DISPLAY LOCK'
ADDRESS 'ISPEXEC' 'DISPLAY MSG(ISRZ000)'
ISREDIT (VAR001 ) = AUTOLIST OFF
REFORMAT .a .b 1 55 60 115 56 59 120 130 OF
ISREDIT (VAR003,VAR004) = AUTOSAVE OFF ,PROMPT
ISREDIT (VAR005 ) = BLKSIZE 006233
ISREDIT (VAR006,VAR007) = BOUNDS 001,251
WARNING the use of NUMBER ON when using RECFM of V will operate
internally with the column numbers of the data portion (excluding
the sequence numbers) and externally to the user the columns are
numbered including the seq number . so that col 1 internally
will be viewed by the user as column 9. This affects BOUNDS and
DISPLAY_COLS.
-----internal to clists------------ --------as seen by user--
---------
positioned BOUNDS DWIDTH DISPLAY positioned BOUNDS DWIDT
H DISPLAY
seq.number 001,243 243 001,116 seq.number 009,251 24
3 001,124
data 001,243 243 001,124 data 009,251 24
3 009,132
far right 001,243 243 001,173 far right 009,251 24
3 128,251
ISREDIT (VAR008 ) = CAPS OFF
ISREDIT (VAR009,VAR010) = CHANGE_COUNTS 00000000,0000000
0
number of strings changed ==CHG>
number of strings that could not be changed ==ERR>
ISREDIT (VAR011,VAR012) = CTL_LIBRARY NOCHECK ,FIR
STLIB
variable name to contain lock status of the member
variable name to contain additional status information
ISREDIT (VAR013,VAR014) = CURSOR 000074,000
ISREDIT (VAR014A) = DATA_CHANGED 000 s/b YES or N
O
ISREDIT (VAR016 ) = DATA_WIDTH 251
logical data width unnumbered same as LRECL
STD is LRECL-8, COBOL is LRECL-6, STD COBOL is LRECL-14
ISREDIT (VAR018 ) = DATAID ISR00041
return code =4 dataid created by edit will be freed by edit
ISREDIT (VAR018A ) = DATASET IS03.SHARE.TEXT
ISREDIT (VAR019,VAR020) = DISPLAY_COLS 001,124
first and last data column currently visible to end user
* commands that refer to DISPLAY values are invalid in a recovery m
acro
ISREDIT (VAR021,VAR022) = DISPLAY_LINES 000074,000087
first and last line number visible if macro terminated at this poin
t
ISREDIT (VAR023E,VAR024E) = EXCLUDE_COUNTS 00000000,0000000
0
number of strings found (excluded)
number of lines on which strings were excluded
ISREDIT (VAR023,VAR024) = FIND_COUNTS 00000001,0000000
1
number of strings found
number of lines on which strings were found
ISREDIT (VAR025,VAR026) = FLOW_COUNTS 00000000,0000000
0
number of original lines participated in text flow operation
number of lines that were generated by the text flow operation
if varname1 > varname2, difference is number of lines deleted
if varname1 < varname2, difference is number of lines added
ISREDIT (VAR027,VAR028) = HEX OFF ,
ISREDIT (VAR029 ) = IMACRO NONE
ISREDIT (VAR031,VAR032) = LABEL .ZFIRST ,000
name of label found on current line, and highest nesting level (0 i
s highest)
return code =4 label not found
ISREDIT (VAR033 ) = LEVEL 00
ISREDIT (VAR035 ) = LINE 9 >APPENDIX V.
content of VAR035 is the content of line 9
ISREDIT (VAR036 ) = LINE .ZLAST <content of .ZLAST line> <
ISREDIT (VAR037 ) = LINENUM .ZLAST 000087
ISREDIT (VAR039 ) = MACRO_LEVEL 001
ISREDIT (VAR043 ) = MEMBER NCAPXB
ISREDIT (VAR045 ) = NOTE ON
ISREDIT (VAR047,VAR048) = NULLS ON ,ALL
ISREDIT (VAR049,VAR050) = NUMBER ->> OFF,NOSTD NOCOBOL
NODISPL
ISREDIT (VAR051 ) = PACK OFF
ISREDIT (VAR053,VAR054) = PROFILE TEXT,UNLOCK
name of current profile, and LOCK or UNLOCK status
ISREDIT (VAR055 ) = RANGE_CMD
return code =8 line command setting not acceptable out of RANGE_CM
D
ISREDIT (VAR057 ) = RECFM V
ISREDIT (VAR059 ) = RECOVERY OFF
ISREDIT (VAR061 ) = RMACRO NONE
* commands that refer to DISPLAY values are invalid in a recovery m
acro
* elips !ELIED0
* ZAPPLID ISR
***
* LIB@EDIT LIB@EDRT ZEDTDSN ZZDBDSN
ISREDIT (VAR063,VAR064) = SEEK_COUNTS 00000000,0000000
0
number of strings found
number of lines on which strings were found
ISREDIT (VAR065 ) = STATS ON
ISREDIT (VAR067A,VAR067B) = TABS
OFF,
ON | OFF, tab char and ALL | STD
ISREDIT (VAR071 ) = USER_STATE <<USED TO STORE USER_STATE>> <
ISREDIT USER_STATE = (VAR071) <<USED TO RESTORE USER_STATE>>
ISREDIT (VAR073 ) = VERSION 01
ISREDIT (VAR075 ) = XSTATUS .ZCSR NX
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Setting Variables or mode in clists
refer to manual SC34-2133 for more specific information
the equal sign, optional in most cases, is required on LABEL
ISREDIT AUTONUM mode ON|OFF
ISREDIT AUTOSAVE mode ON | OFF PROMPT | OFF NOPROMPT
ISREDIT BOUNDS left right
ISREDIT CAPS mode ON|OFF
ISREDIT CURSOR = line col
The following statements may change the cursor position
CHANGE EXCLUDE FIND SEEK TSPLIT
A LOCATE does not change the cursor position
ISREDIT DEFINE name {CMD MACRO | PGM MACRO | ALIAS name2 | NOP | RESET
}
ISREDIT HEX {ON DATA | ON VERT | OFF }
ISREDIT IMACRO name|NONE to set the initial macro
ISREDIT LABEL lptr = labelname <level>
ISREDIT LABEL .ZCSR = .POINT <0 -- optional level 0 - 255,
0 makes label visable at all levels
ISREDIT LEVEL num
ISREDIT LINE lptr = data (to change line content see manu
al)
(refer to manual SC34-2133 for more specifics)
ISREDIT LINE_AFTER lptr = <DATALINE | NOTELINE | MSGLINE> "data"
(refer to manual SC34-2133 for more specifics)
ISREDIT LINE_AFTER lptr = (LINEDATA)
(*** where LINEDATA is a variable, do not use ampersands on this
one ***)
ISREDIT LINE_AFTER .zcsr = LINE .zcsr /* .zcsr an example of any lp
tr */
(*** one method used to repeat a line ***)
ISREDIT LINE_BEFORE lptr = <DATALINE | NOTELINE | MSGLINE> "data"
(refer to manual SC34-2133 for more specifics)
ISREDIT MASKLINE = data (create mask for added lines)
(refer to manual SC34-2133 for more specifics)
ISREDIT NOTE = mode {ON | OFF} (whether dialog model
include notes)
ISREDIT NULLS = {ON | OFF | ALL | STD}
ISREDIT NUMBER = {ON | OFF | STD | COBOL | STD COBOL | DISPLAY}
ISREDIT PACK = {ON | OFF}
ISREDIT PROFILE (refer to manual SC34-2133 for m
ore specifics)
ISREDIT RECOVERY = {ON | OFF}
ISREDIT RENUM <STD> <COBOL> <DISPLAY> same as on NUMBER
ISREDIT REPLACE member lptr-range
ISREDIT RESET <LABEL|CHANGE|ERROR|SPECIAL|EXCLUDED|COMMAND> <lptr-ran <
ge>
ISREDIT RMACRO = name Set Recovery Macro
ISREDIT SCAN = {ON | OFF}
ISREDIT STATS = {ON | OFF} determine whether statistics kept
ISREDIT TABS = (refer to manual SC34-2133 for m
ore specifics)
ISREDIT TABSLINE = (refer to manual SC34-2133 for m
ore specifics)
ISREDIT USER_STATE = (varname) ...see manual for values save/re
stored
ISREDIT VERSION = num
ISREDIT XSTATUS lptr = X | NX sets status on line
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
A separate little section has been created for REXX as a reminder to use
quotes except around variables. Obtaining variables was more straight for-
ward. In setting variables you may have a variable ("PTR") which is an ad-
dress (PTR=".STA") which must then be used as a REXX variable, since there
will be no TSO clist substitution for the likes of "&PTR.".
refer to manual SC34-2133 for more specific information
the equal sign, optional in most cases, is required on LABEL
Address "ISREDIT:" Set Default for ISREDIT
"AUTONUM" mode ON|OFF
"AUTOSAVE" mode ON | OFF PROMPT | OFF NOPROMPT
"BOUNDS" left right
"CAPS" mode ON|OFF
"CURSOR =" line col
The following statements may change the cursor position
CHANGE EXCLUDE FIND SEEK TSPLIT
A LOCATE does not change the cursor position
"DEFINE" name {CMD MACRO | PGM MACRO | ALIAS name2 | NOP | RESET}
"HEX" {ON DATA | ON VERT | OFF }
"IMACRO" name|NONE to set the initial macro
"LABEL" lptr "=labelname <level">
"LABEL .ZCSR=.POINT <0>" -- optional level 0 - 255,
0 makes label visable at all levels
"LEVEL" num
"LINE" lptr "="data (to change line content see manual)
(refer to manual SC34-2133 for more specifics)
"LINE_AFTER" lptr"= <DATALINE | NOTELINE | MSGLINE"> """data"""
(refer to manual SC34-2133 for more specifics)
"LINE_AFTER" lptr"= (LINEDATA)"
(*** where LINEDATA is a variable ***)
(refer to manual SC34-2133 for more specifics)
"LINE_BEFORE" lptr"=" <DATALINE | NOTELINE | MSGLINE> "data" "
(refer to manual SC34-2133 for more specifics)
"MASKLINE=" data (create mask for added lines)
(refer to manual SC34-2133 for more specifics)
"NOTE =" mode {ON | OFF} (whether dialog model include notes)
"NULLS =" {ON | OFF | ALL | STD}
"NUMBER =" {ON | OFF | STD | COBOL | STD COBOL | DISPLAY}
"PACK =" {ON | OFF}
"PROFILE" (refer to manual SC34-2133 for
more specifics)
"RECOVERY=" {ON | OFF}
"RENUM" <STD> <COBOL> <DISPLAY> same as on NUMBER
"REPLACE" member lptr-range
"RESET" <LABEL|CHANGE|ERROR|SPECIAL|EXCLUDED|COMMAND> <lptr-range> <
"RMACRO =" name Set Recovery Macro
"SCAN =" {ON | OFF}
"STATS =" {ON | OFF} determine whether statistics kept
"TABS =" (refer to manual SC34-2133 for more specifics)
"TABSLINE=" (refer to manual SC34-2133 for more specifics)
"USER_STATE =" varname ...see manual for values
save/restored
"VERSION =" num
"XSTATUS" lptr "=" status -- sets status on line X or NX
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Receiving Responses from the Terminal
WRITENR Please supply value for A ...
READ
WRITE Value received is &SYSDVAL
WRITE Please supply values A,B,C,D
WRITE e.g. 15,24,,73 or '15' '24' '' '73'
READ A,B,C,D = &STR(value)
WRITE A has value of &A.,...,D has value of &D.
Receiving Responses from the Terminal using REXX
SAY 'Please supply value for A ...'
PULL a
SAY Value received is a
SAY "Please supply values A,B,C,D"
SAY " e.g. 15,24,,73 or '15' '24' '' '73'"
PULL A B C D
SAY 'A has value of 'A',...,D has value of 'D
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
ISPEXEC VGET (variable) SHARED
WRITE variable = &variable
SET variable = &STR(value)
ISPEXEC VPUT (variable) SHARED
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Clist code to Place a short message on panel and a long message for HELP
SET &ZEDSMSG = MISSING MEMBER
SET &ZEDLMSG = MEMBERNAME TO BE DELETED FROM "&DSN." WAS NOT SPEC-
IFIED
ISPEXEC SETMSG MSG(ISRZ000)
EXIT CODE(0)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Clist code to Place a long message on panel immediately
SET &ZEDSMSG =
SET &ZEDLMSG = &STR(**Spell Checking in progress **)
ISPEXEC CONTROL DISPLAY LOCK
ISPEXEC SETMSG MSG(ISRZ000)
EXIT CODE(0)
ISREDIT CURSOR = line col
ISREDIT CHANGE ...
ISREDIT COPY ...
ISREDIT CREATE ...
ISREDIT DOWN amt
ISREDIT FIND ...
ISREDIT LEFT amt
ISREDIT LOCATE ...
ISREDIT MOVE ...
ISREDIT REPLACE ...
ISREDIT RIGHT amt
ISREDIT SEEK ...
ISREDIT SHIFT ...
ISREDIT SORT ...
ISREDIT UP amt
ISREDIT BUILTIN ...
ISREDIT CTL_LIBRARY
ISREDIT DEFINE ...
ISREDIT PROCESS ... and RANGE_CMD
ISREDIT SCAN on/off (there is an example later)
LISTDSI Information -- TSO Clist and REXX exec version
SET DSN = 'IS03.LIBR.CLIST(JUNK)' dsn = "is03.libr.clist(junk)"
LISTDSI &DSN. + x = LISTDSI(dsn) DIRECTORY
_________
SYSDSNAME Data Set Name IS03.LIBR.CLIST
SYSVOLUME Volume serial id TSOD12
SYSDSORG Data Set Organization PO
SYSRECFM Record format VB
SYSLRECL Logical record length 255
SYSBLKSIZE Block size 19069
SYSKEYLEN Key length 0
SYSCREATE Creation date 1987/043
SYSEXDATE Expiration date 0
SYSREFDATE Last referenced date 1988/242
SYSUPDATED Change indicator YES
SYSUNIT Device on which volume resides 3380
SYSUNITS Space units TRACK
SYSADIRBLK Directory blocks allocated (PDS only)
200
SYSPRIMARY Primary allocation in space units 45
SYSSECONDS Secondary allocation in space units 0
SYSUDIRBLK Directory blocks used (PDS only) 55
SYSMEMBERS Number of members (PDS only) 326
SYSALLOC Allocation in space units 45
SYSUSED Allocation used, in space units 41
SYSBLKSTRK Directory blocks per track for unit 4
SYSEXTENTS Number of extents used 1
SYSTRKSCYL Tracks per cylinder per unit 15
SYSMSGLVL1 First level message (if an error)
SYSMSGLVL2 First level message (if an error)
SYSPASSWORD password indication NONE
SYSRACFA RACF indication GENERIC
SYSREASON LISTDSI reason code 0000
+------------------------------------------------------------------------------+
| TSO CLIST to ALLOCATE a dataset |
+------------------------------------------------------------------------------+
| ALLOCATE DA(&NEW) NEW SPACE(&SYSPRIMARY,&SYSSECONDS) + |
| LIKE (&BASE) CATALOG |
| |
| or |
| |
| ALLOCATE DA(&NEW) NEW SPACE(&SYSPRIMARY,&SYSSECONDS) + |
| &SYSUNITS DIR(&SYSADIRBLK) + |
| RECFM(&SUBSTR(1:1,&SYSRECFM. ) &SUBSTR(2:2,&SYSRECFM. ) + | .
| &SUBSTR(3:3,&SYSRECFM. ) &SUBSTR(4:4,&SYSRECFM. ) + | .
| LRECL(&SYSLRECL.) BLKSIZE(&SYSBLKSIZE.) |
| |
+------------------------------------------------------------------------------+
| Generated code will look like this visually to you (REXX has commas at end |
| not &plus) |
| |
| ALLOCATE DA('xxxxxxx') NEW SPACE(45,0) + |
| VOL(TSOD12) UNIT(3380) + |
| TRACK DIR(200) + <DIRECTORY must be included on command> |
| RECFM(V B + |
| ) + |
| LRECL(255) BLKSIZE(19069) |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| in REXX exec the ALLOCATE would read as follows (drop the ampersands) |
+------------------------------------------------------------------------------+
| |
| SUBSTR(string,n,length) same as in PLI, REXX also has |
| SUBSTR(string,n,length,pad) e.g. SUBSTR('abc',2,6,'.') |
| STRIP(string,'t') remove trailing blanks (,' ' default) |
| |
| x = LISTDSI("'old.dsn'") /* x is set to a function code */ |
| "ALLOCATE DA('xxxxxxx') NEW SPACE("SYSPRIMARY","sysseconds")", | "
| "UNITS DIR(0"sysadirblk")", |
| "RECFM("STRIP(SUBSTR(sysrecfm,1,1) SUBSTR(sysrecfm,2,1,' '), |
| SUBSTR(sysrecfm,3,1,' ') SUBSTR(sysrecfm,4,1,' '),'t')")", |
| "LRECL("syslrecl") BLKSIZE("sysblksize")" | "
| /* say "x=" x returns x= 0 */ |
+------------------------------------------------------------------------------+
| Generated code will look like this visually to you (REXX has commas at end |
| not &plus) |
| |
| ALLOCATE DA('xxxxxxx') NEW SPACE(45,0) , |
| VOL(TSOD12) UNIT(3380) , |
| TRACK DIR(200) , <DIRECTORY must be included on command> |
| RECFM(V B) , |
| LRECL(255) BLKSIZE(19069) |
+------------------------------------------------------------------------------+
Techniques for some troublesome parts of CLISTS
This code is available in IS03.LIBR.CLIST(PATTERN) at Mytown.
-- dataset name will be different but look for PATTERN.txt
SET LP = &STR(()
SET I = 1
DO WHILE &I <= 100
SET TOKEN = &&TOK&I
SET TOKEN = &STR(&SYSCAPS(&TOKEN))
IF &STR(&TOKEN) = &STR() THEN GOTO END_TOK
IF HELP = &STR(&TOKEN) | NX = &STR(&TOKEN) -
| LEFT = &STR(&TOKEN) | RIGHT = &STR(&TOKEN) -
THEN DO
SET &&TOKEN. = &STR(&TOKEN)
IF DEBUG = &DEBUG THEN WRITE &I TOK&I=&TOK&&I TOKEN=&TOKEN & &
GOTO NXT_TOK
END
IF &SUBSTR(1:6,&STR(&TOKEN) ) = &STR(BEGIN&STR(&LP)) +
THEN DO
SET BEGIN = &SUBSTR(7:&EVAL(&LENGTH(&STR(&TOKEN))-1),+
&STR(&TOKEN) )
GOTO NXT_TOK
END
SET REMAIN = &STR(&REMAIN &STR(&TOKEN))
NXT_TOK: -
SET I = &I + 1
END
END_TOK: SET I = &I
Ampersand (x'50') and Double Quote (x'48')
are not compatible with CLIST use of SUBSTR after use of
"ISREDIT (CONTENT) = LINE LINENUM" for a more
complete example, examine the content of the REFORMAT clist.
ISREDIT C ALL X'50' X'47'
or ISREDIT C ALL '&&' X'47'
ISREDIT C ALL '"' X'48'
ISREDIT C ALL '.hr ' '.hr 1 left right'
ISREDIT C ALL '.hr 1 &&&&$CL.' '.hr left right'
ISREDIT C ALL '.hr 0 &&&&$CL.' '.hr left right'
====
/* Note it takes 4 ampersands in a clist to replace a single ampersand*/
ISREDIT (VAR075) = XSTATUS &K.
IF &NX = NX AND &VAR075 = X THEN GOTO LOOP1NXT
ISREDIT (LINE@AAA) = LINE &K.
SET STR2 = &SUBSTR(&SUB1.:&SUB2.,&STR(&LINE@AAA))
--------------------------------------------------------------------------------
&SYSNSUB(level,expression) -- limiting level of symbolic substitution
_
&SYSSCAN=times -- max symbolic substitutions scans per line
ISREDIT MACRO
SET PIEBALD = &STR(JACK &SYSNSUB(0,&.) JILL WENT UP THE HILL)
SET AMP = XXX
SET &SYSSCAN=1
SET L = &LENGTH(&SYSNSUB(1,&PIEBALD.))
WRITE &SYSNSUB(0,&PIEBALD.)
WRITE &SYSNSUB(1,&PIEBALD.)
ISREDIT LINE_AFTER .ZL = DATALINE "&SYSNSUB(0,&PIEBALD.) L=&L."
ISREDIT LINE_AFTER .ZL = DATALINE "&SYSNSUB(1,&PIEBALD.) L=&L."
ISREDIT LINE_AFTER .ZL = DATALINE "1...5...10...15...20...25...30.."
EXIT CODE(0)
JACK &. JILL WENT UP THE HILL L=32
JACK XXX JILL WENT UP THE HILL L=32
1...5...10...15...20...25...30..
&SCAN -- limit scanning to one time
_
ISREDIT (varname) = SCAN obtain current value, if of interest
ISREDIT SCAN OFF
ISREDIT LINE &LNUM = "&&SYSDATE is a CLIST built-in function -- (&SYSDATE.)" "
ISREDIT SCAN ON
00010 &SYSDATE is a CLIST built-in function -- (05/31/91)
ISREDIT MACRO
/* IS03.LIBR.CLIST(NTEST) */
SET MSG = &SYSNSUB(1,/*A && B '"'" ")
WRITE &NRSTR(&MSG.)
WRITE &STR(&SYSNSUB(1,&MSG.))
ISREDIT LINE_AFTER .ZL = DATALINE "/&STR(*) &STR(&SYSNSUB(1,&MSG.))" "
ISREDIT LINE_AFTER .ZL = DATALINE "/&STR(*) &NRSTR(&MSG.)"
/* /*A & B '"'""
/* /*A & B '"'""
/* /*A & B '"'""C
/* /*A & B '"'""C
/* /*A & B '"'""C"
/* /*A & B '"'""C"
/* /*A & B '"'"
/* /*A & B '"'"
/* the example as included at "SET MSG" will fail, but works for
/* each of the above.
Best methods for obtaining and copying lines
(the following has been extracted from the CUT clist)
LOOP: ISREDIT (TEMPFLE) = LINE &LNEBGN.
PUTFILE TEMPFLE
SET &LNEBGN = &LNEBGN + 1
IF &LNEBGN > &LNEEND THEN GOTO CLOSIT
GOTO LOOP
CLOSIT: CLOSFILE TEMPFLE
(the following has been extracted from the PASTE clist)
/* */
/* PASTE : TAKE THE OUTPUT DATASET */
CONTROL NOFLUSH NOLIST NOMSG
ISREDIT MACRO NOPROCESS
ALLOC F(TEMPFLE) DA('&DATASET') SHR REUSE
ISREDIT PROCESS DEST
/* it is important to check return code -- refer to manual*/
/* also see the clists CUT and PASTE */
ISREDIT (DEST) = LINENUM .ZDEST
SET DEST = &DEST
OPENFILE TEMPFLE INPUT
LOOP: GETFILE TEMPFLE
/* Corrections above and below, D.MCRITCHIE 4/24/91 */
ISREDIT LINE_AFTER &DEST = (TEMPFLE)
SET &DEST = &DEST + 1
GOTO LOOP
For an example of the old clist SYSOUTTRAP see the @STRAP edit macro on page
&pg@STRAP, which shows codings for both REXX and clist.
Coding to create a new member using vanilla TSO edit.
IF &SYSPREF = THEN SET PREF = &SYSUID
ELSE IF &SYSPREF = &SYSUID THEN SET PREF = &SYSUID
ELSE SET PREF = &SYSPREF..&SYSUID
ALLOCATE FI(OUTFILE) DS('&SCDS(MASTTEMP)') SHR REUSE
OPENFILE OUTFILE OUTPUT
SET OUTFILE = &STR(.* This member was created by an ISPF dialog)
PUTFILE OUTFILE
SET OUTFILE = &STR(.* It will get replaced -- do not change it)
PUTFILE OUTFILE
SET OUTFILE = .im MASTSG1A
PUTFILE OUTFILE
SET OUTFILE = .im A&PNUM
PUTFILE OUTFILE
SET OUTFILE = .im MASTSG3A
PUTFILE OUTFILE
CLOSFILE OUTFILE
FREE FI(OUTFILE)
Calling a Subprocedure
Note:
&A contains a variable value
B contains a variable name
Returning Information from a Subprocedure
- Return codes
- SYSREF variables
- NGLOBAL variables e.g. NGLOBAL variable <... variable>
The following example has been modified from the example in TSO Extension CLISTs
SC28-1304. Comments may have to be removed for example to function.
PROC 0
SET &A = AL
SET &B = Jr.
SYSCALL XYZ JONES &A B /* pass parameters to XYZ */
WRITE &PARM1, &PARM2 &PARM3 /* result: JONES, AL Jr. */
WRITE Jones, // &A. &B.
XYZ: PROC 3 PARM1 PARM2 PARM3 /* receive parameters on PROC stmt */
SYSREF PARM3 /* indicate parm3 holds a variable name */
WRITE &PARM1, &PARM2 &PARM3 /* result: JONES, AL Jr. */
SET PARM1 = NPARM1
SET PARM2 = NPARM2
SET PARM3 = NPARM3
END
END
results
JONES, AL Jr. /* Result: JONES, AL Jr. */
,
Jones, // AL NPARM3
PROC 0
SYSCALL XYZ 0258 CCRBG
SYSCALL XYZ 0267 IS03
SYSCALL XYZ 0258 C047
SYSCALL XYZ 0258 BWMRB
SYSCALL XYZ 0258 TCDDE
SYSCALL XYZ 0267 I047
SYSCALL XYZ 0267 IS0B
EXIT CODE(0)
XYZ: PROC 2 ACCT PIC#
SET NEWACCT =
WRITE &ACCT. &PIC#.
IF 0258 = &ACCT. THEN DO
IF &DATATYPE(&SUBSTR(2:2,&PIC#.99999)) ª= NUM AND &DATATYPE(&SUBSTR & &
(3:3,&PIC#.99999)) ª= NUM AND &DATATYPE(&SUBSTR(4:4,&PIC#.99999)) ª= NUM
AND &DATATYPE(&SUBSTR(5:5,&PIC#.99999)) ª= NUM THEN DO
SET NEWACCT = &STR(D-)&SUBSTR(1:2,&PIC#.99)
WRITE &B. NEWACCT = &NEWACCT FOR &ACCT. &PIC#.
END
END
END
results
COMMAND INVOKING @STRAPQ CLIST MACRO ===> @STRAPQ fixusera
0258 CCRBG
NEWACCT = D-CC FOR 0258 CCRBG
0267 IS03
0258 C047
0258 BWMRB
NEWACCT = D-BW FOR 0258 BWMRB
0258 TCDDE
NEWACCT = D-TC FOR 0258 TCDDE
0267 I047
0267 IS0B
PFK Usage in CLISTs
To show pfkeys or not to show pfkeys
PFSHOW ON|OFF <--- on ISPF
ISPEXEC VGET (ZPFCTL)
SET SVPFCTL = &ZPFCTL.
&ellipse.
SET ZPFCTL = &SVPFCTL.
ISPEXEC VPUT (ZPFCTL)
To change a PFKEY for duration of a clist
KEYS (and then make changes) <--- on ISPF
ISPEXEC VGET (ZPF04)
SET SVPF04 = &ZPF04.
&ellipse.
SET ZPFC04 = &SVPF04.
ISPEXEC VPUT (ZPF04.)
Prefix and userid usage in CLISTs
Since some individuals will be running with PREFIX off, clists should provide
for this possibility. An example is found in SAS606.
IF &STR(&SASUSER) EQ THEN DO
IF &STR(&SYSPREF.) EQ &STR() -
THEN SET &SASUSER = &STR('&SYSUID..SAS606.SASUSER')
ELSE SET &SASUSER = &STR('&SYSPREF..SAS606.SASUSER')
An example of more generic nature can be found in the clist CSTSOP which stores
prefix for later related clists. This clist is initiated from panel VUTSOP or
VSTSOP used for on-line access to the SOP manual.
Library Access Services
Reference clist @DIRSTAT RESETDIR @DIR
hierarchy (order) of Library Management functions
Some examples of usage are the clists (or REXX executes) -- @DIR (directory
clist), @DIRSTAT, @SAVEX, RESETDIR (reset directory)
"(DSN018A) = DATASET" /* ---- example in REXX -------------- */
"LMINIT DATAID(XCCX) DATASET('"||DSN018A||"')"
"LMOPEN DATAID("||XCCX||") OPTION(INPUT)" /* use after LMINIT */
...
"LMMFIND DATAID("||XCCX||") MEMBER("||MEMBER||") STATS(YES)" "
...
"LMMSTATS DATAID("||XCCX||") MEMBER("||MEMBER||")" TOKEN
...
"LMCLOSE DATAID("||XCCX||")" /* use when finished LMOPEN */
"LMFREE DATAID("||XCCX||")" /* when finished DATAID assigned by LMINIT*/
EXIT 1
If OPTION(OUTPUT) is used on LMOPEN such as for LMMDEL, then need an enqueue
value such as ENQ(SHRW) on the LMINIT. An example is the KILL clist.
LMINIT will assign to the DATAID named variable the name of a ddname. Had a
variable name been used then the variable name would have received the value.
Usage above in REXX is clear but use in clist language may pose a bit of diffi-
culty in interpretation. Recommend never using an ampersand with the DATAID on
the LMINIT in clist language (contrary to some examples in manuals).
To find out what Application Id you are in, enter:
====> TSO Q WHAT
+------------------------------------------------------------------------------+
| The following was attempted to see variables in for applid(lib@) |
| |
| TSO Q SELECT PANEL(ISRTXD1) NEWAPPL(LIB@) |
| |
| it did not work, but I am sure that I once had something that did. |
| It did attempt to invoke ISPEXEC SELECT PANEL(ISRTXD1) NEWAPPL(LIB@) |
| It did reset the Application Id, but the panel will not accept |
| the value since it goes out in flames on a dialog error. |
| The actual profile for LIB@ is in userid.ISPF.PROFILE(LIB@PROF). |
+------------------------------------------------------------------------------+
PANEL NAME = ISRYVPN MESSAGE NAME = ISPZZ100
--------------------------------- VARIABLES -------------------- ROW 1 OF 431
COMMAND ===> SCROLL ===> PAGE
ADD/DELETE/CHANGE VARIABLES. UNDERSCORES NEED NOT BE BLANKED.
ENTER END COMMAND TO FINALIZE CHANGES, CANCEL COMMAND TO END WITHOUT CHANGES.
VARIABLE P A VALUE APPLICATION: ISR
'''' Z_______ S N
'''' ZAPLCNT_ S N 0000
'''' ZAPPLID_ S N ISR
'''' ZCOLORS_ S N 0007
'''' ZDATE___ S N 89/07/20
'''' ZDATEF__ S N YY/MM/DD
'''' ZDATEFD_ S N YY/MM/DD
'''' ZDAY____ S N 20
'''' ZDBCS___ S N NO
'''' ZENVIR__ S N ISPF 2.3MVS/XA TSO
'''' ZHILITE_ S N YES
'''' ZJDATE__ S N 89.201
'''' ZLOGNAME S N IS03.SPFLOG4.LIST
'''' ZLOGON__ S N TECH
'''' ZLSTLPP_ S N 0060
'''' ZLSTNAME S N
'''' ZLSTNUML S N 0000
'''' ZLSTTRUN S N 0120
'''' ZMONTH__ S N 07
'''' ZPREFIX_ S N IS03
'''' ZSCREEN_ S N 2
'''' ZSCREEND S N 0027
'''' ZSCREENW S N 0132
'''' ZSCRMAXD S N 0027
'''' ZSCRMAXW S N 0132
'''' ZSPLIT__ S N NO
'''' ZTEMPF__ S N IS03.SPFTEMP2.CNTL
'''' ZTEMPN__ S N ISP20379
'''' ZTIME___ S N 20:43
'''' ZUSER___ S N IS03
'''' ZYEAR___ S N 89
'''' AMT_____ P PAGE
TSO Symbolic Variables -- used in REXX
refer to manual SC28-1883-0 TSO/E Ver 2 -- REXX reference, for more speci
Document Number: SC28-1883-07
fic information
refer to manual SC28-1882-0 TSO/E Ver 2 -- REXX User's Guide, for usage i
Document Number: SC28-1882-05
nformation
REXX
+------------------------------------------------------------------------------+
| |
| Symbolic value Use |
| |
| DATATYPE('expression') To determine if an expression is entirely |
| numeric. Returns either NUM or CHAR. |
| e.g. &datatype('3*2/4') results in NUM |
| |
| DATATYPE('expression',type) type |
| . |
| Alphameric(a-z,A-Z,0-9), Bits, C (mixed |
| SBCS/DBCS), Dbcs (double byte), |
| Lowercase, Mixed case, Number, |
| Symbol, Uppercase, Whole number, |
| heXadeciamal |
| |
| LENGTH('expression') To determine the number of characters in the |
| result of an evaluated expression. |
| |
| SUBSTR('string,from <,length <,pad>>) |
| substring |
| |
| SYSDSN('data set name') Check if dataset exits, returns "OK" or |
| other value. See page NCAPXB-1. |
| |
| INDEX('haystack,needle <,start>') an argument within a string. |
Locate
| Operands reversed compared to use of TSO |
| CLIST &SYSINDEX. POS() in in REXXSAA, |
| INDEX() is not so do not use INDEX(). |
| e.g. node1 = INDEX('dsname','.') + 1 |
| |
| POS('needle,haystack <,start>')Locate an argument within a string. |
| Approximates use of TSO CLIST |
| &SYSINDEX. |
| e.g. node1 = POS('.','dsname') + 1 |
| |
| LASTPOS('needle,haystack <,start>') Locate an argument within a string. |
| Approximates use of TSO CLIST |
| &SYSINDEX. |
| e.g. node1 = POS('.','dsname') + 1 |
| |
| VERIFY('string1','string2' <,<'opt'> <,start>>) | <
| Verify all characters in string1 are in |
| string2., optional padding character. |
| No equivalent in TSO CLIST language |
| e.g. node1 = POS('.','dsname') + 1 |
| |
| USERID() TSO/E userid |
+------------------------------------------------------------------------------+
| Other considerations converting to REXX from CLIST |
| SYSCAPS make up your own function, or use ARG from, or TRANSLATE |
| SYSLC make up your own function |
| WRITE, WRITENR use SAY, SAY and PULL |
| x=OUTTRAP(var,100) |
| Clist -- openfile, Getfile, closfile |
| REXX - filerec1 filerec2 filex |
| SYSCALL --> call |
| READ,READVAL put,parse |
| write,writenr say |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| REXX execute, hierarchy to invoke a REXX execute |
+------------------------------------------------------------------------------+
| See Using SYSPROC and SYSEXEC for REXX Executes in manual for more |
| information. Also see NOLOADDD flag in manual. |
| |
| EX x(y) EX |
| IS03.x.EXEC(y) |
| |
+------------------- |
| /* REXX */ Variable length records in CLIST |
+------------------- |
| |
| ddname(SYSEXEC) Fixed length records |
| LIBR.EXEC |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| Example -- IS03.LIBR.CLIST(REXX) |
+------------------------------------------------------------------------------+
| /* REXX -- NEXT TIME WILL RUN REXX FROM IS03.LIBR.EXEC(REXX) */ |
| "EXECUTIL SEARCHDD(YES)" |
| "ALLOC FILE(SYSEXEC) DATASET(LIBR.EXEC) SHR REUSE" |
| "FREE DS('SYS1.BRODCAST')" |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| Example -- IS03.LIBR.EXEC(REXX) |
+------------------------------------------------------------------------------+
| /* REXX - EDIT A REXX MEMBER IN "SYSVAR(SYSUID)".LIBR.EXEC */ |
| /* ------- THE FOLLOWING CODE IS IN "SYSVAR(SYSUID)".LIBR.CLIST(REXX) */ |
| /* "EXECUTIL SEARCHDD(YES)" */ |
| /* "ALLOC FILE(SYSEXEC) DATASET(LIBR.EXEC) SHR REUSE" */ |
| /* ---- NEXT CALL TO REXX PICKS UP THIS CODE IN IS03.LIBR.EXEC(REXX)*/ |
| ARG membername |
| IF membername = '' THEN DO; SAY WHAT MEMBER DO YOU WANT?;PULL membername;EN |
| D; |
| /* THERE APPEARS TO BE A BUG IN REXX CALLING A CLIST WHEN THE */ |
| /* CLIST HAS A SYSOUTTRAP OR AN LD --- FUTHER INVESTIG. NEEDED*/ |
| "$EDIT '"SYSVAR(SYSUID)".LIBR.EXEC("membername")' NEW REXX" | "
| IF RC ª= 0 THEN |
| SAY "RC="RC "$EDIT '"SYSVAR(SYSUID)".LIBR.EXEC("membername")' NEW" |
| EXIT |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+ | REXX -- Data Stack commands and use Data elements can be placed into the | | top(PUSH) or bottom(QUEUE) of a queue stack, can only be drawn(PULL) from | | the top. | +------------------------------------------------------------------------------+ | PUSH g56 top, place data into top of stack | | PULL g55 from top of stack, will proceed through Buffer ares | | till all elements have been retrieved. | | QUEUE g57 tail, place data into bottom of stack (bottom of BUF) | | QUEUED() g97 # lines in queue, also includes buffer areas | | | | 'MAKEBUF' g165 makes a new buffer area (substack) | | 'DROPBUF' g166 drops buffer created by MAKEBUF (substack) | | DROPBUF 0 will empty the original datastack 0 and | | each buffer created by a MAKEBUFF -- buffer 1, | | buffer 2, etc. This should be used with extreme | | cautions because it will also clear out stacks be- | | fore your exec was invoked. | | | | 'QBUF' g166 # of buffers (number of MAKEBUF in effect in current | | stack) | | 'QELEM' g167 # elements in a current buffer area (if QBUF=0 so will | | QELEM) | | | | NEWSTACK g170 Create a new data stack | | DELSTACK g172 delete stack created by NEWSTACK | | 'QSTACK' g172 # total number of stacks in effect (1 + each new | | stack) | +------------------------------------------------------------------------------+ | Items above with # (QUEUED(),QBUF,QELEM,QSTACK all supply the number in RC | | (return code) used immediately after. To prevent a language processor from | | searching the data stack, you can issue a PARSE EXTERNAL instead of PULL. | | PARSE EXTERNAL will get input directly from your terminal. | +------------------------------------------------------------------------------+ | Elements left in the stack will be treated as TSO commands at the end of the | | REXX exec. e.g. COMMAND command_name NOT FOUND | | | | In order to clear a stack ..... | +------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| TRANSLATE function |
+------------------------------------------------------------------------------+
| TRANSLATE(string,to,from); This is the same as PLI when all three entries |
| are provided, and the second and third are the same length. |
| |
| TRANSLATE(string,tableo,tablei,pad); if both tables are missing the func- |
| tion returns capitals. If the output table is missing or shorter than the |
| input table, the output table is padded with the pad character. If the out- |
| put table is longer than the input table the extra characters will be ig- |
| nored. If duplicates appear in the input table only the first occurrence of |
| the character is meaningful. |
| |
| x = TRANSLATE('abcdef') --> ABCDEF |
| x = TRANSLATE('abcdef','cbbF','abcf') --> cbbdeF |
| x = TRANSLATE('abcdef','12','ec) --> ab2d1f |
| x = TRANSLATE('abcdef','12','abcd','.' --> 12..ef |
| x = TRANSLATE('abcdef','oneway','fedcba','.' --> yaweno |
| |
| REXX does not provide a specific function to translate upper to lowercase or |
| from lowercase to uppercase; however, you can make your own functions and |
| even name the same as you used in TSO clists. See the ANIMAL exec on page |
| &*XV953. There are three methods used there to effect such a translation. |
| to translate requires setting |
| /* REXX -- ANIMAL */ |
| lowercase = 'abcdefghijklmnopqrstuvwxyz' |
| UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| animal = "Fox" |
| animal1=translate(animal) |
| animal3=translate(animal,uppercase,lowercase) |
| animalf=syscaps(animal) /*function defined elsewhere*/ |
| parse upper var animal animalp |
| SAY animal animal1 animal3 animalF ANIMALp |
| animal = 'Fox' |
| animal1=translate(animal) |
| lowercase = 'abcdefghijklmnopqrstuvwxyz' |
| UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| animal3=translate(animal,uppercase,lowercase) |
| parse upper var animal animalp |
| SAY animal animal1 animal3 ANIMALP, animalp |
|--------- |
| results: |
| Fox FOX FOX FOX FOX |
+------------------------------------------------------------------------------+
| To simply translate a variable to uppercase you may use the TRANSLATE func- |
| tion with only the first operand. |
| ARG = TRANSLATE(ARG) |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| separating a dsname(member) into its components |
| |
| dsn = 'IS03.LIBR.CNTL(XYZ)' |
| PARSE VAR dsn dsname '(' member |
| member = STRIP(member,t,')') |
+------------------------------------------------------------------------------+
| Arithmetic operations in REXX execs are hierarchical, whereas in TSO clists |
| they are on an as encountered basis. |
+------------------------------------------------------------------------------+
| INTERPRET ... g177 |
+------------------------------------------------------------------------------+
| EXECIO ... g178 |
| |
| "EXECIO * DISKR ddname <start> (FINISH |
| |
| (STEM varpool.1 |
| (STEM varpool.2 |
| (STEM varpool.3 |
| etc. |
| |
| (FINIS, closes file after reading it, available to other users |
| (STEM, read list of compound variables |
| (SKIP, skip over specified number of lines |
| (LIFO, uses PUSH to place information on the stack |
| (FIFO, uses QUEUE to place information on the stack |
| |
| In order to obtain records beyond a null line, if stack contains may contain |
| null lines. |
| |
| n=QUEUED() |
| "EXECIO" n "DISKW outdd (FINIS" |
| |
| When the stack is exhausted, requests will be made for more input from the |
| terminal. This can be prevented using |
| |
| QUEUE '' to indicate a null line, and end of information |
| |
| * is all lines until null line encountered or , nn lines. |
+------------------------------------------------------------------------------+
| |
| QUEUE " to .... |
| |
| Return Codes from EXECIO |
| 0 Normal completion |
| 1 Data was truncated during DISKW operation |
| 2 EOF during DISKR or DISKRU |
| 20 Severe Error |
+------------------------------------------------------------------------------+
EXECIO -- Copying an Entire Data Set
"ALLOC DA(my.input) F(datain) SHR REUSE"
"ALLOC DA(new.input) F(dataout) LIKE(my.input) NEW"
"NEWSTACK" /* Create a new data stack for input only */
"EXECIO * DISKR datain (FINIS"
QUEUE '' /* Add a null line to indicate the end of the */
/* information */
"EXECIO * DISKW dataout (FINIS"
"DELSTACK" /* Delete the new data stack */
"FREE F(datain dataout)"
n = QUEUED() /* Assign the number of stack items to "n" */
"EXECIO" n "DISKW dataout (FINIS"
EXECIO -- Copying an Entire Data Set into Compound Variables
"ALLOC DA(old.data) F(indd) SHR REUSE"
"EXECIO * DISKR indd (STEM newvar."
DO i = 1 to newvar.0
SAY newvar.i
END
EXECIO -- Copying from Compound Variables
"ALLOC DA(new.data) F(outdd) LIKE(old.data) NEW"
"EXECIO 10 DISKW outdd (STEM NEWVAR."
+------------------------------------------------------------------------------+
| Problems with REXX encountered so far: |
| |
| REXX calling a TSO clist, where the TSO CLIST got a RC=4 within |
| terminated the TSO clist by REXX. Problem solved by the addition |
| of CONTROL NOFLUSH and CONTROL FLUSH around code within the |
| TSO clist. The TSO clist worked fine by itself and within other |
| TSO clists. |
| |
| The other problem encountered is the old TSO macro clist problem |
| -- creating a DATALINE where the content contains an quote (single or |
| double) or an ampersand. |
| |
| The correct solutions in CLIST is |
| ISREDIT LINE_AFTER lptr = (LINEDATA) |
| (*** where LINEDATA is a variable, do not use ampersands on |
| this one ***) |
| |
| The correct solutions in REXX is |
| "LINE_AFTER" lptr"= (LINEDATA)" |
| (*** where LINEDATA is a variable ***) |
| |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
| This sequence is to pull out the datasetname from a line of code if it is |
| there. |
| |
| Will it work if there is not comma at end |
| DISP=SHR,DSN=xxxxxx.xxxxxx |
| |
| IF POS("DSN=",inline)<>0 THEN, |
| PARSE VAR inline . "DSN=" DSN "," . |
+------------------------------------------------------------------------------+
REXX, insertion of commas into numeric fields
+------------------------------------------------------------------------------+
| REXX does not provide any Picture type editing capability. The following |
| coding demonstrates how one can insert commas into the numeric output for |
| readability. |
+------------------------------------------------------------------------------+
| /*** 05/20/94 19:16:45 FROM IS03.PC.CMD(SRCHALL) -- LINES 94-101 */ |
| |
| line = substr(oldkey,1,46), |
| right(insert_commas(totdir),12); |
| call lineout file2,line |
| line = substr(' ',1,46) '------------'; |
| call lineout file2,line |
| line = substr("Total in all directories",1,46), |
| right(insert_commas(totall),12); |
| call lineout file2,line |
| |
| /*** 05/20/94 19:19:14 FROM IS03.PC.CMD(SRCHALL) -- LINES 171-186 */ |
| |
| Insert_commas: Procedure; |
| /**** Picture/Edit function for REXX */ |
| /**** created by John Kennedy for D.McRitchie 03/16/94*/ |
| /**** fractions and negative numbers added D.McR */ |
| Parse arg Integer"."Fraction; |
| Group = Length(Integer) - 2; |
| Edited = Substr(Integer, Max(Group, 1)); |
| Old_group = Group; |
| Do while (Old_group > 1); |
| Group = Max(1, Old_group - 3); |
| Group_length = Old_group - Group; |
| Edited = Substr(Integer, Group, Group_length)","Edited; |
| Old_group = Group; |
| End; |
| If Fraction \= "" then Edited = Edited"."Fraction; |
| Return Strip(Edited); |
+------------------------------------------------------------------------------+
+------------------------------------------------------------------------------+
|+---------------------------------------------------------------------------+ |
|| Imbedded file listings: Although a specific macro was created here to | |
|| effect imbeds without any conversion change/loss, the | |
|| 'SCRIPT.r40.MACLIB(IMFILE)' (current $DCF=4.0.0) macro will do at least | |
|| as well. The IMFILE macro relies on the of the .PX Script control word. | |
|| Usage would be as follows: | |
|| | |
|| .dd member dsn 'SYS1.USERPROC(member)' | |
|| .imfile member | |
|+---------------------------------------------------------------------------+ |
+------------------------------------------------------------------------------+
oInteresting point: In the above the ISREDIT LABEL would not work until the
word LABEL was capitalized.
In a REXX execute it is much easier to pass quotes around a parameter than to
pass quotes with a token in a clist.
TOKEN is basically a simplified version of PATTERN, which was used as a basis
for determining coding changes needed in converting the PATTERN clist in
"IS03.LIBR.CLIST(PATTERN)" to the PATTERN REXX execute in
"IS03.LIBR.EXEC(PATTERN)". Both forms of PATTERN will be shown below. The .
clist will be shown first.
PATTERN 'IS03.LIBR.CLIST(PATTERN)' macro clist pattern
PATTERN 'IS03.LIBR.EXEC(PATTERN)' REXX exec macro pattern
PATTERN 'IS03.LIBR.TEXT(PATTERN)' script doc. pattern (not
shown)
QHELP 'sys1.tsoclist(QHELP)' tso help info into file in
edit
QHELP@ 'sys1.tsoclist(QHELP@)'
REXX 'IS03.LIBR.CLIST(REXX)' set up to find within .EXEC
REXX 'IS03.LIBR.EXEC(REXX)' find within .EXEC afterwards
REX#TERM 'IS03.LIBR.EXEC(REX#TERM)' ex. changes to terminals list
home 'IS03.libr.clist(home)' set up pfkeys for home (no
good)
token 'IS03.LIBR.CLIST(GDGNEW)'
The above clist is probably working. If must be invoked in one of the following
forms.
===> TSO HOME H
===> TSO HOME W
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Some Things to AVOID in MACROS or at least be aware of
Placing NOTELINE after .ZLAST
Placing a NOTELINE after .ZLAST can cause interference with later macro use as
illustrated in the following MACRO. Such practice can interfere with the CUT
macro for instance. (ETR 8E852,149)
EDIT---- IS03.LIBR.CLIST(zz) - 01.00 - COLUMNS 001 124
COMMAND ===> SCROLL ===> CSR
****** **************************** TOP OF DATA ***************************
**
000001 ADDRESS "ISREDIT"; /*REXX*/
000002 /* 1. RUN AS IS */
000003 /* 2. MOVE BOTTOM NOTELINE CREATED AFTER LINE 08 */
000004 /* 3. CC RANGE, CC ON LINE 08 AND 09 */
000005 /* 4. C3 ON LINE 08 */
000006 /* 5. C999 ON LINE 08 -- FAILS RC=16 */
000007 /* FAILS RC=28 W/O CONTROL ERRORS RETURN */
000008 /* 6. C2 ON LINE 08 -- FAILS RC=26 */
000009 /* FAILS RC=28 W/O CONTROL ERRORS RETURN */
000010 /******************************************************************/
000011 /* 19:45:16 RANGE C IS 000001 TO 000016, CMD=, RC=4 --STEP 1. */
000012 /* 19:45:30 RANGE C IS 000008 TO 000009, CMD=C, RC=0 --STEP 3. */
000013 /* 19:45:38 RANGE C IS 000008 TO 000009, CMD=C, RC=0 --STEP 4. */
000014 /* 19:45:50 RANGE C IS 000000 TO 000000, CMD=C, RC=16 --STEP 5. */
000015 /* 19:46:59 RANGE C IS 000000 TO 000000, CMD=C, RC=16 --STEP 6. */
000016 /******************************************************************/
000017 "MACRO NOPROCESS"
000018 ADDRESS "ISPEXEC" "CONTROL ERRORS RETURN"
000019 "PROCESS RANGE C";LASTCC=RC
000020 IF LASTCC /=0 THEN SAY 'PROCESS RANGE C, LASTCC='LASTCC
000021 ZEDSMSG = ZERRSM
000022 ZEDLMSG = ZERRMSG ZERRLM
000023 ADDRESS "ISPEXEC" "SETMSG MSG(ISRZ000)"
000024
000025 "(CMD) = RANGE_CMD"
000026 "(LABF) = LINENUM .ZFRANGE"
000027 "(LABL) = LINENUM .ZLRANGE"
000028 "LINE_BEFORE .ZF = NOTELINE """TIME('N'),
000029 " RANGE C IS" LABF "TO" LABL", CMD="CMD", RC="LASTCC""""
000030 "LINE_AFTER .ZL = NOTELINE 'XXXXX'"
****** ************************* BOTTOM OF DATA ***************************
**
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
[Appendix-V INDEX]
This list may serve as a guide to examining and/or ordering manuals; however, please do not order manuals blindly. Please verify beforehand that the manual numbers are still current. If you order an out of date manual you could be paying a higher price for obsolete material. Never include the 1 or 2 digit suffix number when ordering. Even though a manual is listed you may have absolutely no interest in the manual. Manuals may be examined in the SYSTECH library but are not to be removed from the library. The SYSTECH library and it's contents are for the express needs of SYSTECH personnel.
Do NOT order the following manuals by name or number These was created a long time ago and the manuals have probably changed. But this may help you find the manuals that you need.
SC34-4253 EDIT MACROS
GC28-1274 TSO Terminal User's Guide
SC28-1876 TSO Extensions CLISTs.
SC34-4112 ISPF Dialog Management Guide and Reference %OK%
SC34-4117 ISPF Customization
SC28-1883 TSO/E Ver 2 -- REXX Reference
SC28-1882 TSO/E Ver 2 -- REXX User's Guide, for usage information
You can obtain more current information on the IBM BookManager® BookServer Library http://ppdbooks.pok.ibm.com:80/cgi-bin/bookmgr/bookmgr.cmd/libraryI have created a list of some of the manuals available there.
Please send your comments concerning my pages or materials to: David using send email comments
Disclaimer and site usage: Material at The REXX Macros Toolbox is available without warranty of any kind. Redistribution of source, coding and documentation other than from this site is prohibited.
Copyright © 1995 - 2006, F. David McRitchie, All Rights Reserved