MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problems capturing HDELETE output

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 625
Topics: 175
Location: Stockholm, Sweden

PostPosted: Wed Nov 14, 2018 9:50 am    Post subject: Problems capturing HDELETE output Reply with quote

I have a Rexx script that is supposed to delete all files older than a specific number of days. The last part I'm having problem with is capturing the output from the HDELETE command rather than it being splattered over the screen.

I have tried using the msg('off') and the trapmsg('off') as well as the OUTTRAP command. Here is what I'm seeing in my results
Quote:

160 *-* x = OUTTRAP('alloc.')
161 *-* del_rc = 0
163 *-* address TSO delete_type "'"file_to_delete"'"
>>> "HDELETE 'migrated.filename"

ARC1001I migrated.filename DELETE FAILED, RC=0039, REAS=0008 <------ These lines are splattered onto the screen
ARC1139I ERROR PROCESSING RACF PROTECTED DATA SET, RECOVERY/RECALL/DELETE
ARC1139I (CONT.) TERMINATED
165 *-* select
say alloc.0
1
say alloc.1
DELETE REQUEST 00018053 SENT TO DFSMSHSM
say rc
0


Now, the file I'm trying to delete is one I'm not allowed to delete (so that's fine). If I run the SAME code against a non-migrated file (that I'm not allowed to delete either), I can capture the "error" using the following code
Code:

racf = 'SECURITY VERIFICATION FAILED'

x = OUTTRAP('alloc.')                                 
del_rc = 0                                             
                                                       
address TSO delete_type "'"file_to_delete"'"           
                                                       
select                                                 
                                                       
  when rc = 0 then                                     
    say "'"file"' deleted, date "creation_date         
                                                       
  when pos(racf,alloc.1) <> 0 then                     
    say "Couldn't delete "file" - no RACF authority"   


What do I need to do to capture the HDELETE output (the ARC1001I message etc) that I'm missing ?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Wed Nov 14, 2018 10:00 am    Post subject: Reply with quote

Why do you have a script rather than let the MGMTCLAS do what is required ???
That way there shouldn't be any RACF failings if you have DFhsm set up correctly.

If I recall correctly, DFhsm only writes to the log, it does not return a collectable output, so you will need to go to SDSF in your REXX and then go through the DFhsm log that is current.

Of course you will need to determine that any responses that you do collect are the latest ones, as in the ones that you want.

Good luck - I did have some code once but unfortunately mislaid it bonk

Of course, if the problem is merely the messages being issued, isn't there a parameter in the HDELETE that stops them being issued.

After a quick shufty - I don't think that there is
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 625
Topics: 175
Location: Stockholm, Sweden

PostPosted: Wed Nov 14, 2018 10:31 am    Post subject: Reply with quote

Quick reply to my question since I seem to have found/experimented the answer.
Code:

rc_39 = 'DELETE FAILED, RC=0039'                 
                                                 
if zdlmigr = 'NO' then                           
  do;del_cmd = 'DELETE'; wait = ''; end         
else                                             
  do;del_cmd = 'HDELETE'; wait = 'WAIT'; end                                                     

followed by (where delete_type is either DELETE or HDELETE)
Code:

address TSO delete_type "'"file_to_delete"'" wait           
                                                             
select                                                       
                                                             
  when delete_type = 'HDELETE' then                         
    do                                                       
      select                                                 
        when rc = 12 & pos(rc_39,alloc.1) <> 0 then         
          say "Couldn't delete "file" - no RACF authority"   
        otherwise
           /* Default result ??? */                                           
          "'"file"' deleted, date "creation_date             
      end                                                   
    end                                                     


seemed to do the trick
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Thu Nov 15, 2018 2:01 am    Post subject: Reply with quote

Well done, but, I do ask again, why do you not let the SMS management class deal with these expiries ?
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 625
Topics: 175
Location: Stockholm, Sweden

PostPosted: Thu Nov 15, 2018 4:05 am    Post subject: Reply with quote

Your question is valid. We've been having a discussion today related to GDPR, and I think the solution above will disappear if we use standardized DSN names that are deleted after 10 days.

(Still, it's a problem that enjoyed solving, and I won't be surprised if I can use the solution some time in the future)
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Thu Nov 15, 2018 6:01 am    Post subject: Reply with quote

Not sure if my CSIUTIL is on this forum, but I used that a lot in the past, quite a handy thing for storage admins.

If I remember rightly, an IDCAMS DELETE should also do the delete even if the dataset is migrated.
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group