Copy Natural program to a dataset?

Is it possible to copy a natural program on to a dataset?


What is it you are trying to do that would require such a dataset?

I have a few thousand programs in a library in production. I need to run various scans on a few tens of programs every now and then for some analysis. I find it hard to work with such a huge library.
I thought if I could get all the source on to a PDS as members, then I can work with a subset of them them more easily.

Do you have Entire (Natural) Connection?

This would make it easy to move selected program objects to a PC where you could employ any edit tools available to you.

thanks Steve. I don’t have entire connection. I will try asking our Configuration Management folks if they can copy over the selected list of programs from production library to my personal library in test environment without locking the code. If they could do it, that would solve my issue in a way. Thanks a lot again for looking into this.

It’s a simple enough matter to write a process to do this. We are mainframe OS natural here so this may need to be adapted for other environments.

Create a TSO dataset list of the library/modules you want
Create a program that you can run in batch that reads this list and uses the USR exits from SAG to read the source and write to a work file - not sure which one off the top of my head but they are documented on SAG website and listed in SYSEXT I think

You can do what you like with the work file after that.

1 Like

Thanks Mick. That’s interesting. Will try it!

have you used the Natural SCAN command? that might save you the hassle of exporting the programs.

With SCAN you can specify ranges of program names to scan (ABC* for all programs starting with ABC). Or you can leverage XREF information to create sets of related programs and scan those.

With XREF data, you often don’t need to scan since it enables you to search and select by variables, programs, data areas, etc). It is usually much more efficient to search via XREF than to SCAN libraries.

1 Like

Thanks a lot Doug. I do use SCANS but they run longer on a huge library. I will try XREF !

I want to compare two programs one in development region and other one is in non-development region. In order to do that I want to copy Natural program to a dataset.


See Mick’s answer for the best way to do this.

For your comparison purposes, you might also just do a batch job that does LIST PROGRAM <name | pattern> and direct the output to a dataset that you can edit and compare.

This is one of the many situations where a Single Point of Development (SPoD) environment is so helpful. Just a few clicks in Natural for Windows, and your selected objects are passed to your desktop compare utility.

The modules can be selected from a mainframe, Unix or Windows server, or your desktop Natural environment.