-
Is there any specific sequence to use LDA, PDA and GDA in our Program, Subprogram and Subroutine?
-
If there is any change in LDA, what all elements needs to be compiled?
-
If there is any change in PDA, what all elements needs to be compiled?
-
If there is any change in GDA, what all elements needs to be compiled?
-
If there is any change in Copycode, what all elements needs to be compiled?
-
If an online program is updating a record in an adabas file simultaneously another batch application is accessing the same file/record. Will the job be abended?
First, a note.
Most people who contribute to this forum, myself included, do not mind answering basic questions. HOWEVER, and I will speak only for myself here, I do mind answering questions that are answered in the Natural documentation. An exception would be if the poster does not have access to said documentation. In which case you should DEMAND such access from the company you work for.
If you go to http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat824mf/sm/defineda.htm
you will find answers to all you questions regarding LDA, GDA, and PDA.
In the event you do not have such access, the order for these is GDA, PDA, and finally LDA.
Of course, a program cannot have a PDA, so the order is just GDA LDA.
A subprogram cannot have a GDA, so the order is just PDA, LDA.
The answer to questions 2,3, and 4 is the same, it depends.
For example. If I have a variable #AA which is defined as A3. I change #AA to A5. Do I have to recompile a program where this is used? In general, the answer might be no. What about objects that do not use the LDA? Before you answer, consider if there is a statement in a program that uses the LDA’s variable #AA as follows:
CALLNAT ‘MYSUB’ … #AA …
The subprogram , let us suppose, has an embedded parameter data area. The variable that corresponds to #AA in the program is #ZZ in the subprogram. Clearly, the subprogram would have to be changed and recompiled.
There are such considerations for PDAs and GDAs. BTW, the reason for using a PDA in a LOCAL USING is to avoid many of these problems.
Question 5. Copycode is source code that is “translated” at compile time. Anything that uses a changed copycode should be recompiled.
There is one exception to what I mentioned earlier. If an OPTIONAL variable is added to a PDA, it may be that no change is required to programs that use the subprogram. This would be true unless the programs wish to employ the added variable(s).
Finally, the last question. You should find someone in your shop who understands Natural’s transaction logic. Get them to explain record holding in Adabas and how this is manifested in Natural.
for #6, please review the Natural parameter “WH” (wait on hold), which governs how Natural and Adabas will respond when a record is on hold and another user/process also attempts to obtain that same record to hold for update.
The typical setting for online is to use WH=OFF. This will return an immediate NAT3145 error (that can be trapped with an ON ERROR and the RETRY statement optionally used) and ensure that an online, interactive user does not just clock while waiting for the record to be released from hold. Batch jobs typically use WH=ON, so if an online user or another process has the record on hold, the hope is that the record will be released and allow the batch job to continue (possibly slowly, but at least less likely to abend).
There are reasons to violate these typical settings, but generally you should have to justify why you wouldn’t use the typical settings.
Subprograms can have GDAs but the GDA is not shared with the invoking object. It creates a new GDA instance and the values of the original GDA are only available if passed as a parameter. I’ve seen this passing as parameters done extensively in one shop but, with the way the GDA probably grew over the years, I’ll guess they wouldn’t do it again if they could start over.
Hi Todd;
Correct. I “conveniently” forget about that “feature” since it is basically non functional.
As you correctly pointed out, a new “copy” of the GDA is created. In order to pass any data back to the program that did the CALLNAT, you have to have the data in a PDA (or use the DEFINE DATA INDEPENDENT or an old style global variable).
Thus, you really do not have a GDA that is globally available. You have two GDAs which are accessible from a program and a subprogram respectively. Not my idea of a “global”.
However, when discussing the syntax, I should have included the global as possible preceding the PDA and LDA.
Thanks Steve, Todd and Douglas for your help. It’s really helpful.