Difference between DISPLAY and WRITE??

Hi all,

What is the major difference between DISPLAY and WRITE??

Rahul

In display you will get header row by default.
Using write, you will need to separately write the headings.

Any other major difference ??

The quick answer is: DISPLAY does more things automatically (like formatting of arrays). Please try out the following code:

define data local
01 structure
  02 #a10 (A10)     init <'ABCD'>
  02 #a1  (A1/1:5)  init <1,2,3,4,5>   (HD='array')
  02 #n10 (N10)     init <67890>       (HD='numeric')
end-define
write nohdr structure
newpage
display structure
end

Please have a look at the “Natural Programming Guide > Referenced Example Programs > DISPLAY and WRITE Statements” to get more examples.

Hi Rahul;

DISPLAY was designed as a “spreadsheet” statement. Virtually anything you would do with a spreadsheet can be done with DISPLAY. This includes (as already noted) Column headers, row headers, pagewise system functions, etc.

By contrast, WRITE is “free form”. You must provide anything you want to see.

Rahul, have you not attended any Natural classes? Your questions would seem to reflect someone without any formal Natural classes. There is far more to know about Natural than what you would get from a manual. :slight_smile:

steve

Hi Steve,

I have not attended any Natural classes because here nobody knows Natural so no classes & no sessions for Natural :cry:

Are you trying to learn Natural on your own because you are simply interested in it; or are you actually working with Natural (writing or maintaining code)?

steve