Display command within Read or Find

Hi,

Am a Natural Adabas Developer, working from past 3 years, recently i came to a rare scenario, when i used If no record found condition within Find and gave a display command, upon the failure of If Condition the display statement executed, can some experts suggest me why is this happened, if i use write then the flow of the execution was correct.

For example
Find ‘table1’ view of table1 with descriptor

if no records found
display ’ no record ’
end-norec

some operation
end-find

Result:
just
display (if condition fails)

else
no record.

I’m not following your example…

If you use a FIND with an IF NO RECORDS FOUND clause and no records are found, the FIND loop is entered, the IF NO RECORDS clause is executed and processing continues with the rest of the statements (“some operation” in your example) executed once. Use an ESCAPE statement in the IF NO RECORDS clause if you want to skip the “some operation” statements.

If that doesn’t help, please post a small, complete sample program with output in each scenario (presumably when the FIND returns records and when it doesn’t).

Thanks Kelly for your valuable information,

here is the program which i have coded:

FIND view-1 WITH Descriptor EQ #Value1
IF NO RECORD FOUND
DISPLAY 'ERROR ’ #value1
END-NOREC
statement
end-find

1)when #value1 is present in the file.
the output of this as :

     Error                    (this statement is with in the if no record clause)

statement which are coded in the Find loop

2)When #value1 is not present then the output will be:
Error

#value1

If the same code done by using Write Statement within If no record Cluase.

FIND view-1 WITH Descriptor EQ #Value1
IF NO RECORD FOUND
Write 'ERROR ’ #value1
END-NARC

end-find

since the #value1 is present in the file, output displayed As:

#value1.(Without entering into the if norecord cluase)

My question is:

1)Why the COMMAND DISPLAY Prints ‘Error’ when the record is present in the file( if no-record Class should not execute) Here it execute once?

2)How the COMMAND WRITE is displayed the output correctly without entering into the if no record clause when the record is present ?

Please let me know if you need any more information.

Note:
Irrespective of the conditions, DISPLAY Command will execute and throws information on the screen (just Header in case of condition fails or information what ever present after DISPLAY if condition satisfies)

Correct me if am wrong !!!

Thanks
Ahmed

As with the WRITE statement, DISPLAY sends field values to the printer each time it is executed. In addition, the DISPLAY statement creates a report header at compile time. This header is automatically printed at the top of each page, even if the DISPLAY statement itself is not executed.

Your DISPLAY sets up the header, but if no record is found, the statement is not executed. Later, you execute a WRITE statement which forces the header to be printed.

If you don’t want the WITE to force the report header, code

WRITE NOHDR field-list ...

Hi Ralph,

thanks for the information which cleared doubts of Display and Write .

:slight_smile:

thanks
Ahmed khan

take a look at the coding standards discussion also: http://tech.forums.softwareag.com/viewtopic.php?t=7290

Thanks for the information.

i have some quiries:

What are the levels of Cerification Avialble in Natural Adabas?

How these certification are useful for our future carrer, as openings of Natural Adabas is very limited ?