Wednesday, November 4, 2009

REXX

SETUP

/* REXX */
ADDRESS TSO
"ALLOC FILE(SYSEXEC)
DA('SYSLOC.TSO.COMMON.EXEC.FB','DBDCLOC.TSO.S0F.EXEC.FB',
'SYS1.SISPEXEC','NDVR.EDVTOOLS.REXX','RSXRR3.ROMMY.EXEC')SHR REUSE"
ISPF



_________________________

exec 'rsxrr3.share.rexx(SETUP)' in the initial command b4 logon





++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

KR-228* How to execute REXX codes

Addendum to the REXX crash course series.

4 ways to execute REXX codes

1.) Foreground execution

Prefix member name by EXEC within the member listing screen – the method we’ve been using so far.

2.) Another foreground method

Type TSO EXEC 'pds(rexx-member)' on the command line on any screen.

3.) Foreground again (most commonly used method)
• To run the rexx exec without giving specifying the path we can allocate the PDS containing the REXX member to SYSEXEC or SYSPROC -> these are the files that are searched to locate execs.
• Usually SYSPROC contains all user created CLISTS; so we can append our dataset to this (SYSPROC is like a dd-name to which datasets can be concatenated) -> use the ISRDDN command to check datasets allocated in your session.
• To allocate datasets to SYSPROC use the following TSO command: CONCAT FILE(SYSPROC) DA('pds name') SHR REUSE
• Now if your REXX code is called CREATOR then you can just say TSO CREATOR on any screen to invoke the tool. We can also say: %CREATOR
• One question is should I execute the CONCAT command each time I log into mainframes?
Yes - there are a couple of ways to circumvent this: take advantage of the initial logon screen where you can specify commands to be executed on logging in. Another option is that your mainframe might already have a specific dataset that is executed for each user on logging in; in this case just add the CONCAT step to this file.
4.) Running a REXX exec in batch

Write a jcl step to execute the tso program IKJEFT01.
In the SYSTSIN card we can give the TSO commands to be executed.
Ex:
//SYSTSIN DD * EX 'TEST.SS.REXX.EXEC(CREATOR)'
/*
If you want to pass arguments to your program, then use:
//SYSTSIN DD * %CREATOR arg1 arg2
/*
(CREATOR code should then have an ARG statement to capture the arguments).











http://www.tek-tips.com/viewthread.cfm?qid=1234003&page=9


tcurrier (Programmer)
23 May 06 10:55
In a Rexx exec, I am trying to concatenate 2 private libraries to ISPLLIB as follows:
CODE
ADDRESS TSO "ALLOC FI(MYLIB1) SHR DA('H2501S.T.DYNAMIC.LIBZ00')"
IF RC = 0 THEN CONCAT ISPLLIB MYLIB1
ADDRESS TSO "ALLOC FI(MYLIB2) SHR DA('H2501S.T.DYNAMIC.LIBZ01')"
IF RC = 0 THEN CONCAT ISPLLIB MYLIB2


I'm getting an error:

CONCAT- SPECIFIED DDNAME(S) ALREADY "OPEN"

Not sure if this belong in the 'Rexx' forum, but ... Thanks...

Tek-Tips Forums is Member Supported. Click Here to donate.
rexxhead (Programmer)
24 May 06 9:45
Not exactly REXX, but I don't believe there's an ISPF forum....

The error is because when ISPF starts, it OPENs all the ISPxLIB files. You can't concatenate to an already-open file. Not even CONCAT can do it.

Instead, you should LIBDEF:
CODE
address ISPEXEC "LIBDEF ISPPLIB DATASET ID('H2501S.T.DYNAMIC.LIBZ00') STACK"

This layers the datasets specified in "ID" above the current ISPLLIB. When you're finished using them,
CODE
address ISPEXEC "LIBDEF ISPPLIB"
and they evaporate.
Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster

tcurrier (Programmer)
24 May 06 14:10
Thanks... using your method, I wasn't able to get it to work, though:

"ISPEXEC LIBDEF ISPLLIB DATASET ID('H2501S.T.DYNAMIC.LIBZ00') STACK"
"ISPEXEC LIBDEF ISPLLIB DATASET ID('H2501S.T.DYNAMIC.LIBZ01') STACK"

"ISPEXEC SELECT CMD(H2545Z00)"
IKJ56500I COMMAND H2545Z00 NOT FOUND

ADDRESS LINKPGM 'H2545Z00'
+++ RC(-3) +++

"ISPEXEC SELECT PGM(H2545Z00)"
Link to 'H2545Z00' failed, abend code = x'00000806'.
-------------------------------------------------------------
"ISPEXEC LIBDEF ISPLLIB DATASET
ID('H2501S.T.DYNAMIC.LIBZ00','H2501S.T.DYNAMIC.LIBZ01')"

"ISPEXEC SELECT PGM(H2545Z00)"
CEE3501S The module H2545Z01 was not found.
------------------------------------------------------------
"ISPEXEC LIBDEF ISPLLIB DATASET
ID('H2501S.T.DYNAMIC.LIBZ00','H2501S.T.DYNAMIC.LIBZ01')"

ADDRESS LINKPGM 'H2545Z00'
CEE3501S The module H2545Z01 was not found.
-------------------------------------------------------------
THIS IS THE ONLY WAY I COULD GET IT TO WORK :

"ISPEXEC LIBDEF ISPLLIB DATASET
ID('H2501S.T.DYNAMIC.LIBZ00','H2501S.T.DYNAMIC.LIBZ01')"

"ISPEXEC SELECT CMD(H2545Z00)"

*** NOW IN H2545Z00 ***
*** NOW IN H2545Z01 ***

--------------------------------------------------------------

kevinf2349 (TechnicalUser)
24 May 06 14:24
Thats because in the initial attempt you effectively caused the first LIBDEF to be thrown aside for the second one.

The way you eventually got it to work is the correct method.

rexxhead (Programmer)
25 May 06 10:50

He STACKed the LIBDEFs, so he actually has all of them available. Notice that he also switched to "SELECT CMD(" as Doug Nadel advised him to do over on MVSHELP. I think that was "the answer".
Frank Clarke
Tampa Area REXX Programmers' Alliance
REXX Language Assn Listmaster

kevinf2349 (TechnicalUser)
25 May 06 13:19
Whoops...my bad... I completely missed the STACK.




Example:

ALLOC FI(NOTCAT) DA('dsn.not.catalog') +
SHR REUSE UNIT(SYSALLDA) VOL(vvvvvv)
ALLOC FI(MYDD) DA('cat.dsn.#1' +
'cat.dsn.#2' +
'cat.dsn.#3') SHR REUSE
CONCAT (MYDD,NOTCAT)
OPENFILE MYDD INPUT
...




TSO ISRDDN

SYSEXEC


TSOCMD = ALLOC F(SYSPROC) DA('') SHR REUSE"
ADDRESS TSO TSOCMD

No comments: