510 likes | 752 Views
Dialogue Manager Internals. Sandra Steeves Information Builders. Agenda. What is Dialogue Manager? Dialogue Manager Processing Dialogue Manager Limits Dialogue Manager Variables User System Implicit PROMPT Navigating the Procedure Debugging Dialogue Manager Procedures.
E N D
Dialogue Manager Internals Sandra Steeves Information Builders
Agenda • What is Dialogue Manager? • Dialogue Manager Processing • Dialogue Manager Limits • Dialogue Manager Variables • User • System • Implicit PROMPT • Navigating the Procedure • Debugging Dialogue Manager Procedures
Conceptual View Stack FOCUS Command Processor SYSIN REPORT MODIFY MAINTAIN EXEC
All System &Variables • All Local and Global Variables Dialogue ManagerProcessing • Dialogue Manager Uses: • DATREC for
Dialogue ManagerProcessing • Dialogue Manager Uses: • LINREC for • All System, Local and Global Variable Values LINREC 4/1/00 20000401 000401 010400 040100 STEP1 STEVENS ‘STEVENS’ Alex Let’s Look at an Example
Dialogue ManagerProcessing Remember !! • Dialogue Manager Executes First! • Line by Line -DEFAULT &GOTO=STEP1 -GOTO &GOTO -STEP1 -SET &NAM1 = IF &WHO EQ ’GB’ THEN ’’’’ | - ’SMYTH’ | ’’’’ ELSE ’’’’ | &NAME || ’’’’; TABLE FILE EMPLOYEE -INCLUDE HEADING SUM SALARY BY DEPARTMENT BY EMP_ID WHERE LAST_NAME CONTAINS &NAM1 END -RUN -STEP2
Dialogue ManagerProcessing The FOCEXEC DATREC LINREC -DEFAULT &GOTO=STEP1&GOTOSTEP1 -GOTO STEP1 -STEP1 -SET &NAM1 = IF &WHO EQ ’GB’ THEN ’’’’ | &WHO ALEX - ’SMYTH’ | ’’’’ ELSE ’’’’ | &NAME || ’’’’; &NAME STEVENS &NAM1 ‘STEVENS’ TABLE FILE EMPLOYEE -INCLUDE HEADING SUM SALARY BY DEPARTMENT BY EMP_ID WHERE LAST_NAME CONTAINS ‘STEVENS’ END -RUN -STEP2 How did we get values for &WHO and &NAME? If Not Previously supplied, FOCUS Will Prompt for the Values
Dialogue Manager LINREC 4/1/2000 20000401 000401 010400 040100 STEVENS ‘STEVENS’ Alex STEP1 FOCSTACK TABLE FILE EMPLOYEE HEADING CENTER “REPORT OF SALARIES “ SUM SALARY BY DEPARTMENT BY EMP_ID BY EMP_ID WHERE LAST_NAME CONTAINS ‘STEVENS’ END Where did the HEADING come from? It was –INCLUDE’d (-INCLUDE HEADING)
Dialogue ManagerLIMITS • Dialogue Manager uses DATREC and LINREC • LINREC/DATREC Size Established at Install • Default is 16K • Can be Increased to 32K in 4K increments • FOCCTL.DATA Contains Two Members • LINREC and DATREC • Make changes to BOTH Members as Follows: • DA XL(16*1024) Default 16K • DA XL(32*1024) Max Size • Assemble and Link • See Installation Guide for Details
Dialogue ManagerLIMITS • DATREC - 16K Default • Each Variable Name Takes 32 Bytes • 16384 / 32 = 512 Variables • ~40 Are Reserved by FOCUS • 472 Remain for Use • Each Additional 4K Increases the Available Variables by 128 • At the 32K Max 1024 Total Variables are available • 1024 – 40 =984 Remain For Use OR….
Dialogue ManagerLIMITS • LINREC - 16K Default • Each Variable Value Can Be as Large as: • 16384 / (Number of Variables + 40 Reserved) = Max VariableSize (Never greater than 256 Bytes Each) • Each Additional 4K Increases the Available Variable Size • A 32K Max is allowed
YMD DMY RECORDS… COUNTRY Dialogue Manager TABLE FILE CAR SUM RCOST BY COUNTRY IF COUNTRY EQ &COUNTRY END TABLE FILE CAR SUM DCOST BY CAR IF COUNTRY EQ &COUNTRY END EX PGM1 FOCSTACK.FTM PGM1.FEX TABLE FILE CAR SUM RCOST BY COUNTRY PLEASE SUPPLY ... COUNTRY = ENGLAND 020518 051802 0 ENGLAND
Dialogue Manager Process • Line does NOT begin with - (dash) • Evaluate &variables • Write to FOCSTACK with substitution • FOCSTACK also contains focexec name and line number • Line begins with dash in column 1 • Evaluate (process ) immediately • -* Comment line
Dialogue ManagerEnding the Process • -RUN • Execute the current FOCSTACK • Return to Procedure at next line • -EXIT • Execute the current FOCSTACK • Return to FOCUS command level (SYSIN) • -QUIT • Return to FOCUS command level (SYSIN) • Clear the current FOCSTACK • -QUIT FOCUS n • Return to system command level • Return code set to n
Dialogue ManagerUser &variables • &variable • Local variables are identified by a single ampersand (&) preceding the name of the variable. They remain in effect throughout a single procedure. • &&variable • Global variables differ from local variables in that once a value is supplied, it remains current throughout the FOCUS session, unless set to another value with -SET or cleared by the LET CLEAR command.
Dialogue ManagerUser &variables • &variable.LENGTH • &variable.EXIST • &variable.EVAL • &variable.TYPE
Dialogue ManagerSystem Variables • &DATE • &DATEYYMD • &YMD &DMY &MDY • &YYMD &DMYY &MDYY • &TOD
Dialogue ManagerValues for &variables • Implicit PROMPT • -DEFAULT • -PROMPT • -CRTFORM • -SET • -READ
Dialogue ManagerImplicit PROMPT 1 TABLE FILE CAR =====> Write to FOCSTACK 2 SUM RCOST =====> . 3 BY COUNTRY =====> . 4 IF COUNTRY EQ =====> . 5 &COUNTRY =====> IMPLICIT PROMPT PLEASE SUPPLY VALUES REQUESTED: COUNTRY= DATREC CONTAINS: COUNTRY LINREC CONTAINS: ENGLAND =====> TO STACK: ENGLAND 6 END =====> TO STACK: END
Dialogue ManagerImplicit PROMPT 8 TABLE FILE CAR =====> Write to FOCSTACK 9 SUM DCOST =====> . 10 BY CAR =====> . 11 IF COUNTRY EQ =====> . 12 &COUNTRY =====> VALUE AVAILABLE DATREC CONTAINS: COUNTRY LINREC CONTAINS: ENGLAND =====> TO STACK: ENGLAND 13 END =====> TO STACK: END
Dialogue Manager-DEFAULT(S) Syntax: -DEFAULT variable=value -DEFAULT &COUNTRY=ENGLAND TABLE FILE CAR SUM RCOST BY COUNTRY IF COUNTRY EQ ‘&COUNTRY’ END EX PRC1 OR EX PRC1 COUNTRY = FRANCE
Dialogue Manager-DEFAULT(S) • -DEFAULT &TST=‘ ‘ MODIFY FILE EMPLOYEE &TST ... EX PRC2 OR EX PRC2 TST=TRACE • -DEFAULT &1=ONLINE TABLE FILE VIDEOTRK ... ON TABLE SET PRINT &1 END EX PRC3 OR EX PRC3 OFFLINE
Dialogue Manager-PROMPT SYNTAX: -PROMPT &var.format.message. -PROMPT &var.(value1,value2,).message. Examples: -PROMPT &COUNTRY.(ENGLAND,FRANCE).COUNTRY?. TABLE FILE CAR SUM RCOST BY COUNTRY IF COUNTRY EQ &COUNTRY END -PROMPT &COUNTRY.(FRANCE,ITALY).COUNTRY?. TABLE FILE CAR SUM DCOST BY CAR IF COUNTRY EQ ‘&COUNTRY’ END
Dialogue Manager-CRTFORM SYNTAX: -CRTFORM -” text <&variable/length “ -” text <T.&variable> “ -” text <D.&variable> “ EXAMPLE: -CRTFORM - “ ENTER COUNTRY <&COUNTRY/10 “ TABLE FILE CAR SUM RCOST BY COUNTRY IF COUNTRY EQ ‘&COUNTRY’ END -CRTFORM “ COUNTRY - <T.&COUNTRY>“ ...
Dialogue Manager-SET SYNTAX: -SET &variable=expression; EXAMPLES: -SET &COUNTRY= IF COUNTRY EQ ‘GERMANY’ - THEN ‘W GERMANY’ ELSE &COUNTRY; -SET &COUNTRY=‘------------’; -SET &COUNTRY=UPCASE(12,&COUNTRY,’A12’); -SET &INCREASE = (&PCT1 / 100) + 1 -SET &NAME = &LN || (‘, ‘ | &FN); -SET &WITHQUO = ‘‘‘‘ | &LN || ‘‘‘‘; -SET &DTX = (YMD ,MDY ,&YMD | ‘X’, ‘A17’);
Dialogue Manager-READ Syntax: -READ ddname [NOCLOSE] &var1.len &var2.len -READ ddname [NOCLOSE] &var1, &var2 • ddname closed with -RUN • ddname closed with statistical variable
Dialogue Manager-READ TABLE FILE CAR SUM COUNTRY BY COUNTRY ON TABLE SAVE END -RUN -READ SAVE &COUNTRY.A10. GRAPH FILE CAR SUM SALES ACROSS MODEL ON GRAPH SAVE AS &COUNTRY WHERE COUNTRY EQ ‘&COUNTRY’ END
Dialogue Manager-TYPE -DEFAULT START=STEP1, END=STEP99 -GOTO &START -STEP1 -TYPE NOW ENTERING &START TABLE FILE ... -RUN -TYPE THE VALUE OF &|END IS &END
Dialogue Manager-WRITE -PROMPT &EXTSORT.(ON,OFF).EXTERNAL SORT?. SET EXTSORT = &EXTSORT TABLE FILE BIGFILE PRINT * BY KEYFLD END -RUN -WRITE OUTFI WHEN EXTERNAL SORT IS &EXTSORT -WRITE OUTFI THE AMOUNT OF LINES IS &LINES -WRITE OUTFI THE BASEIO IS &BASEIO
Dialogue ManagerNavigating the Procedure • Labels: (-name) • -GOTO label • -IF expression THEN label1 ELSE ... ; • -REPEAT endlabel n TIMES • -INCLUDE focexec
Dialogue Manager-GOTO -DEFAULT START=STEP1,END=STEP99 -GOTO &START -STEP1 TABLE FILE ... -RUN -IF &END EQ ‘STEP1’ GOTO STEP99; -STEP2 TABLE FILE HOLD ... END -RUN -IF &END EQ ‘STEP2’ GOTO STEP99; ... -STEP99 EXIT
Dialogue Manager-IF and -GOTO TABLE FILE CAR SUM COUNTRY BY COUNTRY WHERE COUNTRY EQ ‘ENGLAND’ OR ‘JAPAN’ ON TABLE SAVE END -RUN -LP -READ SAVE &COUNTRY.A10. -IF &IORETURN NE 0 GOTO NOMORE; TABLE FILE CAR SUM RC BY COUNTRY WHERE COUNTRY EQ ‘&COUNTRY’ END -GOTO LP -NOMORE EXIT
Dialogue Manager-IF and -GOTO TABLE FILE CAR SUM COUNTRY BY COUNTRY WHERE COUNTRY EQ ‘ENGLAND’ OR ‘JAPAN’ ON TABLE SAVE END -RUN > NUMBER OF RECORDS IN TABLE= 2 LINES= 2 EBCDIC RECORD NAMED SAVE FIELDNAME ALIAS FORMAT LENGTH COUNTRY COUNTRY A10 10 COUNTRY COUNTRY A10 10 TOTAL 20
Dialogue Manager-IF and -GOTO -LP -READ SAVE &COUNTRY.A10. -IF 0 NE 0 GOTO NOMORE; TABLE FILE CAR SUM RC BY COUNTRY WHERE COUNTRY EQ ‘ENGLAND’ END -GOTO LP -LP -READ SAVE &COUNTRY.A10. -IF 0 NE 0 GOTO NOMORE; TABLE FILE CAR SUM RC BY COUNTRY WHERE COUNTRY EQ ‘JAPAN’ END -GOTO LP
Dialogue Manager-IF and -GOTO -LP -READ SAVE &COUNTRY.A10. -IF 1 NE 0 GOTO NOMORE; -NOMORE EXIT > NUMBER OF RECORDS IN TABLE= 4 LINES= 1 PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY PAGE 1 COUNTRY RETAIL_COST ------- ----------- ENGLAND 45,319
Dialogue Manager-IF and -GOTO > NUMBER OF RECORDS IN TABLE= 2 LINES= 1 PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY PAGE 1 COUNTRY RETAIL_COST ------- ----------- JAPAN 6,478
Dialogue Manager-IF -STRT -PROMPT &COUNTRY.A10.ENTER COUNTRY. TABLE FILE CAR SUM RC BY COUNTRY WHERE COUNTRY EQ ‘&COUNTRY’ END -RUN -IF &LINES EQ 0 GOTO ERR; -EXIT -ERR -TYPE NO DATA FOUND FOUND FOR &COUNTRY -GOTO STRT
Dialogue Manager-IF -DEFAULT &PERIOD = 'MONTH' TABLE FILE FINANCE SUM AMOUNT BY ACCOUNT BY CUSIP BY YEAR -IF &PERIOD EQ 'ANNUAL' GOTO NOMORE ELSE - IF &PERIOD EQ 'QUARTER' GOTO QTRLY; BY MONTH -GOTO NOMORE -QTRLY BY QUARTER -NOMORE END
Dialogue Manager-IF -SET &CTR=1; -SET &CTR1=1; -STRT TABLE FILE FINANCE SUM AMOUNT BY ACCOUNT ACROSS MONTH COLUMNS -LP -IF &CTR GT 12 GOTO NOMORE; -SET &XYZ=IF &CTR1 EQ 1 THEN &CTR ELSE ‘AND ‘ | &CTR ; &XYZ -SET &CTR = &CTR + 1; -SET &CTR1 = &CTR1 + 1; -GOTO LP -NOMORE END -EXIT
Dialogue Manager-IF -SET &CTR=7; -SET &CTR1=1; -STRT TABLE FILE FINANCE SUM AMOUNT BY ACCOUNT ACROSS MONTH COLUMNS -LP -IF 7 GT 12 GOTO NOMORE; -SET &XYZ=IF 1 EQ 1 THEN 7 ELSE 'AND ' | 7 ; 7 -SET &CTR = 7 + 1; -SET &CTR1 = 1 + 1; -GOTO LP Note: we changed the counter(CTR) to 7 to limit the length of the output
Dialogue Manager-IF -LP -IF 8 GT 12 GOTO NOMORE; -SET &XYZ=IF 2 EQ 1 THEN 8 ELSE 'AND ' | 8 ; AND 8 -SET &CTR = 8 + 1; -SET &CTR1 = 2 + 1; -GOTO LP -LP -IF 9 GT 12 GOTO NOMORE; -SET &XYZ=IF 3 EQ 1 THEN 9 ELSE 'AND ' | 9 ; AND 9 -SET &CTR = 9 + 1; -SET &CTR1 = 3 + 1; -GOTO LP
Dialogue Manager-IF -LP -IF 10 GT 12 GOTO NOMORE; -SET &XYZ=IF 4 EQ 1 THEN 10 ELSE 'AND ' | 10 ; AND 10 -SET &CTR = 10 + 1; -SET &CTR1 = 4 + 1; -GOTO LP -LP -IF 11 GT 12 GOTO NOMORE; -SET &XYZ=IF 5 EQ 1 THEN 11 ELSE 'AND ' | 11 ; AND 11 -SET &CTR = 11 + 1; -SET &CTR1 = 5 + 1; -GOTO LP
Dialogue Manager-IF -LP -IF 12 GT 12 GOTO NOMORE; -SET &XYZ=IF 6 EQ 1 THEN 12 ELSE 'AND ' | 12 ; AND 12 -SET &CTR = 12 + 1; -SET &CTR1 = 6 + 1; -GOTO LP -LP -IF 13 GT 12 GOTO NOMORE; -NOMORE END -EXIT
Dialogue Manager-IF NUMBER OF RECORDS IN TABLE= 6 LINES= 6 PAUSE.. PLEASE ISSUE CARRIAGE RETURN WHEN READY PAGE 1 MONTH 7 8 9 10 ACCOUNT ---------------------------------------------------------------------------------- 1000 . . . . 1010 . . . . 6500 45,643 . . . 6600 . 12,909 . . 6900 . . 1,743 . 7000 . . . 17,459
Dialogue Manager-INCLUDE fexname TABLE FILE FILE1 -INCLUDE HDNG PRINT RCOST BY COUNTRY END -RUN TABLE FILE FILE2 -INCLUDE HDNG SUM DCOST BY COUNTRY END -INCLUDE PRC3
Dialogue ManagerDebugging • EX procedure • Only output from procedure seen • EX procedure ECHO=ON • Output from procedure seen • Stack (after substitution) displayed • EX procedure ECHO=ALL • Output from procedure seen • Dialogue Manager commands echoed • Stack (after substitution) displayed • SET XRETRIEVAL=OFF
Before You leave! Be Sure To Visit Our Problem Isolation Debugging Tool Site http://techsupport.informationbuilders.com/app/css_web_tool/default.htm
QUESTIONS Thanks for Coming!