EDITOR'S NOTE: The following is a section of the dBASE IV documentation that summarizes many of the differences between the general working environment of dBASE IV and dBASE III PLUS. The information contained in this summary may undergo change as dBASE IV nears completion. PLEASE KEEP IN MIND THIS IS NOT FINAL DOCUMENTATION. For those who desire a summary of modified commands and functions, please contact Ashton-Tate's Public Relations department, (213)538-7317. (Sysop's Note: I'm trying to get a copy of that document, and when I have it I will post it on ASHFORUM. //Steve//) =========================================================================== dBASE IV CHANGE SUMMARY From dBASE III PLUS to dBASE IV =============================== Overview of the Changes ----------------------- dBASE IV has many new features that enhance its power for both end users and applications developers. This section highlights many of the basic differences between the general working environment of dBASE IV and dBASE III PLUS. New User Interface ------------------ A completely new interface allows you to harness dBASE IV's features and power without needing to write statements at the dot prompt. Every full-screen component of dBASE IV, from EDIT to SET, now supports a menu bar of pull-down menus. These new menus are supplemented by dBASE IV's new keyboard macro feature. The screen designers for forms, labels and reports share a common "what you see is what you get" (WYSIWYG) approach to designing. You can easily keep track of which forms, reports and labels work with which database files. Browse and Edit are more closely related, with a special function key that lets you flip between these two methods of displaying data. the dBASE III PLUS approach to handling views and queries has been enhanced to offer a direct and powerful way to join, filter and project data from multiple files. The Assistant has been replaced by the far more sophisticated Control Center, which makes it easier to work with all the essential database components. The Control Center ------------------ The Control Center is a new interface for dBASE, offering you a single system for handling the elements of dBASE IV. You can use the Control Center to open and close files, and access the menu system to establish views, reach design screens, run programs, and manage files and catalogs. The Control Center displays files, views, forms, reports, labels and programs in the current catalog. After selecting an object (such as a format file), you can then quickly display either the object's data or its design. This "point and shoot" Control Center is the perfect compliment to the command-oriented dot prompt. The Control Center also has some features not available from the dot prompt, such as a tree-structured DOS file directory and manager. Please refer to the "Using the Menu System" manual for complete information on dBASE IV's Control Center and menu system. Browse and Edit --------------- In dBASE IV, the Browse and Edit screens have been linked together to form two sides of the same coin. You use the "F2 Data" key to toggle between table and form displays of data. The menu bar for Browse has been greatly expanded, and a menu bar has been added to the Edit screen. Memo fields have a more powerful editor and can now be searched. The cursor movements on the Browse and Edit screens are more logical and helpful. Error Handling -------------- Error handling from the dot prompt has been improved. When an error occurs, you may now select options to edit the erroneous command line, get help, or cancel the command. Forms ----- The screen painter has been greatly improved. You can lay down all the fields and field names at once with an automatic layout. you can assign colors to design elements or draw crisp lines and boxes. You will find it easier to move objects around the screen, and you can copy text, fields and boxes to other places on a form. Calculated fields are available and you have more picture functions and template characters to choose from. Memo fields can be defined to appear already opened into their window form, and you can specify that certain fields can be edited only after a given condition is satisfied. Help System ----------- The Help system is far more powerful than before. Context-sensitive Help boxes provide how-to information for using the menu system and the Applications Generator. They also offer syntax and examples for all the commands and functions in dBASE IV and SQL. These Help boxes each contain the following selections for increased functionality: CONTENTS: A nested Table of Contents for on-line Help RELATED TOPICS: A pop-up list of related Help screens BACKUP: Allows you to move around the Help system without losing the original context PRINT: Prints the Help screen for future reference Labels ------ The labels generator has been improved over dBASE III PLUS. You no longer have to enter dBASE expressions for each line of the label. Instead, labels use the layout surface common to dBASE IV. You simply place fields where you want them. Fields can be added from the underlying database file or view. You can also use new calculated fields and special fields such as the current date or time. The labels generator offers full support of text styling and print settings, including automatic setup for the nine most common label sizes. Macros ------ dBASE IV has its own complete keyboard macro capability. You are able to create and save a series of keystrokes for playback at any time. Queries and Views ----------------- dBASE IV offers a new work surface for creating the queries that define views. You can more easily join files, filter their records, and choose which fields to display. You can also create calculated fields and global filters for any query. Special update queries help you automatically change many records at once. Reports ------- Reports have been completely redesigned. The report generator is now a WYSIWYG layout surface. You design a report around a bands concept, where each band is either a specific grouping of records, or a special band such as a report introduction or summary. Reports can include calculated fields and special fields such as the system date or a running page number. You have a choice of five types of summary fields (such as Total or Average) and two editing modes: word wrap or layout. Three different automatic report layouts make it easy to generate reports quickly. Flexible box and line drawing are available, along with numerous printing options. A full menu of text styling options lets you add bold or italics, as well as different type fonts and pitches. You can also choose whether to send your report to a printer or an electronic file. Structured Query Language (SQL) Capability ------------------------------------------ dBASE IV supports both interactive and imbedded structured query language (SQL) capability. Please refer to the "Using dBASE IV SQL" manual for complete information. DATABASE FILES ============== Changes to many aspects of database files make dBASE IV more powerful and efficient than dBASE III PLUS. Increased Structure Limits -------------------------- Database structures may now contain up to 255 fileds per record. In addition, each field may now optionally be designed as a key field on which the database is indexed. dBASE IV automatically creates a new .MDX (multiple index) file if any field in the database is designated as a key field. Please see the section in this booklet on indexing for full information on the new .MDX files. dBASE IV database structures may also contain a new numeric data type, F, that indicates fields that contain floating point numbers. See the description below on fixed and floating point numbers for more information. Multiple Child Relations ------------------------ A major improvement in dBASE IV is the added support of multiple-child, multiple-file relationships. In dBASE IV, a single file can now be related to more than one file simultaneously. PROTECT ------- The PROTECT utility is now immediately available from the dot prompt and Control Center, and is no longer an external utility. In addition, memo fields may now be encrypted, either explicitly through the PROTECT command or automatically when the related database is encrypted. All features of the PROTECT utility are now available in the single-user as well as multi-user mode. Read-Only Files --------------- dBASE IV now honors the DOS read-only file attribute when operating in either the single- or multi-user mode. COMMANDS AND FUNCTIONS ---------------------- dBASE IV has a wealth of new commands and functions to make it far more efficient and powerful than previous versions of dBASE. ALIAS Support ------------- dBASE IV allows many commands and functions to operate on unselected work areas. For example, RECNO(Customer) returns the current record number in the work area with the alias Customer, or you can open a database in an unselected work area with USE Customer IN 2. The enhanced functions are: BOF() DBF() DELETED() EOF() FIELD() FLOCK() FOUND() ISMARKED() KEY() LOCK() LUPDATE() MDX() NDX() ORDER() RECCOUNT() RECNO() RECSIZE() RLOCK() TAG() The enhanced commands are: DISPLAY STRUCTURE GO/GOTO LIT STRUCTURE SKIP UNLOCK USE CALCULATE Command ----------------- To meet the need for a single command capable of processing a number of database records for a variety of statistical and financial functions in a single pass, the CALCULATE command has been added to dBASE IV. CALCULATE can process and evaluate any of its functions in a single pass through the database. For example, the following are equivalent in dBASE III PLUS and dBASE IV: dBASE III PLUS: USE Customer COUNT TO Nbr_custs SUM Total_Dol TO Amt_Spent dBASE IV: USE Customer CALCULATE CNT() SUM(Total_Dol) to Nbr_custs, Amt_Spent The CALCULATE command, however, will complete its processing much faster than the two separate COUNT and SUM commands since CALCULATE requires only one pass through the database. The COUNT and SUM commands each require a separate complete pass through the records. See "Language Reference" for full information on the new CALCULATE command. Increased Command Line Length ----------------------------- dBASE IV supports command lines up to 1,024 characters long in program files and from the dot prompt. Date Delimiters --------------- dBASE IV uses curly braces to identify date values. For example: STORE {11/20/1958} TO Mdate is equivalent to: STORE CTOD("11/20/1958") TO Mdate Financial Functions ------------------- A number of financial functions have been added to dBASE IV for ease in calculating future values, present values, payments and other financial data. The financial functions are: FV() PAYMENT() PV() In addition, the new CALCULATE command is able to compute net present value (NPV). LOOKUP() Function ----------------- dBASE IV's LOOKUP() function will save programmers significant time and programming effort. LOOKUP() can search an unselected database for a desired expression and return data from that database (or any other open database) with one statement. For example, consider a common task in applications: Given a customer number, what is the customer's full name? Assuming a database containing the customer's number and first and last name fields, in dBASE III PLUS you would need the following statements: SELECT Customer SEEK Mcust_Nbr IF FOUND() STORE TRIM(First_Name)+" "+Last_Name TO Mcust_Name ELSE STORE "(Unknown)" TO Mcust_Name ENDIF With the LOOKUP() function, you need only: Mcust_Name = LOOKUP(Customer->First_Name)+" "+ Customer->Last_Name, Mcust_Nbr, Customer->Cust_Nbr) Mathematical Functions ---------------------- A number of new mathematical and trigonometric functions have been added to dBASE IV for use in complex calculations. The new mathematical and trigonometric functions are: SIN() ASIN() COS() ACOS() TAN() ATAN() ATN2() PI() RTOD() DTOR() SIGN() CEILING() FLOOR() LOG10() RAND() Memo Field Commands And Functions --------------------------------- Memo field processing is greatly improved in dBASE IV with the addition of new commands and functions to easily enter, edit, process and output memo fields. Memo fields are far more functional in dBASE IV than in dBASE III PLUS as you may now access their contents in searches through a database or under program control. Disk space usage with regard to memo fields has been vastly improved over previous versions of dBASE. Instead of wasting space occupied by outdated memo field information, dBASE IV recycles this old space, resulting in significantly smaller .DBT files. The new or enhanced memo field commands and functions are: APPEND MEMO COPY MEMO SET BLOCKSIZE TO AT() LEN() SUBSTR() REPLACE UPDATE MEMLINES() MLINE() STUFF() LEFT() RIGHT() SCAN/ENDSCAN Command -------------------- dBASE IV provides a new SCAN/ENDSCAN programming construct that establishes a loop to find and process database records meeting a specific condition. SCAN/ENDSCANE loops are easier to program and require fewer statements than equivalent DO WHILE/ENDDO loops. Statements within a SCAN loop may be skipped with a LOOP command, and a SCAN loop may be terminated with an EXIT command. For example, the following commands have the same practical effect: SCAN FOR Due_Date = DATE() .AND. Amt_Due > 0 DO Letter with LastName, FirstName, Amt_Due ENDSCAN is equivalent to: LOCATE FOR Due_Date = DATE() .AND. Amt_Due > 0 DO WHILE FOUND() .AND. .NOT. EOF() DO Letter WITH LastName, FirstName, Amt_Due CONTINUE ENDDO Statistical Functions --------------------- Full statistical capability has been added to dBASE IV with the ability to easily calculate standard deviations, variances, minimums, maximums, averages, sums and counts of database records in one pass through the CALCULATE command. Please see the section on the CALCULATE command above for more information. MEMORY VARIABLES AND ARRAYS =========================== dBASE IV has expanded support of memory variables and a full implementation of arrays in memory. Arrays ------ dBASE IV fully support arrays of memory variables with the following array commands and functions: APPEND FROM ARRAY, AVERAGE, COPY TO ARRAY, DECLARE, and SUM. dBASE IV's arrays can have up to two dimensions. Increased Memory Variable Limits -------------------------------- The maximum number of memory variables has been increased to 2,048. In addition, dBASE IV has an improved memory variable search algorithm to speed up search and retrieval of memory variables. Numeric memory variables in dBASE IV support both the N and new F data types. Numeric constants always have a data type of N. Memory variables created from a numeric constant also have a data type of N. (Please see the section on fixed/floating point numbers below for more information on the new F data type.) Memory variables created from a database field will have the same data type as the field. the data type of memory variables created as the result of a command or function depends on the output of the command or function. If an expression uses both fixed and floating point numbers, dBASE IV will ordinarily return a floating point number. The exceptions are when a floating point number is converted to a fixed point number with the FIXED() function (or vice versa), or when a REPLACE command is issued, since the data is written to the disk in ASCII notation. DATA INTEGRITY ============== dBASE IV has new commands and features to help ensure the integrity of your data. AUTOSAVE Feature ---------------- A new SET command provides automatic and immediate updating of disk files and file allocation tables upon a change. SET AUTOSAVE on/OFF, if set ON, enables the automatic updating of disk information. This feature ensures that all changes to databases and other files are written to disk immediately to prevent loss of data in the event of a power failure or other mishap. Transaction Processing ---------------------- dBASE IV now supports full transaction processing with rollback capability, using the new BEGIN TRANSACTION, END TRANSACTION, and ROLLBACK commands. Once a transaction is started with BEGIN TRANSACTION, each change to data files and index files is recorded in a special transaction file. When the END TRANSACTION statement is executed, the transaction is considered to have terminated successfully and the transaction file is closed an ddeleted. If, however, an error should occur during the transaction, any data and index files involved may be automatically restored with the ROLLBACK command to the condition they were in before the transaction was initiated. The USE command has been enhanced to verify the consistency of a database and/or index file before opening the file. If a transaction has terminated unsuccessfully, the database header is automatically flagged. When a USE is attempted on the possibly inconsistent database, a warning message displays suggesting a ROLLBACK. If a CANCEL command is executed during an active transaction, a ROLLBACK is automatically executed. If a SUSPEND is issued during a transaction, the transaction remains active and all commands issued while in suspended mode become part of the transaction. However, if you request a ROLLBACK while in suspended mode, you will not be able to RESUME the suspended program because you would start in the middle of a transaction. After a ROLLBACK, RESUME executes exactly like CANCEL. POWER AND COMPATIBILITY ======================= Enhancements to dBASE IV make it the most powerful and compatible data management system available on the market today. Automatic Multi-User File And Record Locks ------------------------------------------ dBASE IV now provides automatic file and record locking for the APPEND, BROWSE, CHANGE, EDIT, READ and REPLACE commands. this means that applications may now be used in single- and multi-user environments with a minimum of modification. dBASE IV's record locking function has also been enhanced to allow multiple, shared record locks from a single RLOCK() or LOCK() statement, and to identify the holder of a record lock. A new multi-user command, SET REPROCESS TO , allows you to specify the number of times a multi-user command is automatically attempted before dBASE IV returns an error. When a locking error occurs, dBASE IV now allows you to retry the lock attempt. Automatic Refresh Of Changed Data --------------------------------- When using BROWSE or EDIT, dBASE IV allows you to SET REFRESH TO to specify the number of seconds to wait between automatic checks of the database file in USE to see if another user has altered the data stored there. Most importantly, if another user has changed the data, dBASE IV will automatically display the changed data on your screen. Expanded and Extended Memory Support ------------------------------------ dBASE IV will automatically take advantage of memory above the 640K limit conforming to the LIM 4.0 specifications. Fixed and Floating Point Numbers -------------------------------- All numeric fields and memory variables with data type N are now considered to be fixed point numbers instead of floating point numbers, allowing for greater precision and predictability in numeric comparisons. Fields and variables of type N have greater precision than in dBASE III PLUS, but retain full compatibility. A new numeric data type, F, indicates numbers to be considered as floating point numbers. Both F and N data types may now be specified in the structure of a database. Floating point numbers have greater precision than fixed point type N numbers. Type F fields and numbers, however, are not downwardly compatible with dBASE III PLUS. Both type F and type N numbers are technically floating point numbers. The difference between the data types is in the way dBASE IV stores the numbers internally. Indexing -------- dBASE IV uses a new method of indexing that is able to maintain up to 47 index tags in a single file called an .mdx (multiple index) file. Each index tag is similar to an old .ndx file and consists of a tag name and key expression. The basic difference is that up to 47 different index expressions (the equivalent of 47 old .ndx files) can be maintained in a SINGLE .mdx file. When a database structure is created or modified, you have the option of specifying any (or all, up to 47) fields as an index field. If any field is so designated, a production .mdx file is created with the same name as the database file. After index tags are added to the .mdx file, each index tag in the production .mdx file is automatically updated each time data is changed in the database file. In addition, you may have more than one .mdx file active at once, which allows you to have literally hundreds of indexes open at the same time. The greatest benefits of .mdx files are that up to 47 index expressions are contained in a single file without the need for additional files to be open, and that each index tag is automatically updated upon a change in the database. The new .mdx files also support descending indexes. For example, in dBASE III PLUS, you might have needed the following indexes on a customer database: The databases and indexes require four open files and you need to remember to have each index explicitly opened whenever data in the file could possibly be updated. Using an .mdx file in dBASE IV, you would need the following similar commands: USE Customer INDEX ON Cust_nbr TAG Custnbr INDEX ON SUBSTR(Last_name,1,8)+SUBSTR(First_name,1,1) TAG Custname INDEX ON Zip_code+SUBSTR(Last_name,1,8) TAG Custzip The result is that an .mdx file called Customer.mdx is created and each index expression is contained in the .mdx file as a tag. However, only two files are required to be open, and each tag is automatically updated whenever data in Customer.dbf is changed. dBASE IV also maintains complete compatibility with dBASE III PLUS .ndx files. dBASE IV also allows up to 10 .ndx files to be open simultaneously per database file. MODIFY COMMAND/Memo Field Editor -------------------------------- dBASE IV's built-in program file and memo field editor has been greatly enhanced and is now capable of editing large files up to 1,024 characters by 32,000 lines. The new editor has complete text editing capabilities, including block copy and move functions as well as an automatic indenting feature for program files. In addition, the editor may be used either with a pull-down menu interface or familiar dBASE III PLUS/WordStar control code sequences. Working with Other File Formats ------------------------------- dBASE IV now has the ability to directly read and write files created with other products, including dBASE II, Framework II, RapidFile, MultiPlan, Lotus 1-2-3 (both .wks and .wk1 file formats), PFS, and the DIF spreadsheet format. The commands supporting foreign files are: APPEND FROM COPY TO EXPORT TO IMPORT FROM PROGRAMMING TOOLS ================= A number of new programming tools make programming with dBASE IV easier and more efficient than ever. This section describes some of the new tools available to you. Applications Generator ---------------------- The dBASE III PLUS Applications Generator has been replaced with a completely new and powerful development tool that can be used by both new and advanced programmers to create fully functional applications without writing a single line of code. Unlike the dBASE III PLUS Applications Generator, the new Applications Generator allows you to easily modify menus and assign actions to them, so you can create applications just the way you or your clients want them. The easy-to-use menu system also shortens your development time. The Applications Generator can be invoked from both the Control Center and the dot prompt. Please refer to the "Using the Apgen" manual for complete information on dBASE IV's new Applications Generator. Compiler -------- dBASE IV includes an automatic built-in program compiler that greatly increases execution speed by interpreting and parsing command, procedure and format files into intermediate executable code, and saving the intermediate code in program object (.dbo) files. For developers, dBASE IV affords even greater execution speed when program object (.dbo) files are linked into one large object file. Please see the COMPILE and DBLINK commands in the next section for further information. The @ SAY...GET command has been greatly enhanced to provide extended data validation with the VALID option. VALID is followed by a condition which must be satisfied before the data is accepted into the GET variable. The may be any expression which returns a logical true (.T.) or logical false (.F.). The may also be a user-defined function that returns a logical value. Using a user-defined function as the condition allows unlimited validation by the programmer. Debugger -------- A full-featured program debugger has been added to dBASE IV. It works in a window environment and with a new editor. The debugger is invoked with either DEBUG or SET TRAP ON. The dBASE IV debugger provides windows for debugger status, editing, breakpoints and display. The Debug window shows environmental information such as the program file and procedure name being executed, current line number, work area, database, and index file in use, and current record number. The Edit window displays the program source file being executed and allows changes made during debugging to be stored in the file. The Breakpoint window accepts up to 10 conditions to be evaluated after each line of code is executed. If any of the conditions evaluates to a logical true (.T.), program execution is halted and the Debug window becomes active. The Display window accepts one or more expressions and displays the results based on the current environment status. Menus ----- dBASE IV now supports user-definable menus in the programming language. The menu commands and functions enable you to easily create and modify pop-up and horizontal bar menus similar to dBASE IV's own user interface. (A pop-up menu appears in a window on the screen and disappears after you make a selection; horizontal bar menus are command line or pull-down menus.) The new user-definable menu commands and functions are: DEFINE POPUP DEFINE BAR ACTIVATE POPUP SHOW POPUP DEACTIVATE POPUP CLEAR POPUPS RELEASE POPUPS ON SELECTION POPUPS POPUP() BAR() PROMPT() DEFINE MENU DEFINE PAD ACTIVATE MENU SHOW MENU DEACTIVATE MENU RELEASE MENU CLEAR MENUS ON PAD ON SELECTION MENU() PAD() Procedures ---------- dBASE IV treats procedures differently than dBASE III PLUS. dBASE IV supports the concept of procedures within any program file. When a program source file is compiled into program object code (a .dbo file), any procedures encountered in the command file are added to a procedure list for that object file. Procedures in the procedure list are then available to any subsequently called command file. Thus, all program files are now effectively procedure files. The total number of procedures per program/procedure file has been increased from 32 to 1,170. dBASE IV still supports the SET PROCEDURE TO command for procedures that are contained in a file not activated by a DO statement. Template Language ----------------- The Template Language is completely new in dBASE IV. It allows the developer to customize menu applications created with the Applications Generator or the forms, labels and reports produced by the new screen painter. The Template Language also provides the ability to automatically document applications created with these new tools. This highly sophisticated but easy-to-use language gives developers all the necessary resources to create custom applications in their own style. User-Defined Functions ---------------------- dBASE IV now supports user-defined functions to allow unlimited flexibility and power in the command language. If you need a function that is not provided in dBASE IV, you can create a user-defined function, customized and tailored to your exact needs. A user-defined function can be placed in any dBASE expression or condition. Windowing --------- dBASE IV fully supports windowing from within the command programming language. The maximum number of windows that can exist in memory at one time depends only on the amount of memory available. Windows may be overlaid and moved, and support full color selection, programmable locations, and borders. The new dBASE IV commands for manipulating windows are: DEFINE WINDOW ACTIVATE WINDOW DEACTIVATE WINDOW CLEAR WINDOW RELEASE WINDOW SAVE WINDOW RESTORE WINDOW MOVE WINDOW SYSTEM SETUP ============ An expanded configuration file and new commands make system configuration easier and more flexible using dBASE IV. International Currencies and Dates ---------------------------------- dBASE IV provides a number of functions to support international currency and date formats. The functions are: o SET CURRENCY TO [] to change the currency character o SET CURRENCY LEFT/Right to specify whether the currency character will appear to the left or right of a monetary amount o SET POINT TO [] to change the numeric decimal point character o SET SEPARATOR TO [] to change the numeric separator character o DMY() to return a date expression in the form DD Mon YY (or DD Mon YYYY if SET CENTURY is ON) o MDY() to return a date expression in the form Mon DD YY (or Mon DD YYYY if SET CENTURY is ON) o SET DATE [TO] AMERICAN/ANSI/BRITISH/FRENCH/GERMAN/ITALIAN/JAPAN/ USA/MDY/DMY/YMD to specify the date format used for subsequent date displays o SET HOURS TO 12/24 to specify whether a 12- or 24-hour clock is displayed o SET MARK TO [] to specify which character is used to separate the month, day and year in a date expression Number of Open Files Increased ------------------------------ The maximum number of simultaneously open files has been increased from 15 to 99 files. To use the additional files, both the Config.DB and Config.SYS files must contain an appropriate FILES= statement. Printer Drivers --------------- To enhance the quality of printed output, dBASE IV now supports the use of optional installable printer drivers to control print functions. The printer drivers allow you to specify such print attributes as bold, italic, underlined, superscript, subscript and print font. In addition, dBASE IV allows you to change many of the internal print variables such as page number, line spacing and page offsets. dBASE IV's printer drivers are compatible with Framework II and RapidFile printer drivers. Output through the use of the report generator, ? and ?? commands may specify printer styles. The ? and ?? commands support a STYLE option to specify print styles. A new command, ???, has been added to dBASE IV to send an expression (typically a printer control command string) to the printer without modification by the printer driver. Specifying a printer driver activates a number of special memory variables called "system memvars." System memvars are preceded by an underscore to keep them distinct from other memory variables. They are described fully in the "Language Reference" manual. To further enhance the quality of printed output for developers, the dBASE IV Developer's Edition includes a printer driver toolkit to modify and customize printer drivers in the RunTime manual.