Are LDAs/PDAs a kind of copycode?

Hello all!

I found out that a catalogued program doesn’t need the referenced LDAs. So my maybe stupid question is: Are LDAs and PDAs a kind of copycode?

Try the following:

  1. Create an LDA containing only one field: #test (A10)
  2. stow the LDA
  3. create a program with the following code and stow it:
define data local using tst-lda
end-define
#test := 'a'
write #test
end
  1. delete the LDA
  2. execute the Program

External data areas are similar to copycode in that they are incorporated into the object at comple time and are not referenced at execution time.

You’re right. I forget to mention DDMs.
Where can I read something about this logic in the documentation? The Programming Guide says:

I think this paragraph describes the logical point of view, not the technical one…

First, where did the comment about DDMs come from? And what does it have to do with the discussion? :slight_smile:

Next, I will check in the Programming Guide latter, but I believe all the excerpt you posted is saying is that Variables in an LDA (whether internal or external) are initialized at the time the “object” is about to be executed, which of course is true.

steve

It was me!
DDM are also “incorporated into the object at compile time”.

I think you’re right. But where in the documentation can I read anything about my initial question?

Hi Matthias;

I wandered through the documentation and did not even find your quote (are you sure it was in the programming guide?).

However, it is all very straight forward. An external LDA does not appear in your source code. However, when you STOW an object with an external LDA, the resultant “stuff” (definitions, edit masks, INITs etc) appears in the object code. Thus, once it is STOW’ed, you no longer need the source definition.

steve

Hello Steve!

You can find my quote here:
http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat622win/pg/pg_obj_darea_0035.htm#Local_Data_Area

I thought my TST-LDA is an “external LDA” :?: :?:

If I understand you correctly, I don’t the the source definition of the LDA at runtime. I even don’t need the object code of the LDA. The only thing I need is the object code of the program.

Matthias,

external LDA/PDA are similar to Copycode.

LOCAL USING LDA is a shorthand for
LOCAL
1 blabla

and enables reusage of data definitions and initializations.

A saved only data area can not be included into the program. It must be stowed. What does it mean to stow a data area? In early versions of Natural for Unix the STOW did the following:

  1. Syntax check the “comments” in the source code (comments are the parts of the source code the editor works on)
  2. Add a DEFINE DATA LOCAL/PARAMETER statement to the source code defining all the data
  3. Save the modified source code, no compiled object!
  4. Mark the object as “compiled” in the filedir.sag.
    If you then saved the object again, the DEFINE DATA got lost, but the compile flag did not. At compile time, the compiler complained about an empty object.

Today a compiled object is created in Unix, too. This compiled object does also contain nothing else but a DEFINE DATA, but I think, not in a human readable format (can’t check now).

The only data area that behaves like a “program” is the GDA. A GDA is not incorporated into the object code of the using program, but only a reference to it. That’s the reason, why a GDA must be available at runtime.

hth

Hi Matthias;

Sorry. I re-read what I wrote and realize the confusion. When I said “your” I was not referring to your code. Also, in the next two sentences, “you” does not mean you, Matthias.

I was writing as if you/your referred to any programmer.

steve

[quote="Wilfried B