Upload
hcmarella
View
185
Download
1
Embed Size (px)
Citation preview
Copyright 2007, Information Builders. Slide 1
Controlling Applications: An Overview of Dialogue Manager
B.J. StepienJune, 2009
Copyright 2007, Information Builders. Slide 2
Dialogue Manager
Dialogue Manager
EXEC
ReadsProcedure
PreparesCommand
List
FOCUS Commands
FOCUSCommandProcessor
INPUT
TABLE
DEFINE
JOIN
MODIFY
Copyright 2007, Information Builders. Slide 3
Dialogue Manager
Line begins with dash in column 1 Evaluate (process ) immediately
Line does NOT begin with - (dash) Evaluate &variables Write to FOCUS Command List with substitution
-* Comment line
Copyright 2007, Information Builders. Slide 4
Dialogue ManagerRUN DM1
-*dm1.fex-SET &ECHO=ALL;TABLE FILE EMPDATAPRINT 'EMPDATA.EMPDATA.PIN' 'EMPDATA.EMPDATA.LASTNAME' 'EMPDATA.EMPDATA.FIRSTNAME' 'EMPDATA.EMPDATA.SALARY'WHERE EMPDATA.EMPDATA.DEPT EQ '&DEPT.(<Accounting,ACCOUNTING>, <Administrative Services,ADMIN SERVICES>,
<Consulting,CONSULTING>, <Customer Support,CUSTOMER SUPPORT>, <Marketing,MARKETING>, <Personal/Human Resources,PERSONNEL>, <Programming,PROGRAMMING & DVLPMT>, <Sales,SALES>).Department.'; . . .END
Copyright 2007, Information Builders. Slide 5
Dialogue ManagerRUN DM1
Copyright 2007, Information Builders. Slide 6
Dialogue ManagerFOCUS Command
TABLE FILE EMPDATA
'EMPDATA.EMPDATA.PIN'
'EMPDATA.EMPDATA.LASTNAME'
'EMPDATA.EMPDATA.FIRSTNAME'
'EMPDATA.EMPDATA.SALARY'
WHERE EMPDATA.EMPDATA.DEPT EQ 'PERSONNEL';
ON TABLE SET PAGE-NUM OFF
…
END
Copyright 2007, Information Builders. Slide 7
Variables
Copyright 2007, Information Builders. Slide 8
Dialogue ManagerVariables
Variables (values supplied or calculated at run time: Format Type: Alphanumeric (text) or Numeric (Integer) Storage: All variables, regardless of type, are stored as alpha strings. Maximum Length: 32K Maximum Length of all variables: 32K Variable Type
System Variable -- &YYMD ,&DATEMDYY,&FOCRELStatistical Variable -- &LINES, &RECORDSUser-Supplied Variable
Local: ®ION Global: &&USER
Copyright 2007, Information Builders. Slide 9
Dialogue ManagerSystem and Statistical Variables
System Variables Values Created/ Maintained by FOCUS with the Operating System
Today’s Date - &YYMD , &MDYY , &DATEMtrDyy &DATE , &YMD, &MDY Time of Day - &TOD FOCUS Release Number - &FOCREL Operating System - &OPSYS
Statistical Variables Established/Updated after a command is executed by FOCUS
&LINES Number of lines created by a report request &RECORDS Number of records retrieved in a report request &RETCODE Return code from an operating system command
Copyright 2007, Information Builders. Slide 10
Dialogue ManagerUser-Supplied Variables
Local Variables (&DEPT) Single ampersand. Value retained during the execution of a single procedure. Will not be recognized by other procedures using the same variable
name.
Global Variables (&&USER) Double ampersand (&&user) Value retained per session
WEBFOCUS: Setting in Console Configuration establishes IBIF_PERSISTENTAMP = YES
Core FOCUS: (persistent connection) available until user logs off session:
? && Subsequent Procedures using the same variable name will use the
same value
Copyright 2007, Information Builders. Slide 12
Dialogue ManagerInitializing User Variables
-DEFAULT -DEFAULT &DEPT=PROGRAMMING Can be over-ridden at execution time.
EX MYREPORT DEPT=ACCOUNTING WEBFOCUS: Execute from Command Console
-DEFAULT &DEPT=PROGRAMMING
TABLE FILE EMPDATA
PRINT LN FN BY PIN
WHERE DEPT EQ ‘&DEPT‘
END
TABLE FILE EMPDATA
PRINT LN FN BY PIN
WHERE DEPT EQ ‘PROGRAMMING‘
END
EX FEX1
Copyright 2007, Information Builders. Slide 13
Dialogue ManagerInitializing User Variables
-DEFAULT -DEFAULT &DEPT=PROGRAMMING Can be over-ridden at exaction time.
EX MYREPORT DEPT=ACCOUNTING WEBFOCUS: Execute from Command Console
-DEFAULT &DEPT =PROGRAMMING
TABLE FILE EMPDATA
PRINT LN FN BY PIN
WHERE DEPT EQ ‘&DEPT‘
END
TABLE FILE EMPDATA
PRINT LN FN BY PIN
WHERE DEPT EQ ‘ACCOUNTING‘
END
EX FEX1 DEPT=ACCOUNTING
Copyright 2007, Information Builders. Slide 14
-SET -SET &Variable = expression;
Expression may be ‘text’ , number, or Computation/Logical expression Expression must be terminated by semi-colon (;) If spanning multiple lines, each line must begin with – (dash followed by
space). Over-rides previously supplied values
Dialogue ManagerEstablishing/Updating User Variables
-SET &DEPT1 = IF &DEPT EQ ‘PROGRAMMING’ THEN
- ‘PROGRAMMING & DVLPMNT’ ELSE &DEPT;
TABLE FILE EMPDATA
PRINT LN FN BY PIN
WHERE DEPT EQ ‘&DEPT1‘
END
Copyright 2007, Information Builders. Slide 15
Dialogue ManagerEstablishing/Updating User Variables
Numeric Calculations
Default Output is Integer (no rounding)
SET DMPRECISION = OFF/0/n to indicate number of decimal places .
OFF 0 4
-SET &OUTPT=10/3; 3 3 3.3333
-SET &OUTPT=20/3; 6 7 6.6667
Copyright 2007, Information Builders. Slide 16
Dialogue ManagerEstablishing/Updating User Variables
Date Calculations
Dates are stored as alpha strings.
Date Arithmetic is not supported except using functions
-SET &DATE = 20081231; 20081231
-SET &DATE1 = &DATE + 1; 20081232
-SET &DATEC = DATECVT(&DATE,’I8YYMD’,’YYMD’;
-SET &DATEC2 = &DATEC + 1;
-SET &DT1 = DATECVT(&DATEC2,’YYMD’,’I8YYMD’);
39447
39448
20090101
Copyright 2007, Information Builders. Slide 17
-READ Used to read values from a Fixed-format (Sequential) or Free-format (Comma delimited) files APP FI, FILEDEF, or DYNAM command must be executed, prior to the –READ
Fixed Format Length of variables are specified in the read statement APP FI REGIONVAL DISK appname/REGIONVAL.DAT -RUN -READ REGIONAL ®ION.A10. &DEPT.A5.
Free Format Variable values are separated by commas FILEDEF REGIONVAL DISK appname/REGIONVAL.DAT -RUN -READ REGIONAL, ®ION, &DEPT
Dialogue ManagerInitializing User Variables
Copyright 2007, Information Builders. Slide 18
Dialogue ManagerInitializing Variables
-PROMPT &variable[.format.[(value1,value2,value3).[message.]] Window opened by WEBFOCUS to prompt for user value In core FOCUS, user is prompted on the screen message displays message rather than variable name value1,value2,value3… display acceptable values in
drop down list. In WEBFOCUS a value of FOC_NONE used in a WHERE
eliminates the WHERE. Implicit –PROMPT for variables used within a FOCUS
expression, not previously set. WHERE DEPT EQ &DEPT.(ACCOUNTING,PERSONNEL).Department.
Copyright 2007, Information Builders. Slide 19
Dialogue ManagerImplicit Prompts
Can be built within InfoAssist or ReportPainter.
Copyright 2007, Information Builders. Slide 20
Dialogue ManagerImplicit Prompts
Values Can be Retrieved from the data
Copyright 2007, Information Builders. Slide 21
Dialogue ManagerRUN DM1
Copyright 2007, Information Builders. Slide 22
Dialogue ManagerInitializing Multiple Variables
-CRTFORM
-” Enter values for Department: <&DEPT “
-” Division: <&DIV “ Core FOCUS uses “HEADING” syntax. May use <D.&variable, <T.&variable to show current values.
-HTML Launch PageBuilt using layout tool.May contain prompts for procedures to be executed. The form may also contain output reports, etc.
Copyright 2007, Information Builders. Slide 23
Dialogue ManagerWEBFOCUS Auto Prompt
Preprocessing All prompting is executed prior to any execution of
FOCEXEC Variables used in
Explicit –PROMPT Implicit –PROMPT
Variables NOT initialized by –SET, -READ, -DEFAULT Variables NOT part of the execution step (EX proc var=…)
Other procedures INCLUDEd into the host procedure are interrogated.
Procedures EXECuted from the host procedure are not interrogated, and must have no unresolved variables.
Copyright 2007, Information Builders. Slide 24
Process and Flow Control
Copyright 2007, Information Builders. Slide 25
Dialogue ManagerProcess Control
Labels - An Navigation Point within the Procedure -labelname
Unconditional branching-GOTO labelname
Conditional branching-IF expression GOTO label1- [ELSE [IF expression GOTO label2 …] GOTO labelx] ; Terminated by semicolon Each line must begin with dash and space. Default ELSE is next line.
Copyright 2007, Information Builders. Slide 26
REPEAT - A set of logic should be performed some number of times.-REPEAT ENDLP 5 TIMES-SET &CTR = &CTR + 1;-TYPE CTR IS &CTR-ENDLP
-INCLUDE fexname Named focexec is to be inserted and processed. TABLE FILE EMPDATA HEADING -INCLUDE stdhead PRINT …
Dialogue ManagerProcess Control
TABLE FILE EMPDATA
HEADING
“THIS IS THE COMPANY”
PRINT …
Copyright 2007, Information Builders. Slide 27
-EXIT Execute the current FOCUS Command List Exit from the FOCEXEC.
-RUN Execute the current FOCUS Command List Return to the next line in the FOCEXEC. Automatic when using Statistical Variables.
-QUIT Exit from the FOCEXEC Clear the FOCUS command list without execution.
Dialogue ManagerProcess Control
Copyright 2007, Information Builders. Slide 28
Dialogue ManagerProcess Control
-SET &YR = 2009;-STRTTABLE FILE EMPX PRINT LN FN BY PINWHERE YEAR EQ &YREND-RUN-IF &LINES GT 0 GOTO THEEND;-SET &YR = &YR – 1;-IF &YR EQ 2000 GOTO ERR ELSE GOTO STRT;-ERR-TYPE NO REAL DATA-THEEND -EXIT
Copyright 2007, Information Builders. Slide 29
Dialogue ManagerTesting Dialogue Manager Procedures
SET DEFECHO = {ON/OFF/ALL}
-SET &ECHO={ON/OFF/ALL}
OFF -- View Source, etc. only see output resultsON -- FOCUS Commands are echoed in the view sourceALL -- D.M. Commands and FOCUS commands are
echoed. Useful for debugging.
Copyright 2007, Information Builders. Slide 30
Dialogue ManagerProcedure Builder
Copyright 2007, Information Builders. Slide 31
Dialogue ManagerProcedure Builder