Wednesday, July 11, 2012

Digging Deeper into the FOCUS Language

Even though I have been using the FOCUS language since the 1980s (by the way, I intend to stop telling people how long it has been), I always seem to run across little quirks that stop me in my tracks and make me say, "I've never seen that before!"

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

No comments:

About Me

My photo

I am a project-based consultant, helping data-intensive firms use agile methods and automation tools to replace legacy reporting and bring in modern BI/Analytics to leverage Social, Cloud, Mobile, Big Data, Visualizations, and Predictive Analytics. For several world-class vendors, I led services teams specializing in providing software implementation and custom application development. Based on scores of successful engagements, I have assembled proven methodologies and automated software tools.

During twenty years of technical consulting, I have been blessed to work with smart people from some of the world's most respected organizations, including: FedEx, Procter & Gamble, Nationwide, The Wendy's Company, The Kroger Co., JPMorgan Chase, MasterCard, Bank of America Merrill Lynch, Siemens, American Express, and others.

I was educated at Valparaiso University and the University of Cincinnati, graduating summa cum laude. In 1990, I joined Information Builders, the vendor of WebFOCUS BI and iWay enterprise integration products, and for over a dozen years served in branch leadership roles. For several years, I also led technical teams within Cincom Systems' ERP software product group and the custom software services arm of Xerox.

Since 2007, I have provided enterprise BI services such as: strategic advice; architecture, design, and software application development of intelligence systems (interactive dashboards and mobile); data warehousing; and automated modernization of legacy reporting.