Context\Context.wb Library Functions.  Data Driven Programming.  Enhance Existing programs.  Quickly Develop new Programs.  Powerful Set of Library.

Slides:



Advertisements
Similar presentations
Debugging ACL Scripts.
Advertisements

PHP I.
CC SQL Utilities.
Introduction to ODBC for Business Rules.  What is ODBC?  ODBC – Installing the Drivers  ODBC – Data Sources(BR.INI)  BR Sample Application  BR Context.
The SAS ® System Additional Information on Statistical Analysis Programming.
CPIT 102 CPIT 102 CHAPTER 1 COLLABORATING on DOCUMENTS.
Chapter 10 Introduction to Arrays
Copyright © 2011 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are trademarks of Accenture. SQL Workshop Day 4.
J4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.
ISP 121 Week 1 Introduction to Databases. ISP 121, Winter Why a database and not a spreadsheet? You have too many separate files or too much data.
2015/6/301 TransCAD Managing Data Tables. 2015/6/302 Create a New Table.
Guide To UNIX Using Linux Third Edition
Chapter 8: I/O Streams and Data Files. In this chapter, you will learn about: – I/O file stream objects and functions – Reading and writing character-based.
Guide To UNIX Using Linux Third Edition
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Introduction to PL/SQL Lecture 0 – Self Study Akhtar Ali.
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
Chapter 18: Modifying SAS Data Sets and Tracking Changes 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Creating SAS® Data Sets
Chapter 8 Printing 1. In COBOL you send data to the printer by writing data to a file. In COBOL, the printer is defined as a file, and it is opened, closed,
UFCEKG-20-2 Data, Schemas & Applications Lecture 4 Server Side Scripting & PHP.
Agenda Journalling More Embedded SQL. Journalling.
ASP.NET Programming with C# and SQL Server First Edition
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Chapter 10 Queries and Updating Part C. SQL Copyright 2005 Radian Publishing Co.
Working with a Database
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
Computer Science Standard Level Mastery Aspects. Mastery Item Claimed JustificationWhere Listed Arrays Used to store the student data Lines P.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Creating Context definitions for your own data.  RUN CONTEXT/TOOLS ◦ Application ◦ Application Data File ◦ Master File Record ◦ Context Definition.
OracleAS Reports Services. Problem Statement To simplify the process of managing, creating and execution of Oracle Reports.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Chapter 5 Files/Folders needed: \Chapter5\Samples \Chapter5\Labs.
Reporting in Microsoft Dynamics NAV 2009 NAMECOMPANY REPORTING.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
Exploring an Open Source Automation Framework Implementation.
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
Chapter 17 Creating a Database.
Indexed and Relative File Processing
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
ITGS Databases.
1/62 Introduction to and Using MS Access Database Management and Analysis Yunho Song.
Perl Tutorial. Why PERL ??? Practical extraction and report language Similar to shell script but lot easier and more powerful Easy availablity All details.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
Work with Tables and Database Records Lesson 3. NAVIGATING AMONG RECORDS Access users who prefer using the keyboard to navigate records can press keys.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Student Centered ODS ETL Processing. Insert Search for rows not previously in the database within a snapshot type for a specific subject and year Search.
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
Mark Dixon 1 Soft051 Examination Sample Questions.
Be “GUI ready” developing in RPG by Robert Arce from PrismaTech. Be “GUI ready” developing in RPG-ILE Presented by: Robert Arce.
BR SQL SUPPORT I have a legacy application and I don’t intend to rewrite it any time soon. Why should I be concerned with this?
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
NXT File System Just like we’re able to store multiple programs and sound files to the NXT, we can store text files that contain information we specify.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
File I/O. I/O Flags Flags are passed to give some information about how the file is to be used. – Read only file – flag=0x0 – Write only file – flag=0x1.
Data Virtualization Tutorial: Introduction to SQL Script
Database application MySQL Database and PhpMyAdmin
Database Performance Tuning and Query Optimization
Intro to PHP & Variables
Topics Introduction to File Input and Output
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
Chapter 11 Database Performance Tuning and Query Optimization
The ultimate in data organization
Topics Introduction to File Input and Output
Automation and IDispatch
Tutorial 8 Sharing, Integrating, and Analyzing Data
Presentation transcript:

Context\Context.wb Library Functions

 Data Driven Programming.  Enhance Existing programs.  Quickly Develop new Programs.  Powerful Set of Library Functions.  EMPLOYEE.WB

 Context Manager Database ◦ Application Information ◦ Table Information ◦ Field Information  USE SQL fields as variables. ◦ Self Documented Programs.  READ #EMPLOYER_HANDLE,using EMPLOYER_FORMALL$:MAT EMPLOYER_DATA$,MAT EMPLOYER_DATA  PRINT EMPLOYER_DATA$(EMPLOYER_NAME)

 Replace Hard Coded Lines: ◦ OPEN Statements. ◦ Form Statements. ◦ Individual variables.  Sometimes it’s ok to use Both.  Not all Programs need to be enhanced.  Use Libraries as Much as Possible.

 Use Library Functions: ◦ Easily Open Tables. ◦ Automatically Generate Form Statements. ◦ Automatically Generate Variables.  Hard Coded variables replaced: ◦ EMPLOYER_DATA$(EMPLOYER_NAME).  Dynamic Field Processing: ◦ Use Libraries to Validate. ◦ Field Names (SSN, NAME, _DATE). ◦ Store Additional Information in Context.

 Context\Context.wb: ◦ A Program to import file layouts into Context. ◦ A Group of Powerful Library Functions.  Documented in BR-ODBC.CHM  Functions: ◦ Open Tables & Index Files. ◦ Create Form Statements & Variables. ◦ Process CSV or TAB Delimited Files.

 Simple Report on ADS Sample Data.  Demonstrates library functions.  Creates a simple MS-Excel Spreadsheet.  Uses the Context Manager Database  Written entirely in Business-Rules!  To Run: ◦ CD ADS ◦ RUN EMPLOYEE

 FNOPEN_TABLE(APPLICATION$,FILENAME$,MAT TABLE_HANDLES) ◦ This function will open a table defined within the context manager, along with all of it's related index files. The file handles will be passed to an array.  Parameters: ◦ Application$ - Application Code. ◦ FILENAME$ - Table or File Code. ◦ MAT TABLE_HANDLES - Array of File Handles assigned to each of the available index files.  Returns: ◦ Table handle assigned to "Key1" or the "Primary Index".  Example:  LET EMPLOYEE_RESULT=FNOPEN_TABLE("PAYROLL","EMPLOYEE",MAT EMPLOYEE_HANDLES)

 FNSTATUS_FILE(MAT NAME_FILE$,MAT KFNAME_FILE$,MAT USE_FILE$) ◦ This function will return 3 arrays. Containing information about the files that are currently open.  Parameters: ◦ MAT NAME_FILE$ - An array containing the files that are currently open. ◦ MAT KFNAME_FILE$ - An array containing the Key Names for the open files. ◦ MAT USE_FILE$ - Contains a Shorthand List of both Name & KFNAME.  Returns: The highest file that is currently open.  Example: ◦ LET FNSTATUS_FILE(MAT NAME_FILE$,MAT KFNAME_FILE$,MAT USE_FILE$) ◦ LET EMPLOYEE_HANDLE=SRCH(MAT USE_FILE$,"NAME="&EMPLOYEE_DRIVE$&"EMPLOYEE,KFNAME="&EMPLOYEE_DRIVE$&" EMPLOYEE.KEY")

 FNCONTEXT(APPLICATION$,FILENAME$,ALIAS$,MAT DATA$,MAT DATA,MAT FIELDSC$,MAT FIELDSN$,&FORM_C$,&FORM_N$,&FORM_ALL$) ◦ This function will assign values to the required fields that will be used to perform IO and define the "SQL Names" for the fields within a particular table.  Parameters: ◦ APPLICATION$ - Context Application Code ◦ FILENAME$ - File or TABLE to use ◦ ALIAS$ - Specific Record Layout to Use ◦ MAT DATA$ - Array contains Character variables in IO statements. ◦ MAT DATA -Array contains Numeric variables in IO statements. ◦ MAT FIELDSC$ -Array populated by the function, Character "SQL Field Names". ◦ MAT FIELDSN$ - Array populated by the function, Numeric "SQL Field Names". ◦ FORM_C$ -String variable “cform$” statement read Character variables. ◦ FORM_N$ -String variable “cform$” statement read Numeric variables. ◦ FORM_ALL$ -String variable “cform$” statement read both data types.

 Example: ◦ DIM EMPLOYEE_DATA$(1)*80,EMPLOYEE_DATA(1),EMPLOYEE_FIELDSC$(1)*20,EMPLOYEE_FI ELDSN$(1)*20,EMPLOYEE_FORMC$*512,EMPLOYEE_FORMN$*512,EMPLOYEE_FORM_AL L$* LET FNCONTEXT(APPLICATION$:="PAYROLL",FILENAME$:="EMPLOYEE",ALIAS$:="EMPLOYE E",MAT EMPLOYEE_DATA$,MAT EMPLOYEE_DATA,MAT EMPLOYEE_FIELDSC$,MAT EMPLOYEE_FIELDSN$,EMPLOYEE_FORMC$,EMPLOYEE_FORMN$,EMPLOYEE_FORM_ALL$) ◦ In the above example, the Data & Form variables for EMPLOYEE from the PAYROLL application will be populated. (Note, no file is opened, but the arrays are re-dimensioned to match the appropriate information for EMPLOYEE.

 FNPACK_FORM$*1024(F$*2048;PACK_TYPE) ◦ This function is automatically used by FNCONTEXT, but may be useful to pack other form statements.  Parameters: ◦ PACKED_FORM$- Form Statement to Process ◦ PACK_TYPE - Logical Value (0 Returns Unpacked,1 Returns variable as CFORM$)  Returns: ◦ The form statement with duplicates converted to a compressed format ("3*C"). Based on PACK_TYPE, it will also return the CFORM$ or compiled value.  Example: ◦ DIM PACKED_FORM$* LET PACKED_FORM$="FORM POS 1,C 8,C 1,C 1,N 6,PD 6.2,POS 50,C 80" PRINT PACKED_FORM$ PRINT FNPACK_FORM$(PACKED_FORM$,PACK=0) ◦ In the above example, the program will disply the form statement before & after the function. The packed form statement will look like this: ◦ FORM POS 1,C 8,2*C 1,N 6,PD 6.2,POS 50,C 80

 FNINDEX_HANDLE(INDEX_KEY$*80; ACCESS_RIGHT$, &RECORD_PRIOR) ◦ This function is used to identify the file handle for existing index file. It is also capable of opening the data file if it is missing.  Parameters: ◦ INDEX_KEY$ - The "Shorthand" for the index file we want to open. ◦ ACCESS_RIGHT$ - INPUT,OUTPUT,OUTIN ◦ RECORD_PRIOR - Record pointer (-1 File was closed, 0 No record, >0 Record # assigned).  Returns: The file handle for the requested index handle.  Example: ◦ LET EMPLOYEE_RESULT=FNOPEN_TABLE("PAYROLL","EMPLOYEE",MAT EMPLOYEE_HANDLES) LET EMPLOYEE_INDEX_HANDLE=FNINDEX_HANDLE("NAME=F:EMPLOYEE,KFNAME=F:EMPL OYEE.KEY") ◦ The above example will find the file that has already been opened by FNOPEN_TABLE, and will assign EMPLOYEE_INDEX_HANDLE to the appropriate file handle. (In this example, there was only one index, so it was a bit redundant, but the example still works).

 FNGET_VAR$*128(UNQ$, MAT FIELDSC$, MAT FIELDSN$) ◦ This function actually creates a "PROC FILE" to be executed by the calling program. Once you execute the proc, local variables will be created for use within your application. These variables are assigned automatically based on the "SQL Names" defined in the context database.  Parameters: ◦ UNQ$ - Unique "Prefix" name to be used when creating the BR variables. ◦ MAT FIELDSC$ - An Array Containing "Character" or String Variable Names. ◦ MAT FIELDSN$ - An Array Containing "Numeric" Variable Names.  Returns:Name of a "temporary Proc" that will be executed.  Example: ◦ EXECUTE "PROC="&FNGET_VAR$(PREFIX$:="EMPLOYEE",MAT EMPLOYEE_FIELDSC$,MAT EMPLOYEE_FIELDSN$) ◦ The above example will execute the procedure created by FNGET_VAR$. That procedure will assign variable such as the following.  EMPLOYEE_EMP_NAME  EMPLOYEE_EMP_ADDRESS  EMPLOYEE_EMP_ZIP ◦ In order to use the "Name Field" within the application you would use the "DATA$" array as in the following example. ◦ PRINT "Name=";employee_DATA$(EMPLOYEE_EMP_NAME)

 OPEN #1: "NAME="&ENV$("TEMP")&"\EMPLOYEE.XLS,REPLACE,RECL=32000",DISPLAY,OUTPUT  PRINT #1: " "  Simple Print statements.  Using HTML, create a table. .XLS file name tricks MS-EXCEL.

 MAIN_READ ◦ READ #EMPLOYEE_HANDLE,USING EMPLOYEE_FORM_ALL$,RELEASE: MAT EMPLOYEE_DATA$,MAT EMPLOYEE_DATA EOF FINIS  Read Employee Data into 2 Arrays.  Use “Hard Coded Names” to reference fields.  Lookup available fields in: ◦ MAT EMPLOYEE_FIELDSC$ ◦ MAT EMPLOYEE_FIELDSN$

 Loop Through Records. (Filter by CO_NUM) ◦ 1110 IF TRIM$(EMPLOYEE_DATA$(EMPLOYEE_CO_NUM))<>"1" THEN !: ◦ GOTO READ_NEXT  Output HTML to Create EXCEL Spreadsheet ◦ PRINT #1: " " ◦ PRINT #1: " ";EMPLOYEE_DATA$(EMPLOYEE_EMP_NUM);" " ◦ PRINT #1: " ";EMPLOYEE_DATA$(EMPLOYEE_EMP_NAME);" " ◦ PRINT #1: " ";EMPLOYEE_DATA$(EMPLOYEE_EMP_ADDRESS);" " ◦ PRINT #1: " ";EMPLOYEE_DATA$(EMPLOYEE_EMP_CITY);" " ◦ PRINT #1: " ";EMPLOYEE_DATA$(EMPLOYEE_EMP_ST);" " ◦ PRINT #1: " ";EMPLOYEE_DATA$(EMPLOYEE_EMP_ZIP);" " ◦ PRINT #1: " ";EMPLOYEE_DATA$(EMPLOYEE_SEX);" “ ◦ PRINT #1: ' ';SALARY;' ' ◦ PRINT #1: " " ◦ READ_NEXT: GOTO MAIN_READ

 EXECUTE "sys -c -m start %TEMP%\Employee.xls"  Start command will launch EXCEL or equivalent application.