The Basics of Dialogue Manager for Application Development Walter F. Blood June, 2008.

Slides:



Advertisements
Similar presentations
CC SQL Utilities.
Advertisements

Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
M AT L AB Programming: scripts & functions. Scripts It is possible to achieve a lot simply by executing one command at a time on the command line (even.
Chapter 9: Introducing Macro Variables 1 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Computer Science 1620 Programming & Problem Solving.
Introduction to PL/SQL
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
SQL Query Extras MIS 433. Rerunning the last Query n Type the forward slash “/” to rerun the last query that was entered.
Creating SAS® Data Sets
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
Ch 111 Chapter 11 Advanced Batch Files. Ch 112 Overview This chapter focuses on batch file commands that allow you to:  write sophisticated batch files.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Chapter 4 – The Building Blocks Data Types Literals Variables Constants.
Agenda Control Flow Statements Purpose test statement if / elif / else Statements for loops while vs. until statements case statement break vs. continue.
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
1 Chapter 9 Writing, Testing, and Debugging Access Applications.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Programmer's view on Computer Architecture by Istvan Haller.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
PHP meets MySQL.
Shell Scripting Introduction. Agenda What is Shell Scripting? Why use Shell Scripting? Writing and Running a Shell Script Basic Commands -ECHO - REM.
Chapter 12: How Long Can This Go On?
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection)
Input, Output, and Processing
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
“Ad hoc” Querying and Reporting with WebFOCUS Twanette Jurd 9 April 2010.
Linux Operations and Administration
Flow of Control Part 1: Selection
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Additional Control Structures. Chapter 9 Topics Switch Statement for Multi-way Branching Do-While Statement for Looping For Statement for Looping Using.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
TK 1914 : C++ Programming Control Structures I (Selection)
Introduction to SAS Macros Center for Statistical Consulting Short Course April 15, 2004.
REXX Saravanan Desingh. REXX An abbreviation of IBMs Restructured EXtended eXecutor (REXX) Language, which allows system command to be used or combined.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
JavaScript, Fourth Edition
Shell Scripting – Putting it All Together. Agenda Escaping Characters Wildcards Redirecting Output Chaining and Conditional Chaining Unnamed and Named.
Chapter Six Introduction to Shell Script Programming.
Branching Techniques for Managing WebFOCUS Applications Joel Starkman Director, FOCUS Division Information Builders, Inc. October, 2011 Copyright 2011,
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Agenda Positional Parameters / Continued... Command Substitution Bourne Shell / Bash Shell / Korn Shell Mathematical Expressions Bourne Shell / Bash Shell.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
5.1 Introduction Problem Solving –Requires understanding of: Building blocks Program-construction principles BZUPAGES.COM.
1 Programming in C++ Dale/Weems/Headington Chapter 9 Additional Control Structures (Switch, Do..While, For statements)
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Rexx Programming1 REXX Programming. Rexx Programming2 INTRODUCTION What is REXX ?  REstructured eXtended eXecuter  Simple Programming Language  Can.
 2002 Prentice Hall. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1Introduction 5.2 Essentials of Counter-Controlled Repetition.
Batch Files More flow of control Copyright © by Curt Hill.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapter 25 By Tasha Chapman, Oregon Health Authority.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Linux Administration Working with the BASH Shell.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Oracle 10g Retrieving Data Using the SQL SELECT Statement.
Retrieving Data Using the SQL SELECT Statement
Variables, Variables, Everywhere
Scripts & Functions Scripts and functions are contained in .m-files
Topics Introduction to File Input and Output
Chapter 4: Introduction to PL/SQL
T. Jumana Abu Shmais – AOU - Riyadh
Restricting and Sorting Data
Topics Introduction to File Input and Output
Presentation transcript:

The Basics of Dialogue Manager for Application Development Walter F. Blood June, 2008

Dialogue Manager Agenda 1. What is Dialogue Manager? 2. How does Dialogue Manager process? 3. What are Dialogue Manager variables?  Types - user, system, statistical  Assigning values to variables 4. How can I navigating the procedure? 5. How can I debug Dialogue Manager procedures?

Dialogue Manager What is Dialogue Manager?  Process Controller  Prepare FOCUS commands for execution  Get values for variables (indicated by leading '&')  User supplied  Process supplied (statistical variables)  Calculated  Control Execution Flow  Branching  Conditional Branching  Dialogue Manager commands - leading dash in column 1

What is Dialogue Manager? FOCEXECs  Applications are built using FOCEXECs as building blocks  Dialogue Manager Commands – preceded by dash  FOCUS Commands – not preceded by dash  System Commands – preceded by –  Naming Conventions  VM: focexecname FOCEXEC filemode  MVS  Member of PDS allocated to FOCEXEC  Sequential file allocated to focexecname  Focexecname.fex NOT terminal input or SYSIN (no &YMD in HEADING)

What is Dialogue Manager? FOCEXECs  Application profiles automatically executed by system  EDASPROF.PRF ‘EDASPROF PROF’  ERRORS(FOCPARM)‘FOCPARM ERRORS’  ERRORS(FOCPROF)‘FOCPROF ERRORS’  FOCEXEC(PROFILE)PROFILE FOCEXEC  All others  EX focexecname [variable=value,variable=value]  MVS Batch //SFEX DD * focexec /* //SYSIN DD * EX SFEX FIN /*

Dialogue Manager Processing  Parse FOCEXEC  Substitute variables  Prompt for variables not previously set  Execute Dialogue Manager commands (- in column 1  Place non-Dialogue Manager commands on a stack for further processing EX focexecname [variable=value,variable=value]

Processing Parsing the FOCEXEC  Line begins with - (dash) in column 1  Evaluate and process immediately  -* Comment lines ignored  Line does NOT begin with - (dash)  TABLE, DEFINE, MODIFY, SET, etc.  Evaluate &variables (may PROMPT or AUTOPROMPT)  Write to execution stack with substitution  Stack is executed with –RUN or –EXIT  Stacked commands executed by command processor

Processing Ending the Process  -RUN  Execute the current stack  Return to procedure at the next line  -EXIT  Execute the current stack  Return to FOCUS command level (SYSIN)  -QUIT  Return to FOCUS command level (SYSIN)  Clear the current stack  -QUIT FOCUS n  Return to system command level  Return code set to n

TABLE FILE EMPLOYEE TABLE FILE EMPLOYEE HEADING CENTER "REPORT OF SALARIES" TABLE FILE EMPLOYEE HEADING CENTER "REPORT OF SALARIES" SUM SALARY BY DEPARTMENT BY EMP_ID TABLE FILE EMPLOYEE HEADING CENTER "REPORT OF SALARIES" SUM SALARY BY DEPARTMENT BY EMP_ID WHERE LAST_NAME CONTAINS 'SMITH' TABLE FILE EMPLOYEE HEADING CENTER "REPORT OF SALARIES" SUM SALARY BY DEPARTMENT BY EMP_ID WHERE LAST_NAME CONTAINS 'SMITH' END WHO = US NAME = SMITH EX PROC1 WHO=US, NAME=SMITH -STEP1 Processing Example HEADING CENTER "REPORT OF SALARIES" EX PROC1 WHO=US, NAME=SMITH WHO = US NAME = SMITH NAM1 = 'SMITH' -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

Variables 10

Variables User Variables  &variable  Single ampersand (&) precedes variable name  In effect throughout a single procedure  &&variable  Remain in effect throughout the FOCUS session  Change with -SET &&variable  Cleared by the LET CLEAR command  In a non-persistent connection, set in edasprof, or controlled by IBIF_persistentamp setting  &variable.&index  Indexed variables  Multiple selections for the same variable name

Variables Names and Values  &variable names  Each name from characters  Case sensitive  Variable values  Variables may be from K in length  Stored as alphanumeric values  Interpreted as integer or alphanumeric based on usage  SET DMPRECISION introduces decimal values

Variables Variable Attributes  &variable.EXIST  Test to see if variable exists  0 - value not set  non-zero - value has been set  &variable.LENGTH  Length of the variable value  &variable.TYPE  Type of value  A - alphanumeric  N - numeric  U - undefined

Variables Variable Evaluation  &variable.EVAL  Normal D.M. evaluation of variables only occurs ONCE  Amper variables replaced by their value  Problem for User Written Subroutines. Last arg must be format: Gives: STRING= >qwer IN QWER OUT qwerT -PROMPT &STRING -SET &LSTR = &STRING.LENGTH; -SET &LSTRING = LOCASE(&LSTR, &STRING,'A&LSTR'); -TYPE IN &STRING OUT &LSTRING

Variables Variable Evaluation .EVAL replaces D.M. variable and RE-EVALUATES: Gives: -PROMPT &STRING -SET &LSTR = &STRING.LENGTH; -SET &LSTRING = LOCASE(&LSTR, &STRING,'A&LSTR.EVAL'); -TYPE IN &STRING OUT &LSTRING STRING= >qwer IN QWER OUT qwer

Variables Variable Evaluation .EVAL can be used to control D.M. execution Gives: -DEFAULT &DEBUG=OFF -SET &C = IF &DEBUG EQ 'ON' THEN '-TYPE' ELSE '-*'; &C.EVAL VALUE OF DEBUG IS &DEBUG -TYPE REST OF PROCESS >>ex debug REST OF PROCESS >>ex debug debug=on VALUE OF DEBUG IS ON REST OF PROCESS

Variables System Variables  &DATE MM/DD/YY  &DATEYYMD YYYY/MM/DD  &YMD YYMMDD  &DMY DDMMYY  &MDY MMDDYY  &TOD HH.MM.SS  &FOCFOCEXEC  &FOCREL FOCUS release number  &FOCCPU OS CPU time  …and many more, check the manual.

Variables Statistical Variables  TABLE Command  &LINES, &RECORDS, &BASEIO, &FOCERRNUM  Operating System Command  &RETCODE  -READ  &IORETURN  -? TSO DDNAME ddname  &FOCUSPAGES, &DSNAME  Referencing a statistical variable implies –RUN  Needs execution to get a value

Variables Supplying Values for User Variables  EX focexec variable1=value1,variable2=value2  -DEFAULT  -PROMPT  Implicit PROMPT  -CRTFORM  -SET  -READ

Supplying Values for User Variables -DEFAULT  -DEFAULT variable=value -DEFAULT &COUNTRY=ENGLAND TABLE FILE CAR SUM RCOST BY COUNTRY IF COUNTRY EQ '&COUNTRY' END  EX PRC1  Use default value  EX PRC1 COUNTRY = FRANCE  Override default value WebFOCUS, with AUTOPROMPT, will use the DEFAULT value within the prompt as the 'default' value

Supplying Values for User Variables -PROMPT  -PROMPT &variable  -PROMPT &variable.message.  -PROMPT &variable.format.  Alphanumeric format: An  Numeric format: In (enforces numeric only)  -PROMPT &variable.format.message.  -PROMPT &variable.(value1,value2,...).message.  Implicit PROMPT  IF COUNTRY EQ '&variable'  IF COUNTRY EQ '&variable.message.'  IF COUNTRY EQ '&variable.format.message.'  IF COUNTRY EQ '&variable.(value1, value2).message.'

-PROMPT Examples  Implicit PROMPT: IF COUNTRY EQ '&COUNTRY'  Can be overridden at run time  -PROMPT &COUNTRY  Always prompted  -PROMPT &COUNTRY.Please enter a value for country. PLEASE SUPPLY VALUES REQUESTED COUNTRY= Please enter a value for country

-PROMPT Examples  -PROMPT &COUNTRY.A10.Please enter a value for country.  -PROMPT &COUNTRY.(ENGLAND,FRANCE).Please enter a value for country. Please enter a value for country WEST GERMANY (FOC291) THE VALUE IN THE PROMPT REPLY EXCEEDS THE MAXIMUM LENGTH: 10 CHARS:WEST GERMANY Please enter a value for country Please enter a value for country WEST GERMANY PLEASE CHOOSE ONE OF THE FOLLOWING: ENGLAND,FRANCE Please enter a value for country

Supplying Values for User Variables -SET Alphanumeric or numeric constants  String concatenation  Mathematical expressions  SET DMPRECISION= n (number of decimal places)  Functions  Typically require format as last or output parameter  Logical expressions (IF...THEN...ELSE) -SET &variable=expression;

-SET Examples  -SET &COUNTRY='ENGLAND';  -SET &COUNT=1001;  -SET &NAME = &LN || (', ' | &FN);  -SET &WITHQUO = '''' | &LN || '''';  -SET &INCREASE = &PCT1 + 3;  -SET &COUNTRY=UPCASE(12,&COUNTRY,'A12');  -SET &COUNTRY= IF &COUNTRY EQ 'GERMANY' - THEN 'W GERMANY' ELSE &COUNTRY;

Supplying Values for User Variables -CRTFORM  <T.&variable – display current value for change  <D.&variable – display current value. Cannot be changed. -SET &variable1=... ; -SET &variable2=... ; -SET &variable3=... ; -CRTFORM -" text <&variable0/length " -" text <&variable1" -" text "

-CRTFORM Example -CRTFORM -"ENTER COUNTRY <&COUNTRY/10" TABLE FILE CAR SUM RCOST BY COUNTRY IF COUNTRY EQ '&COUNTRY' END -RUN -SET &COUNTRY=' '; -CRTFORM “ COUNTRY - “...

Supplying Values for User Variables -READ  Use format for fixed length files  Use commas for comma delimited files  ddname closed with -RUN  ddname closed when a statistical variable is referenced  NOCLOSE option keeps file open until explicitly closed with -CLOSE -READ ddname [NOCLOSE] &var1.format &var2.format -READ ddname [NOCLOSE] &var1, &var2

Supplying Values for User Variables -TYPE  -TYPE prints messages to the screen -DEFAULT &START=STEP1 -DEFAULT &END=STEP99 -GOTO &START -STEP1 -TYPE NOW ENTERING &START TABLE FILE... -RUN -TYPE THE VALUE OF &|LINES IS &LINES

Dialogue Manager -WRITE  -WRITE prints messages to a file -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 NUMBER OF LINES IS &LINES -WRITE OUTFI THE BASEIO IS &BASEIO

Navigating the Procedure 31

Dialogue Manager Navigating the Procedure  Labels (-name)  -GOTO label  -IF expression THEN GOTO label1 ELSE... ;  -REPEAT  -REPEAT label n TIMES  -REPEAT label WHILE expression;  -REPEAT label FOR &variable [FROM m TO n STEP s]  -INCLUDE focexec

Navigating the Procedure -GOTO and Labels -DEFAULT START=STEP1,END=STEP99 -GOTO &START -STEP1 TABLE FILE... -RUN -IF &END EQ 'STEP1' THEN GOTO STEP99; -STEP2 TABLE FILE... -RUN -IF &END EQ 'STEP2' THEN GOTO STEP99;... -STEP99 -EXIT

Navigating the Procedure Branching to Control Execution -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 -RUN

Navigating the Procedure Alternative to Branching -DEFAULT &PERIOD = 'MONTH' -SET &SORT=IF &PERIOD EQ 'MONTH' - THEN 'BY MONTH' - ELSE IF &PERIOD EQ ‘QUARTER' - THEN 'BY QUARTER' - ELSE ' '; TABLE FILE FINANCE SUM AMOUNT BY ACCOUNT BY CUSIP BY YEAR &SORT END -RUN

Navigating the Procedure Loops TABLE FILE CAR SUM COUNTRY BY COUNTRY ON TABLE SAVE END -RUN -LP -READ SAVE &COUNTRY.A10. -IF &IORETURN NE 0 GOTO NOMORE; TABLE FILE CAR SUM RETAIL_COST BY COUNTRY IF COUNTRY EQ '&COUNTRY' END -GOTO LP -NOMORE -EXIT

Navigating the Procedure -REPEAT TABLE FILE FINANCE SUM AMOUNT BY ACCOUNT ACROSS MONTH COLUMNS ‑ REPEAT NOMORE FOR &CTR1 FROM 1 TO 12 STEP 1 -SET &XYZ=IF &CTR1 EQ 1 THEN &CTR1 - ELSE 'AND ' | &CTR1; &XYZ -NOMORE END -EXIT

Navigating the Procedure -INCLUDE  -INCLUDE focexecname  Reads another FOCEXEC into the same session  Inserted lines treated as if they were in the calling FOCEXEC (may be 'partial' FOCEXEC)  Variables are shared within session  Use -INCLUDE to insert common code in several FOCEXECs  EX focexecname  Starts a new Dialogue Manager session  Variables are not shared with calling FOCEXEC  Must be 'complete' (self-contained)

Debugging Dialogue Manager 39

Dialogue Manager Debugging  -SET &ECHO=  OFF – do not echo any code  ON – echo only stacked commands after substitution  ALL – echo all commands after substitution  Applies only focexec in which it is called  SET DEFECHO=  ON – Forces ECHO for all commands across focexecs  OFF – Turns off forced echo of all commands  Requires –RUN to engage this setting.  SET XRETRIEVAL=OFF  Parses the non-Dialogue Manager commands  Does not retrieve data from databases

Debugging &ECHO Examples  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

Debugging &ECHO Examples -DEFAULT &PERIOD = 'MONTH' TABLE FILE FINANCE SUM AMOUNT BY ACCOUNT BY CUSIP BY YEAR -SET &ECHO=ALL; -IF &PERIOD EQ 'ANNUAL' GOTO NOMORE ELSE -IF &PERIOD EQ 'QUARTER' GOTO QTRLY; BY MONTH -GOTO NOMORE -QTRLY BY QUARTER -NOMORE -SET &ECHO=OFF; END

Basics of Dialogue Manager for Application Development