As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at firstname.lastname@example.org and provide your corporate email address, company, and name.
It sounds like you're in the very beginning of learning the programming language parts of FOCUS.
I highly recommend you download the Command Language Reference for your version.
First let me suggest a simple answer to your question.
DEFINE FILE CAR TODAYSDATE/wrMtrDYY=&MDYY; END TABLE FILE CAR PRINT COUNTRY TODAYSDATE END
But more importantly, let me help you understand a short debugging technique we all use a lot.
In your code, right at the top, add this line:
Then run your code with the BY &DATEwrMtrDYY again. Notice what it's actually trying to run...
The word after the BY has to be a FOCUS fieldname. You're putting a literal in there (like 'september') which is not a fieldname, so FOCUS dies.
You'll end up using the &ECHO bit over and over. I wouldn't leave that in there when you go to promote your code for the world to see, but while you're developing, it'll help you see what FOCUS is actually trying to execute.
The settings for &ECHO are ON, ALL or OFF. The default is OFF. When you run it with ON - you'll get the same set of code that is being sent to the WebFOCUS Reporting server to be executed. The & variables will be replaced with their corresponding values.
The other main way we use &ECHO is to use ALL instead of ON. The difference here is that ALL will also show you the Dialog Manager commands along with the FOCUS commands.
In case it wasn't confusing enough in the beginning, I'll explain.
There are 2 kinds of commands you'll see in your code. Dialog Manager commands have a '-' in the first or 2nd column. Like
-SET &MYNAMEIS='Toby'; -TYPE the name is &MYNAMEIS
The other type of code does not have the - in front. This code is destined to actually run in FOCUS's brain on the reporting server. Typically this is going to some kind of data retrieval to make reports or mash data together. Examples of this are TABLE FILE, DEFINE FILE, JOIN, MATCH FILE etc..
At your stage of development skill, it's important you start understanding the difference between dialog manager commands and FOCUS code.
Playing with &ECHO will help you see what's happening.
I don't know if anybody even teaches internals anymore, but on a high level, you use Dialog Manager and it's & variables to help you build your FOCUS code. For example you might use Dialog Manager to branch around certain FOCUS TABLE FILE commands that might not be needed. Just realize that & variables get turned into their corresponding values (like September) BEFORE the FOCUS language interpreter runs them.
Timing of the parts of the language:
Dialog Manager code happens right now - as soon as WebFOCUS sees the - commands, they are evaluated immediately. But - not true for plain old FOCUS code. That code is sort of 'stacked up' and gets sent in one batch to be executed.
You can PM me and we can try to go over this more. You're at a stage where you're just about over the hump and you'll be much better once you understand the way WebFOCUS code is parsed and used.