Delete alias



Ask queries about other IBM Tools like Tivoli, COBTEST, Fault Analyzer, z/OS File Manager, Workload Simulator, APA, SCLM, Merge & Migration Tools etc...

Delete alias

Postby brummm » Wed Nov 05, 2014 4:25 pm

Hello everybody.

I need to modify the dataset related to a ALIAS.

Since I did not found any "MODIFY"||"UPDATE"||"ALTER" command, I'm trying to delete a alias and then redefine it bellow as follows.

//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
 DELETE <alias name> ALIAS
 DEFINE ALIAS (NAME(<alias name>) -
 RELATE(<dataset name>))
/*   


This is working, but, if the ALIAS isn't created yet, it gives me a RC 8 on the deletion, which says that "ENTRY <aliasname> NOT FOUND".

Is there a way to test if the alias exists and then delete it only if it's true?

---------

Or there is any better solution to do what I need to do? That is:
I'm recovering information that was migrated from DB2 to disk/tape through weekly PROC. The data to be recovered is separated by months and the dataset names follows this organization.
But the rules for the recovery (such as time frame, transaction type, values, etc) are stored on a DB2 table. In one week, we could have three months to recover and in the next week, none.

Since the datasets that are source to my recovery are not a constant, I need to make its names available to JCL. First, my solution was defining a dataset on a first JOB that was written from a cobol program with only one line that was:
 SET DATEDS=YYYYMM

and then include it on a second job. But here on my shop, include is not allowed.

Then I tryed the solution above with IDCAMS.

Thanks in advance and sorry by bad english.
brummm
 
Posts: 2
Joined: Wed Oct 01, 2014 7:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Delete alias

 

Re: Delete alias

Postby NicC » Wed Nov 05, 2014 7:29 pm

Just ignore the RC=8 from the delete, SET MAXCC=0 and then do the define. If the define fails then that is the return code that is given in your output.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2702
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Delete alias

Postby brummm » Thu Nov 06, 2014 3:42 pm

NicC wrote:Just ignore the RC=8 from the delete, SET MAXCC=0 and then do the define. If the define fails then that is the return code that is given in your output.


Let me see if I understood it correctly.

What I should do (and did) is:
SET MAXCC=0
DEL (<ALIASNAME>) ALIAS
DEFINE(NAME(<ALIASNAME) RELATE(DATASETNAME))


And then, if the DEFINE fails, I get the return code of the DEFINE instruction only. No need to SET MAXCC to another value after DELETE and before DEFINE?

If this is right and I have to do, lets say, four deletes, do I have to SET MAXCC before every DELETE instruction?
brummm
 
Posts: 2
Joined: Wed Oct 01, 2014 7:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Delete alias

Postby BillyBoyo » Thu Nov 06, 2014 8:02 pm

A better way to go at it is to use the IF available. Then you can be in control of things, rather than hiding a problem.

Try a quick internet search for - idcams modal commands. I can't do a link for you as it is refusing to connect to the IBM site at the moment :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Delete alias

Postby Terry Heinze » Thu Nov 06, 2014 8:02 pm

I use:
       IF         LASTCC LE 08 THEN
           DO
               SET MAXCC EQ 00
           END

after a single IDCAMS command and prior to a DEFINE and
       IF          MAXCC LE 08 THEN
           DO
               SET MAXCC EQ 00
           END

after multiple IDCAMS commands and prior to a DEFINE.
.... Terry
Terry Heinze
 
Posts: 193
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times

Re: Delete alias

Postby BillyBoyo » Thu Nov 06, 2014 8:15 pm

That's the stuff I mean, Terry. "modal commands" it's called, though not bothered to find out why :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to Other IBM Tools