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

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


Sarabjeet Pal

See the documentation

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

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

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?


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.

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



Thanks Jerome!!!

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


to delete all my module with a single run?

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.

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

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.

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

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.

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.

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

SCRATCH <modulename>

instead of

DELETE <modulename>

SCRATCH doesn’t request confirmation.

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.

Sarabjeet Pal