# Deleting say 100 module from a lib, easy way to do ?

**URL:** <https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes, Natural-on-Windows-Unix\
**Created:** [May 24, 2016, 1:04pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619 "2016-05-24T13:04:00Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarabjeet\_Pal](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Sarabjeet\_Pal](https://techcommunity.softwareag.com/u/Sarabjeet_Pal)\
**Post date:** [May 24, 2016, 1:04pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/1 "2016-05-24T13:04:00Z")

</div>

Hi All

Do we have an easy way to delete good number(say 100) of module from a lib? We are not looking to delete 1 by 1 rather looking for a smart way with less time consuming process

Thanks

Regards  
Sarabjeet Pal

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson3](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@Steve\_Robinson3](https://techcommunity.softwareag.com/u/Steve_Robinson3)\
**Post date:** [May 24, 2016, 2:08pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/2 "2016-05-24T14:08:57Z")

</div>

See the documentation

[http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat826mf/syscom/delete.htm](http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat826mf/syscom/delete.htm)

In particular, the use of the asterisk to produce a list of objects in a library.

---

<div class="post-metadata">

**Author:** ![Sarabjeet\_Pal](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Sarabjeet\_Pal](https://techcommunity.softwareag.com/u/Sarabjeet_Pal)\
**Post date:** [May 24, 2016, 2:35pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/3 "2016-05-24T14:35:29Z")

</div>

Thanks Steve, But I don’t access to this document ☹

asterik is to get the list of object in Natural but my requirement is to delete random modules

---

<div class="post-metadata">

**Author:** ![Todd\_Beckwith](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/todd_beckwith/32/388_2.png) [@Todd\_Beckwith](https://techcommunity.softwareag.com/u/Todd_Beckwith)\
**Post date:** [May 24, 2016, 2:58pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/4 "2016-05-24T14:58:19Z")

</div>

> [@Sarabjeet Pal](#):
>
> Thanks Steve, But I don’t access to this document ☹
> 
> asterik is to get the list of object in Natural but my requirement is to delete random modules

Do you have access to the documentation through these forums?

[http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat826mf/syscom/delete.htm](http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat826mf/syscom/delete.htm)

If not, you should get it.

I’m not certain this applies to mainframe, but if I needed to delete a large number of known objects from a library on Unix, I would just run a batch job with each object listed in CMSYNIN. This would be “1 by 1” but not time consuming or difficult to set up.

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [May 24, 2016, 4:58pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/5 "2016-05-24T16:58:31Z")

</div>

If you have a list of modules you want to delete you could write a natural program and use the STACK command.

STACK COMMAND ‘DELETE module1’  
STACK COMMAND ‘DELETE module2’  
…  
END

---

<div class="post-metadata">

**Author:** ![Sarabjeet\_Pal](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Sarabjeet\_Pal](https://techcommunity.softwareag.com/u/Sarabjeet_Pal)\
**Post date:** [May 24, 2016, 6:22pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/6 "2016-05-24T18:22:45Z")

</div>

Thanks Jerome!!!

Do you mean I can use a Read loop and call the statement

STACK COMMAND ‘DELETE module1’

to delete all my module with a single run?

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson3](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@Steve\_Robinson3](https://techcommunity.softwareag.com/u/Steve_Robinson3)\
**Post date:** [May 24, 2016, 6:24pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/7 "2016-05-24T18:24:16Z")

</div>

What exactly does “random modules” mean?

I presume it does not really mean randomly selected modules. So, you must have a list of modules somewhere. This would mean that either Todd’s or Jerome’s suggestions would be appropriate.

If it is a “hard copy” list of modules to be deleted, the DELETE \* might be appropriate if the number of modules in the library does not dwarf the 100 objects you cited.

Note you can also use asterisk as a “wildcard”; e.g DELETE ABC\* to get rid of objects that start with ABC.

---

<div class="post-metadata">

**Author:** ![Sarabjeet\_Pal](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Sarabjeet\_Pal](https://techcommunity.softwareag.com/u/Sarabjeet_Pal)\
**Post date:** [May 24, 2016, 6:27pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/8 "2016-05-24T18:27:00Z")

</div>

True, I have a list of module which I need to get rid off, and it is 300 is number so I am looking for some way to do it rather then deleting it one by one

---

<div class="post-metadata">

**Author:** ![Todd\_Beckwith](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/todd_beckwith/32/388_2.png) [@Todd\_Beckwith](https://techcommunity.softwareag.com/u/Todd_Beckwith)\
**Post date:** [May 24, 2016, 7:14pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/9 "2016-05-24T19:14:29Z")

</div>

I assume “one by one” really means manually. I know of no command that would delete a list of 300 specific objects in a single command, so any option would be “one by one” if wildcards are not used. For deleting a known list of objects, in a single, automated process, either stacking the commands in a program, or passing the command list via CMSYNIN would accomplish your goal.

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [May 24, 2016, 9:46pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/10 "2016-05-24T21:46:22Z")

</div>

> [@Sarabjeet Pal](#):
>
> Thanks Jerome!!!
> 
> Do you mean I can use a Read loop and call the statement
> 
> STACK COMMAND ‘DELETE module1’
> 
> to delete all my module with a single run?

Yes. You must have programmer access to the library you are working in. From the Natural manual:

> [@](#):
>
> The STACK statement is used to place any of the following into the Natural stack:
> 
> - the name of a Natural program or Natural system command to be executed;
> - data to be used during the execution of an INPUT statement.

You want the first option. Each STACK COMMAND puts another command on the stack. These commands are executed one at a time in the active Natural session as soon as your program ends. You could intitialize and array with all of your modules do be deleted and loop through the array issuing STACK COMMAND ‘DELETE’ #MODULE(#I). I don’t know if there is a limit to how many commands you can put on the stack. I have used it to rename a bunch of objects.

Make sure to archive all of the modules in the library before doing anything like this.

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [May 25, 2016, 2:17am UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/11 "2016-05-25T02:17:19Z")

</div>

If you’ve been handed a hardcopy list to delete, you can also do this interactively - from mainmenu, select “development functions”, enter “D” for “delete objects” and optionally, type and name (\* wild card for “starting with” - e.g. “everything starting with ABC” is ABC\*). Then just mark (X) each object to be deleted.

but if you have a text file with the list of objects to delete, either the batch (CMSYNIN) approach or program (STACK TOP COMMAND) will work.

---

<div class="post-metadata">

**Author:** ![Sarabjeet\_Pal](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Sarabjeet\_Pal](https://techcommunity.softwareag.com/u/Sarabjeet_Pal)\
**Post date:** [May 25, 2016, 8:38am UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/12 "2016-05-25T08:38:27Z")

</div>

When I try STACK approach, I am poped up with a window which ask for the confirmation before deleting.Can I get rid of this? Else I need to enter the module name multiple time

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [May 25, 2016, 11:17am UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/13 "2016-05-25T11:17:04Z")

</div>

```auto
SCRATCH <modulename>
```

instead of

```auto
DELETE <modulename>
```

SCRATCH doesn’t request confirmation.

---

<div class="post-metadata">

**Author:** ![Sarabjeet\_Pal](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Sarabjeet\_Pal](https://techcommunity.softwareag.com/u/Sarabjeet_Pal)\
**Post date:** [May 25, 2016, 2:22pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/14 "2016-05-25T14:22:33Z")

</div>

Thanks all for your valuable suggestion, I used batch to run my program(using STACK COMMAND) instead of trying with online, it didn’t ask for any confirmation.All good and sucessful.

Regards  
Sarabjeet Pal

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:36pm UTC](https://techcommunity.softwareag.com/t/deleting-say-100-module-from-a-lib-easy-way-to-do/188619/15 "2021-04-02T15:36:05Z")

</div>


