Focal Point
[CLOSED] LET command problem

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/307104971

July 13, 2009, 11:24 AM
Francis Mariani
[CLOSED] LET command problem
It's not often we get a chance to use the LET command and now that I have the opportunity, I can't get it to work.

This example works:

LET APPLE=CAR

TABLE FILE APPLE
PRINT
COUNTRY
END

This example does not work, qualified column names are not translated by the LET command:
LET APPLE=CAR

TABLE FILE APPLE
PRINT
APPLE.COUNTRY
END

I thought this would work, but it does not:

LET APPLE=CAR
LET APPLE.=CAR.

TABLE FILE APPLE
PRINT
APPLE.COUNTRY
END

The error: (FOC004) THE OPTION ON THE VERB OBJECT IS NOT RECOGNIZED: APPLE.COUNTRY

Any ideas?

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 13, 2009, 01:17 PM
Darin Lee
I may be way off on this (as I have probably used LET only slightly more than what you probably have) but my understanding is that it only does WHOLE WORD matching. For example PINEAPPLE would not become PINECAR just as APPLE.COUNTRY does not become CAR.COUNTRY. Someone please correct me if that is wrong.

Is there a reason why an &var could not be used instead?


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
July 13, 2009, 01:28 PM
j.gross
The LET substituton process -- like Dialog Manager's focexec prescan process -- has no knowledge of Focus syntax. It operates very mechanically, breaking the line into "tokens" wth blanks and start/end of line serving as delimiters, and substituting where it finds a whole-token exact match. It regards quotes and periods as potentialy part of a token, not as delimiters.

In your example, APPLE.COUNTRY is a token, and the APPLE or APPLE. portion does not trigger substitution, since it is not an etire token.

Consider: If you had
LET CA=Central_America

would you want subsitution to be made on the CA prefix in
TABLE FILE CAR ...
?


- Jack Gross
WF through 8.1.05
July 13, 2009, 01:30 PM
Francis Mariani
Darin, yes an &VAR would work, I just thought "here's a nice opportunity for the LET command", but I'm sure you're right about the "whole word" matching.

Thanks for the input.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 13, 2009, 02:52 PM
Francis Mariani
Jack, no, I wouldn't expect the CA in CAR to be translated to Central_America, but I would have thought LET was smart enough to see that there are two words in APPLE.COUNTRY, the . being a delimiter in most languages.

Thanks.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 15, 2009, 07:11 AM
Danny-SRL
Francis,

Would this suit you:
  
LET APPLE=CAR
LET APPLESEG=CAR<1>
TABLE FILE APPLE 
PRINT APPLE
BY APPLESEG .COUNTRY
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

July 15, 2009, 09:05 AM
Francis Mariani
Daniel, that works, but what is the <1> doing? It doesn't seem obvious.

Thanks,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 15, 2009, 09:29 AM
Danny-SRL
Francis,
The <1> is the parameter for the LET. By defining it stuck to CAR, APPLESEG .COUNTRY is translated as CAR.COUNTRY. Nice trick, no?
You can have many params. For example:
  
LET 
SORTGROUP=BY <1> IN-GROUPS-OF <2>
END

TABLE FILE CAR
SUM SALES
SORTGROUP MPG 10
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

July 15, 2009, 09:38 AM
Francis Mariani
Very neat trick!

Is this documented anywhere?

Thanks,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 15, 2009, 10:10 AM
Tony A
quote:
Is this documented anywhere?

Hooray! I've won my bet with someone that you would come up with that statement Wink

Don't change Francis Razzer

T
July 15, 2009, 10:38 AM
Francis Mariani
Tony,

Just being consistent!

It IS a rather interesting technique, innit?

By the way, I just cannot find the LET command syntax in the WebFOCUS Windows Help documentation - 'LET command' doesn't result in much.

Good One


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 15, 2009, 11:05 AM
GinnyJakes
Francis,

Look in a mainframe FOCUS manual. I have an old 7.0 one. It is in book 2, chapter 21.

I personally don't use LET anymore but I used to use it a lot when I did mainframe FOCUS back in the day. I'd make shortcuts for TED for example.

Happy reading!


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
July 15, 2009, 11:08 AM
Francis Mariani
Ah, yes! Those famous TED shortcuts:

LET TF    = TED FOCEXEC(<1>)
LET TH    = TED HOLDMAST(<1>)
LET TM    = TED MASTER(<1>)
LET EF    = EXEC FMSPEDIT
LET SPF   = TSO ISPF
LET BR    = TSO ISPF 1
LET ED    = TSO ISPF 2
LET IOF   = TSO ISPF I



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 15, 2009, 11:12 AM
j.gross
Is period a token separator in circa-1980 FORTRAN?

As I noted, even quote marks are excluded, despite their delimiting functon since the early days of Focus.

IBI could update the rules, after due deliberation -- but for now the period is not a token delimiter for LET subsitution.


- Jack Gross
WF through 8.1.05
July 15, 2009, 11:15 AM
Francis Mariani
I don't expect IBI will be updating the delimiter rules any time soon.

I have an open case that just celebrated its fourth anniversary regarding CHECK FILE PICTURE - it's not very useful now that, more often than not, table names are longer than 8 characters.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 15, 2009, 03:08 PM
Tony A
I always found some easy target to show that -

SAMPLE
END

could produce a simple report. Of course I did have LET SAMPLE = TABLE FILE CAR SUM RCOST DCOST BY COUNTRY BY CAR BY MODEL in a profile somewhere. Raised a few smiles back in the late 1980's early 1990's!

As for the LET command, search for LET in Dev Studio help files but don't expect any mention of the parameter syntax as reminded by Dan (thank goodness he didn't mention w*****p again Wink)

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 15, 2009, 05:38 PM
Doug
quote:
Ah, yes! Those famous TED shortcuts (mainframe days)
Something like:
LET TFC = TABLE FILE CAR
TFC
PRINT CAR BY COUNTRY
END
I got "Extra Credit" for the TFC thing back in 19xx at a Basic Reporting Class at IBI's 1250 Broadway location. Now, that was a while ago...
Good One Thanks for the memories...




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206