Focal Point Banner


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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] Code indentation with dialog manager

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SHARING] Code indentation with dialog manager
 Login/Join
 
Virtuoso
posted
Let me start with a little anecdote about how this post came to be:

We have a fairly fresh colleague here with a background in programming C on embedded systems. This person was using some existing WebFOCUS code (by yours truly) as an example of how to implement a nested loop in his own report. So far so good.

What he added into the mix was that he indented the bodies of the nested loops to make the code more readable.

For some reason this resulted in the server becoming rather unresponsive, and upon investigation it turned out that the tscom3 process serving his request had eaten up over 8GB of system memory already! There was nothing in the report to warrant that, so obviously something was wrong.

Removing the indentation, the report behaved as normal again, so that was the obvious solution. However, we did like the indentation that we just lost. Obviously, we didn't give up there, or this would have been a different kind of post.

As it turns out, it is possible to indent dialog manager code as long as you keep the dash at the first column instead of indenting it along with the rest of the statement!

Here's an example:
-TYPE Here we start a loop
-REPEAT :LOOP1 FOR &I1 FROM 1 TO 10;
-	TYPE Looping... &I1
-	REPEAT :LOOP2 FOR &I2 FROM 1 TO 3;
-*		Here's a comment; unfortunately indenting the * causes the editor to
-*		no longer recognize the lines as a comment. Not sure about the parser.

-		SET &ITEM = (&I1 -1)*3 + &I2 -1;
-		TYPE Sub-loop &ITEM
-	:LOOP2
-:LOOP1


I don't know whether this is officially supported and from which version it is if so. Any official word? It seems useful.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
Wep5622

I am following up with your "Sharing" topic.

From my training (Noreen - FOCwizard) many years ago I was taught that dialogue manager commands must always start in column 1 only. This goes back to MainFrame days.

The following is from the FOCUS 7.7 Developing Reporting Applications user's manual

Without a leading hyphen, this is interpreted as a FOCUS command.

The following is from the WebFOCUS 7.7.05 Developing Reporting Applications user's manual -


When creating a procedure , you must follow these rules:
◾Dialogue Manager commands begin with a hyphen. Other commands do not.
◾At least one space must be inserted between the Dialogue Manager command and other text.
◾If a Dialogue Manager command exceeds one line, the following line must begin with a hyphen (-) in the first position. The continuation line can begin immediately after the hyphen, or you may insert a space between the hyphen and the rest of the line.

For those who might be interested this is how Dialogue Manager processes the lines within a focexec that has '-' statements (again from the above documentation) :


Dialogue Manager Processing:

You can modify your application at run time with user input and environment conditions by using Dialogue Manager procedures, which include commands and variables. It is important to understand how Dialogue Manager processes commands and variables of an application, using a procedure.

Dialogue Manager executes a procedure as follows:

1.Dialogue Manager reads each line of the procedure one by one, and substitutes values for variables when encountered.
You must make sure to assign values or identify defaults for all variables. Otherwise, you will receive an error message indicating a missing value. In Developer Studio, you are prompted for values not already assigned.

2.All Dialogue Manager commands execute as soon as Dialogue Manager reads them.
Other WebFOCUS commands are temporarily stored for subsequent execution, which are called stacked commands.

3.The -RUN and -EXIT commands execute any stacked commands.


I hope the above helps provide some clarity. Dialogue manager commands must start in column 1.

Thank you for participating in the Focal Point Forum.

Kindest regards,
Tamra Colangelo
Focal Point Moderator
Information Builders Inc.


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Report This Post
Virtuoso
posted Hide Post
What you just pointed out is precisely the reason I shared the info at the top, as it isn't obvious from the description from IBI that it is (apparently) also legal to have spaces between the hyphen and the actual dialog manager statement.

Apparently, these are identical from the point of view of DM:
-TYPE Looping... &I1
-	TYPE Looping... &I1


That is NOT obvious! All the docs talk about DM statements such as -TYPE, -SET, etc.
I only thought of experimenting with this because I know that when continuing a DM statement on a next line you must start the line with a hyphen, but are allowed to add white-space after the hyphen.

It looks like the starting hyphen in DM statements is only used to indicate that the following keyword will be a DM keyword, regardless of whether that comes immediately after the hyphen or after some white-space.


This is a behaviour of the DM parser that doesn't appear to be documented.
Whether it is safe to assume that it will also behave as such in the future is perhaps another matter. That's one of the reasons that I figured sharing this info might be useful - I would like to know whether that's a sage assumption or not?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Expert
posted Hide Post
Interesting......


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Master
posted Hide Post
To be honest, I have never given this much thought, but have a different method of making DM more readable. I space things vertically instead of horizontally.
-TYPE .
-TYPE . Here we start a loop
-TYPE .
-*
-REPEAT :LOOP1 FOR &I1 FROM 1 TO 10;
-*
-TYPE .
-TYPE . Looping... &I1
-TYPE .
-*
-REPEAT :LOOP2 FOR &I2 FROM 1 TO 3;
-*
-*		Here's a comment; unfortunately indenting the * causes the editor to
-*		no longer recognize the lines as a comment. Not sure about the parser.
-*
-SET &ITEM = (&I1 -1)*3 + &I2 -1;
-TYPE .
-TYPE . Sub-loop &ITEM
-TYPE .
-*
-:LOOP2
-*
-:LOOP1


I will concur that FOCUS/WebFOCUS does not like '- *'. We did that by accident once and ran the job. It was a comment in the middle of a TABLE request and the Reporting Server froze. I've also had the Reporting Server freeze because of a missing ; in a COMPUTE statement in MODIFY.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Master
posted Hide Post
quote:
...making DM more readable. I space things vertically instead of horizontally.

+1




Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
 
Posts: 822 | Registered: April 23, 2003Report This Post
Expert
posted Hide Post
Agreed,

Dialog Manager can be difficult to read when its all bunched up.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Master
posted Hide Post
-******************************************
-* BEGIN: customer loop
-******************************************

CODE
CODE
CODE

-******************************************
-* END: customer loop
-******************************************


That's what I usually do.
Mind you, in the editor I've set the backgroundcolor of the comment to something else than the default. For better visibility.

G'luck,
Dave



Post 500 ! Music


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Expert
posted Hide Post
quote:
Post 500 !

Congratulations Dave - Just don't go calling people "grasshopper"!

Or is that too 70's for people and therefore before many peoples memories? 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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
But Dave, If you subsequently happen to open the fex in the GUI, all the nice white space in between the sections gets eliminated - and of course comments within TABLE aren't allowed ....


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Master
posted Hide Post
George,

that is sad, but true.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Virtuoso
posted Hide Post
quote:
it is possible to indent dialog manager code as long as you keep the dash at the first column

Goodness!
Who ever thought of doing it otherwise???


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Master
posted Hide Post
quote:
Originally posted by George Patton:
But Dave, If you subsequently happen to open the fex in the GUI, all the nice white space in between the sections gets eliminated - and of course comments within TABLE aren't allowed ....


Which is another reason why that I almost never use the GUI.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Master
posted Hide Post
Code indention is a Windows code standard, so most of us Windows developers prefer that over vertical spacing.. Though I'm not opposed to vertical spacing, I just use it within my indented code as well. Smiler

Good find!



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report This Post
Virtuoso
posted Hide Post
quote:
as long as you keep the dash at the first column


Historically, first or second (apparently to facilitate dynamically generated code)


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SHARING] Code indentation with dialog manager

Copyright © 1996-2020 Information Builders