SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-46
Conditional Printing of Items or Line Entries
2. Defines the inline prefix as two slashes (//). TACL sends prefixed lines to the inline
process (in this case, SQLCI) and waits until the inline process issues another
prompt.
3. Sets the inline echo variable to enable echoing.
4. Defines the variable RPTMONTH.
5. Sets RPTMONTH to the parameter value entered with the RUN command (in this
case, June, 2001).
6. Runs SQLCI, specifying the INLINE run option.
7. Sends a SET LIST_COUNT command to the SQLCI process.
8. Sends an OBEY command to the SQLCI process. The SELECT command and
report formatting commands in the command file execute. The data is selected and
the report formatted, but no lines are printed yet.
9. Substitutes the value of RPTMONTH in the REPORT TITLE command and sends
the command to the SQLCI process.
10. Sends a LIST command to the SQLCI process. The report is printed.
11. Sends an EXIT command to SQLCI.
12. Pops all variables pushed since the last #FRAME function call.
You can use TACL macros to perform complex database operations by modifying
SQLCI and report formatting commands at the time you run the macro.
To learn how to write TACL macros and get complete information about the TACL
INLINE facility, see the
TACL Reference Manual.
Conditional Printing of Items or Line Entries
By using an IF/THEN/ELSE clause, you can specify conditions for printing items or lists
of items, and you can specify alternate items to be printed if the conditions are not met.
An IF/THEN/ELSE clause can be included in a detail line, title, or footing and within a
CONCAT clause. You can also include an IF/THEN/ELSE clause in another
IF/THEN/ELSE clause.
The report defined by the following commands conditionally prints text depending on
the employee's salary:
>> SELECT EMPNUM, FIRST_NAME, LAST_NAME, DEPTNAME,
+> SALARY
+> FROM PERSNL.EMPLOYEE E, PERSNL.DEPT D
+> WHERE E.DEPTNUM = D.DEPTNUM
+> ORDER BY LAST_NAME;
S> DETAIL CONCAT (FIRST_NAME STRIP, SPACE 1, LAST_NAME)
+> AS A20 HEADING "NAME",
+> DEPTNAME,
+> IF SALARY < 30000 THEN ("Evaluate")
+> ELSE (IF SALARY < 60000 THEN ("Wait 1 month")