Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to delete a VSAM dataset from inside a program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 5:58 am    Post subject: How to delete a VSAM dataset from inside a program
Reply with quote

Hi

I know someone will say 'RTFM' but Miss Google has been unable to help me find the right manual... I want to delete a VSAM cluster from inside a program without resorting to calling IDCAMS - seems like a lot of overhead.
I know in C, I can just call 'remove' for standard datasets, but it doesn't support deleting VSAM datasets.
I'm happy to drive the right assembler macro if someone can point me to the right book...
Back to top
View user's profile Send private message

steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 753
Location: The Universe

PostPosted: Fri Feb 15, 2019 7:27 am    Post subject:
Reply with quote

You have two choices:
  • You can run IDCAMS from your program. See Appendix D: Invoking Access Method Services from Your Program in DFSMS Access Method Services Commands. I know that will work as I have done it myself.
  • This is less complicated, but I think this will work most of the time. Use MVS dynamic allocation to allocate the cluster. Specify the equivalent of OLD in the DALSTATS key and DELETE in the DALNDISP key. After you have allocated the cluster use MVS dynamic allocation the free the allocation. That will delete the cluster.
Back to top
View user's profile Send private message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 7:28 am    Post subject:
Reply with quote

Some more digging...
It looks like SVC99 with KEY 5 and/or KEY 7 -might- do the trick. I'll try it. If folks that know more have advice, I'd love it...
Back to top
View user's profile Send private message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 7:30 am    Post subject:
Reply with quote

thanks steve ... just saw your post after i put mine up... will give it a shot
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 753
Location: The Universe

PostPosted: Fri Feb 15, 2019 11:08 am    Post subject:
Reply with quote

Dead minimum program to delete data set specified in parm text. No validation of any sort. Ends with RC=0, data set deleted, RC=12 delete failed, RC=16 allocation failed.
Code:
KILLVSAM CSECT
         USING *,12
         SAVE  (14,12),,*
         LR    12,15
         LA    15,SAVEAREA
         ST    13,4(,15)
         ST    15,8(,13)
         LR    13,15
         L     2,0(,1)             LOAD ADDRESS OF THE PARM TEXT
         LH    1,0(,2)             LOAD LENGTH OF PARM TEXT
         LA    0,2(,2)             COMPUTE ADDRESS OF THE PARM TEXT
         LR    15,1                COPY LENGTH TO REG 15
         LA    14,ADSN             COMPUTE DATA SET NAME ADDRESS
         MVCL  14,0                COPY PARM TEXT TO DATA SET NAME
         LA    1,A                 ALLOCATE THE DATA SET
         DYNALLOC ,
         LTR   15,15               RC OK
         BZ    FREE                YES
         MVI   RC,16               SET RC = 16
         B     EXIT
FREE     MVC   UDDN,ADDN           COPY DD NAME TO UDDN
         LA    1,U                 UNALLOCE THE DATA SET
         DYNALLOC ,
         LTR   15,15               OK?
         BZ    EXIT                YES
         MVI   RC,12               SET RC = 12
EXIT     L     13,4(,13)           LOAD ADDRESS OF THE HIGHER SAVE AREA
         SR    15,15               LOAD THE RETURN CODE
         IC    15,RC
         RETURN (14,12),RC=(15)    RETURN
* DYNAMIC ALLOCATION PARAMETERS TO ALLOCATE A DATA SET
A        DC    A(X'80000000'+ARB)
ARB      DC    AL1(S99RBEND-S99RB,S99VRBAL,0,0)
         DC    2AL2(*-*),A(ATXTPP,0,0)
ATXTPP   DC    A(ATXT01,ATXT02,ATXT03,X'80000000'+ATXT04)
ATXT01   DC    AL2(DALDSNAM,1,L'ADSN)
ADSN     DC    CL44' '
ATXT02   DC    AL2(DALRTDDN,1,L'ADDN)
ADDN     DC    CL8' '
ATXT03   DC    AL2(DALSTATS,1,1),X'01'
ATXT04   DC    AL2(DALNDISP,1,1),X'04'
* DYNAMIC ALLOCATION PARAMETERS TO FREE A DATA SET
U        DC    A(X'80000000'+URB)
URB      DC    AL1(S99RBEND-S99RB,S99VRBUN,0,0)
         DC    2AL2(*-*),A(UTXTPP,0,0)
UTXTPP   DC    A(X'80000000'+UTXT01)
UTXT01   DC    AL2(DUNDDNAM,1,L'UDDN)
UDDN     DC    CL8' '
RC       DC    FL1'0'
SAVEAREA DC    9D'0'
         LTORG
         IEFZB4D0 ,
         IEFZB4D2 ,
         END   KILLVSAM
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8784
Location: Welsh Wales

PostPosted: Fri Feb 15, 2019 12:59 pm    Post subject:
Reply with quote

Or maybe calling through to BPXWDYN
Back to top
View user's profile Send private message
Mike.Fulton

New User


Joined: 11 Jun 2014
Posts: 22
Location: Canada

PostPosted: Fri Feb 15, 2019 9:46 pm    Post subject: very cool Steve - thank you! - very clear code!
Reply with quote

icon_biggrin.gif
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Running a REXX exec program using ZOSMF Sakthi344 CLIST & REXX 0 Tue Oct 15, 2019 3:13 pm
No new posts How to handle NULL in COBOL program bhaskar_kanteti COBOL Programming 8 Mon Oct 07, 2019 3:54 pm
No new posts DFSMShsm Dataset Recovery with B and ... Joerg.Findeisen JCL & VSAM 0 Sat Oct 05, 2019 10:01 pm
No new posts REXX VSAM Harold Barnes CLIST & REXX 2 Sat Oct 05, 2019 2:38 pm
No new posts Organization of a migrated dataset saravanakmr.tpr All Other Mainframe Topics 2 Fri Sep 20, 2019 6:10 pm

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