I want to implement an development pattern at the company that I work but I don’t know if is possible to do what I want.
I want to do a code generator to generate programs to access Adabas considering all action through the database.
For example: generate each program to each action such as INSERT, DELETE, UPDATE, FIND, READ, GET and HISTOGRAM in order to use only the specified program to do the specific action.
So, I want to do it automatically. First of all, I will receive the name of the Adabas File, the action through the database and read the information of this file such as Fields name, Fields length, Fields type, Descriptors and Super-Descriptors. Once I got these information I will structure the program based on the action received from the input parameter.
So, I know that it’s possible to do it using DB2 Databases through the access of tables that store these informations.
What I really want to know is if it’s possible to do something like I usually do at DB2.
When coding Adabas “direct calls” in COBOL you will have access to the
two-character Adabas “short names” only, in Natural you will be able to
read either the DDM and, if available, the PRE-DICT file description as well.
Yes, about Cobol I will really use the direct calls or I can use Adabas SQL Commands too.
But what programing language and how can I get structure information from a DDM?!
The necessity is: I will input a DDM name and the program will identify the fields, it types and length, the descriptors and super-descriptors. With these informations, the idea is to generate a sequencial file with the code in cobol or natural to persist this DDM according with the action given by the user.
Structure of the program:
1 - Receive the name of DDM and the action of the persistence (READ, FIND, GET…);
2 - Get structure information of the DDM (FIelds, type and length of fields…);
3 - According with the action given (as parameter) mount the access command to the database (read, find , get…) considering the descriptors or super-descriptor of the DDM;
4 - Generate a sequencial file with the program code that will be the persistence according with the action given by the user;
So, is it possible to be done using Natural or Cobol?!
Just logon to library SYSEXT, enter keyword “DDM”, then enter function “L”
to list the sample program USR1058P, this includes the parameter definition.
The SYSEXT command will display a list of all available user exits, but it may be secured by the Natural administrator via Natural Security. If so, arrange for access to the SYSEXT library.
Each module is named USRnnnnx, where “x” is
. N for the executable subprogram
. T for a text module containing a description of the function
. P for a working sample program
USR1058P and USR1058T will contain the parameter definitions you need.
Yes. the problem is to get the access to this library to see the parameter…
I will try to get the layout to declare it inside the program to call this program.
On the other hand, someone have this layout to paste here?! It could be so usefull for me.
Only Adabas itself will give you a 100% accurate layout of the file,
a DDM may either not match the file or map a subset (View) of the
“physical” file only.
Have you looked at Natural Construct? The product generates code (such as CRUDs) for you based on the Predict data dictionary. If the particular program models aren’t to your taste, you can create your own.