Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rexx macros to view given member in a PDS

Status
Not open for further replies.

vissesh

Technical User
Jun 15, 2012
8
US
Hi,

I am new to REXX. I have the below requirement:

In ISPF, we enter 3.4, ENTER and give the PDS name and enter, TYPE M or S to display the list of members and then select E or B or V to do action on the member(s)

This must be automated.

On the command line (ISPF first screen after logging), I need to give below commands:

TSO JOB JOBNAME - The job must be displayed in VIEW mode from my production PDS. If member not found, it must say that message.

TSO SRC SOURCENAME - The source module must be displayed in VIEW mode from my production dataset.If member not found, it must say that message.

TSO CPY COPYBOOK NAME - Same as above for displaying COPYBOOK
TSO DCL DCLGENNAME - Same as above for displaying DCLGEN for a table
TSO PARM PARMNAME - Same as above for displaying the Parn
TSO PROC PROCNAME- Same as above for displaying Procedure
TSO TBL TABLENAME- Same as above for displaying TABLE DETAILS
TSO PSB PSBNAME - - Same as above for displaying PSB DETAIS

For example,
TSO JOB ABCDEFG
TSO PGM ABCDEFG
TSO PARM ABCEDFG
etc..

PS: For all the above, we have the DATASET existing. This is just to select from a singly PDS.

Pls help me how to achieve the same.

thanks,
visva.


 
I'm presuming the dataset for "TSO JOB <name>" is a different dataset than for "TSO TBL <name>". You probably also want to discriminate between EDIT and VIEW, and you should realize that you can't just open an ISPTLIB member for EDIT without risking damage.

In other words, you really have to think lots more about what it is you're trying to do. You may decide some other route would be more productive. This is also not a project I would assign to someone "new to REXX", and all the old hands here are unlikely to do much design/coding/testing (as much as this task would require) without some form of remuneration.


Frank Clarke
--America's source for adverse opinions since 1943.
 
As Frank mentions, not a task for a learner.

Suggest you implement a few "practice" rexx exrcs before attempting this. Also suggest you create some new "just for testing" datasets/libraries rather than take the risk of damaging existing datasets.
 
All,

Thanks for your concerns. I shall ensure I would not break one. I shall apply to my development PDS before I go for next level.

rexxhead : Yes, all are separate PDS. Pls can you suggest me a probable solution? I am new to REXX but not to mainframes! So I am sure I can cope-up

Kindly assist me with just View option and not EDIT though!
 
Sure. 'JOB', 'PROC', 'PARM', etc should all be parameters to a routine (a router) which says "Hmmm... He wants to view PROC xyz... Where are those PROCs? Search thru them until we locate xyz. Display the text using (view/edit/browse/other)."

If you're in an ISPF environment, you can use services like LMMFIND to locate a member in a concatenation. You will have to precede the LMMFIND with LMOPEN and LMINIT to enable the LMMFIND, and you should LMFREE+LMCLOSE afterwards.

Inside every large problem there are whole families of little problems screaming to be let out. The programmer's task is to locate and free each of those little problems. Those with only a vague notion of what programming is about sometimes call this 'analysis' ;-)



Frank Clarke
--America's source for adverse opinions since 1943.
 
I found a thread in this forum thread277-1443229 having code to display the members of PDS with other details.

I tried to customise that with LMMFIND & LMMDISP. It displays the member name,but not the content of the member.

ISPEXEC LMMDISP DATAID(data-id) OPTION(DISPLAY) MEMBER(member)

Kinldy assist
 
2.37 LMMDISP--member list service

LMMDISP provides a flexible and efficient way of performing many of the tedious tasks associated with processing member lists.


Not members; member lists.

Edit, View, and Browse display the actual text of the member, BUT... if you've gotten this far, you are mere inches away from finishing. You already have a DATAID because of the LMINIT and you have the member because of the LMMFIND (or you may have already known the member name). Change the LMMDISP call to edit/view/browse and you are done.

Congratulations! You have just been promoted from 'bare-boned novice' to 'apprentice'.



Frank Clarke
--America's source for adverse opinions since 1943.
 
Oh, yes...

And don't do this:
[tt]
ISPEXEC LMMDISP ...
[/tt]

Yes, I know that's what the manual says, but the manual is wrong. The manual was written in CLIST-time for CLIST programmers. This is good CLIST syntax; REXX is different. CLIST operates strictly in what REXX programmers think of as 'address TSO'. REXX has other address spaces it can operate in, notably 'address ISPEXEC' and 'address ISREDIT'

Do:
[tt]
address ISPEXEC
"LMMDISP ... "
[/tt]

Why? Because your syntax gets handed to TSO which dispatches a fresh copy of ISPEXEC to handle your request. My syntax uses the existing copy of ISPEXEC already loaded and started to handle the request.



Frank Clarke
--America's source for adverse opinions since 1943.
 
rexxhead,

Many thanks for your assistance. I achieved it by this code below. I am able to open the member in VIEW mode.

But after the command is executed and if I press PF3, I see RC =4. I am not sure if I miss something obvious in syntax or need to check some thing. I see some examples having MACRO(MACNAME). Cud not confirm if that is causing, but for me I donot need a macro though!.

/********************REXX***********************/
PDSNAME = 'MY.PDS.JCL'
ARG MEMBR
/**********************************************************/
/* GET DATAID FOR DATA SET AND ISSUE LMOPEN */
/**********************************************************/
ADDRESS ISPEXEC
ISPEXEC "LMINIT DATAID("DATID") DATASET('"PDSNAME"') ENQ(SHR)"
ISPEXEC "LMOPEN DATAID("DATID") OPTION(INPUT)"
IF RC <> 0 THEN
CALL EXIT8 'ERROR OPENING PDS' PDSNAME 'RC='RC
/**********************************************************/
ISPEXEC "VIEW DATAID("DATID") MEMBER("MEMBR")"
IF RC <> 0 THEN
CALL EXIT8 'ERROR EDITING MEM' PDSNAME 'RC='RC
/**********************************************************/
/* FREE THE MEMBER LIST AND CLOSE THE DATAID FOR THE PDS. */
/**********************************************************/
ISPEXEC "LMMLIST DATAID(DATID) OPTION(FREE)"
ISPEXEC "LMCLOSE DATAID(DATID)"
EXIT8:
ARG ERRMSG
SAY ERRMSG
EXIT 08
/* */
 

I'm surprised it isn't ending RC=8. After the LMCLOSE, the code falls through to the "EXIT 08" statement. You should probably follow the LMCLOSE with "RETURN" so that the EXIT8 routine is never entered unless deliberately called.

Try running this in "Trace ?R" and see if anything looks peculiar.

You're still using ISPEXEC as a TSO verb. Tsk.

Frank Clarke
--America's source for adverse opinions since 1943.
 
Thanks Rexxhead!

I made changes accordingly. I am left out with one more requirement.

If the member is not found, I must say "Member not found" and exit.

I did add this patch below after LMOPEN

ADDRESS ISPEXEC
"LMMFIND DATAID("DATID") MEMBER("MEMBR") STATS(YES)"
IF RC <> 0 THEN
SAY "MEMBER NOT FOUND IN DATASET"
EXIT

But it says below error

*********************************************************************
ISPS107

Required parm missing
Not all required parameters were found for the LMMFIND service.



Current dialog statement:
LMMFIND DATAID(ISR00055) MEMBER() STATS(YES)


I missed something in the LMMFIND?
 
Did you pass a member name in to the routine? I see
Code:
ARG MEMBR
but when the LMMFIND executes, it's empty. That's wrong. Run it in TRACE ?R and see what's happening.

Frank Clarke
--America's source for adverse opinions since 1943.
 
rexxhead,

I have solved all issues and see it is working good. I allocate the rexx dataset using below command :

TSO ALLOC FI(SYSEXEC) DA('PDSNAME') SHR REUSE

And then I am able to invoke my TSO SRC PGMNAME etc.,

Every time I logon to TSO session, I had to run the ALLOC FI(SYSEXEC) command.

Is there any way, I need not run the SYSEXEC command everytime and by default, my functions be invoked? For ex, TSO TIME command can run just after we logon.
 
When you log on to TSO, do you see a screen where you can enter your password and change it if necessary and set your region size, etc.?

At the bottom of that screen is a "Command" prompt. You could write in there a command to do all your logon-time tasks: allocate libraries, run startup jobs, etc., and it will be remembered for future sessions.


That is a method-of-last-resort, however. Most installations have a standard start-up protocol whereby if you name a library in a certain way it will be allocated to SYSEXEC, name it a different way and it will be allocated to ISPPLIB, and so on. You should ask around to see if anyone is aware of the rules. System programmers are traditionally not very good at communicating such things and they quickly become village folk tales passed by word of mouth from generation to generation.

There is a way to "hack" into an MVS system and I may outline it later if you're still having trouble.

Frank Clarke
--America's source for adverse opinions since 1943.
 
Rexxhead,

I tried most of

ALLOC FI(SYSEXEC) DA('DATASET') SHR REUSE

but still it does not get allocated.
i also tried ALTLIB, TSOLIB, EXEC etc. but no use. this is the best option i wud say, as i can make it work simple.
 
SYSEXEC is a funny bird. Most of the time, it's OPEN and thus cannot be FREEd, and therefore cannot be re-allocated. See for a general-purpose logon-time customizer. I just realized that the documentation for ATTACH is not out there. Wait 10 hours and it will be as ~~/attach.doc.

For the time being, I suggest you create a routine in your command library to allocate what you need, and execute that package from the logon screen. Naturally, you won't be able to reallocate SYSEXEC, but you can add your library to SYSPROC.

Remember that SYSPROC is already allocated with a stack of datasets. When you reallocate, you must keep all those datasets in the concatenation or lose their functionality,















Frank Clarke
--America's source for adverse opinions since 1943.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top