A question from an exam that I need to check

Sorry, I don’t have no idea about NATURAL but I had an exam and I would like to review the following questions. Please, help me if you have a few minutes. I’ve trying checking by myself but the learning curve is high. And I need an answer soon.

Read(5) employees with loc eq 'PARIS' cod-empl:=employees.num-emp find cars with num-emp eq cod-empl cod-car:=cars.num-car end-find end-all sort by cod-empl cod-car display 'num' cod-empl 'car' cod-car end-sort

Two questions:

  1. How many rows will i get witch this sentence if each employee has three cars?
  2. Is it syntactically correct written?

Thanks a lot!!!

Instead of cheating on the exam, perhaps you could take some training and download the Community Edition of Natural from the techcommunity and try this out yourself. There are some public training modules that can help you get started with Natural.

Education package: http://techcommunity.softwareag.com/ecosystem/communities/public/universities/ANEP/
Tutorials: http://techcommunity.softwareag.com/ecosystem/communities/public/universities/ANEP/Tutorial/

Douglas, I already did the exam so I can’t cheating on it. I only was asking to check the correct answer. But thank you for your time answering and the links that you suggested me.

I don’t know if what I’m asking is difficult or not. But, if someone can help me, I’d be very grateful. Thanks in advance!!!

There is an important “possible” syntax error.

You are writing in structured mode (as evident by the END- s). If Employees and Cars are file names, not view names, your program will not compile.

If you are writing this code to satisfy a question, please note that "with loc eq ‘PARIS’ is really going to do a starting from ‘PARIS’ so, if there are fewer than 5 PARIS records, you will see records for other than PARIS.

Otherwise, syntax is correct.

good luck

Hello,

I would strongly recommend for you to test your code with our Software AG FREE community Edition, this will help you to understand the syntax and also the results.

Adabas & Natural Community edition.

Eli Cohen
Product Management

Finally, I installed Adabas & Natural Community Edition for Docker and checked the syntax of the sentence with NaturalONE as @Eli_Cohen1 suggested me.

With NaturalONE I checked what @Steve_Robinson pointed, the sentence is in structured mode (I got syntax errors because of ENS-s if I use reporting mode). And, when I use structured mode, I also get another syntax error because USING in SORT is required in this mode. So, effectively, the sentence is syntactically wrong.

@Steve_Robinson & @Eli_Cohen1, thank you a lot for your help!!! :grinning:

1 Like