Navigating a Procedure

In this section:

You can navigate a procedure in the following ways:

Performing Unconditional Branching

How to:

You can perform unconditional branching which transfers control to a label with the -GOTO command.

The first time through a procedure, Dialogue Manager notes the addresses of all of the labels it encounters so that they can be found immediately if needed again. However, If it encounters a -GOTO command that bypasses certain labels, those labels do not go on the list. When Dialogue Manager processes a -GOTO command, it first checks its list of labels. If the target label is already on the list, control is transferred to that label. If the target label is not on the list, Dialogue Manager searches forward through the procedure for the target label. If it reaches the end without finding the label, it continues the search from the beginning of the procedure. Dialogue Manager takes no action on labels that do not have a corresponding -GOTO.

If a -GOTO does not have a corresponding label, execution halts and an error message is displayed.

Note: It is recommended that you not use Dialogue Manager commands as labels.

Syntax: How to Perform Unconditional Branching

-GOTO label 
  .
  .
  .
-label [TYPE text]

where:

-label

Is a user-defined name of up to 64 characters. Do not use embedded blanks or the name of any other Dialogue Manager command except -QUIT or -EXIT. Do not use arithmetic or logical operations, words that can be confused with functions, or reserved words.

Note: The word CONTINUE can be used as a label in a -GOTO that is not part of a -IF command, but CONTINUE will not be recognized as a label in a -IF command, where it always transfers to the command immediately following the -IF.

The label text may precede or follow the -GOTO command in the procedure.

Note: When the label follows the -GOTO command, a dash does not precede it.

TYPE text

Sends a message to a client application.

Example: Performing Unconditional Branching

The following example comments out all the FOCUS code using an unconditional branch rather than -* in front of every line:

-GOTO DONE
TABLE FILE SALES
PRINT UNIT_SOLD RETURNS
BY PROD_CODE,CITY
END 
-RUN 
-DONE

Performing Conditional Branching

In this section:

How to:

Conditional branching performs a test of the values of variables and, based on the test, transfers control to a label in the procedure with the -IF... GOTO command. This helps control the execution of requests and builds a dynamic procedure by choosing to execute or not execute parts of a procedure.

For example, you can check whether an extract file was created from a production data source. If the extract file exists, the program runs a set of reports against the extract. If it does not exist, the program branches around the reports and writes a message to a log file.

Note: An -IF test does not require that each test specify a target label.

Syntax: How to Perform Conditional Branching

-IF expression [THEN] {GOTO label1|CONTINUE} [ELSE IF...;] [ELSE {GOTO label2|CONTINUE}];

where:

expression

Is a valid expression. Literals do not need to be enclosed in single quotation marks unless they contain embedded blanks or commas.

THEN

Is an optional command that increases readability of the command.

label1

Is a user-defined name of up to 64 characters to which to pass control if the -IF test is true. Do not use embedded blanks or the name of any other Dialogue Manager command except -QUIT or -EXIT. Do not use arithmetic or logical operations, words that can be confused with functions or reserved words. The word CONTINUE can be used as a label in a -GOTO that is not part of a -IF command, but CONTINUE will not be recognized as a label in a -IF command, where it always transfers to the command immediately following the -IF.

The label text may precede or follow the -IF criteria in the procedure.

CONTINUE

Continues to the command that follows the semicolon of the -IF command.

Note: CONTINUE cannot be used as a label in a -IF statement.

ELSE IF

Specifies a compound -IF test. The command -IF must end with a semicolon to signal that all logic has been specified. For more information, see Performing a Compound -IF Test.

ELSE GOTO

Passes control to label2 when the -IF test fails.

If a command spans more than one line, continuation lines must begin with a hyphen and one or more spaces.

Example: Performing Conditional Branching

The following example passes control to the label -PRODSALES if &OPTION is equal to S. Otherwise, control passes to the label -PRODRETURNS, the next line in the procedure.

-IF &OPTION EQ 'S' GOTO PRODSALES;
-PRODRETURNS
TABLE FILE SALES
PRINT PROD_CODE UNIT_SOLD
BY STORE_CODE
END
-EXIT
-PRODSALES
TABLE FILE SALES
SUM UNIT_SOLD
BY PROD_CODE
END
-EXIT

The following command specifies both transfers explicitly:

-IF &OPTION EQ 'S' GOTO PRODSALES ELSE
                 - GOTO PRODRETURNS;

Notice that the continuation line begins with a hyphen and includes a space after the hyphen.

Example: Testing System and Statistical Variables

In the following example, if data (&LINES) is retrieved with the request, then the procedure branches to the label -PRODSALES. Otherwise, it terminates.

TABLE FILE SALES
SUM UNIT_SOLD
BY PROD_CODE BY CITY
WHERE TOTAL UNIT_SOLD GE 50
ON TABLE HOLD
END 
-IF &LINES NE 0 GOTO PRODSALES;
-EXIT
-PRODSALES
TABLE FILE SALES
SUM UNIT_SOLD
BY PROD_CODE ACROSS CITY
END

Example: Executing Stacked Commands and Exiting the Procedure

In the following example, the first report request or the second report request, but not both, will execute. Assume the report is launched by an HTML form that uses a text input variable named &PROC to prompt the user for the procedure to run. The user may enter SALES or EMPLOYEE.

1. -IF &PROC EQ 'EMPLOYEE' GOTO EMPLOYEE; 
2. -SALES
   TABLE FILE SALES
   SUM UNIT_SOLD
    BY PROD_CODE
   END 
3. -EXIT
   -EMPLOYEE
   TABLE FILE EMPLOYEE
   PRINT LAST_NAME
    BY DEPARTMENT
   END

The procedure processes as follows:

  1. Dialogue Manager passes SALES to &PROC. An -IF test is done, and since the value for &PROC is not EMPLOYEE, the test fails and control is passed to the next line, -SALES.

    If the value for &PROC had been EMPLOYEE, control would pass to -EMPLOYEE.

  2. The FOCUS code is processed, and stacked to be executed later.
  3. -EXIT executes the stacked commands. The output is sent to the WebFOCUS Client application, and the procedure is terminated.

    The request under the label -EMPLOYEE is not executed.

This example also illustrates an implicit exit. If the value of &PROC was EMPLOYEE, control would pass to the label -EMPLOYEE after the -IF test, and the procedure would never encounter -EXIT. The TABLE FILE EMPLOYEE request would execute and the procedure would automatically terminate.

Example: Canceling the Execution of a Procedure With Conditional Branching

The following example illustrates the use of -QUIT to cancel execution based on the results of an -IF test. Assume the report is launched by an HTML form that uses a text input variable named &SELECT to prompt the user for the procedure to run.

-IF &SELECT EQ 'DONE' GOTO QUIT;
-REPORT
   TABLE FILE SALES
   SUM UNIT_SOLD
   BY PROD_CODE
   WHERE AREA EQ '&SELECT';
   END
-RUN
-QUIT

The user can run sequential reports by hitting the Back button in the browser and entering a new value for SELECT and resubmitting the form. If a product code is selected, the procedure continues to the next line and the request executes before encountering -QUIT. When the user enters DONE, control passes to -QUIT. The procedure is exited.

Performing a Compound -IF Test

A compounded -IF test is a series of -IF tests nested within each other. You can use a compound -IF test if each test specifies a target label.

Example: Using a Compound -IF Test

In the following example, if the value of &OPTION is neither R nor S, the procedure terminates (-GOTO QUIT). -QUIT serves both as a target label for the GOTO and as an executable command. Assume the report is launched by an HTML form that uses a text input variable named &OPTION to prompt the user for the procedure to run.

-IF &OPTION EQ 'R' THEN GOTO PRODRETURNS ELSE IF
- &OPTION EQ 'S' THEN GOTO PRODSALES ELSE
- GOTO QUIT;
-PRODRETURNS
TABLE FILE SALES
PRINT PROD_CODE UNIT_CODE
BY STORE_CODE
END
-EXIT
-PRODSALES
TABLE FILE SALES
SUM UNIT_SOLD
BY PROD_CODE
END
-QUIT

Looping in a Procedure

How to:

You can perform a function repeatedly by using looping in your procedure with the -REPEAT command. Looping can be used for many tasks. For example, files can be named and renamed by embedding operating system calls within a Dialogue Manager loop. Indexed variables can also be populated using a loop, or the output of a request can be used for a second request.

A process loop can be executed a designated number of times or until a condition is met. A loop ends when any of the following occurs:

You can also limit the repetition of a loop by incrementing a variable with the -SET command.

Syntax: How to Specify a Loop

-REPEAT label n TIMES

or

-REPEAT label WHILE condition;

or

-REPEAT label FOR &variable [FROM fromval] [TO toval] [STEP s]

where:

label

Identifies the code to be repeated (the loop). A label can include another loop if the label for the second loop has a different name than the first.

n TIMES

Specifies the number of times to execute the loop. The value of n can be a local variable, a global variable, or a constant. If it is a variable, it is evaluated only once, so you cannot change the number of times to execute the loop. The loop can only be ended early using -QUIT or -EXIT.

WHILE condition

Specifies the condition under which to execute the loop. The condition is any logical expression that can be true or false. The loop executes if the condition is true.

Note: The condition must be followed by a semi-colon.

&variable

Is a variable that is tested at the start of each execution of the loop. It is compared with the value of fromval and toval, if supplied. The loop is executed only if &variable is less than or equal to toval when s is positive, or greater than or equal to toval when s is negative.

fromval

Is the minimum value of &variable that will execute a loop. 1 is the default value.

toval

Is the maximum value of &variable that will execute a loop. 1,000,000 is the default value.

STEP s

Increments the value of &variable by a constant, s. It may be positive or negative. The default increment is 1.

Note: The parameters FROM, TO, and STEP can appear in any order.

Example: Repeating a Loop

These examples illustrate each syntactical element of -REPEAT.

-REPEAT label n TIMES

For example:

-REPEAT LAB1 2 TIMES
-TYPE INSIDE
-LAB1 TYPE OUTSIDE

The output is:

INSIDE
INSIDE
OUTSIDE
-REPEAT label WHILE condition;

For example:

-SET &A = 1;
-REPEAT LABEL WHILE &A LE 2;
-TYPE &A
-SET &A = &A + 1;
-LABEL TYPE END: &A

The output is:

1
2
END: 3
-REPEAT label FOR &variable FROM fromval TO toval STEP s

For example:

-REPEAT LABEL FOR &A STEP 2 TO 4
-TYPE INSIDE &A
-LABEL TYPE OUTSIDE &A

The output is:

INSIDE 1
INSIDE 3
OUTSIDE 5

Example: Controlling Loops

The following example illustrates the use of -SET to control a loop:

1. -DEFAULT &N=0 
2. -START 
3. -SET &N=&N+1; 
4.   EX SLRPT
   -RUN 
5. -IF &N GT 5 GOTO NOMORE; 
6. -GOTO START 
5. -NOMORE TYPE EXCEEDING REPETITION LIMIT
   -EXIT

The procedure executes as follows:

  1. The -DEFAULT command gives &N the initial value of 0.
  2. -START begins the loop. This is also the target of an unconditional -GOTO.
  3. The -SET command increments the value of &N by one each time the loop executes.
  4. The FOCUS command EX SLRPT is stacked. -RUN then executes the stacked command.
  5. The -IF command tests the current value of the variable &N. If the value is greater than 5, control passes to the label -NOMORE, which displays a message for the end user and forces an exit. If the value of &N is 5 or less, control goes to the next Dialogue Manager command.
  6. -GOTO passes control to the -START label, and the loop continues.

Inserting a Procedure or StyleSheet File Into Another Procedure With -INCLUDE

How to:

Reference:

Using the -INCLUDE command, you can insert a report procedure (.fex) or StyleSheet file (.sty) within another report procedure (.fex). Partial code can also be inserted. A partial procedure might contain heading text, or code that should be included at run time based on a test in the calling procedure.

The inserted procedure and StyleSheet files can be located in the WebFOCUS Repository or in an application directory on the Reporting Server. However, the syntax varies depending on the location of the inserted files and the calling procedure.

Note: A StyleSheet attribute named INCLUDE can also be used in a report request to apply a StyleSheet file that is stored separately from the report procedure file. The INCLUDE attribute, which can only be used for StyleSheet files, is not the same as the -INCLUDE command described in this topic.

For information on creating report requests and StyleSheet files, see the Creating Reports With TIBCO WebFOCUS® Language manual.

Reference: Uses for -INCLUDE

The -INCLUDE command can be used for the following:

  • Controlling the environment. For example, the inserted procedure may set variables, such as server name or user name, before the calling procedure continues execution.
  • As a security mechanism. The included procedure can be encrypted and a direct password set.
  • Shortening the code when there are several possible procedures that may be inserted. For example, the command -INCLUDE &NEWLINES could be used to determine the inserted procedure, reducing the number of GOTO commands.
  • Reusing sections of code used throughout the application, such as standard headings and footings. This enables changes made in a single module to affect the entire application.
  • Inserting a StyleSheet file.

Reference: Obtaining the Full IBFS Path Reference for a Repository Procedure

When you create a report procedure or StyleSheet file in the Repository, a unique path and file name reference is created, based on the Workspace in which the report is created and the file name and type specified. Note that there are file naming rules that replace most non-alphanumeric characters and modify the file name, when necessary.

To use the -INCLUDE command to insert a report procedure or StyleSheet file located in the Repository, you usually specify the full IBFS path to it. The only exception is when the file to be inserted and the calling procedure are stored in the same Repository folder. In that scenario, you can specify a relative path in the -INCLUDE command, as described in Insert a Repository Procedure File or StyleSheet File Using a Relative Path.

The full IBFS path information, including file name, can be obtained by right-clicking the file on the Home Page and clicking Properties.

The following image shows the Properties dialog box for a report procedure (.fex), with the full path.

Syntax: How to Insert One TIBCO WebFOCUS® Reporting Server Procedure or StyleSheet File Into Another

The following syntax illustrates how to insert a procedure or StyleSheet file located in an application directory on the Reporting Server into another report procedure located in an application directory on the Reporting Server.

-INCLUDE [appname[/subapp...]/filename[.ext]

where:

appname[/subapp...]

Is the application directory path on the Reporting Server in which the server procedure or StyleSheet file is located. If the application directory path is not specified, the file must be on the application path of the Reporting Server.

filename[.ext]

Is the name of the procedure or StyleSheet file located on the Reporting Server. The file extension is optional when a report procedure (.fex) is referenced. When incorporating a StyleSheet file, specify the .sty extension.

If you do not use the appname/filename type of path, you can use a file system path.

  • On UNIX or Windows, filename must specify the absolute path and file name for the inserted procedure. For example, F:\\ibi\apps\sales\headings.fex.
  • On z/OS, the included file must reside in the FOCEXEC library.

Example: Inserting a TIBCO WebFOCUS® Reporting Server Procedure and StyleSheet File

The salesrptsetup.fex procedure file, located in the ibisamp application directory on the server, contains the following commands that create two fields commonly used in the product sales reports.

DEFINE FILE GGSALES
PROFIT/D12.3= DOLLARS - BUDDOLLARS;
INVENTORY/D12 = UNITS - BUDUNITS;
END 

The salesrptstyle.sty StyleSheet file, located in the ibisamp application directory on the server, contains the following styling commands.

TYPE=REPORT,COLOR=NAVY,FONT='ARIAL',SIZE=9,GRID=OFF,$
TYPE=HEADING,LINE=1,STYLE=BOLD,SIZE=12,JUSTIFY=CENTER,$
TYPE=TITLE,BACKCOLOR=RGB(45 111 205),COLOR=WHITE,STYLE=UNDERLINE+BOLD, $
TYPE=DATA,BACKCOLOR=(WHITE RGB(235 235 255)),$
TYPE=SUBTOTAL,BACKCOLOR=RGB(163 200 236),STYLE=BOLD,$

The following procedure on the Reporting Server incorporates the procedure file salesrptsetup.fex and the StyleSheet file salesrptstyle.sty.

-INCLUDE ibisamp/salesrptsetup
TABLE FILE GGSALES
HEADING
"Regional Inventory and Profit Report"
SUM BUDUNITS UNITS INVENTORY AS 'Inventory'
BUDDOLLARS DOLLARS PROFIT AS 'Profit'
BY REGION
BY CATEGORY 
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
-INCLUDE ibisamp/salesrptstyle.sty
ENDSTYLE
END

The output is shown in the following image.

Example: Inserting a Procedure File That Contains a Heading

The following request incorporates a heading, which is stored in the procedure file salehead.fex:

TABLE FILE SALES
-INCLUDE SALEHEAD
SUM UNIT_SOLD AND RETURNS AND COMPUTE
DIFF/I5 = UNIT_SOLD-RETURNS;
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
TYPE=HEADING, COLOR=NAVY, FONT=ARIAL, STYLE=BOLD+ITALIC, SIZE=10, JUSTIFY=CENTER,$
TYPE=TITLE, COLOR=TEAL, STYLE=BOLD, SIZE=10,$
ENDSTYLE
END

The file salehead.fex, which is located in an application directory on the application path of the Reporting Server, contains the following syntax:

HEADING
"THE ABC CORPORATION"
"RETAIL SALES DIVISION"
"MONTHLY SALES REPORT"

This heading is included in the report request and displayed on the report output, as shown in the following image.

Syntax: How to Insert a Repository Procedure File or StyleSheet File Using a Full IBFS Path

The following syntax illustrates how to insert a report procedure file or StyleSheet file stored in the Repository into another report procedure, using the IBFS path.

-INCLUDE IBFS:/path/filename

where:

IBFS:/path/filename

Is the full path, including filename, of the report procedure, or the filename and extension (.sty) of the StyleSheet file. The file extension is optional when a report procedure (.fex) is referenced.

Note: This syntax can be used in a report procedure located either in the Repository or in an application directory on the Reporting Server.

Example: Inserting Repository Report Procedure and StyleSheet Files Using a Full IBFS Path

The salesrptsetup.fex file, located in the Public Workspace in the Repository, contains the following commands that create two fields commonly used in the product sales reports.

DEFINE FILE GGSALES
PROFIT/D12.3= DOLLARS - BUDDOLLARS;
INVENTORY/D12 = UNITS - BUDUNITS;
END 

The salesrptstyle.sty StyleSheet file, located in the Public Workspace in the Repository, contains the following styling commands.

TYPE=REPORT,COLOR=NAVY,FONT='ARIAL',SIZE=9,GRID=OFF,$
TYPE=HEADING,LINE=1,STYLE=BOLD,SIZE=12,JUSTIFY=CENTER,$
TYPE=TITLE,BACKCOLOR=RGB(45 111 205),COLOR=WHITE,STYLE=UNDERLINE+BOLD, $
TYPE=DATA,BACKCOLOR=(WHITE RGB(235 235 255)),$
TYPE=SUBTOTAL,BACKCOLOR=RGB(163 200 236),STYLE=BOLD,$

The following procedure incorporates the Repository procedure file salesrptsetup.fex.

-INCLUDE IBFS:/WFC/Repository/Public/salesrptsetup.fex
TABLE FILE GGSALES
HEADING
"Regional Inventory and Profit Report"
SUM BUDUNITS UNITS INVENTORY AS 'Inventory'
BUDDOLLARS DOLLARS PROFIT AS 'Profit'
BY REGION
BY CATEGORY 
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
-INCLUDE IBFS:/WFC/Repository/Public/salesrptstyle.sty
ENDSTYLE
END

The output is shown in the following image.

Syntax: How to Insert a Repository Procedure File or StyleSheet File Using a Relative Path

The following syntax illustrates how to insert a report procedure file or StyleSheet file stored in the Repository into another report procedure, using a relative path. This syntax is only supported when the file to be inserted is in the same Repository folder as the calling report procedure.

-INCLUDE ./filename.ext

where:

./filename.ext

Specifies the relative path to the procedure (.fex) or StyleSheet (.sty) file to be inserted. You can only use this syntax when the file to be inserted is in the same Repository folder as the calling procedure.

Note: This syntax is not supported when running a procedure from the Reporting Server.

Example: Inserting a File Containing a Heading Using a Relative Path

The following procedure file, heading.fex, contains the following heading syntax.

HEADING
"This is the included heading file"
" "

The following procedure, include_heading.fex, is in the same Repository folder as the heading file, and contains a -INCLUDE command with a relative path to it.

TABLE FILE EMPLOYEE
-INCLUDE ./heading.fex
PRINT CURR_SAL BY LAST_NAME BY FIRST_NAME
WHERE DEPARTMENT EQ 'MIS'
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
TYPE=HEADING, SIZE = 16, STYLE=BOLD,$
END

The output is shown in the following image.

Syntax: How to Insert a TIBCO WebFOCUS® Reporting Server Procedure or StyleSheet File Using an IBFS Path

To insert a procedure or StyleSheet file located in an application directory on a Reporting Server into another procedure, using the WebFOCUS IBFS path, enter:

-INCLUDE IBFS://EDA/nodename/appname/filename.ext

where:

nodename

Is the Reporting Server node defined in the WebFOCUS Client configuration. The IBFS://EDA/ path specifies that the procedure or StyleSheet file is located on a Reporting Server.

appname

Is the application directory path on the Reporting Server in which the server procedure or StyleSheet file is located. If this path is not specified, the file must be on the application path of the Reporting Server.

filename.ext

Is the name of the procedure or StyleSheet file located on the Reporting Server. The file extension is optional when a report procedure is referenced. When incorporating a StyleSheet file, specify the .sty extension.

Note: This syntax can be used in a report procedure located either in the Repository or in an application directory on the Reporting Server.

Example: Inserting TIBCO WebFOCUS® Reporting Server Report Procedure and StyleSheet Files Using an IBFS Path

The salesrptsetup.fex procedure file, located in the ibisamp application directory on the Reporting Server, contains the following commands that create two fields commonly used in the product sales reports.

DEFINE FILE GGSALES
PROFIT/D12.3= DOLLARS - BUDDOLLARS;
INVENTORY/D12 = UNITS - BUDUNITS;
END 

The salesrptstyle.sty StyleSheet file, located in the ibisamp application directory on the Reporting Server, contains the following styling commands.

TYPE=REPORT,COLOR=NAVY,FONT='ARIAL',SIZE=9,GRID=OFF,$
TYPE=HEADING,LINE=1,STYLE=BOLD,SIZE=12,JUSTIFY=CENTER,$
TYPE=TITLE,BACKCOLOR=RGB(45 111 205),COLOR=WHITE,STYLE=UNDERLINE+BOLD, $
TYPE=DATA,BACKCOLOR=(WHITE RGB(235 235 255)),$
TYPE=SUBTOTAL,BACKCOLOR=RGB(163 200 236),STYLE=BOLD,$

The following procedure incorporates the Reporting Server procedure salesrptsetup.fex and the Reporting Server StyleSheet file salesrptstyle.sty.

-INCLUDE IBFS://EDA/EDASERVE/ibisamp/salesrptsetup.fex
TABLE FILE GGSALES
HEADING
"Regional Inventory and Profit Report"
SUM BUDUNITS UNITS INVENTORY AS 'Inventory'
BUDDOLLARS DOLLARS PROFIT AS 'Profit'
BY REGION
BY CATEGORY 
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
-INCLUDE IBFS://EDA/EDASERVE/ibisamp/salesrptstyle.sty
ENDSTYLE
END

The output is shown in the following image.

Syntax: How to Insert a TIBCO WebFOCUS® Reporting Server Procedure or StyleSheet File Using Legacy Managed Reporting Syntax

A best practice in WebFOCUS application development is to centralize report styling and environmental setup, such as JOINs and DEFINEs, by storing them in a common workspace and defining security permissions to permit users to read and run them, but not edit or change them. However, Repository applications may need to reference report procedures and StyleSheet files that are located in an application directory on the Reporting Server.

Note: The information in this section is for legacy Managed Reporting applications that have been migrated.

Managed Reporting inserts Reporting Server procedure or StyleSheet files by using Reporting Server -INCLUDE syntax prefixed with the -MRNOEDIT command.

-MRNOEDIT -INCLUDE appname[/subapp...]/filename[.ext]

where:

appname[/subapp...]

Is the application directory path on the Reporting Server in which the server procedure or StyleSheet file is located. If the application directory path is not specified, the file must be on the application path of the Reporting Server.

filename[.ext]

Is the name of the procedure or StyleSheet file located on the Reporting Server. The file extension is optional when a report procedure (.fex) is referenced. When incorporating a StyleSheet file, specify the .sty extension.

Note: If you have a procedure that includes this legacy syntax, and you move the procedure to an application directory on the Reporting Server, you must remove the -MRNOEDIT prefix.

Example: Inserting TIBCO WebFOCUS® Reporting Server Procedure and StyleSheet Files Using Managed Reporting Syntax

The following is an example of incorporating Reporting Server procedure and StyleSheet files into a Repository procedure using the -MRNOEDIT and -INCLUDE commands.

The salesrptsetup.fex procedure file contains the following commands that create two fields commonly used in the product sales reports. This file is located in the /ibi/apps/ibisamp directory on the Reporting Server.

DEFINE FILE GGSALES
PROFIT/D12.3= DOLLARS - BUDDOLLARS;
INVENTORY/D12 = UNITS - BUDUNITS;
END 

The salesrptstyle.sty StyleSheet file containing the following styling commands is located on the Reporting Server in the /ibi/apps/ibisamp directory.

TYPE=REPORT,COLOR=NAVY,FONT='ARIAL',SIZE=9,GRID=OFF,$
TYPE=HEADING,LINE=1,STYLE=BOLD,SIZE=12,JUSTIFY=CENTER,$
TYPE=TITLE,BACKCOLOR=RGB(45 111 205),COLOR=WHITE,STYLE=UNDERLINE+BOLD, $
TYPE=DATA,BACKCOLOR=(WHITE RGB(235 235 255)),$
TYPE=SUBTOTAL,BACKCOLOR=RGB(163 200 236),STYLE=BOLD,$

The following Repository procedure incorporates the salesrptsetup procedure file and the salesrptstyle StyleSheet file, both located on the Reporting Server.

-MRNOEDIT -INCLUDE ibisamp/salesrptsetup 
TABLE FILE GGSALES
HEADING
"Regional Inventory and Profit Report"
SUM BUDUNITS UNITS INVENTORY AS 'Inventory'
BUDDOLLARS DOLLARS PROFIT AS 'Profit'
BY REGION
BY CATEGORY 
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
-MRNOEDIT -INCLUDE ibisamp/salesrptstyle.sty
ENDSTYLE
END

The output is shown in the following image.

Note: If you move the Repository procedure to an application directory on the server, remove the -MRNOEDIT command. For example:

-INCLUDE ibisamp/salesrptsetup

Syntax: How to Use -INCLUDE With a TIBCO WebFOCUS® Server Application Directory Linked to a TIBCO WebFOCUS® Repository

If you configure the Adapter for WebFOCUS Client REST on the Reporting Server, you can create an application directory that is linked to your WebFOCUS Repository and use that application directory as the server path in the -INCLUDE command.

For information about configuring the Adapter for WebFOCUS Client REST, see the TIBCO WebFOCUS® Adapter Administration manual. For information about linking your WebFOCUS Repository to an application on the server, see the TIBCO WebFOCUS® Reporting Server Administration manual.

The following syntax illustrates how to insert a report procedure or StyleSheet file located in the WebFOCUS repository, using an application directory on the Reporting Server linked to a WebFOCUS Repository.

-INCLUDE [wfcapp[/subapp...]/filename[.ext]

where:

wfcapp[/subapp...]

Is the Repository Workspace that contains the file to be inserted, referenced using the linked server application directory (wfcapp).

filename[.ext]

Is the name of the procedure or StyleSheet file located on the Repository path. The file extension is optional when a report procedure (.fex) is referenced. When incorporating a StyleSheet file, specify the .sty extension.

Example: Using a TIBCO WebFOCUS® Server Application Directory Linked to a TIBCO WebFOCUS® Repository With -INCLUDE

As shown in the following image, the Reporting Server has an application directory that is linked to the WebFOCUS Repository.

The name assigned to this application directory is wfc01.

The Repository Workspace named Public in the linked wfc01 application directory contains the salesrptsetup.fex file, as shown in the following image.

The salesrptsetup.fex file contains the following code that creates two fields commonly used in the product sales reports.

DEFINE FILE GGSALES
PROFIT/D12.3= DOLLARS - BUDDOLLARS;
INVENTORY/D12 = UNITS - BUDUNITS;
END 

The following report procedure on the Reporting Server incorporates the salesrptsetup.fex file using the linked application directory.

-INCLUDE wfc01/Public/salesrptsetup.fex
TABLE FILE GGSALES
"Regional Inventory and Profit Report"
SUM BUDUNITS UNITS INVENTORY AS 'Inventory'
BUDDOLLARS DOLLARS PROFIT AS 'Profit'
BY REGION
BY CATEGORY 
ON TABLE SET STYLE *
-INCLUDE ibisamp/salesrptsty.sty
ENDSTYLE
END

The output is shown in the following image.

Reference: Considerations When Using -INCLUDE With TIBCO WebFOCUS® ReportCaster

From the Reporting Server, for each task within a schedule, ReportCaster supports receiving a single answer set, such as report, chart, or HTML file. Therefore, when using -INCLUDE to incorporate a procedure into a procedure that will be scheduled with ReportCaster, only one answer set should be returned. If you need to distribute multiple reports within a single document, use the Compound Report feature. For more information, see the Creating Reports With TIBCO WebFOCUS® Language manual.

Using Fully Qualified Names With the -INCLUDE Command

In this section:

How to:

The -INCLUDE Dialogue Manager command can accept fully qualified file names so that files outside of the standard search path can be inserted into procedures. This technique reduces the time it takes to search for a specific procedure, providing a performance benefit.

Relative paths are not supported in the -INCLUDE command in a procedure on the server, and must use the fully qualified platform-specific file name. The limit for a fully qualified platform-specific file name is defined by the operating system (as long as it is within the 32K length maximum for a FOCEXEC line).

Procedures stored in the WebFOCUS Repository can use the relative path syntax ./filename.ext to -INCLUDE a file in the same Repository folder.

The fully qualified name applies only to the -INCLUDE command in which it is specified. It is not inherited by other -INCLUDE commands.

Syntax: How to Use a Fully Qualified File Name on UNIX

-INCLUDE /path/filename.ext

where:

path

Is the fully qualified path to the file that contains the FOCEXEC.

filename

Is the name of the file that contains the FOCEXEC.

ext

Is the extension of the file that contains the FOCEXEC.

Syntax: How to Use a Fully Qualified File Name on Microsoft Windows

-INCLUDE drive:\path\filename.ext

where:

drive

Is the drive that contains the path to the FOCEXEC.

path

Is the fully qualified path to the file that contains the FOCEXEC.

filename

Is the name of the file that contains the FOCEXEC.

ext

Is the extension of the file that contains the FOCEXEC.

Example: Using a Fully Qualified Name in a -INCLUDE Command

Assume the FOCEXEC named HEADINGS contains the following heading text for the request:

HEADING
"THIS IS THE INCLUDED HEADING FILE"
" "

Microsoft Windows example:

TABLE FILE EMPLOYEE
-INCLUDE c:\ibi\srv82\mydataarea\headings.fex
PRINT CURR_SAL BY LAST_NAME BY FIRST_NAME
WHERE DEPARTMENT EQ 'MIS'
END

UNIX example:

TABLE FILE EMPLOYEE
-INCLUDE /u2/prog/headings.data
PRINT CURR_SAL BY LAST_NAME BY FIRST_NAME
WHERE DEPARTMENT EQ 'MIS'
END

The output is:

Nesting Procedures With -INCLUDE

Any number of different procedures can be invoked from a single calling procedure. You can also nest -INCLUDE commands within each other as seen here. There is no limit to the number of -INCLUDE commands that can be nested.

Files one through four are incorporated into the original procedure. All of the included files are viewed as part of the original procedure.

Calling Another Procedure With EXEC

How to:

You can call a procedure from another procedure with the EXEC command. The called procedure must be fully executable. It behaves as a completely separate procedure, with its own content. It cannot use any local variables (&variables) defined by the calling procedure (unless they are explicitly passed to the called procedure on the command line). However, the executed (called) procedure can use any global variables (&&variables) that have been defined in the calling procedure.

When an EXEC command is encountered, it is stacked and executed when the appropriate Dialogue Manager command is encountered. The called procedure must be fully executable.

Procedures called using the -INCLUDE command must be in the search path of the WebFOCUS Reporting Server.

Syntax: How to Call a Procedure With the EXEC Command

EX[EC] procedure

where:

procedure

Is the name of the procedure.

Note: When EXEC is used in Managed Reporting, it is important to note that there is a difference between EX and EXEC. EX statements coded in a procedure are processed by the WebFOCUS Client, which looks for the procedure in the Managed Reporting repository. Procedures that are referenced with an EXEC statement are not processed by the WebFOCUS Client, they are only passed to the WebFOCUS Reporting Server for processing, and these procedures are not looked for in the Managed Reporting repository.

Example: Calling a Procedure With EXEC

In the following example, a procedure calls DATERPT:

-IF &OPTION EQ 'S' GOTO PRODSALES ELSE GOTO PRODRETURNS;
    .
    .
    .
-PRODRETURNS
    EX DATERPT
    .
    .
    .
-RUN