View previous topic :: View next topic |
Author |
Message |
kris_madras Beginner
Joined: 07 Apr 2004 Posts: 46 Topics: 29
|
Posted: Tue Apr 27, 2004 11:28 pm Post subject: Current PDS access in REXX |
|
|
Hi,
How to access a PDS from rexx program. i.e. If I execute rexx exec, it has to access the current pds and members. Please help me how to do this?
Thanks
sai krishna |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Apr 27, 2004 11:51 pm Post subject: |
|
|
kris_madras,
Code: |
/*rexx */
address isredit
" macro"
"(ds) = dataset"
Say 'The pds being execueted is 'ds'
|
This gives you the name of the dataset from where the rexx exec is being execueted. Once you have the name then you can use the examples shown in this topic to process the current PDS
http://www.mvsforums.com/helpboards/viewtopic.php?t=256&highlight=members
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
kris_madras Beginner
Joined: 07 Apr 2004 Posts: 46 Topics: 29
|
Posted: Wed Apr 28, 2004 12:03 am Post subject: |
|
|
Hi,
Lot of thanks for your reply. Could you please help me by correcting the code
its displaying THE PDS BEING EXECUETED IS DS.
Thanks and Regards,
Sai Krishna |
|
Back to top |
|
|
Maton_Man Beginner
Joined: 30 Jan 2004 Posts: 123 Topics: 0
|
Posted: Wed Apr 28, 2004 1:43 am Post subject: |
|
|
Too many quotes...take the last one off the last line of the code.
/*rexx */
address isredit
" macro"
"(ds) = dataset"
Say 'The pds being executed is 'ds _________________ My opinions are exactly that. |
|
Back to top |
|
|
Mike Beginner
Joined: 03 Dec 2002 Posts: 114 Topics: 0 Location: Sydney, Australia
|
Posted: Wed Apr 28, 2004 5:17 pm Post subject: |
|
|
The problem could be that you are not invoking the edit Macro correctly.
To use an edit macro you must be within the ISPF editor (or view but not browse). You issue the command, i.e. the member name where the Rexx is located (assumes that the Rexx is allocated to either SYSEXEC or SYSPROC) without prefixing it with TSO (space after TSO).
e.g. assuming that your Rexx is saved in the member FINDDS, then you should enter FINDDS on the command line within edit. If you enter the command TSO FINDDS then you will get the result that you have found.
I would advise using the TRACE command within the Rexx (I use TRACE I to start tracing and TRACE O to terminate the trace).
Here's two examples that use TRACE, one is when the Rexx is invoked incorrectly (note the RC(20) from the MACRO command i.e. a severe error because you aren't in EDIT, also note another error when you issue the DATASET EM command, again RC(20) because of the same reason). The second is the trace from when the edit macro is invoked correctly).
1)
3 *-* address isredit
4 *-* " macro"
>L> " macro"
+++ RC(20) +++
5 *-* "(ds) = dataset"
>L> "(ds) = dataset"
+++ RC(20) +++
6 *-* Say 'The pds being execueted is 'ds
>L> "The pds being execueted is "
>L> "DS"
>O> "The pds being execueted is DS"
The pds being execueted is DS
7 *-* Trace O
2)
3 *-* address isredit
4 *-* " macro"
>L> " macro"
5 *-* "(ds) = dataset"
>L> "(ds) = dataset"
6 *-* Say 'The pds being execueted is 'ds
>L> "The pds being execueted is "
>V> "DMI021.USER.EXEC"
>O> "The pds being execueted is DMI021.USER.EXEC"
The pds being execueted is DMI021.USER.EXEC
7 *-* Trace O _________________ Regards,
Mike. |
|
Back to top |
|
|
Manas Biswal Intermediate
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Thu Apr 29, 2004 9:12 am Post subject: |
|
|
Ravi,
You have to be in edit mode within the member of the PDS where you want to run the macro, not within the macro itself...Basically you have to allocate the macro library to sysproc and then open the member on which you want to run the macro and then simple give the macro name on the command line. That should run the macro.
Regards,
Manas |
|
Back to top |
|
|
Maton_Man Beginner
Joined: 30 Jan 2004 Posts: 123 Topics: 0
|
Posted: Thu Apr 29, 2004 10:12 pm Post subject: |
|
|
Without going into a lengthy explanation and summarising the text of the respective manuals....
The reason for the difference is that edit macros are invoked by the editor using the ISPF SELECT service. If you prefix them with TSO then they get invoked as a TSO command.
If you append your edit macro with % it will limit the search to the SYSPROC and SYSEXEC concatenation to speed things up. You can also prefix with ! if you write your macros in COBOL or some other compiled language and only ISPLLIB, STEPLIB, and LINKLST load libraries will be searched. _________________ My opinions are exactly that. |
|
Back to top |
|
|
Maton_Man Beginner
Joined: 30 Jan 2004 Posts: 123 Topics: 0
|
Posted: Thu Apr 29, 2004 10:17 pm Post subject: |
|
|
I should have said 'prefix' not 'append'... _________________ My opinions are exactly that. |
|
Back to top |
|
|
|
|