DataBase Generation


What is it?

DBG/400 is a collection of integrated utilities that help in setting up a test environment with any required files and data areas, and then populating those files with all, or just a subset, of realistic data from an existing source. As much as possible is done for you automatically, but to get the best benefit of data subsets (much quicker and less stress demanding on your DASD), you'll need to spend some time tailoring the tool's database to your setup. Hopefully this isn't too onerous a task.

There is a simple pull-down menu front end to the main routines in DBG, which you can use while you get used to the package. All the components are accessible via commands, so you can forego the menu if you want.

  • CRTPGMFSET extracts program reference information from a named program (can be generic or *ALL), drilling down into called programs if required. This then puts copies of all the files identified (including physicals for dependant logicals) into your test library.
  • CRTDBGSCP builds a script, based on the physicals it finds in your library, to either copy data to your target files, or extract just a subset, dependant on the contents of a file populated earlier.
  • EXCDBGSCP executes your selected script to put the data in place.
  • TDYPGMFSET is an add-on, not included in the main DBG/400 utilities (or on the menu), to try and get round the problem of join/multi-format logicals that span multiple libraries. These files don't duplicate in the way you'd want (they still point to a library other than your test library) so this tool tries to compile from source (providing it can find it from the object description). Obviously this won't be available on many systems - I'll keep looking for a better method. Download it from this page. The target library should be at the top of your library list for this one.

There are also two screen based commands

  • EDTDBGLNK lets you define links between a pair of files (as an SQL statement), so that subsets can be used.
  • EDTDBGSCP is the script editor which lets you view, copy, edit and delete existing scripts, or create new ones.

The script editor uses a general purpose document management system that I developed some years back. (Originally done so our users could create and maintain their own application help.) It offers, amongst other things:

  • Use of multiple document sets to allow separate use by different users or departments.
  • Supports display attributes to enhance, or decrease ;-), a document's readability.
  • A crude but effective word wrap facility.
  • Add, delete, copy, move, split, join and merge lines of text.
  • Keyword index to allow searching across multiple documents in a document set.
  • Search function within each document.
  • Formatted (A4) printouts with either a standard or user defined set of headers and footers, and bold/underline matching of the display attributes.
  • A function key (F2, not shown on screen) to run an exit program over a selected line - which is how the script editor does its stuff.
  • A command/program interface (API) so you can choose to work with all documents, or just a specific one, in either edit or display mode.

Why write it?

I work on my company's IT Helpdesk, supporting our mainly in-house written software. When a bug is found in, say, our main invoicing routine, I need to fix it then get it back in place quickly. Even if I can do the first quickly, getting it tested quickly is another thing altogether. We're in a fortunate situation in having HA mirroring software available (MIMIX) to replicate data to our development system, so at least access to data isn't an issue.

Files are updated all over the place, so I can't use the mirrored data directly. Taking copies of all the libraries involved would take lots of time, and even more disk space. Identifying what files are required, over the whole suite of programs involved, is a fairly painstaking task. Then there's the job of getting all these files populated with data, and making any data adjustments necessary.

A colleague and I had looked at a tool to help with this some time ago (ExtractDB from Silvon, now MKS), but it was about 8,000 UKP, and we couldn't persuade management to take it on board (wrong time in the budget year, I think). We were stuck with the manual method and had to get on with it.

One of the benefits of my particular role at the time was the freedom (when time allows, that is) to do some R&D into projects (that benefit the department or the company more widely) that aren't in the general project plan that the other developers have to work to. During the Christmas week of '98, I had some free time, and decided to see if I could put something together that would give us at least some of the functionality we required. I got the core product in place and the other developers started using it.

Doing entire copies of files was the easy/lazy way of doing it then. We had a 530 at the time, with about 50Gb of old 9337 drives set aside as ASP 2. We could use that exclusively for test data, so copying was fine, if a little slow. Extracting subsets was possible, but required a lot more work than I would have liked. I finally got round to making that side of things a little easier in May/June of 2000.

How is it used?

You'll find the documentation here. The html documentation is also available for separate download (zip 388Kb), as well as online help being available when you run the interactive commands

Why Open Source?

Well, one of my other R&D projects at the time was Linux. My manager asked me if I knew anything about it in '99, after coming back from an IBM CUA meeting where it had been mentioned quite a bit. I told him what little I knew, and suggested I look into it. I got the go ahead, the company paid for a Linux boxed set (Mandrake 5.3 at the time) and a copy of O'Reilly's "Running Linux", and I haven't looked back since. As I'm not a Linux programmer (I'm slowly learning Perl and I know a bit of shell scripting) - I'm only really comfortable in RPG so far - this project is my way of contributing something back to the free software community.


All software on this site is free software - free to download and free to use. It is released under the GNU General Public License (unless specifically stated otherwise).

download Download

zip (99Kb) Packaged in SRCPARSER format - see the installation instructions for details


If you've any questions, bug reports, feature requests or even improved source code, then feel free to email me at As a free package, there is no official support for DBG/400 - if it breaks you get to keep both pieces. Having said that, I will do what I can to help.

I'd love to hear from anyone downloading DBG/400, or just visiting the site - how did you find out about it, where are you from, what's your involvement in AS/400s, how much use do you think you can make of DBG/400, and would you be interested in other free programmer utilities available in the same way?
Topic revision: r1 - 29 Dec 2006 - 22:40:46 - MartinRowe
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DBG/400? Send feedback