Today it happened again while developing a new redundancy analysis for FOCUS applications. The BI Analyzer already had a feature for scanning SQL-based applications to find redundant reports, but for some reason we had never gotten around to building the same capabilities for FOCEXECs, the FOCUS programs.
Redundancy analysis is actually a very useful feature when you consider the history of end-user reporting tools such as the FOCUS 4GL.
Companies who purchased FOCUS decades ago turned it loose among the end users who then each started building computer applications on his or her own. Today, these companies are left with libraries full of legacy code that might be doing the exact same thing as other systems. Out of one thousand different reports, there may in reality only be about a dozen core reports and then lots of minor variations.
The BI Analyzer finds and groups all of those redundant reports, identifying them for consolidation during a modernization effort.
About seven years ago, while modernizing a financial services company's NOMAD 4GL legacy applications into WebFOCUS, I realized that the FOCUS language would not let you reformat a column being used for sorting. NOMAD could do that, but FOCUS and WebFOCUS could not. Strange.
For example, in the FOCUS language you can specify a BY phrase to sort data by columns:
The display formats of these columns come from the underlying metadata instructions. So RETAIL_COST might have instructions associated with it to display as a number with five digits to the left of a decimal point and two to the right, along with commas. But the default rules might not say to put a dollar sign in there and that is what you want.
In that case, inside the report logic you can override the metadata's default formatting and add your own instructions:
By putting a forward slash after the column name and some formatting commands of "D9.2M," I can make this decimal column bigger and add a dollar sign.
The NOMAD language is (was) very similar to FOCUS and allowed you do this same type of formatting on the sort columns. So the BI Transformer (our software for translating legacy reporting applications into modern BI equivalents) tried to generate a replica for WebFOCUS like this:
Surprisingly, FOCUS does not understand this reformatting on the BY sort columns. I shrugged, implemented a work-around, and moved on with the project.
Today, I stumbled across some legacy code that looked like this:
Wait, that can't be right! I've never seen that before.
After some testing, I realized this was a little-used FOCUS feature--at least, I've only seen it once in three decades--for formatting not the sort column but its page title.
You can Center, Left-Justify, and Right-Justify the titles. Here is another code example along with its PDF output:
In the example above, I told FOCUS to left-justify the County title, right-justify the Car title, and center the title for the Model.
Of course, in today's WebFOCUS environment you have at your disposal inline WebFOCUS stylesheets and HTML cascading stylesheets. This little FOCUS language trick is pretty arcane.
Still, it is always interesting to look into the history of the FOCUS language and understand what is going on under the covers. Drop me a line the next time you stumble across something in the FOCUS language that makes you say, "Wait, that can't be right!"
If you are interested in more information about the core FOCUS 4GL, click here.