View previous topic :: View next topic
|
Author |
Message |
rookie 1987
New User
Joined: 29 Oct 2014 Posts: 7 Location: India
|
|
|
|
In ISPF 3.4 panel after pressing enter, I want to execute a command by the side of the file name which would change the first qualifier of the file and replace it with my User ID.
I have got the file name from the console window and I need to manipulate the file name and create the output file as below. Is this possible.
For example : XXX.CCC.FFF is the file
(MYID).CCC.FFF should be the output file.
Thank you |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Yes, it is possible. Something I have done before but don't have access to the MF for this contract so can't test anything.
BEWARE - Only if you are absolutely certain that the same user catalog is related to both aliases should you use the RENAME command.
OTHERWISE perform a copy to the new dataset name and only when that has completed perform the DELETE of the original dataset. |
|
Back to top |
|
|
rookie 1987
New User
Joined: 29 Oct 2014 Posts: 7 Location: India
|
|
|
|
Will you please throw some light on how to identify and delete the first qualifier of the file . I believe we can achieve it by WORD function in REXX. Any similar function that can be used here to achieve it ?
Thank you |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
Code: |
hlq = word(translate(dsname, '.', ' '), 1) |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Look at the ALTER command entered on the DSN line from 3.4
However, as stated earlier check the "alias relates" to avoid potential catalog mismatch problems. |
|
Back to top |
|
|
rookie 1987
New User
Joined: 29 Oct 2014 Posts: 7 Location: India
|
|
|
|
Robert ,
I believe your code works in REXX.
I am getting the filename dynamically from 3.4 panel
PROC 1 DSN
SET hlq = word(translate(&DSN, '.', ' '), 1) - this doesn't work
Hence this doesn't work. Any other ways to accomplish my requirement.
Thank you |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
I am not sure what a 'console window' is but why not use the Rename command available in 3.4 (paying heed to the caveats written about by Expat).
You never mentioned actually writing a program to do this but as you are - why are you using CLIST and not Rexx? |
|
Back to top |
|
|
rookie 1987
New User
Joined: 29 Oct 2014 Posts: 7 Location: India
|
|
|
|
By Console window , I meant after 3.4, giving the dataset and pressing enter, the window that I get
I'm trying to get the file name from 3.4 , rather than executing a REXX(say TSO rexx command). I prefer getting the file name and use it for manipulation downstream.
Suppose somebody gets to 3.4 and type this command, he should perform the operation seamlessly rather than give a TSO command.
Thank you |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
Ever thought about pressing PF1 when on the 3.4 screen, and then selecting option 2?
Code: |
TUTORIAL--------- DISPLAYED LIST - TSO COMMANDS/CLISTS/EXECS ----------TUTORIAL
COMMAND ===>
You can use TSO commands and CLISTs as data set list line commands.
For example, if you specify the TSO command LIST to the left of data
set USER.TEST.DATA, the effect will be the same as if you had entered
TSO LIST 'USER.TEST.DATA' on the COMMAND line.
The quoted fully-qualified data set name will be appended to the line
command during command expansion unless either the '/' character is used
or the unquoted fully-qualified data set name is the first argument of
the command.
If a TSO command, CLIST, or REXX exec issues a return code greater
than or equal to 8, processing will stop and an error message will be
displayed.
(continued on next page)
|
|
|
Back to top |
|
|
rookie 1987
New User
Joined: 29 Oct 2014 Posts: 7 Location: India
|
|
|
|
Very much
I know the rename works either ways but my requirement is to delete the first qualifier and then replace with my Userid.
Thank you |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
rookie 1987 wrote: |
Will you please throw some light on how to identify and delete the first qualifier of the file. |
PARSE will make it easier (supposing it's rexx):
Code: |
parse var dsname oldhlq '.' whatsleftofthedsname
newdsname = userid()'.'whatsleftofthedsname |
rookie 1987 wrote: |
By Console window , I meant after 3.4, giving the dataset and pressing enter, the window that I get |
Place "smiley tearing his hair off" here. |
|
Back to top |
|
|
rookie 1987
New User
Joined: 29 Oct 2014 Posts: 7 Location: India
|
|
|
|
Thanks Marso, I have the rexx code with me that works but just wanted to accomplish this by combination of tso commands.
Thank you |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
From the American movie Cool Hand Luke:
What we've got here is a failure to communicate
I know there is a language barrier, but this is the most non-understandable statement ever:
Quote: |
By Console window , I meant after 3.4, giving the dataset and pressing enter, the window that I get
I'm trying to get the file name from 3.4 , rather than executing a REXX(say TSO rexx command). I prefer getting the file name and use it for manipulation downstream.
Suppose somebody gets to 3.4 and type this command, he should perform the operation seamlessly rather than give a TSO command |
What dataset are you giving? They are all listed on the screen
Manipulating downstream where?
Type what command?
You need to hit the books and understand how Rexx and TSO commands work.
Quote: |
Thanks Marso, I have the rexx code with me that works but just wanted to accomplish this by combination of tso commands. |
If you have a Rexx that works, then what do you want that is different?
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
I know the rename works either ways but my requirement is to delete the first qualifier and then replace with my Userid. |
Can you clarify your requirement? 'Replacing the the HLQ with your userid' sound very much like you want to rename the data set. If you do not want to rename the data set, where do you want the replacing to occur? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
I believe your code works in REXX.
I am getting the filename dynamically from 3.4 panel
PROC 1 DSN
SET hlq = word(translate(&DSN, '.', ' '), 1) - this doesn't work
Hence this doesn't work. Any other ways to accomplish my requirement. |
It does not work because you are adding rexx syntax into a CLIST. The 'other way' you ask for is to actually use a rexx program instead of a clist. |
|
Back to top |
|
|
rookie 1987
New User
Joined: 29 Oct 2014 Posts: 7 Location: India
|
|
|
|
Thank you and that worked |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Quote: |
BEWARE - Only if you are absolutely certain that the same user catalog is related to both aliases should you use the RENAME command. |
Hello, Could you please explain why this should not be done?
I have done a lot of renames in my career without knowing the above precaution. And I have not run into any problems doing so. Or atleast I was not noticing that I was messing up the catalog.
Any layman explanation is welcome.
Thank you, |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
I believe that this may have been fixed in later releases, but when you did a rename in 3.4 the original dataset was catalog'd in a user catalog and upon rename was left in the original catalog, which may not have the alias from the master catalog pointing to that catalog.
Caused quite a few problems many years ago |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Hello Expat,
I renamed one of my user dataset and changed it to some other HLQ.
The dataset usercat automatically switched to the new HLQ's usercat.
Guess the issue has been fixed.
Regards,
Vasanth.S |
|
Back to top |
|
|
|