Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Delete VSAM or flat file using a single rexx command

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Vinay N.G

New User


Joined: 15 Sep 2008
Posts: 36
Location: Bangalore

PostPosted: Tue May 12, 2009 9:12 pm    Post subject: Delete VSAM or flat file using a single rexx command
Reply with quote

Hi,

1) Please let me know if we can delete any VSAM or Flat file using the same command in REXX.

2) Is it possible for a REXX program to differentiate the input files
between VSAM and a flat file. If so how to find out whether the input file is a VSAM file or flat file(PS).
Back to top
View user's profile Send private message

Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2083
Location: Silicon Valley

PostPosted: Tue May 12, 2009 9:34 pm    Post subject: Reply to: Delete VSAM or flat file using a single rexx comma
Reply with quote

Use the LISTDSI built-in function to check the DSORG. Read Rexx Reference manual for more information.

And to delete a dataset, use the delete command
Code:
Address TSO 'DELETE ...'


I am not sure what you mean by 'using the same command in REXX.'
Back to top
View user's profile Send private message
Vinay N.G

New User


Joined: 15 Sep 2008
Posts: 36
Location: Bangalore

PostPosted: Tue May 12, 2009 9:43 pm    Post subject:
Reply with quote

Is it possible to track whether the delete is successful or not.. If so how to track it.

What if dataset is not present and we are trying to delete it.

I mean, in JCL if it happens like that, then we will set maxcc=0 right , in the same way can we don anything here in REXX so that it doesnt throw any error message if it tries to delete the dataset which is not catalouged.
Back to top
View user's profile Send private message
acs_amit

New User


Joined: 30 Apr 2009
Posts: 14
Location: Noida

PostPosted: Tue May 12, 2009 11:45 pm    Post subject:
Reply with quote

Suppose your dataset is:
DSN.A = 'A.B.C'

/*then to delete the dataset.. use*/

Address TSO
"delete '"||DSN.A||"'"


/*Now to check whether delete is successful use SYSDSN command..foe ex..*/

if sysdsn("'"||DSN.A||"'") = 'OK' THEN
SAY 'PROBLEM WITH DELETING THE DATASET'
Else
SAY 'DATASET HAS BEEN DELETED'

/* search for SYSDSN command in manuals.. */

I hope this will solve your query...
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 13, 2009 12:03 am    Post subject:
Reply with quote

Hello,

I believe that will not work if the dataset does not exist at the beginning. . . The delete will fail. . .
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2083
Location: Silicon Valley

PostPosted: Wed May 13, 2009 12:58 am    Post subject: Reply to: Delete VSAM or flat file using a single rexx comma
Reply with quote

use SYSDSN first to make sure it exits.

After DELETE, check the return code.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1243
Location: Israel

PostPosted: Wed May 13, 2009 1:27 am    Post subject:
Reply with quote

acs_amit wrote:
Suppose your dataset is:
DSN.A = 'A.B.C'

/*then to delete the dataset.. use*/

Address TSO
"delete '"||DSN.A||"'"


/*Now to check whether delete is successful use SYSDSN command..foe ex..*/

if sysdsn("'"||DSN.A||"'") = 'OK' THEN
SAY 'PROBLEM WITH DELETING THE DATASET'
Else
SAY 'DATASET HAS BEEN DELETED'

/* search for SYSDSN command in manuals.. */

I hope this will solve your query...


I use a different logic (one that hopefully works):
Code:
DSN.A = "'A.B.C'"

/* If the file is here, remove it */
/* If the delete fails, the program is ended */

If SYSDSN(DSN.A) = 'OK' Then
   Address TSO "DELETE "DSN.A
Isn't it easier?
The error can be trapped to allow housekeeping and a proper message.
Code:
SIGNAL ON ERROR
DSN.A = "'A.B.C'"

/* If the file is here, remove it */
/* If the delete fails, send appropriate message */

If SYSDSN(DSN.A) = 'OK' Then Do
   Address TSO "DELETE "DSN.A
   Say 'File 'DSN.A' has been deleted'
End

ERROR:
Say 'The return code from the command on line 'Sigl' is 'RC
Say 'Command is: 'SourceLine(Sigl)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts More than 1 Include criteria for sing... Roy Ware SYNCSORT 6 Wed Sep 13, 2017 11:45 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us