Question on View

Hi,

I hava a view.

01 EMP VIEW OF EMPLOYEES
02 EMPNAME A(10)
02 EMPADDR A(20)

01 EMPREC.
02 NAME A(10)
02 ADDR A(20)

Is the following stqatement valid in Natural?

MOVE EMP TO EMPREC

Thanks,
Selva.

MOVE BY NAME EMP TO EMPREC (if EMPREC uses the same field names as EMP, which is not the case in your example)
MOVE BY POSITION EMP TO EMPREC (if fieldnames differ but field positions are the same, which is the case in your example)

n.b. There is no need to specify the format in view fields, as this is by default taken from the DDM. But for documentation purposes it can be usefull (but used carefully!).

Thanks for the reply !

Ahh - one of my favorite discussion topics!

In fact I think that is more risky to leave them out than to specify them in the program. Because if a field definition is afterwards changed in the ddm, the compiler will notify you with an error message when the field definition is in the program, so you are warned and forced to change it and aware that there might be other changes needed in the program, e.g. increase the length of work fields, check if there is the needed space on a report, correct redefinitions etc.

If the format is not specified in the program it is easy to recompile it, but there might be hidden traps in it that might not be discovered until the end user runs into a system error or even worse lost data.

Just my 2 cents!

I disagree.

Unless the formats (the one specified in the DDM and the one specified in the program) are compatible (eg. P and N), the compiler will not complain. Even the program will run, but your data may be lost! (you can define a P8 as P10 in your program, store P10, but consecutive programs will crash as Adabas wants to try to put a P10 value into a P8. Happy error tracking!). This will not happen, if you leave the formats out.

[quote="Wilfried B