═══ 1. ! Note ═══ Product Documentation Information. Y.A.M. COMPUTERS (1982) Ltd. (Y.A.M) PROVIDES THIS INFORMATION "AS IS", WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. This information could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in new editions of the information. Y.A.M. may make improvements and/or changes in the product(s) and/or the program(s) described in this information at any time. It is possible that this information may contain reference to, or information about, Y.A.M. products (programs), programming, or services that have not been announced in your country. Such references or information must not be construed to mean that Y.A.M. intends to announce such Y.A.M. products, programming, or services in your country. OpenWin (C) Copyright Y.A.M. Computers (1982) Ltd. 1991.All rights reserved. OpenWin Program License Agreement STATEMENT OF LIMITED WARRANTY OpenWin REGISTRATION CARD ═══ 2. OpenWin Program License Agreement ═══ OpenWin Program License Agreement BEFORE OPENING AND USING THIS PACKAGE, YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS. OPENING THIS PACKAGE OR USING THIS PACKAGE INDICATES YOUR ACCEPTANCE OF THESE TERMS AND CONDITIONS. IF YOU DO NOT AGREE WITH THEM, YOU SHOULD PROMPTLY RETURN THE PACKAGE UNOPENED AND YOUR MONEY WILL BE REFUNDED. THE LICENSE HEREIN IS VALID ONLY FOR USERS THAT HAVE PURCHASED THE PRODUCT FROM Y.A.M. COMPUTERS OR ITS LICENSED DISTRIBUTORS. This is a license agreement and not an agreement for sale. Y.A.M. owns all copyrights to the program - "OpenWin" henceforth the Program. You obtain no rights other than the license granted you by this agreement. Title to the enclosed copy of the Program, and any copy made from it, is retained by Y.A.M.. Y.A.M. licenses your use of the program. You assume all responsibility for the selection of the program to achieve your intended results and for the installation of, use of, and results obtained from, the program. LICENSE You may: 1. Use the program on only one machine and only one user may operate it at any one time, unless permission to use it on more than one machine at any one time is granted in attached Special License Information ; 2. Make a copy of the Program for backup or modification purposes only in support of your authorized use. However, programs marked "Copy Protected" limit copying; 3. Transfer possession of copies of the program to another party by transferring this copy of the OpenWin Program License Agreement, the License Information, and all other documentation, along with at least one complete, unaltered copy of the program. You must, at the same time, either transfer to such other party or destroy all other copies of the program in your possession, including modified copies or portions of the Program merged into other programs. Such transfer of possession terminates your license from Y.A.M.. Such other party shall be licensed, under the terms of this agreement, upon acceptance of this agreement by its initial use of the program. You shall reproduce and include the copyright notice(s) on all such copies of the Program, in whole or in part. You may not: 1. Use, copy, modify, merge, or transfer copies of the Program except as provided in this agreement; 2. Perverse assemble or reverse compile the program, and/or 3. Sub license, rent, lease or assign the program or any copy thereof. LIMITED WARRANTY Warranty details and limitations are described in the Statement of Limited Warranty which is attached. Y.A.M. provides a three-month limited warranty on the media for all programs. For selected programs, as indicated on the outside of the package, a limited warranty on the program is available. The applicable warranty period is measured from the date of delivery to the original user as evidenced by a Certain Programs receipt., as indicated on the outside of the package, are not warranted and are provided "AS IS." SUCH WARRANTIES ARE IN LIEU OF ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. LIMITATION OF REMEDIES Y.A.M.'s entire liability and your exclusive remedy shall be as follows: 1. Y.A.M. will provide the warranty described in Y.A.M.'s statement of Limited Warranty. If Y.A.M.'s authorized distributor does not replace defective media or, if applicable, make the Program operate as warranted, or replace the Program with a functionally equivalent program, all as warranted, you may terminate your license and your money will be refunded upon the return of all of your copies of the Program. 2. For any claim arising out of Y.A.M.'s limited warranty, or for any other claim whatsoever related to the subject matter of this agreement, Y.A.M.'s liability for actual damages, regardless of the form of action, shall be limited to the money paid to Y.A.M., its authorized dealer, or its approved supplier for the license for the program that caused the damage, or that is the subject matter of, or is directly related to, the cause of action. This limitation will not apply to claims for personal injury or damages to real or tangible personal property caused by Y.A.M.'s negligence. 3. In no event will Y.A.M. be liable for any lost profits, lost savings, or any incidental damages or other consequential damages , even if Y.A.M., its authorized dealer, or its approved supplier, has been advised of the possibility of such damages, or for any claim by you based on a third party claim. GENERAL You may terminate your license at any time by destroying all copies of the Program in your possession, or as otherwise described in this agreement. Y.A.M. may terminate your license if you fail to comply with the terms and conditions of this agreement. Upon such termination, you agree to destroy all copies of the Program in your possession. Any attempt to sub-license, rent, lease or assign, or, except as expressly provided herein, to transfer any copy of the program is void. You agree that you are responsible for payment of any taxes, including personal property taxes, resulting from this agreement. No action, regardless of form, arising out of this agreement may be brought by either party more than two years after the cause of action has arisen, except for breach of the provisions in the section entitled "License", in which event four years shall apply. This agreement will be construed under the laws of Israel. ═══ 3. Statement of limited warranty ═══ STATEMENT OF LIMITED WARRANTY (MEDIA AND PROGRAM) Y.A.M. Computers (1982) Ltd. (Y.A.M.) grants the following limited warranty for this Y.A.M. Licensed Program - OpenWin (Program), if this copy of the program is delivered by Y.A.M., a Y.A.M. authorized dealer for this program, or any other Y.A.M. approved supplier for this program to a user (supplier). Such a user is referred to herein as "original user." A "user" shall mean a customer who acquired possession of and is licensed to use this copy of the program for his own use, or for use within his own business enterprise, and not for re-marketing. Any unused portion of the warranty period may be conveyed to another user. 1. MEDIA The Warranty Period for the media on which the program is recorded is for three months from the date of its delivery to the original user, as evidenced by a receipt. Y.A.M. warrants that this media will be free from defects in material and workmanship under normal use during the warranty period. If notified during the warranty period that the media contains such defects, your media supplier will replace such media. If the media supplier is unable to deliver replacement media, you may terminate your license and your money will be refunded upon return of all copies of the program in your possession. 2. PROGRAM The warranty period for this program is for three months from the date of its delivery to the original user, as evidenced by a receipt. Y.A.M. warrants that this program, if unaltered, will conform to its program specifications during the warranty period, when such program is properly used on a machine for which it was designed. If notified during the warranty period that the program contain s defects such that it does not conform to its program specifications, Y.A.M. will 1) attempt to make the program operate as warranted a) if prior to the service expiration date, by providing a correction, or b) if after the service expiration date, by providing any existing corrections, or 2) replace the program with a functionally equivalent program, as determined by Y.A.M.. In the event that Y.A.M. does not provide such a remedy, you may terminate your license and your money will be refunded upon return of all of your copies of the program. Y.A.M. does not warrant that any other defects in the program will be corrected or that the operation of the program will be uninterrupted. This limited warranty will apply only if the program is licensed. THIS WARRANTY IS IN LIEU OF ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. This limited warranty gives you specific legal rights. Following the end of the warranty period, program services may be available until the service expiration date. The license information contains details on such availability. If you have a question as to where you may obtain warranty service, see the statement of service in the license information for this program. ═══ 4. Registration ═══ Before you start using OpenWin you are requested to register your OpenWin copy by completing and sending the enclosed OpenWin Registration Card. If you have an Unregistered Copy of OpenWin Light you will be able to use it as well under the limits described in the Product Definition. You are requested to register your copy of OpenWin Light by completing and sending the enclosed OpenWin Light Registration Card. . When you receive a registration code (provided with the product or after registration), you can change the " UNREGISTERED COPY, Not for Sale." title to the title you have specified in on your Purchasing / registration form. To do this activate the OpenWin Development Module. Select the Registered option from the action bar. Type the requested title and the password and press O.K. (The requested company title must be the one you have specified on your Purchasing / registration form.) ═══ 4.1. ! OpenWin Registration Card. ═══ Please use OpenWin Light Registration Card. ═══ 4.2. ! OpenWin Light Registration Card. ═══ OpenWin Light Registration Card To register your copy of OpenWin Light, just complete and send this form: To :Y . A . M .Computers . Fax: 972-52-901423 Telephone: 972-52-901416 CompuServe E-Mail: 100310,10 Mail: Y.A.M. Ltd., P.O.B. 2426, Raanana 43663, Israel Name: ___________________________________________________ Company: _________________________________________________ Street: __________________________________________________ City / State / Country: ______________________________________________ Zip/Postal Code: __________ Phone: _______________ Fax: ______________ Requested Company Title __________________________________________ (Please specify a title that will be used as your application's title) I would like more information about becoming an OpenWin distributor ___ We are interested in the development market for: ___ Windows ___ OS/2 ___ Unix/Motif We estimate our OpenWin unit sales volume to be _________ copies. Please register my copy of OpenWin Light for: ___Windows ($99) ___ OS/2 ($99) Add $14 per copy for shipping and handling. And charge my ___ Visa ___ MasterCard ___ Diners Club Number: __________________________________________________ Expiration Date: __/____ Signature: ______________ * Prices are subject to change at any time without prior notice. ═══ 5. ! Product Definition. ═══ The OpenWin manual describes most of the OpenWin package's capabilities. If you are using OpenWin Light which is the stand alone single database version of OpenWin, you should be aware that: 1. OpenWin Light uses one non-SQL file handler bound in the product (dBASE files format compatible file handler). 2. Your application can use external commands by shelling, but you cannot define new OpenWin commands as described in OpenWin Programming guide User Defined Routines chapter. The above mentioned does not apply to the full OpenWin package Unregistered OpenWin Light limits You may use your evaluation copy of OpenWin Light before registering it for a 90 day evaluation period under the following limitations: 1. Your OpenWin Light application title will be "UNREGISTERED COPY, Not for sale.". 2. Your OpenWin Light data files size will be limited to 25K bytes and approximately 100 records. 3. Your OpenWin Light task can use up to 3 tables within a single task. 4. The non-SQL file handler bound in the product is C-Index/II. As soon as you have registered your copy of OpenWin Light you will get a new copy of OpenWin Light. These limitations will be removed and the file handler bound in the product will be dBASE files format compatible. ═══ Help for Help ═══ Choose this option in order to receive information on how to use Help Menus, Extended Help Menus, Keys Help, or the Main Help Index. Help for Help This help window. Extended Help Gives general help/information for the use of OpenWin's on-line help. Keys Help A listing of keyboard functions. Help Index Displays an index of all help items. ═══ Extended help ═══ It is possible to receive extended help for each part of the OpenWin program. This help can be accessed at any time by pressing the F1 key. The help system is context-sensitive and will automatically bring you to the related area. (If your present position has no specific help, this screen will appear.) ═══ Keys Help ═══ OpenWin is using the system keys assignment. ═══ 6. Printing a hard copy ═══ OpenWin User Guide has been developed to be used as an On-Line manual as well as to be printed as a hard copy. In order to print OpenWin User Guide you should use the help facility print option. Print all the sections according to the contents order. This manual is formatted to fit A4 pages. Note! If you are using the OS/2 version you should specify in your Printer settings - Queue Options that the printer supports Printer-specific format. ═══ 7. $ START HERE. ═══ Welcome to OpenWin Development Environment. OpenWin is a powerful 4GL and database Front End programming environment. This guide has been developed to help you learn about OpenWin. OpenWin provides you with an On-Line help system to assist you in learning to use OpenWin. Within this help system you will find an OpenWin Tutorial, a Programming Guide and a Commands Reference Guide. How to begin ? OpenWin User Guide consists of three books - Tutorial (T) Programming guide (P) Commands Reference guide (C) The (T),(P),and (C) marks will help you to distinct between the books when you use the on-line index. In the first book (Tutorial), Read the tutorial thoroughly and follow its instructions carefully. We are sure that in the end of the first book you will have the ability to build an OpenWin application completely by yourself. If you have any questions please call your dealer. ═══ 8. T U T O R I A L ═══ This book has been developed to help you learn more about OpenWin. Use this guide according to the order of items listed in the Contents index (select it from the Help Window Action Bar) . Continue ═══ 9. Control file OpenWin.cfg ═══ When OpenWin is installed, a control file named OpenWin.Cfg is created in C: root directory. This file defines some of the parameters used by OpenWin. When you have many applications in different directories, you can create an OpenWin.Cfg file in each directory. The control file contains the following parameters: FPATH=C:\system directory\-\working directory\ ( C: indicates your hard disk ) These parameters define the directory in which the application and the data are located. This definition may include more than one directory, but must include at least the directory in which OpenWin is installed. YAAM=C:\system directory\ This parameter directs OpenWin to the location of internal files and programs. It must define the directory in which the system is installed. ARSENV=environment name This parameter indicates the environment definition file (.NUM), which monitors the application. ARSFONT=Courb 16 6 This parameter indicates the name and size of the font. Continue ═══ 10. Monitoring and On-Line Help ═══ Monitoring and on-line help while developing To assist in creating an error-free application, OpenWin monitors the developer throughout the definition stages. Every time you type in or select data or commands, the legality of your choice is checked. If the data you typed in are not appropriate, you receive a message guiding you to the correct selection. For on-line help, you can press the F1 key anywhere in the system to open a help window applicable to your location, or you can get extended help from the help menu for each part of the developing environment. Using Action Bar While developing an application in OpenWin, you may use the Action bar or the Tool bar. The Action Bar is a text option, just as in every Windows environment. The Tool bar is a list of icons that refer to the respective text options. When you use the mouse to point to an icon in the Tool bar, the text option is displayed in the Status line located at the bottom of the screen. Opening a file When OpenWin Development module is opened, you can choose the type of definition module you wish to use (Define Environment, Tables, Views or Tasks ) from the Application options in the Action bar or the Tool bar. When entering a module, You must define the file which you want to edit. To do this, select the File, Open option and the appropriate file from the list. The file name will appear at the top of the screen. If you want to define a new file, choose the New option. After you have defined the file, choose File and the Save option. If you are defining a new file, you will be asked to type in the file name. The window action bar Two kinds of windows can be opened in each module. The first is a "Dialogue window". Here you must fill in the required details and press OK. The second and more popular is a multi-line window which has an action bar at the top containing the following commands: Edit Move Paint O.K. Cancel _______________________________________________ The Paint menu enables you to refresh the screen. The Move menu enables you to move quickly from line to line. The Edit menu contains the following commands: Insert opens a new input line at the currently chosen location. Append opens an input line under the currently chosen location. Update moves to the currently chosen location in order to update it. Delete deletes the currently chosen location. In order to mark a line as chosen, click on it with the mouse. When you have finished entering information, you must click on either O.K., or Cancel. In order to mark lines for Copy or Cut, click on the first line with the mouse, keep the left mouse button depressed and drag the mouse down. The marked lines will be highlighted. Continue ═══ 11. The application's purpose ═══ Chapter 1 Before creating an application in OpenWin, you may wish to view a Demo application. Once you have seen what the application can do, you can continue on to Chapter 2 to see how the application is organized. The application is designed for organization of worker files. You can add, delete, update, find and save information related to workers and departments. Running the Demo In order to run the Demo, you should first open the Tutorial Application Demo module from the OpenWin main menu (folder). When you enter the Tutorial Application Demo module, the following application menu will appear on the screen: As you see, the MAIN MENU has two options: SQL and NON-SQL. Click on the NON-SQL option. The sub-menu shows three tasks: WORKERS, DEPARTMENT and HOURS-REPORT. These tasks are interrelated. First, open the WORKERS task. (You can access the DEPARTMENT table either from the WORKERS table, while you are working in it, or independently). The screen will show the following: Data entry Note that there are two windows on the screen. One is called MENU and the other DATA ENTRY. In order to begin an activity, click on the appropriate button in the MENU screen. For example, click od the ADD button. This will transfer the activity to the DATA ENTRY screen. A frame will appear around the field WORKER ID. The frame indicates that the user is to type data in this field. Since the worker code is the key to the record, it is opened first. No further information can be entered until data are typed in this field. After the data have been typed in the WORKER ID field, the application checks to see if the record already exists. If the record exists, the application notifies the user of this fact. If not, the application accepts the input and opens a new field with a frame around the DEPARTMENT. Here too , the application checks to see if a record exists for this department code. At this point, type in the DEPARTMENT field 100 and press the TAB key. The name of the department will appear in the next field, and the rest of the fields will be shown with red frames, indicating that you may enter data in any field you choose. Fill the fields and press Enter to confirm the input. Press ESC to stop the workers data entry. What to do if you don't know the department's code. If you don't know the department's code,leave the DEPARTMENT CODE field empty and press TAB. This will bring the department table to the screen, where you can see all department details. You may implement the following operations: a. View a list of all existing departments with their codes. b. Find, delete, update or add a department code. c. Choose a department code. To do this, use the keyboard arrows to highlight the row containing the desired code. From the tool bar, choose the Choose icon. At this point, choose the desired department as described in c. above. For updating or entering a worker hours per day, you can choose the LOG option from the menu window, and the following window will appear: After updating the worker hours choose the EXIT option for returning to Data entry window. After completing the entry of worker data, you may exit to the MAIN MENU by selecting the QUIT action option. From the MAIN MENU, you may enter the report task, and the following window will appear: Close the tutorial application window. You can now continue to Chapter 2, to see how the application build. Continue ═══ 12. Application building ═══ This chapter describes the process of building an application with OpenWin and the main modules used in the process. The application building process includes three main steps : 1. Defining the application Environment 2. Defining the application Tables/Views. 3. Defining the application Tasks. This process goes from top to bottom, starting with general definitions and ending with details. Defining the application Environment. The application Environment supervises the application in its totality. The definitions include the name of the application, available printers, etc. This module also enables you to create a menu for the application. Defining Tables module The Table Definition module is used to define the global data dictionary of the application. The table definition includes general information about the table, such as its name, the type of DBMS that will manage it, etc. The definition also includes the field (table columns) and the way in which the keys are to be used. Defining View module The View Definition module is used to create view statements for use in OpenWin tasks. After defining and building a view statement, you can regard it as a new table in your application. Editing Task module The third and main phase in creating an application is the Task Definition. A task is a program that uses previous definitions in order to execute different functions, such as updating tables, producing reports, or any other operation. In order to shorten the application writing process, you can generate a task source code after defining a table. Of course, you can edit tasks which are created automatically and change them according to your needs. Building Each definition module has a building module: The compilation has two purposes- A. Checking the legality of the definition. If an error exists, it is displayed on the screen. B. Creating run files. Whenever you check an environment in which a menu has been defined, a run file for this menu is created. Whenever you check a table, an empty physical table is created. Whenever you check a task, a run file for the task is created. If an existing module is edited, you must repeat the compilation process in order to check it and create a new run file. Module activating A development module is activated by clicking on the "Development" module with the mouse. When the Development module is opened, you choose the type of definition module you wish to use (Define Environment, Tables, Views or Tasks ) from the Application options in the Action bar or the Tool bar. Continue ═══ 13. OpenWin files ═══ OpenWin files Definitions that you execute are saved in the definition files. The compilation process creates run tables. All files have been given preset fixed extensions so that you may distinguish among them. The extensions are listed below: Environment definition file .NUM Menu to run .MNU Table definition file .DES Inner table definition file .DCL The physical DBMS files are given different endings, according to the DBMS chosen. For example, DAT and IDX. View definition file .VEW Task definition file .ARS Task execution file .TSK In the next chapter you will learn how to set up an OpenWin tutorial application quickly. Continue ═══ 14. Tutorial application ═══ In this section, you will learn how to start using OpenWin's powerful 4GL database programming language. A short application has been prepared to make the learning process clearer and more efficient. With the help of this application you will learn how to use Openwin according to the following stages: 1. What does the application do? 2. How is the application build? 3. Analyzes and modification of the application. To further simplify the learning process, data have already been entered. Your work will be limited to updating, changing and adding to the existing data. ═══ 15. Environment definition ═══ Following in this tutorial you will be asked to type in some data as shown in the manual. When you are requested to "Add the following lines ..." you should add only the highlighted lines you will see in the pictures The first phase in defining an application is to define the application environment. Open the development module. Make sure you are in the Define Environment module (If not, Select it from the action bar), and open the file 'Employee.num'. Next Page ═══ 15.1. General Settings .. ═══ Defining General Settings In the Environment Definition module open the General Settings section. You will see the following details- Press OK. Minimize the General Settings window to an icon Next Page ═══ 15.2. Tables Declaration .. ═══ Table Declaration In the Environment Definition module open the Table Declaration section. You will see the following details: ( If you are using OpenWin Light or a non SQL OpenWin version, delete the tables Employee, DayPay,and Hours . ) Minimize the Table section to an icon. Next Page ═══ 15.3. DBMS Declaration .. ═══ In the Environment Definition module open the DBMS Declaration section. You will see the following details ( If you are using OpenWin Light or a non SQL OpenWin version, delete the file handler IBM-DBM DBMS name. ) Next Page ═══ 15.4. Task Declaration .. ═══ Task Declaration In the Environment Definition module open the Task section. You will see the following details ( If you are using OpenWin Light or a non SQL OpenWin version, delete the tasks Employee, DayPay, RDayPay and Hours . ) Minimize the tasks section to an icon. Next Page ═══ 15.5. The application menu .. ═══ Defining the application menu In the Environment Definition module open the Application Menu section You will see the following details Next Page ═══ 30085 ═══ You can look at the following Newmenu , M-Line , Endmenu , Task commands to learn more about the menu. Next Page ═══ 30086 ═══ Minimize the menu section to an icon. If you have made corrections, select the File option and save the file. Activate the (Build) Environment Checking Module. Check the file Employee.NUM. If you have entered the data properly, a working menu will be created. If not, a list of errors will be displayed. Correct all errors, save the file and recheck the environment. Activate the Run option. The menu you have defined will appear and you will be able to review the different options. Of course, tasks which you haven't yet created can't be activated. Close the Run Tasks module. Continue ═══ 16. Tables definition ═══ The second phase of building an application is defining the tables that make up the application data base. Select the Table Definition module from the tool bar. Enter the module and open the file 'Depart.des'. Next Page ═══ 16.1. Table General Settings ... ═══ General Settings In the Table Definition module open the General Settings section. You will see the following details Minimize the General Settings section to an icon. Next Page ═══ 16.2. Fields Definition ... ═══ Fields Definition In the Table Definition module open the Field Definition section. You will see the following details Minimize the field section to an icon. Next Page ═══ 16.3. Keys definition ... ═══ Key definition In the Table Definition module open the Key definition section. You will see the following details Minimize the key definition section to an icon. If you have made corrections, select the File option and save the file. You have now finished defining the departments table. The next phase is building tables. Continue ═══ 17. Tables building ═══ Build tables We have already built the physical table for you, so you won't need to build it again. Now you can use the Automatic Program Creation option - Source Generator. Continue ═══ 18. Task generation ═══ Activate the Source Generator module. Select O.K. for the name DEPART. Select the "EDIT WINDOW" Option. Within a few seconds an OpenWin Task named DEPART.ARS will be created automatically which will enable you to update the departments table, If you will get a message saying that the task already exists, and it will be overwritten. Press O.K. and continue. Close the Source Generator module window. (If you were activating the Source Generator from another module and not the Tables Definition module, you were asked to specify the source table name.) To activate the task you have created, you must build it. Continue ═══ 19. Tasks building ═══ To activate the tasks which you have created, enter the Tasks definition module and open the file 'Depart.ars'. Now you can activate the Build Tasks module. Within a few seconds an executable task called Depart.TSK will be created automatically. If you have made any errors, they will be presented on the screen. Correct the errors, save the file and repeat the check. Now you can run the Task. Continue ═══ 20. Running the Application ═══ Activate the Run Task module. The following window will appear on the screen: Next Page ═══ 30010 ═══ To add a department, select the option Edit from the action bar and the option Insert Or click on the correspond icon from the tool bar. Using the mouse, fill in the Department Code field and move to the next field. After typing the line, press ENTER or TAB. The line will be entered and a new input line opened. Add some new departments. After entering the departments as described, press ESC when you are in a Code field. Pressing ESC will take you out of the Add mode. Select Exit from the action bar to close the task. In the next chapter, you will analyze the input task which updates the items. Continue ═══ 21. Input Task - Analyzing ═══ In this chapter, you will analyze the input task which updates the department file. Please close the Table Definition Module by selecting the EXIT option. In order to follow the explanation, make sure you are in the Task Definition module and open the file Depart.ARS. As you have seen, the data entry task created by the Source Generator. This is an example of a regular task used to update a file. A data entry task normally includes the following sections: - General Parameters section, Defining the task structure. - The name of the table being handled, and how to access it. - Constant Char used as messages and titles. - Local variables. - Defining and planning the windows. Edit Window and, Edit Operations sections, Defining the edit window. - The logic flow that supervises the course of the task. - Defining the ranges used in the flow control commands . In this chapter, you will review the different components and explain their meanings. If you wish to receive further information about any of the windows described, you can find it in the appropriate chapters of the Programming Guide We will now view the General Parameter section in the Edit Task module. Continue ═══ 21.1. General Parameters ═══ In the Edit Tasks module open the General Parameters section In this section, the task parameters are described, as they are set by the source generator. Next Page ═══ 30011 ═══ The task name is a general name given by the code generator. Enter this field and change the name to In the routines, only the main routine called Main was defined. This is a routine (label) in the logic flow that runs the task. Press O.K. and minimize the General Parameters window. Now you will view the task data dictionary. Continue ═══ 21.2. Data dictionary ═══ In the Edit Task module open the Table section This window defines the tables handled by the task. The structure of the window is as follows- The table name the name of the table you wish to refer to (as you have defined in the Define Tables module without the .DES extension.)- in this case, the Departments file, 'DEPART'. In order to enable references to a number of tables, you must use a table identifier - in this case, 1. Later in the task, you will refer to the table fields by writing down their names and the table identifier. Next Page ═══ 30012 ═══ Variables The present task uses different variables for different purposes. The definition window for the Variable section is as follows- Next Page ═══ 30013 ═══ The variables Zero and Blank are used to nullify fields. The Max variables are used to define maximum values. The Title variable is used as at title for the edit window. The Dummy variable is used as a field when you define the contents of a window. This will be explained later in the chapter. The Del, AccKey variables, etc. are used as range parameters for flow control commands. We will now go into window design. Continue ═══ 21.3. Window Design ═══ Window Design Activate the Window Design section. This window is used for interactive editing of the input task. Drag the mouse pointer to the window MAIN and drag the window top frame up so you can see the fields in it. The window will appear as follows- Drag the mouse pointer to the field 1DCode and click on it in order to select the field. Select the Color Window icon from the tool bar. The color window will appear. Using the mouse, select a color and double click on the chosen field. The field color will change. Repeat this process for the other field. In this window, you can perform various functions, but at this stage you will stick to changing colors only. Drag the window top frame down to one line size (as it was in the beginning) Select the O.K option at the top corner of the screen, in order to save the changes. You will get a message confirming the changes. Leave the window design screen by minimizing it. Notice that the window height is set for only one line. Our task uses the multi-line editing command EDIT to edit this window. An EDIT window height is determined by the EDIT Window section. The height set when designing the window represents ONE line in the window when it is edited with the edit command. Look at the EDIT Window section. Continue ═══ 21.4. EDIT Window section ═══ The Edit Tasks module EDIT Window section When you open this section, the following window appears- The data in this window determines the way in which the window is presented on the screen during the execution of the Edit command. At this stage, you won't change the data in this window. Next Page ═══ 30014 ═══ In The Edit task module, open the Edit Operations section. Data defined in this section indicate the functions which the user can perform in the edited window. Read the EDIT Operations chapter in the Programming Guide, and the explanation on the Edit command in the Command Guide. Open the edit operations window, which will appear as follows- Next Page ═══ 30015 ═══ Each of the edit functions is linked to a routine in a logic flow. These routines are explained in greater detail later on. The main part of the task is the logic flow. Continue ═══ 21.5. Logic Flow ═══ The Logic Flow When you open the Logic Flow section, the program command sequence is presented as follows- Next Page ═══ 30016 ═══ The logic flow structure The logic flow is a list of OpenWin commands and different parameters for these commands. The command sequence is divided into different groups called routines. A routine is characterized by a label at the beginning that enables it to relate to it , and ends with a Return command. In an OpenWin Task, there are two groups of routines.The first group comprises the routines indicated in the General Parameters section of the task as initial , main , and final routines. When a task is activated, the initial routine is executed and ends, if it has been defined, when the main routine is executed. When this routine ends, the final routine is executed, if one has been defined. The second group comprises routines that were called out from other routines, or were activated as routines defined in libraries exclusive for certain commands. For example, routines used for editing functions of the edit command. We will now view the main routine. Continue ═══ 21.6. Logic Flow .. ═══ The main routine In this task, ONLY the routine called Main was defined in the General Parameters section. Defining a main routine ONLY is accepted practice in interactive input tasks. The routine begins with the following line: This command opens a work screen whose title is the contents of the field "0 Title". The execution of this line is conditioned by the flag Z0. The command will is executed only if the flag is OFF (=). The reason for this condition will be explained later. The following command is the main command in the program. This command displays the # MAIN window on the screen and transfers supervision to the edit command. Further information regarding this command is available from the command window. In the Result variable a local variable, Zero, whose value is 0, was indicated, meaning that the window should be displayed in its full size. This is defined in the Edit Window definition. Next Page ═══ 30091 ═══ When the edit functions ends, the next two lines are executed to clear the screen and end the task. Next Page ═══ 30017 ═══ The following routines are called by the edit command when the user selects the edit option. The Insert routine When the edit command Insert is selected, a new line is opened on the screen in order to enable input and the supervision is turned to the routine. In the present cases, this routine is called 'Insert'. The first line in this routine sets I1 flag to OFF (=) status. The next line in this routine branches out to the First routine, which nullifies the fields to be entered. Next Page ═══ 30092 ═══ After the content of these fields has been reduced to zero or blanks, the next line calls Disp* routine to display the sub-screens that contain the fields which make up the line. As a result, the empty fields are displayed in the line opened by the edit command. Next Page ═══ 30018 ═══ The following line calls AccKey routine where an Accept command - input to the sub screen * KEY that includes the field 1DCode is executed. This line is given a label, since you may want to refer to it later. At the end , or in the middle of accept, If the input is aborted, AccKey routine will set A1 flag status to ON. In such a case the next line will set I1 flag to ON and divert the flow to Insert routine end at InsEnd label. The flag I1 is the same as the flag defined in the edit function as a result flag. As long as the insert routine returns the value = (OFF) in this flag, the edit function insert continues to open new lines and refer to the routine. When the routine returns the value +/- (ON), the insert function ends. Next Page ═══ 21.7. Logic Flow ... ═══ The following lines check to see if the department code already exists. This is done by trying to find a record from table 1, according to the MainK key . The result of the search is returned in the flag I0. If the record has been found, indicating that it already exists in the file, the search has been successful and the flag will get the value = (OFF). In that case, the Message command is executed, displaying the contents of the string Exist and beeping once to request the user to confirm the message. The flow will return to Ins1 label to enable input of a new department number. Next Page ═══ 30022 ═══ Once the department Code has been checked, the following lines calls AccData routine. In this routine the Accept command enables you to receive data in fields that belong to the sub-screen * DATA. If you press ESC to end the input, the flag A2 is set to ON and the flow returns to Ins1 label. Next Page ═══ 30023 ═══ After entering the department details (Name), if the If term is true, the Write command executes the entry of a new record in the table. The program will reach the "InsEnd" line when the Insert ends and the return command returns control to the edit command. Continue ═══ 21.8. Logic Flow .... ═══ Update routine When the Edit function Update is selected, the edit command knows that you now wish to update the current chosen record. The logic flow is diverted to a routine, in this case the Update routine. When going through the records, the edit command saves the values of key fields. Since the possibility exist of a situation in which the value of the fields that are not the key fields is different from the contents of the record. The first thing to do in the routine is to find the record according to the key. After the record has been found, the sub-screen "* KEY" containing the key field data, and the "* DATA" sub-screen that contains the fields which are not key fields, are displayed in Disp* routine. Next Page ═══ 30025 ═══ The Accept command you can see in AccData routine enables updating the contents of the fields that are not part of the key. If the user doesn't wish to update, the flag A2 is set to ON. In such case, the flag U1 is set to ON and Update routine ends. the edit command once again displays the line with the field content as it was before the changes were made. The Rewrite command is executed during a regular update, thus updating the record in the file. If, for technical reasons, the update should fail, the flag I0 will be set to ON (-) . Next Page ═══ 30026 ═══ Like any other routine, the update routine is ended by the Return command Delete routine Delete is a routine which is activated when the edit function Delete is selected. To prevent accidental deletion of records, the routine presents a warning message by using the message command. If the user replies in the negative, the flag D1 will be set to ON. Next Page ═══ 30027 ═══ If the user acknowledges the deletion, the "If Delete" will be true and the Delete command will erase the record from the table. The Return command will return control to the Edit command. If a deletion was made (information which the Edit command gets through the flag D1), the Edit command refreshes the window. The following routine is the First routine. Continue ═══ 21.9. Logic Flow ..... ═══ First routine This routine is executed when the edit command is required to indicate the task to the first record in the table. To make this possible, the routine transfers a minimum value, Blank, to the key field DCode. In the present task, this routine is also used to bring the other fields down to Zero, so that if a new record is inputted, the fields will be empty. When an edit command is activated, this routine is executed automatically. After it is executed, a loop of Next and Display routines is executed, until the window is full. Last routine This routine is executed when the edit command is required to indicate the task to the last record in the table. For this to happen, the routine transfers a maximum value, "0 MaxStr", to the key field DCode. In the present task, this routine is also used to bring the other fields to maximum . Next Page ═══ 30028 ═══ Next routine. This routine is executed in order to jump forward in the table. To make this possible the Read command Reads the Next record according to the key MainK. If there are no more records I0 flag will be set to ON in "+" status. The flag N1 will be set to ON and by this will notify the Edit command that it is on the last record. Prev routine This routine enables you to scan the table backwards. In order to do this, the Prev command reads the previous record according to the key, MainK. When no more records exist, I0 flag will be set to ON in "+" status. The flag P1 is set to ON, indicating to the edit command that it is on the first record. Next Page ═══ 30031 ═══ Display routine This routine is executed when the edit command has to present a record. In order to do this, the routine finds the record using the Find command. The display is automatic. Next Page ═══ 30032 ═══ When the last option is selected, the edit command automatically executes a loop to fill the window with records. Exit routine When the user chooses to leave the edit command, the exit routine is executed. This routine turns off the flag E1 in order to retain the information about how you exited the edit command. Next Page ═══ 30034 ═══ Exit- routine This routine is used to leave the edit command when you want to indicate a selection of a certain record. A detailed explanation about this command will be presented later in the chapter. Exit+ routine This routine is used to leave the edit command. From this routine, you can execute different functions. If the flag is turned on, returning to the edit command, as shown in the present case, the edit command will continue with the edit functions. Further information about the use of this option is presented later. If you are using OpenWin version supporting SQL, you will create an SQL Advanced Task in the SQL Table chapter If you are using OpenWin Light or non SQL OpenWin version you should continue in Non SQL Task ═══ 22. Non SQL Application ═══ In the following chapters we will analyzed the Workers application. you should continue in Workers table ═══ 22.1. Workers table ═══ Activate the Table Definition module. and open the file 'Workers .des'. You will see the following details: Minimize this section to an icon. Next Page ═══ 31411 ═══ Field definition In the Table Definition module open the Field Definition section. You will see the following details: Minimize this section to an icon. Next Page ═══ 31412 ═══ Key definition In the Table Definition module open the Key Definition section. You will see the following details: Minimize this section to an icon. We have already built the physical table for you, so you won't need to build it again. Continue ═══ 22.2. Tasks building ═══ Source Generator Activate the Source Generator module. Select the Generate Input Task option. Select Workers.DES file. Press O.K. for the name Workers. Select the "Dialog" Option. Within a few seconds an OpenWin Task named Workers.ARS will be created automatically, which will enable you to update the Workers table. Close the Source Generator module window . To activate the task which you have created, you must complete the build stage. Activate the Definition Tasks module and open the file 'Workers.ars'. Activate the Build Tasks module. Within a few seconds an executable task called Workers.TSK will be created. Close the Build Task module Before you analyze and modify the task, you can run it to see how this task functions. To do that activate the Run module. Use Quit option to end the task run. Continue ═══ 22.3. Non SQL Workers Task ═══ In this chapter you will analyze the Workers.ARS task, which is a Data Entry task for a Workers table, without using the Edit Command. Please close the Table Definition Module by selecting the EXIT option. Make sure you are in the Edit Tasks module and that the Workers.ARS task is opened. Continue ═══ 22.4. Non SQL Logic Flow ═══ Enter the Logic Flow window. You will see the following lines at the beginning - Next Page ═══ 31002 ═══ You already know what the New-Scr line is. The Setoff commands sets initial status OFF for some flags. The Q5 flag is used as the main While loop conditions. The Put-Lin lines calls the MAIN window and the Menu window to the screen. The next lines Displays the MAIN window (with the contents of the first record). The "While" command begins a loop that continues as long as the "NotQuit" range terms are true. This is the main loop for this task. Following is a Dialog in which there are two Accept commands: Accept * Action and Accept * Repeat. The Dialog allows the execution of more than one Accept simultaneously. In the Accept * Action line you are asked to click on one of the buttons to indicate the operation you wish to perform. To understand how this is done open the section Design window. Click with the mouse on the Menu window to bring it up, then click on the radio button called "0 Action". Now you can open the Object Details by clicking on its icon from the tool bar. You will see that this button is a Char (string) local variable and that it is grouped with the * Action sub-screen. Minimize the window design window and return to the Logic Flow. The Accept command here will wait for the user to click on a button. When a button is pushed the Accept ends and the button field's value is set to the chosen option. The options are defined in the "Input Field" field: ActLst. If the Q5 flag is ON (accept aborted), you quit the loop. The following "Switch" command begins a switch to allow use of "Case" blocks for different selections. The Switch parameter is the local variable "0 Action", whose value is set by the user selection. If the value of the following "Case" commands meets this value, the following block is executed. You can see that each "Case" performs routines. We will take a look at some of these routines. Continue ═══ 22.5. Non SQL Next Routine ═══ The Next routine. The First and Last cases initialize or minimize the table fields and designate the first or last record as the current record. In order to understand these cases you will analyze the Next routine: The read command tries to read the next record. If the read fails, I0 is set to ON in + status. Then, after performing I/O_ok routine, If the read has failed we set the N1 flag to ON to indicate that there is no next record. Look at the First, Last and Prev routines (Cases). These are all simple routines used to scroll through the file. Note that you have seen similar routines in the Depart Task. Continue ═══ 22.6. Non SQL Insert Routine ═══ The Insert Case. Unlike a Depart Task, where the EDIT command did a great deal of the editing work, in this task you handle all operations related to editing, such as keeping the right key value, etc. The insert routine itself is similar to the one in Depart task. The Add case does what the Edit command did in depart task. You can see that if "Add" is selected, you enter a loop calling Insert routine. This loop will continue as long as you do not abort the insert. When the user presses ESC, or if there is an error, the I1 flag will turn ON and the program will quit the loop, find the current record, display it and quit the insert (Add) case. The Update and the Delete routines are quite similar. Continue ═══ 22.7. Non SQL Validity test ═══ Now you will begin to modify the task and customize it according to your needs. The first change you will make is to enable you to enter only existing departments. To do this, you must specify that the task uses the Depart table. In the defined task module open the Table section Add the table Depart, giving it "2" as an identifier. The window will appear as follows: Next Page ═══ 31006 ═══ Enter the window design section and arrange the "MAIN" window so that it appears as follows: (First increase its height and then drag the fields to the requested positions.) Next Page ═══ 31007 ═══ Now add a new field to the window. Select the Field, Append option and add the field 2 DName as follows- Next Page ═══ 31008 ═══ Then place the field next to the 1 DCode field, so the MAIN window appears as follows: Next Page ═══ 31009 ═══ Indicate 1DCode as the chosen field and update it. Change (Select Field - Update ) the sub-screen from DATA to DATA1. Save the window design changes by pressing O.K at the top of the window and minimize the window design section. Now you need to make some changes at the logic flow section. Next Page ═══ 31010 ═══ First, change the display routine so that it appears as follows: Then change Disp* routine so that it appears as follows: As a result of these changes, each time the display routine is activated you find the department name in the Depart table (2) and display it next to the department code. Now you will modify the AccData routine so that it allows you to enter only an existing department code. By changing this routine you will control department code entry during Insert and Update as well, since this routine is called from the insert and update routines. In order to nullify the department name field when entering new record, add the following highlighted line to First routine as follows - In order to keep display and data integrity, change FindCur routine Perform *Disp line to Perform Display as follows - Next Page ═══ 31011 ═══ Change AccData routine so that it appears as follows: Don't forget to specify the AcEnd label at the end of the first line. This routine accepts the department code and then checks to see if such a department code exists in table 2 (the Depart table). This routine does not allow you to type in a wrong code. If you press ESC during the code input (the Accept * DATA1 command ), the flag A2 will be turned on and the routine will return to the calling routine with that information. Save the task, build it in the Build Tasks module and run it. You will see the effects of all the changes you have made. End the task run by selecting the Quit option. Continue ═══ 22.8. Non SQL Linked Tasks ═══ As you see, it is not convenient for you to input Workers, because you must type in the right department code and you do not normally know the department codes. OpenWin will open a department code window for you. Make sure you are in the Edit Tasks module, and that the Workers.ARS task is opened. Add an new range in the range window - Next Page ═══ 31013 ═══ Now make a slight change in "AccData" routine so that it appears as follows: Next Page ═══ 31014 ═══ The "If NoCode" command checks to see if you have left the field 1 DCode empty. If not, the flow will continue from the DTest label. If it is empty, the callers will call a Depart task. The shared flag Z1 is affected by the way in which you exit the Depart task. If it is OFF (=), meaning no selection has been made, the 1 DCode value will not change. If a selection has been made, move the value of 2 DCode field to 1 DCode. Because you have indicated that Depart table is shared by the two tasks, the values of the 2 DCode field will be as they were at the end of the Depart task execution. Save and build the task. Activate the Link Tasks module. Select the "File - Link" option. Type "Workers.tsk" as the source task name. Type Workers1.tsk as the target task name. Click on the "LINK" button. At the end of the linking procedure, exit the Link task module. Note: from this point on, if you modify a Workers task or a Depart task, you must re-link the Workers.tsk after you build it. In order to see how the linked task works, you need to run it, but our menu runs Workers.tsk tasks. Next Page ═══ 31015 ═══ In the Environment Definition module open the Application Menu section window, and change the line: to: Save the file, build the environment and run the task through the menu. You will see that now, if you don't know the department code you can leave it empty and then choose it from the department list. Quit the task and close the Run window. Close the Environment Definition Module by selecting the EXIT option. Continue ═══ 22.9. GUI fields in Non SQL Task ═══ In this chapter you will make a small change in the Workers task to show how to use the GUI environment. You will enable the user to fill the "Sex" field from a list. In the Edit Tasks module, open a Workers.ARS task. Add a local variable named Sexlst as follows: Notice that you have set the Repetition Factor (R.F.) to two and defined two initial values. Next Page ═══ 31017 ═══ Now enter the window design and change the Input field and Style of the field 1 ESex so that it appears as follows: To make this change you must give the field a focus by clicking on it with the mouse. After this choose Field/Update from the action bar. Make the change and confirm it by pressing accept . Exit the window design (do not forget to press O.K.). This change will enable the user to select the required sex designation from the list. Assume you want to define the default sex as female during the insert operation. Next Page ═══ 31018 ═══ Add two lines to the task logic Flow in the insert routine immediately following the "Perform First" line so that it appears as follows: Note the use of one of the Vector Commands, VSetInx. After you have set the current value of 0Sexlst, move it to 1ESex as the default value. Save your task Build, Link and run it From the Menu (to run the menu select the Run Time option from OpenWin main menu (folder)). You will see that the user can select the sex designation from the defined list. Continue ═══ 22.10. Non SQL Header and Trailer ═══ Up to this point, you have created a task enabling you to update workers and department data. The next step in the application is to enable the user to update the work hours for each Worker. The first step will be to define a TimeCard table as follows: Activate the Define Tables module. Select New option. Define the General Settings Activate the General Settings section and fill it in as follows: Click on OK and minimize this window to an icon. Next Page ═══ 31021 ═══ Field definition Activate the fields definition section and fill it in as follows: Minimize this window to an icon. Next Page ═══ 31022 ═══ Key definition Activate the Key Definition section and fill it in as follows: Save the file as TimeCard, and build it Use the source generator to create an input task called "TimeCard". Select the Edit Window format for this task. Open the Edit Tasks module and open the file TimeCard.ARS. Build the task "TimeCard". Now you have a task that can handle the TimeCard table. Close the Table Definition Module by selecting the EXIT option. Continue ═══ 22.11. Non SQL Header and Trailer .. ═══ Make sure you are in the Edit Tasks module and open the Workers.ARS task, add an local variable as follows: Now change the repetition factor of the ActLst variable to 10 and add "Log" to its appearances in the initial value: Next Page ═══ 31024 ═══ Now you need to change the logic flow so that it will call the TimeCard task when Log selection is made. Add a new "Case" after the "Switch 0 Action" command: This "Case" (routine) is activated when the "0 HWin" value (Log) meets the value of the 0 Action field. Save, build, link and run the task from the Menu (to run the menu select the Run Time option from OpenWin main menu (folder)). Note that when you click the Log option you enter the TimeCard task and you can update the TimeCard table. You will find, however, that your task will not do exactly what you want it to. 1.You must type a Worker ID in each line. 2. You can view lines (working hours) that do not belong to this Worker. A few changes will complete your task. Continue ═══ 31026 ═══ First we will take care at data integrity Make sure you are in the Edit Tasks module, and that the file Workers.ARS is opened. Add the table TIMECARD in the tables definition section - Now add the following lines to the Delete routine- As a result of this change, each time you delete a worker record, you will also delete all its trailing records in TIMECARD table. Next Page ═══ 22.12. Non SQL Header and Trailer ... ═══ In the Edit Tasks module, open the file TimeCard.ARS. First change the windows. Enter the Window design section. Drag the window top frame up so you will see the fields in it. Select a color from the Colors Window and change the color's field. Select the 1ECode field within the MAIN window and delete it. Drag the window top frame down so the window will be only one line height. By making this change you prevent the user from typing in an Worker ID during input. (Click on OK before you minimize the window design) Next Page ═══ 31030 ═══ Now relate the task to the current Worker. In order to get the current Worker's ID, define the Workers table as a shared table. Open the Table section. Add the Table Workers, giving it "2" as identifier. The window will appear as follows: Now let the user see only those work Hours that are related to the current Worker. Open the Logic Flow section. Change the beginning of the "First" routine so that it appears as follows: Next Page ═══ 31031 ═══ As a result of this change, when the First routine is executed only lines having to do with the current Worker Id or a greater Id are read . You need to change the Last routine so that the maximum Worker Id will not be greater than the current Worker Id. Change the beginning of the "Last" routine so that it appears as follows Next Page ═══ 31032 ═══ You know that the "Next" and "Prev" routines are used to read the next or previous record. You need to change these routines to ensure that when you read a record you read only those records that are related to the current worker. Change the "Next" routine so that it appears as follows: As a result of this change, if a record is read ( N1 flag is = OFF), you compare the value of 2 ECode with 1 ECode field. You use the N1 flag to get the result of the comparison . If the record has a worker Id that is greater than the current one, the N1 flag will be set to ON and the Edit command will act as if this is the last record. Next Page ═══ 31033 ═══ You need to change the "Prev" routine as well. Change "Prev" routine so that it appears as follows: The last change to be made in this task is to establish that when a new work hours line is added, the default date will be the current date. To do this, you first add an local variable called DumTime, as follows: (The initial value should be 00:00:00;) Next Page ═══ 31034 ═══ Now add the command Get-Dat to the insert routine after the "Perform . . First" line so that it appears as follows- This command will set the value of the 1WDate field to the current date. Save Build the TimeCard task. Link the Workers task, and run it from the Menu (to run the menu select the Run Time option from OpenWin main menu (folder)). Now the task does what it's supposed to. Continue ═══ 22.13. Non SQL Report ═══ In this chapter we will create and modify a report-printing (to a printer or the screen) TimeCard table. Next Page ═══ 31102 ═══ Activate the Source Generator module. Select the Generate Report Task option. Select the TimeCard.DES file and define the task name as "RTimeC". After generation, make sure you are in the Edit Tasks module, open the file RTimeC.ARS. build the RTimeC task with the build tasks module. Run it through the menu to see the report. Next Page ═══ 31103 ═══ Now modify the report task so it will print the total number of hours for each Worker in Hour and day formats. Make sure you are in the Task Definition module and that the file RTimeC.ARS is opened. Add two local variables as follows: Now add a sub total definition as follows: Enter the window design section. Add a New window named CodeT as follows - Add 0 Hours and 0 Days fields to this window. Specify their sub-screen to be Tot The window will look like this - Now you will make some changes in the task logic flow to use this sub-totals definition. Next Page ═══ 31104 ═══ Enter the task logic flow. First, add a Break command after the QtLoop command as follows: As a result, each time a record is read the Code sub-totaling is executed. Look at the Sub-totals to understand when the InitC and TotC routines will be executed. Next Page ═══ 31105 ═══ Now you need to define these two routines as follows: Save the task, build it in the Build Tasks module and run the application from the menu (to run the menu select the Run Time option from OpenWin main menu (folder)). You will see the effects of all the changes you have made. You have completed the tutorial application. We hope you will enjoy your work with OpenWin. Back to Start ═══ 23. SQL Tables definition ═══ The second phase of building Employee application is defining Employee table. If you are using OpenWin Light or non SQL OpenWin version you should continue in Non SQL Task chapter. Activate the Definition module. Select the Table Definition module. When entering the module, you must choose the option File and indicate that you are defining a new file. To do this, select the option New General Settings Activate the Table Definition module General Settings section and fill it in as follows- Minimize this window to an icon. Next Page ═══ 30008 ═══ Field definition Activate the Field Definition section and fill it in as follows- Minimize this window to an icon. Next Page ═══ 30009 ═══ Key definition Activate the Key Definition section and fill it in as follows- Minimize this window to an icon. Select the option File and in it the option Save. Type Employee as the file name and save the file. Close the table definition window. The next phase is building tables. Continue ═══ 23.1. Tables building ═══ Build tables This module checks your table definition and creates physical tables that are ready for work. Since an Employee table is an RDBMS table, you need to create the data base in which the table will be created. Open the the Query Manager and create a new database named OpenWin. Activate the Build Tables module and choose Employee.DES table. The table definition will be checked in a few seconds. If you have made any errors, they will be presented on the screen. Correct the errors and repeat the check. Now you can use the Automatic Program Creation option. Continue ═══ 23.2. Task generation ═══ Activate the Source Generator module. Select the Generate Input Task option. Select Employee.DES file. Press O.K. for the name Employee. Select the "Dialog" Option. In a few seconds , an OpenWin Task named Employee.ARS will be created automatically, which will enable you to update the Employees table. You will be informed that a table named IEmploye.DES has been created. Build it with the build tables module. Close the Task generation module window . To activate the tasks you have created, you must compile them. Continue ═══ 23.3. Tasks building ═══ To activate the tasks which you have created, you must perform the build stage. Activate the Build Tasks module. Choose the program Employee.ARS. In a few seconds an executable task will be created, called Employee.TSK. Close the Build Task module window. You can run the application through the menu and see this task behavior. Continue ═══ 23.4. SQL Handling ═══ In this chapter you will analyze an Employee.ARS task, which is a Data Entry task, for the RDBMS (SQL) table Employee. Before you analyze and modify the task, activate the Build task module on an Employee.ARS task. Then activate Run the task through the menu. You will see that you can add and update the Employee table. You can also use the query option to view only a part of the data. The Employee.ARS task enables you to access data in the Employee table. This task is also used to show how you can use different data handling methods simultaneously. The idea of this task is to use a temporary file to scroll through and update this file and the table simultaneously. Activate the Definition module. Select the Edit Tasks module and open an Employee.ARS task. Open the Edit Task module Table section In this window, the tables which the task handles are defined. In this window you will see the following: Next Page ═══ 30040 ═══ Although you are working with the Employee table, you can see two tables here- IEmploye and Employee. IEmploye is a temporary table, created by the source generator. All data handling and scrolling in this task is done on the temporary file IEmploye. When data are entered, this file is updated and an SQL Query is executed to update the real database. When a Select Query is executed, the output is written in this temporary file. This method enables quick scrolling through a chosen range of data. Of course this is only one possible way of handling data from a RDBMS table. Continue ═══ 23.5. SQL Logic Flow ═══ Enter the Logic Flow window. At the beginning of the flow, you will see the following lines - We already know what the New-Scr line is. The Setoff commands sets initial status OFF for some flags. Q5 flag is used as the main While loop conditions. Z5 flag is used to indicate if the database is changed and needs a Commit query to be executed when the task ends. M0 is set to ON only if the "Root" range is true. This flag is used to indicate that this is a root task. As a result, In case of linked tasks, the Commit query in "IfChange" routine is executed at the end of the task only at the root task execution end. This in done because Commit and Rollback queries close all the open cursors off a session, what we don't want to happen during a linked called task execution. The Put-Lin lines puts MAIN window and Menu window on the screen. The next lines Displays a MAIN window (with the contents of the first record). The "While" command begins a loop that continues as long as the "NotQuit" range terms are true. This is the main loop for this task. Following is a Dialog in which there are two Accept commands - Accept * Action and Accept * Repeat. The Dialog enables the execution of more than one Accept simultaneously. In the Accept * Action line, the user is asked to click on one of the buttons to indicate the operation he wishes to perform. To understand how this is done, open the Window Design window. Click with the mouse on the Menu window to bring it up. You will see a field in a radio button format called "0 Action". Click with the mouse on it and open the Object Details option from the action bar. You will see that this button is an Char (string) local variable and that it is grouped to * Action sub-screen. Minimize the window design window and return to the Logic Flow. The Accept command here will wait for the user to click on a button. When the a button is pushed, the Accept ends and the button field's value is set to the chosen option. The options are defined in the "Input Field" field - ActLst. If Q5 flag is ON (accept aborted), you quit the loop. The following "Switch" command begins a switch to enable use of "Case" blocks for different selections. The Switch parameter is the local variable "0 Action", whose value is set by the user selection. If the value of the following "Case" commands meets this value, the following block is executed. You can see that each "Case" is performing routines. We will look at some of these routines. Continue ═══ 23.6. Next Routine ═══ The Next routine. The First and Last cases set the first or the last record of the temporary file as the current record. In order to understand these cases, you will analyze the Next routine - The read command tries to read the next record in the temporary file. If the read fails we set N1 flag to ON to indicate that there is no next record in the temporary file. Next Page ═══ 30042 ═══ The "If Fetch1" tests the status of N1 flag. If there is no next record we call Fetch1 routine which will be explained later, in which we try to Fetch another line from the Database. If Fetch1 routine fetched a line, it sets I0 flag to OFF so we set N1 flag to OFF as well to indicate that Next succeeded. Look at the First, Last and Prev routines (Cases). These are all simple routines used to scroll through the temporary file. Notice that you have seen similar routines in the Depart Task. The difference is that in the case of a temporary file, as in Relative, Sequential and Vector files, you indicate the record by the reserved key "RECORD" which is the record number. Continue ═══ 23.7. Insert Routine ═══ The Insert routine. Unlike a Depart Task, where the EDIT command did a great deal of the editing work, in this task you handle all operations related to editing, such as keeping the right record number, etc. In this task we keep the last entered record number is a local variable called "0 Record". The purpose of the "Perform First " is to nullify the current record fields, before displaying the record. Look at #MAIN window in the window design. You will see that the fields which the user is updating are the fields from table 1, the temporary IEmploye table, and that they are grouped into two sub screens, KEY and DATA. The data input to these sub-screens fields is done in AccKey and AccData routines. If the data entry stops, we set I1 flag to ON and quit the Insert routine. Next Page ═══ 30043 ═══ After the data has been entered in the Accept command, the following lines are executed: Next Page ═══ 30044 ═══ The Ex-Sql command sends to the database server the contents of the query "Insert" Open the SQL Query Window and look at this query. It will look this: The purpose of this query is to insert the values of the indicated fields into table 2 (the Employee table). Return to the logic flow. In the Ex-Sql command, you see that a local variable 0 SqErr was defined as the result parameter and that the flag Q1 is the result Flag. Since 0 SqErr value was set to 100 before the Ex-Sql command, an error message will be displayed in case of an error. Look at the Ex-Sql command in order to understand the use of the result flag. The Q1 flag can have the following values: "=" (OFF), meaning the query has been executed successfully, "+" (ON), meaning a "good" SQL error, or "-" (ON), meaning a "bad" error. You can see that the lines following the Ex-Sql command will be executed only if there is no error, Else, we set I1 flag to ON and end the Insert routine. Next Page ═══ 30045 ═══ If there is no error, we set Z5 flag to ON. This indicates that the database has been changed. As any other Zx flag, Z5 is a shared flag between tasks in cases of linked tasks. As a result, information indicating that database changes were made during a linked task execution will be returned through this flag to the root task, what will effect the execution of "IfChange" routine at the end of the task execution. The next line add 1 to the last temporary file record number that we keep in "0 Record" variable and put the result in the temporary file RECORD number. The following line write the data to the temporary file "IEmploye". If I/O is ok we save the new RECORD number in 0 Record variable. You can see in the "Case 0 Add" that is calling Insert routine that if the user does not abort the insert by pressing ESC, and there is no error, the flow will loop to enable another input. When the user presses ESC, or if there is an error, the I1 flag will turn ON and the program will quit the loop, find the current record, display it and quit the insert case. The Update and the Delete routines are quite similar. Continue ═══ 23.8. QBE and Quit ═══ Query Case is calling QBE routine. The QBE routine enables the user to define a query to be executed as a Select query and retrieve data from the data base. Notice that in this task you have chosen to work on a temporary file in order to enable quick scrolling through data. After the Select query, you will see an "Until 10Fetch " loop calling Fetch1 routine in which a "Fetch" query is executed and the retrieved data is moved and written to the temporary file. You may notice we are Fetching only the first 10 records. As we saw, more records will be Fetched if next routine will reach the end of the temporary file. Notice that Fetch1 routine saves the value of the last record written to the temporary file in "0 Record" variable. The Action selection loop ends in the following lines: Next Page ═══ 30046 ═══ We are calling Close routine to Close an open Select Query if there is such. he close query will be executed only if O5 flag is ON. Following is the the IfChange routine -. IfChange" begins in an If command. As you saw in the "Insert" case, when you are updating the data, you set the value of Z5 flag to ON. The purpose of this condition is to skip the Commit question, if no changes were made. If you look at "IfChange" range, you will see that it is true only if M0 flag is ON. We are setting this flag status to ON at the beginning of the task. The Message line asks the user if he wishes to commit the changes. If the answer is Yes, Ex-Sql ? Commit is executed. If the answer is No, Ex-Sql ? RollBack is executed. Continue ═══ 23.9. Validity test ═══ Now you will begin to modify the task and customize it to your needs. The first change you will make is to enable the user to enter only existing departments. To do this, you must define that the task is using the Depart table. Open Edit Tasks module Table section Add the table Depart, giving it "3" as an identifier. The window will: look as follows Next Page ═══ 30047 ═══ Enter the window design section and arrange the "MAIN" window so that it loos as follows- (First increase its height and then drag the fields to the requested positions.) Next Page ═══ 30048 ═══ Now add a new field to the window. Select the Field, Append option. Add the field 3 DName as follows- Next Page ═══ 30095 ═══ Then place the field next to the 1 DCode field, so the MAIN window looks as follows Next Page ═══ 30050 ═══ Indicate 1DCode as the chosen field and update it. Change (Select Field - Update ) the sub-screen from DATA to DATA1. Save the window design changes by pressing O.K at the top of the window, and minimize the window design section. Now you need to make some changes at the task logic flow. First , change the display routine so that it looks as follows- Next Page ═══ 30051 ═══ Then change Disp* routine to look like this - By making these changes, each time the display routine will be activated you find the department name in the Depart table (3) and display it next to the department code. Now you will modify the AccData routine so that it allows you to enter only an existing department code. By changing this routine you will control department code entry during Insert and Update as well since this routine is called from the insert and update routines. Next Page ═══ 30056 ═══ Change AccData routine to look as follows - We see that this routine accepts the department code and then checks to see if there is such a department code in table 3 (the Depart table). This routine does not allow the user to type in a wrong code. If the user presses ESC during the code input (the Accept * DATA1 command ), the flag A2 will be turned on and the routine will return to the calling routine with that knowledge. Save the task, build it in the Build Tasks module and run it. You will see the effects of all the changes you have made. Continue ═══ 24. Linked Tasks ═══ As you see, it is not convenient for the user to input employees because he must type in the right department code, and he does not normally know the department codes. We will open a department code window for him. Activate the Definition module. Select the Edit Tasks module and open the Employee.ARS task. Add a new range in the range window - Next Page ═══ 30058 ═══ Now make a slight change in "AccData" routine so that it looks as follows- Next Page ═══ 30059 ═══ The "If NoCode" command checks to see if the field 1 DCode has been left empty by the user. If not, the flow will continue from the DTest label. If it is empty, The callers will call a Depart task. The shared flag Z1 is affected by the way in which the user exits the Depart task. If it is OFF (=), meaning no selection has been made and the 1 DCode value will not change. If selection has been made, move the value of 3 DCode field to 1 DCode. Because you indicated that Depart table is shared by the two tasks, the values of the 3 DCode field will be as it was at the end of the Depart task execution. Save and build the task. Activate the Link Tasks module. Select the "File - Link" option. Type "Employee.tsk" as the source task name. Type Employe1.tsk as the target task name. Click on the "LINK" button. At the end of the linking procedure, exit the Link task module. Note: from this point on, if you modify an Employee task or a Depart task, you must re-link the Employee.tsk after you build it. In order to see how the linked task works, you need to run it, but our menu runs Employee.tsk tasks. Next Page ═══ 30060 ═══ Activate the Definition module. Select the Environment Definition module and the Application Menu section window, and change the line: Save , build the environment and run the task through the menu. You will see that now, if the user does not know the department code, he can leave it empty and then choose it from the department list. Continue ═══ 25. GUI fields ═══ In this chapter you will make a small change in the Employee task, to show how to use the GUI environment. You will enable the user to fill the "Sex" field from a list. Activate the Definition module. Select the Edit Tasks module, and open an Employee.ARS task. Add a local variable named Sexlst, as follows- Notice that you have set the Repetition Factor (R.F.) to two ,and defined two initial values. Next Page ═══ 30061 ═══ Now enter the window design and change the definition of the field 1 ESex as follows - Using the mouse, expand the field. Exit the window design (do not forget to press O.K.). This change will enable the user to select the required sex designation from the list. Assume you want to define the default sex as female during the insert operation. Next Page ═══ 30062 ═══ Add two lines to the task logic Flow at the insert routine, immediately following the "Perform First" line so Insert routine will look as follows - Note the use of one of the Vector Commands, VSetInx. After you set the current value of 0Sexlst, you move it to 1ESex as the default value. Save your task, Build, Link and run it . You will see that the user can select the sex designation from the defined list. Continue ═══ 26. Header and Trailer ═══ Up to this point, you have created a task enabling you to update employee and department data. The next step in the application is to enable the user to update the work hours of each employee. The first step will be to define an hours table, as follows- Activate the Definition module. Select the Define Tables module. Defining General Settings Activate the General Settings section and fill it in as follows- Click on OK and minimize this window to an icon. Next Page ═══ 30063 ═══ Field definition Activate the fields definition section and fill it in as follows- Minimize this window to an icon. Next Page ═══ 30097 ═══ Key definition Activate the Key Definition section and fill it in as follows- Save the file as Hours. Use the source generator to create an input task called "Hours". Select the Edit Window format for this task. Build the tables "Hours" and "IHours" that you create using the source generator. Build the task "Hours" with the build tasks module. When you have a task that can handle an hours table, call it from the Employee task. Continue ═══ 26.1. Header and Trailer .. ═══ Activate the Definition module. Select the Edit Tasks module, and open an Employee.ARS task. Add a local variable, as follows- Now change the repetition factor of ActLst variable to 10 and add "Log" to its appearances in the initial value - Next Page ═══ 30066 ═══ Now you need to change the logic flow so that it will call an Hours task when Log selection is made. Add a new "Case" after the "Switch 0 Action" command - This "Case" (routine) is activated when the "0 HWin" value (Log) will meet the value of 0 Action field. Save, build, link and run the task. Note that when you click the Log option , you enter the Hours task and you can update the hours table. You will find, however, that your task will not do exactly what you want it to. 1. You don't see the employee existing working hours when you enter the log window. You must select the Query option in order to do that. 2.You must type an Employee ID in each line. 3. You can view lines (working hours) that do not belong to this employee. A few changes in Hours tasks will complete your task. Continue ═══ 26.2. Header and Trailer ... ═══ Activate the Definition module. Select the Edit Tasks module, open Hours.ARS task. First, add the following line to the logic flow before the "Loop" beginning- Then,change the windows. Enter the Window design section. Select a color from the Colors Window (from the Option menu) and double click on MAIN window to change its color. Select the 1ECode field within the MAIN window and delete it. Select the QBE Window. Delete the four following fields from the window: By these changes you prevent the user from typing an employee ID during input and, or from defining an employee ID as part of the query terms, if he chooses the Query option in order to access data related to the employee. (Click on OK before you minimize the window design) Next Page ═══ 30098 ═══ Change the local variables "0 Order" and "0 OrdList" as follows- Next Page ═══ 30067 ═══ Now relate the task to the current employee. In order to get the current employee's ID, define the IEmploye table as a shared table. Open the Edit Tasks module Table section Add the Table IEmploye, giving it "3" as identifier. The window will appear as follows- Since you have removed the Employee ID field (1ECode) from the input window and from the query window, you need to change some of the queries. Open the SQL query section. Change the Select query so that it appears as follows Next Page ═══ 30068 ═══ As a result of this change, when the Select query is executed, only lines relating to the current employee are selected. Change the Insert query Now, every time the Insert query is executed, the current employee ID will be taken from the field 3.ECode and all lines related to this employee will contain the employee's ID. The last change to make in this task is to establish that when a new work hours line is add, the default date will be the current date. To do this, you first add a local variable called DumTime, as follows- Next Page ═══ 30070 ═══ Now add the command Get-Dat to the insert routine after the "Perform . . First" line, so that it appears as follows- This command will set the value of the 1WDate field to the current date. Save build an Hours task. build Employee task, link the it and run it. Now the task is doing what it's supposed to. Next you will learn about views Continue ═══ 27. Views ═══ In this chapter, you will create a view of Employee and Hour tables, calculating the daily payment for each employee. Then you will create two tasks, a viewing task and a reporting task. Activate the Definition module. Select the Define View module. Enter the Table Definition section and fill it in as follows-- By this definition, the statement view will be related to fields from both tables. To use functions within the view statement, you must define fields to hold the results. Next Page ═══ 30071 ═══ Enter the Field Definition section and fill it in as follows The last step in the view definition is to create a view statement. Enter the View Statement Definition section and fill it in as follows- The results of "Select" are stored in the corresponding fields list. (There are many ways to define views. This method is used when the view is intended to use functions or conduct calculations, so that it is necessary to indicate where the calculation results will be stored.) Save the view with the name "DayPay". Build it using the Build Views module. Note that a a table Definition File (.DES) named "DayPay" will be created long with the view created. You can look at it using the Define Tables module. Note that this table is a "View" type table and has the same fields as you defined in the view definition. You can relate to this table as any other table. Use the source generator to create an Input task named "DayPay" by the DayPay.DES . Use the source generator to create a report task named "RDayPay" by the DayPay.DES . Build the tasks using the Build Tasks module. Now you have two view tasks at DayPay table. Run these tasks. As a result of the view statement multiplying ( 1.Rate * 2.Hours ) you will get the result as the "Daily payment" You can edit these tasks and see that they are much like the other SQL handling tasks you have created. Continue ═══ 27.1. SQL Report ═══ In this chapter we will modify RDaypay report printing task. We will modify the report task so it will print the hours total for each employee in Hours and days formats. Activate the Definition module. Select the the Task Definition module and open the file RDayPay.ARS. Add two local variables as follows- Now add a sub total definition as follows - Enter the window design section. Add a New window named CodeT Add 0 Hours and 0 Days to this window. specify their sub-screen to be Tot Now we will make some changes in the task logic flow to use this sub totals definition. Next Page ═══ 31204 ═══ Enter the task logic flow. First , add a Break command before the Print # MAIN command as follows - As a result, each time a line is fetched, the Code sub-totaling is executed. Look at the Sub-totals to understand when will InitC and TotC routines will be executed. Next Page ═══ 31205 ═══ Now you need to define these two routines as follows - Save the task, build it in the Build Tasks module and run it. You will see the effects of all the changes you have made. ═══ 28. P R O G R A M M I N G G U I D E ═══ This guide has been developed to help you learn about OpenWin modules. You may use the Contents option (select it from the Help Window Action Bar) to view this book by it's chapters order or you may search the Index for a particular module, section, command etc. You can also select one of the following OpenWin's modules which are OpenWin's main development modules - Define Environment, Define Tables, Define Views, Edit Tasks, Source Generator, Linker, Visual Debugger, ═══ 29. Environment definition ═══ The environment defining module is used to define the environment of the application which you are developing. This module includes the following windows- General Settings . U.D.R. Declaration . Locking Resources . Printer Declaration . DBMS Declaration . Tables Declaration . Tasks Declaration . Application menu . When entering the module you must specify what File you wish to edit. It can be done by selecting Open. from the File menu and choosing the desired file name from the list presented. The file name will appear at the top of the screen. If you wish to define a new filename you must select the New option. When you have finished editing the file, select the option File and save it. If you are defining a new file you will be asked to type the filename. ═══ 29.1. General Settings ═══ In this section you will type in, or choose the General settings regarding the application you are developing. System code This code identifies the application uniquely, and it's used to identify the system for locking needs. Description This text shortly describes the application. Application language You must select the language in which you wish to work during development. System users You must define whether the application which you are developing will work as a stand alone application or in a multi-users environment. ═══ 29.2. Users Defined Routines ═══ In this section you point out whether in addition to OpenWin commands you wish to include programs (servers) written in a third generation language, or to activate programs that can be activated from the system prompt. The definition includes- Command name . The command name is the name through which you will activate this command while writing the application. Server/program name The server is a third generation language program name, which will perform the command. See library commands in order to get more information about this option. In case you wish to activate an outer program through the operating system the server's name would be SYC_SYS (for synchronized execution), or ASYC_SYS ( for un synchronized execution). For example, the next definition makes possible of operating an outer Word Processor, named 'Word', from the OpenWin tasks. Command name Server Description ------------------------------------- Word ASYC_SYS Word processor Command description Is a Text describing, That describes the perform of this command. ═══ 29.3. Locking Resources ═══ In this section you define the logical locking resources for the application. OpenWin enables you to perform lock and share actions to these resources while giving them different values. You can find a detailed explanation about the Lock command in the command guide. In order to define a new resource you must define- Resource name Treat this name as a parameter while writing the lock and share commands. The resource description Is a Text explaining, that explains the purpose of the resource's definition. ═══ 29.4. Printers Declaration ═══ In this section you choose which printers will be Active or Inactive while an application is running. The definition includes- Printer Name A Text string, which will describe the printer, and will appear in the printer selection menu during run time. Control file The filename which includes the escape sequence controlling this printer. Command file If you wish the printing to be performed through the command file, you must type in the file name. This command file will get the file name from the program during run time and you can use the system " %1 " parameter in order to print it. This enables you, for example, to define that before printing begins you can change the printer's emulation. For direct printing to the printer type PRN. ═══ 29.5. DBMS Declaration ═══ In this section you choose which DBMS will be used in the application. The DBMS's definition is made by selecting them from the DBMS list. ═══ 29.6. Tables Declaration ═══ In this section you declare the table names that the application will use. This definition is made in order to guide you to an organized work environment. The definition includes- Table name The table name is a definition file (.DES) which describes the logical structure of the table. Table description In the description you are asked to type a text string describing the table's task in the application. This description will enable other users to understand the application structure. ═══ 29.7. Tasks Declaration ═══ In this section you are asked to type the different tasks that make up the whole application. The definition includes- Task name The task name is the program name (.ARS) that is used in the application Task description The description includes a text string describing the task and its uses in the application. ═══ 29.8. Application Menu ═══ In this section you will define the application menu and create a shell, which will be used as a main menu in the application. A detailed description regarding the menu commands can be found. Each line in the definition includes- Label Defining a label in this field will allow access to this line. A line beginning a menu window with the Newmenu command and a line beginning a group of commands with the Newbtch command must be characterized by a label. Variable Some of the menu commands give an answer as a numeric value stored in variable (A-Z). Defining variables in this field will create together with "Whether in range" fields a condition that will effect the execution of the line. The value of this variable is set in the user's task by the Ext-Val command. By checking the value of this variable you can condition the execution of tasks, in the ending of other tasks. Whether in range Under this heading there are two numeric fields. In order to create a condition for the execution of the line you must put in these fields maximum and minimum values. The line will be executed only if the value of the variable that was chosen in the "check variable" field will fit the defined range. Command In this field you have to select the requested command Parameter In this field you should type in a parameter for the command. For example, the Task command runs an OpenWin task, the parameter will be the task's name. Variable There are some commands that return a result to a variable. This result will be stored inside the variable defined in this field. Icon In lines, which are used as options in a menu, you must point out an icon or a ".bmp" file name, which will appear next to the text describing the option. Text In this field you should type in text that will appear on the screen as a heading for a menu or as a choice selection description. ═══ 30. Tables definition ═══ The Define Tables module is used to define the logical structure of the tables which comprise your data base. This module contains three windows: General settings Field definition Key definition When entering the module, you must specify the File that you wish to edit. This is done by selecting Open from the File menu and choosing the desired file name from the list displayed. The file name will appear at the top of the window. If you wish to define a new file name, you must select the New option. When you have finished defining the file, select the file option and save it. If you are defining a new file you will be asked to type in the file name. ═══ 30.1. General Settings ═══ In this section you define the General Setting of the data file. File name The file is the physical data file name. You must define this name. In some cases the data file will comprise a number of physical files. The file names will consist of the defining name and various extensions. If, for example, a file with the name VENDOR S, together with the DBMS chosen to run it, is C-Index/II, two physical files will be created: VENDORS and VENDORS.DCL When writing programs, you aren't normally concerned with the physical file name, but rather with the defining file name. Table Type The file can be organized in different ways. You must select the method of organization you desire, in accordance with its purpose. The possible types are: A RDBMS table - Relational. This method of organization allows you to use a SQL Query about the RDBMS data. An index file - Indexed. Enables a quick and direct access to the records according to different key values. A relative file - Relative. This method of organization enables you to treat the records in accordance with their numbers. It does not require that the records be arranged sequentially. A sequential file - Sequential. This method of organization enables you to treat the records in accordance with their numbers. In a sequential file, the records must always be arranged sequentially. A temporary file - Temporary. This is a sequential file created during the running of programs and erased when the task ends. A vector file - Vector. This file is a sequential file which is managed only in memory. A view file - View. This file is created by the Build View module. It saves the view definition in a way that you can relate to data via SQL Queries. DBMS If the data base method of organization is chosen, you must select the DBMS. In order to enable you to make a selection, a list of DBMS's is displayed which are suited to the chosen method of organization. Data Base If a relational table type has been chosen, you must specify an existing data base name under which the table is to be created. Record length Some of the DBMS's require that the length of a record be defined. This length must be longer than the length of all of the fields which comprise the record The number of records In some cases, such as for a Vector table used as a definition, you must define the maximum number of records. This field will usually be left empty ═══ 30.2. Field Definition ═══ In this section you define the fields which comprise a line or a record in the data base. Field name This field is a distinct name that identifies the field. Reference to the field is made in the program by the use of this name. The field description The field description is text which describes the context of the field. The description may be presented in the programs next to the field, or as a heading for the column in which the field will appear The field type There are different types of fields, different types of numeric, character and date fields, etc. You must select a field from the list. The different fields and their meanings are listed below - 1. Byte 2. Integer 3. Long 4. Money 5. Date 6. Time 7. Real 8. Float 9. Char 10. Bitmap The field format You can define different characteristics for various types of fields, for example, a Char field can be defined for characters or digits only, to be received from right to left, or left to right, etc. Characteristics suitable to the specific type of field can be chosen from the list. The different possible characteristics are listed below: 1. Positive 2. Negative 3. AmerDate 4. EuroDate 5. Time 6. 0..9 7. Rgh-T-Lf 8. Lf-T-Rgh 9. Numeric 10. Catalog 11. Date 12. Hidden-> 13. Hidden<- The field length The field length is the length displayed on the screen. In numeric fields, this length includes the decimal point and commas, if the field characterization is Money. Offset Use the Offset option only when you wish to make an equivalence off two different fields. The offset indicates the physical place in the record where the field begins. You normally leave this field empty and the fields arrange themselves sequentially in the record. ═══ 30.3. Keys Definition ═══ In this section you define the file keys. The purpose of the keys is to allow rapid and practical location of data suited to specific conditions. Keys must be defined for relational tables and index files. The key name The key name identifies the key exclusively. The key fields Key fields are table fields according to which you can sort or locate records. For example, there is a table with the following fields: VENDCODE - Distributor code VENDNAME - Distributor name CITY - City The specialized identifier of every distributor is the Distributor code, so the first key must be defined to include the field VENDCODE. To enable you to obtain a list of distributors sorted according to both name and distributor code, another key defines the VENDCODE and VENDNAME fields. ═══ 31. Views definition ═══ The Define View module is used to create a view statement for use within OpenWin tasks. After defining and building the view statement, you can regard it as a new table in your application. This module includes the following sections: Tables . Fields . View Statements. When entering the module, you must specify the File you wish to edit. This is done by selecting Open from the file menu and choosing the desired file name from the list displayed. The file name will appear at the top of the screen. If you wish to edit a new file name, you must select the New Option. When you have finished editing the file, select the File option and save it. If you are defining a new file, you will be asked to type in the file name. ═══ 31.1. View Tables ═══ In this section, you indicate the tables which are handled by the view. The table definition includes the fields of this table. The table identifier In this field you must define a table identifier (1-9, A-Z). Later you will refer to this table by specifying the identifier. The Table Name In this field you must specify the definition file name of the table used in the view. This must be the definition of an RDBMS table. ═══ 31.2. View Statements ═══ In the View Statements section, you define view creation statements which are made of SQL sentences based on the ANSI standard. The queries are written in multi-line windows. When writing a Create query, you use TOKENS (SQL queries) and may handle the table fields. You can choose to see a number of query examples. If you don't know SQL, we suggest that you study the subject from suitable literature. Comprehensive information can be found in the following books: IBM OS/2 Extended Edition; Database Manager Programming Guide and Reference; Database Manager Structured Query Language (SQL) Concepts. ═══ 31.3. View Fields ═══ If you wish to use functions within the View Statement, you must define a Local Field in which the function result are stored, so that you will be able to refer to it. The field is defined just as you define table fields. ═══ 31.4. View TOKENS ═══ Following is the list of Tokens used for writing Create queries. Commands CREATE VIEW AS - Views name query - Begins a create view statement. SELECT- Defines field limits in the query and is normally used according to a specified query condition. FROM- Indicates a table to be queried WHERE- Starts a condition sentence. GROUP- Files "records" according to groups. DISTINCT- Ignores double columns. ANY- A condition word in a SELECT sentence. IS- Enables conditioning with NULL. TO- A reserved word. BY- A linking word. AND- A condition word. OR- A condition word. NOT- A condition word. Condition char > - big < - small <> - different >= - greater than or equal to <= - smaller than or equal to = - equal More char , - separates variables * - all the fields in the table ' - opens and closes a constant local char in a query ( - open brackets ) - close brackets ═══ 31.5. View Examples ═══ Following are a few examples for query structures. The parts in brackets [ ] are optional. Example 1 - a CREATE VIEW AS sentence General example Private example Example 2 - a detailed CREATE VIEW AS sentence general example Private example Next Page ═══ 30100 ═══ Example 3 - a CREATE VIEW AS sentence using function and local field. Private example ═══ 32. Tasks editing ═══ The Edit Task This is the central module in the development environment. With it you can write or change the tasks (programs) which make up the application The Edit Task module includes the following windows: General Parameters. Tables . . Strings . . Variables. . Window Design . . Logic Flow. Sub totals . . Ranges . . The Edit Window Edit Operations . . SQL Query . . Printers . . When entering the module you must specify the File you wish to edit. This is done by selecting Open from the file menu and choosing the desired file name from the list presented. The file name will appear at the top of the screen. If you wish to edit a new file name you must select the New option. When you have finished editing the file, select the File option and save it. If you are defining a new file you will be asked to type in the file name. ═══ 32.1. Identifiers [Tasks] ═══ OpenWin distinguishes between different objects by using identifiers. An identifier is a mark which indicates the object type. This relationship makes it possible to give identical names to different objects , yet retain the ability to differentiate among them. For example, you can define a local field called NAME with 0 as the identifier. You may then refer to a table field which is also called NAME by referring to it according to the table identifier, for example B. Identifiers that can be used in the edit tasks module flow are: 9 Printer Z-A,9-1 Tables ! constant strings 0 local variables # windows * sub-window " another task -,+ numeric constants ? SQL query % locking resource ^ Flag (In ranges section) ═══ 32.2. Flags [Tasks] ═══ OpenWin uses logical variables called flags. A flag is identified by the combination of a letter and a digit, for example F1 C5, etc. The flags are effected by OpenWin commands and can have the following values On ON ( - or + ) Off OFF ( = ) See the explanation for use of the flags in The Logic Flow window When tasks are linked through the Callers command, each task is given a distinct set of flags. OpenWin has a group of common flags which are used to transfer logic information between linked tasks. These flags are identified by the letter Z. ═══ 32.3. General Parameters [Tasks] ═══ In this section you define the general parameters of the task. This data includes: The task name The task name is a short text line which describes the task. Routines An OpenWin task must have a main routine, but may also include a beginning and ending routine. Each of the routines comprises a group of commands written in the Logic Flow window, which begins with a label. An Initial routine In this field you have the choice of indicating a routine name (label) which will be activated before the main routine. Beginning routines are primarily defined for tasks with an initialization phase, for example, receiving ranges in a report task. Main routine In this field you can specify the name of the main routine of the task. Final routine In this field you can specify a name (label) for the routine which will be activated after completion of the central routine. Ending routines are defined primarily in tasks which have ending phases, for example, presenting final calculations in report tasks. ═══ 32.4. Printers [Tasks] ═══ This section is used for report tasks. In this window you define the report specifications and data. Beginning routines are primarily defined for tasks with an initialization phase, for example, receiving ranges in a re port task. Printer ID In this field you specify the printer to which the report will be sent. You can enter the name of a printer, a file name, or "?" to enable the selection of a printer while you are working on the task. Form size You specify the length of the page. Standard A4 size paper is usually 66 lines. First printing line You must specify the line on which the printing should begin. Last printing line You must specify the line on which the printing should end. The page beginning routine You must specify the name for a routine which will be repeated at the beginning of each page, for example, a routine that prints a heading at the beginning of the page Page end routine You must specify the name for a routine which will be repeated after the printing of each page has ended, for example, a routine that prints the page number at the bottom of each page ═══ 32.5. Tables [Tasks] ═══ In this section you identify the tables managed by this task. The table definition includes the fields. The table identifier In this field you must define a table identifier (1-9,A-Z). Later you will refer to this table by specifying the identifier The table name In this field you must specify the definition file name of the table to be used in the task. Access You must select the access form admitted for this table (reading only, reading and writing). Shared If you want this table to be shared by a number of linked tasks, you must define the table as a shared table. ═══ 32.6. Strings [Tasks] ═══ In this section you define constant character strings used in the task. Constant name This name identifies the constant for future reference. Constant content The constant content is the text. Constant characters are normally used to define text messages that will be presented on the screen or printed etc. ═══ 32.7. Local Variables [Tasks] ═══ In this section you may define variables (local fields) to be used for different purposes in the task such as initial values, numeric variables for temporary calculation, etc. The field name The field name is an exclusive name which identifies the field and is used to refer to the field in the program. The field description The field description is text which describes the context of the field. This description is presented in the programs as the field title or a heading for the column in which the field will appear. The field type There are different types of field characteristics: different kinds of numeric fields, date fields, etc. You must type in the desired field type, or select it from the list. A list of the fields and their meanings is presented below: 1. Byte 2. Integer 3. Long 4. Money 5. Date 6. Time 7. Real 8. Float 9. Char 10. Bitmap The field format Different field types can have different formats defined for them, for example, a Char field can be presented in a form which receives characters or digits only, to be received from right to left, or left to right, etc. The characteristics suited to each field type can be chosen from the following list: 1. Positive 2. Negative 3. AmerDate 4. EuroDate 5. Time 6. 0..9 7. Rgh-T-Lf 8. Lf-T-Rgh 9. Numeric 10. Catalog 11. Date 12. Hidden-> 13. Hidden<- The field length The field length defines the length of the field presented on the screen. In numeric fields this length includes the decimal point and commas, if the field format is money. Repetition factor For each field you must define the desired repetition factor (minimum - 1 ). This means that each local field can comprise a table with more than one value Initial value A field you may defined with an initial value. When you define a field with more then one repetition factor, you will be able to define an initial value for each of the factors. A beginning value ends with a ";". ═══ 32.8. Window Design [Tasks] ═══ This window is used for interactive editing of the task windows. You can perform a variety of actions on the windows and their fields in order to give them the shape you want. Chosen window/field In order to perform actions of various kinds on a window or a field, you must first indicate the window or field to be edited. To do this, click on the requested field or window with the mouse. Windows are presented at the front of the screen. Fields are surrounded by a narrow frame. Shifting In order to move a window or a field on the screen, bring the mouse to the field, click and hold the mouse button down, then drag the window or field to the desired location and release the mouse button. Size change You can change the size of the windows and the fields. This is done similarly to the PM with the mouse. The Action Bar The following options are presented in the operation bar window. Under Window you will find the following options - Append Update Delete Under Field you will find the following options - Append Update Delete Under Options you will find the following options - Object Details Color Window Windows List After editing a window you should press OK or Cancel Click on the option you wish to know more about. ═══ 32.9. Revise/Update Window. ═══ When revising/updating a window, you should refer to the following parameters: Click on the parameter you wish to know more about. Name Style Background Title Field Icon Name Icon Position Icon Dimensions ═══ 32.10. Revise/Update Field. ═══ When revising/updating a field you refer to the following parameters: Click on the parameter you wish to know more about. Screen Output Field Input Field Style Background Foreground Title Place SubScreen Help Panel ═══ 32.11. Color Window. ═══ This window can be used to change field or window colors and field styles. Color change In order to change the color of a field or window you must mark the field/window as chosen. Press the appropriate button to choose the desired color from the palette and then confirm your choice by pressing Apply at the top of the palette. Field style change You can define a display of fields in different forms. In order to do this you must mark a field as chosen, go to the Format list by selecting the Format (Style) option from the operation bar at the top of the palette, mark the display style de sired (by clicking the mouse) and confirm your choice by pressing Apply ═══ 32.12. Logic flow [Tasks] ═══ In this section you define the logical sequence of the task. Each line is constructed as follows: Label Identifies the line exclusively. Condition A conditional group. If conditions are specified, the line will be constructed only if the specified conditions are met. Command An OpenWin command, the parameters associated with it, and the resultant variables. Branching Each line can include conditioned branching. Each part of the command is comprised of a number of fields.The fields are defined as follows: Label Each label identifies a specific line in a logical sequence for purposes of reference. The label can be made up of letters and numbers. Various commands can direct the task flow to this label. There is no need to identify each line by a label. The reserve label ******** prevents execution of the line while running. Flag A flag mentioned in this field will cause the command in this line to be executed while running or not. Use the first flag only if you want to create a complex condition. Operation In this field you define a logical condition which effects the previous and following flags. The possible conditions are AND,OR, XOR Flag A flag mentioned in this field together with the first flag and the logical condition, if one has been defined, will effect the execution of the command in the line. If a first flag has been defined, it is a necessity to define this flag and the logical condition between them. Command The desired command is written in this field. It can be one of the OpenWin commands or an external command added to the system. See the command specifications and the parameters which they use in the command guide. Identifier An Identifier that characterizes the first parameter of the command. Parameter 1 A local field, a table field, constant, etc. Used as the first parameter in the command, if it requires or permits the use of this parameter. Identifier An identifier that characterizes the second parameter of the command. Parameter 2 A local field, a table field, constant, etc. Used as the second parameter in the command, if it requires or permits the use of this parameter. Identifier An identifier which characterizes the result variable of the command. Result variable A local field, a table field, constant,used as a result variable in the command, if it requires or permits the use of this parameter. Result flag A logical flag. Most commands effect the situation of the result flag. A flag with the value "=" (OFF) indicates success. A flag with the value "+" or "-" (ON) indicates failure. Specifications for the situation of the flag after each command can be found in the command guide. Goto Label This label is used for quick branching from this line. The label relates to the definition of a line in the task. Branching through this label can be done in two ways. The first is through the use of different flow commands such as "Perform", etc. The second depends on the nature of the result flag. When you indicate a result flag, branching to the defined lab el will proceed if, after execution of the command, the result flag is set to the same value as that defined in the Result flag. ═══ 32.13. Comment Line [Tasks] ═══ In a comment line you may write comments to document your task logic flow. ═══ 32.14. SQL Queries [Tasks] ═══ In the SQL Queries section you define queries which are made of SQL sentences written in multi-line windows to the ANSI standard. Each query starts and is specified by a label and continues until another label indicates the beginning of the next query. You will refer to this label in the Ex-Sqland the Fetch commands. While writing a query you use TOKENS (SQL queries) and treat local variables and fields from the data bases. You can choose to see a number of queries examples. If you aren't familiar with SQL, we recommend that you study the subject from suitable literature. Comprehensive information can be found in the following books- IBM OS/2 Extended Edition Database Manager Programming Guide and Reference Database Manager Structured Query Language (SQL) Concepts. ═══ 32.15. Variables in the query [Tasks] ═══ In the SQL queries you can use OpenWin variables as part of the query condition tot create flexible queries that change while running. The variables in the queries can be fields from tables, fields from files, local fields , or textual constants The variables in the query are identified as used to in OpenWin with the identifier. You can also define them as part of the query's condition. a local constant character by inserting it between inverted commas, for example: 1.CITY = 'WASHINGTON' ═══ 32.16. Queries TOKENS [Tasks] ═══ The following is a list of TOKENS used for writing queries. Commands ROLLBACK- cancels changes made in the current operation. COMMIT- updates changes in the current operation. SELECT- Defines field limits in the query normally used according to a specified condition in the query. FROM- Indicates a table on which the query is to be performed. WHERE- starts a condition sentence. INSERT- inserts new "records" into the table. DELETE- deletes the table "records". UPDATE- updates "records" GROUP-organizes "records" by groups. ORDER- sets the fields according to which the table will be categorized. SET- joins the VALUES VALUES- indicates the beginning of a group of values to be entered into the table. DESC- organizes in descending order (from large to small). ASC- organizes in ascending order (from small to large). IN-starts an operation. ALL-a condition word in a SELECT sentence. DISTINCT- ignores double columns. ANY- a condition word in a SELECT sentence. IS- enables conditioning with NULL. TO-a reserved word. BY-a linking verb. INTO-indicates a table. AND-a condition word. OR- a condition word. NOT-a condition word. Condition char > - big < - small <> - different >= - larger or equal <= - smaller or equal = - equal More char , - separates variables * - all the fields in the table ' - opening and closing a constant local char in a query ( - open brackets ) - close brackets ═══ 32.17. Queries Examples [Tasks] ═══ Following are a few examples for query structures The parts in brackets [ ] are optional. Example 1 - a SELECT sentence general example Private example Next Page ═══ 30101 ═══ Example 2 - INSERT sentence General example Private example Next Page ═══ 30102 ═══ Example 3 - UPDATE sentence General example Private example Next Page ═══ 30103 ═══ Example 4 - DELETE sentence General example Private example Next Page ═══ 30104 ═══ Example 5 - ROLLBACK sentence General example Private example example 6 - COMMIT sentence General example Private example ═══ 32.18. Sub totals [Tasks] ═══ In this section you can define sub-totaling and operations performed in response to the Break command. Breaks and sub-totaling are usually used with report tasks. To do this you must define the following parameters: Label The label identifies a group of sub-totals. The group of sub-totals continues until the next label. Breaking field A table field or a local field and the field identifier Operations defined for execution when the field changes will be executed when the value of this field is changed. Add field A field that calculates. Result A field that collects the scheme result. When a field changes In a line that defines breaking - when a field value changes - you can define the following operations to be executed Routine name The name of a routine in the logic flow which will be executed when the value of the breaking field changes. This routine is used for complicated calculations. Printing window A window which will be printed if a break occurs. New page You can indicate that you wish to move to a new page whenever a break occurs. beginning value Routine name You can indicate the name of a routine in the logical flow to be executed at the beginning of a task and after a break. Such a routine is normally used to initialize values for different fields such as fields for sub-totaling. ═══ 32.19. Ranges [Tasks] ═══ In this section you define the ranges to be examined during the execution of the Range command. These examinations are usually performed in report tasks. See the Range command in the command guide. Range definition is performed as following way: Label The label identifies a group of ranges. The group of ranges continues until the next label. A range can be made of fields as well as of Flags. To define a range of Flags use ^ identifier. Checked field A field and field identifier on which the range is examined. Minimum field You have to type in the field name and the field identifier This field is used as a lower blockage in the examined range. It will normally be a local field which will be given an initial value at the beginning o f the task. Maximum field You must type in the field name and the field identifier This field is used as an upper blockage in the examined range. It will normally be a local field which will be given an initial value at the beginning of the task. A logical condition This the connection between the examined range in this line and the following lines of the range group, if they exist. The possible conditions are: AND, OR, XOR. ═══ 32.20. Edit Operations [Tasks] ═══ The Edit Operations section is an operation library which is activated when the Edit command is used on a window. Each window on which the Edit command is to be used must contain a group of operations. The structure of the Edit Operations window is as follows: Window name Entering a window name in this field starts a group of edit commands which belong to this window. The name of the window is defined in the window design section. The group includes all defined commands from a line for which a window name has been defined, until the next line for which a window name has been defined. This field can be defined only once for each group of edit commands, in the first line of the command group. Identifier If this line has an edit key defined for it, you must define the table identifier to which it belongs to. Key If the line starts a group of commands, you must enter the key name from a table according to which the automatic edit operations will be executed. In special cases you can define a field (local or from a table) as an edit key. Operation One of the edit commands. Some of the edit commands are mandatory, some can appear only once in a group of commands and some can appear several times in the same group. See the detailed explanation of the edit commands in the edit commands appendix Selection char When the Edit command is being executed the system waits for the user's selection, which is made by selecting an option from the operation menu with the mouse or by pressing the key or combination of keys defined as the selection char. Each edit command has a character defined as default choice, but the programmer can change it. Routine for execution A routine name written in the logic flow Some of the edit commands require definition of a routine, some are internal and have no connection to a routine, and some can be executed automatically or referred to a routine. The sequence of actions performed by an edit operation is: Executing an automatic beginning action (usually a screen operation). Executing the default choice or the routine, if defined. Execution of an ending operation (usually a screen operation with a command execution break). The result flag The result flag is a logical flag which permits the transfer of information from the user routine to the edit command that activated this routine. Normally a flag in the OFF position indicates a successful operation and an ON flag indicates its conclusion. Operation description The text is displayed in the operation bar. To set a "Hot Key" type ~ first. For example, ~Exit. ═══ 32.21. Edit Window [Tasks] ═══ In this section you define the way in which the edit window is shown on the screen.To do this you must insert the following parameters: The window name The window name is the window you wish to activate with the Edit command.Remember that you must define EDIT actions for this window. Position X axis The position of the bottom left corner of the window on the x-axis (the width axis) in relation to the left side of the screen. Y axis The position of the bottom left corner of the window on the y-axis (the height axis) in relation to the left side of the screen. Width The width of the window. Height The height of the window. Line color This is the color of the current line. Heading and identifier You must define a local field or constant character to be used as the heading for a window. ═══ 33. Source Generator ═══ The The Source Generator module is used to generate OpenWin codes that can be edited with the Edit Tasks module. You may select different types and formats of code such as Input Task (data entry), Reports, Dialog, etc. Source generation is based on a Table Definition file (.DES) which you create with the Define Tables module. The output of Source Generation is a task source code file (.ARS). You can edit this file with the Edit Tasks module, or build it from the start with the build tasks module. To generate a source you must: Select the type . Select the table definition (.DES) file. Select the task name to be generated. The default name is identical with the table definition name. Select the format and the source to be created. ═══ 34. Link Tasks ═══ The Link Tasks module is used to Link tasks that use the Callers command. Before you link a task, you should build it and the called tasks using the Build Tasks module. Linking tasks creates a new task (.TSK), which includes all of the tasks called by the main (source) task. If one of the called tasks also uses the Callars command Do Not Linking the main task will link all the tasks called by the main task and the called tasks, if any exist. To link a task you should: Select the main task as the Source Task Name Define the new task name you wish to have as the output of the linkage and type it in as the Target Task Name You may mark the overwrite option. If you do not mark this option, a message will be displayed, if the Target (New) task exists. Press LINK A list of the called tasks names will be displayed. You may link another task, or press CANCEL to quit. ═══ 35. Help File ═══ If you wish to define help panels for the end of the application, you should modify the file USERHELP.IPF. You will find this file in the directory where OpenWin is installed. This file is embedded within the OpenWin standard help file - RARSE.IPF. To define an .IPF file, look at the proper section (Developing Help Information) of the IBM OS/2 Programming Guide. Use resource codes (res=) from 10000 and higher. After editing the USERHELP.IPF File, you should compile the file RARSE.IPF in order to create the help file - RARSE.HLP. The compilation is done with the OS/2 IPFC compiler. ═══ 36. Debugger ═══ The The Visual Debugger module enables you to run your tasks in debug mode. When you run a task in debug mode you can see the task execution as well as all commands, data, etc. When you activate this module and enter a task, you see the following windows: 1. Commands 2. Flags 3. Variables 4. Tables 5. SQL Query 6. Locate Data Dictionary The items in each window are numbered according to the order in which they appear.You can refer to these items by their number. You can access these windows by clicking with the mouse, or by choosing the Windows option from the action bar. On the action bar you will also find the Operations, Run and Step options. ═══ 37. Debugging Operations ═══ Under this title you will find the following options: 1. Present PC 2. Change PC 3. Find Text 4. Break Points ═══ 37.1. Present PC ═══ This option effects the Commands window. It displays the present command line to be executed. ═══ 37.2. Change PC ═══ This option effects the Commands window. It enables you to change the program counter and thus define a new command line to be executed next. ═══ 37.3. Find Text ═══ This option can be used within any window. The text may be a Command, Variable name or title, Field value, etc.The line found becomes the first line in the window. ═══ 37.4. Break Points ═══ This option opens a table from which you can define break points. In each line you can type a Line No., Field No, Screen No., etc.. You should type the flag name (A1, B5 etc.). You can specify the flag status that will create a break by typing it (A1=, B5+, etc.) At the end of the line, you indicate whether or not the line break points should be active. When you scroll through the Commands window you can define a break point for every line by double clicking on the line with the mouse Right button. ═══ 37.5. Debugging Run ═══ When you choose the Run option, the task will start running. If you define Break Points, the task will pause when it reaches a break point. You can use the mouse to switch back and forth between the task window and the debugger window. ═══ 37.6. Debugging Step ═══ When you choose the Step option, the task starts running, step by step. You will be able to see the execution of the command and the results. ═══ 37.7. Commands [Debug] ═══ In the command window, you can see the task commands and parameters as they appear in the logic flow. The displayed PC line is highlighted. When you scroll through the Command window, you can define a break point for every line by double clicking on it with the mouse Right button. You can double click on a line with the mouse Left button to see all the Locate Data Dictionary related to the command in this line. ═══ 37.8. Flags [Debug] ═══ In the Flags window you can see the task flags and their status. You can double click on a flag with the mouse Left button to Change to see and change its status. ═══ 37.9. Variables [Debug] ═══ In the Variables window you can see the task's local and global data. In each line you can see the data type identifier, title and value. This data includes (Id 1-9,A-Z) Tables Fields, (Id 0)Local Variables, (Id 0) Strings Constants and (Id +,-)Immediate numeric constants. If a Local Variable has a repetition factor greater than one, a list of values is displayed and the current value highlighted. You can double click on a line with the mouse Left button to Change change the data values. ═══ 37.10. Tables [Debug] ═══ In the Tables window, you can view the names of the tables used by the task, together with their identifiers, to enable you to refer to the table's Variables (Fields), or to Commands processing the table data. ═══ 37.11. SQL Query [Debug] ═══ In the SQL Query window, you can see the SQL Queries as they are sent to the SQL Server. ═══ 37.12. Locate Data Dictionary [Debug] ═══ In the Locate Data Dictionary window, you can see all the data related to a chosen command. When you scroll through the Commands in the Command window, you can double click on a line with the mouse Left button to see the data related to the command. In the Locate Data Dictionary window you can double click on a line with the mouse Left button to Change and see the data values. ═══ 37.13. Debugging Values Change ═══ When you are in the Variables Window, the Flags window, or the Locate Data Dictionary window, you can double click on a line with the mouse Left button to change the data values. A window appropriate to the data format will be opened. ═══ 38. Utilities ═══ Under the Utilities option, you will find utilities used during development. 1. User Permeations 2. Lister 3. Printers 4. Locking Resources ═══ 39. User Permeations ═══ The User utility defines access rights to system resources from OpenWin tasks and the OpenWin environment. When you enter the User utility for the first time, use the system password - OPENWIN After you have defined your system manager password with the same permission as that of the OPENWIN password, delete the OPENWIN password. A "Job" is a group of operations for which you wish to control the access rights. It may be an application, a menu option, a task, a routine, or one line within a task. There are two options in the utility module: 1. Input 2. Output See also "Passwrd" - OpenWin environment command, "Ckpw" logic flow command. ═══ 39.1. Input ═══ The Input Module contains three windows: 1. USER HANDLING 2. JOB HANDLING 3. PERMISSION HANDLING ═══ 39.2. USER HANDLING ═══ In USER HANDLING, a user password is entered into the system. This window has the following structure: User password. is a code identifying the user or user's group. General code. is a parameter which allows you to define the access rights for users with the same password. Work code. is a numeric code used to define access rights for the user from an OpenWin environment menu.The application's menu command, Passwrd, puts the Work code into the result variable. Description. Includes a text string describing the user's access rights. ═══ 39.3. JOB HANDLING ═══ In JOB HANDLING, the default access to a job is defined. This window has the following structure: Job code identifies the job . Enter the job name here and refer to it whenever you use the Logic Flow "Ckpw" command in order to get the permission a user has for this job A "Job" is a group of operations on which you wish to control the access rights. It may be an application, a menu option, a task, a routine, or one line within a task. Access You must select an access from the list. If a user has no other permission in the PERMISSION HANDLING for this job code, the access defined here will be returned by the Ckpw command as a result. Description includes a text string describing the job. ═══ 39.4. User permeations ═══ In PERMISSION HANDLING, each user receives access rights to a specific job. This window has the following structure: User password. is a code identifying the user or user's group which can be selected from the list of passwords in the USER HANDLING window. Job code.can be selected from the job list in the JOB HANDLING window. Group and Sub are numeric codes which allow you to define different access rights to the job defined for several users with the same password. The value "0" indicates that this applies to all of the groups (Sub-groups). Zero may be used for one or both variables. Access You must select an access from the list. It will be returned by the Ckpw command as a result. Description includes a text string describing the user's access rights. ═══ 39.5. Output ═══ The Output Module contains three printing options: USER HANDLING, JOB HANDLING and PERMISSION HANDLING. ═══ 40. Lister ═══ The lister utility enables you to print your environment, table definitions, view definitions and task sources. ═══ 41. Printers ═══ The printer utility enables you to define new Printer Control Files. ═══ 42. Locking Resources ═══ the Locking Resources status while IN USE. When using this utility, be very careful not to change the normal behavior of the application ═══ 43. Batch Building ═══ In order to maintain large applications you may rebuild and link an application from a batch file. To do so, you should add the /B qualifier to the command and specify an errors messages file name. a BTH extension will be add to this file name. Following are the building commands formats- Build Environment- BV [Environment file name] /BErrors Build Tables - BLDTBL [Table definition file name] /BErrors (Batch tables building dose not overwrite existing tables) Build Views - BLDVEW [View definition file name] /BErrors (Batch views building dose not overwrite existing views) Build Tasks - BX [Task definition file name] /BErrors Link Tasks - LN [Table definition file name] /O /BErrors (You must specify the /O (overwrite) qualifier) ═══ 44. C O M M A N D S R E F E R E N C E ═══ This guide has been developed to help you learn about OpenWin commands. You may use the Contents option (select it from the Help Window Action Bar) to view this book by it's chapters order or you may search the Index for a particular module, section, command etc. You can also select one of the following sections - Menu Commands, Field Types, Logic Flow Commands, Edit Command Operations, ═══ 45. Menu commands ═══ Here is the list of commands used to create a menu. Batch Goto Endbtch Endmenu M-Line Newbtch Newmenu Passwrd System Task Choose a command on which you wish to receive further information. ═══ 45.1. Batch ═══ Description Is used to define this menu option. With the selection of a choice a branching to a label is made. This label should point out a line that begins a group of commands which are supposed to be executed one after the other. In the line which the reference is made to there should be a Newbtch command. Action parameter A label points to address. Result variable None. Icon Bitmap name which will appear next to the text.(a .bmp file name without the .bmp extension ) Text This text would be shown as the option description. See also Newbtch,Endbtch ═══ 45.2. Endbtch ═══ Description Ends a group of commands which are executed one after the other. A group of commands that begins with a Newbtch command must end with this command. Action parameter None. Result variable None. Icon None. Text None. See also .Newbtch,Batch ═══ 45.3. Endmenu ═══ Description Ends a group of commands which create a menu window. Every menu window must end with this command. Action parameter None. Result variable None. Icon None. Text None. See also .Newmenu ═══ 45.4. M-Line ═══ Description Used to define a menu option. With the selection of a choice a branching to a label is made. This label should indicate a line which begins a sub-menu window. In the line which the reference is made to there should be the Newmenu command. Action parameter Label to go to. Result variable None. Icon Bitmap name which will appear next to the text.( a .bmp file name without the .bmp extension ) Text Would be shown as the option description. See also .Newmenu,Batch ═══ 45.5. Newbtch ═══ Description Begins a group of commands which are executed one after the other. Every group of "Batch" commands must begin with this command and end with the Endbtch command. The reference to this command is made from the Batch menu option. Action parameter None. Result variable None. Icon None. Text None. See also .Endbtch,Batch ═══ 45.6. Newmenu ═══ Description Begins a group of commands which make up a menu window. Every group of commands defining a menu window must begin with this command and end with the Endmenu command. The referral to this command is made from the M-Line menu option. This command begins the menu tree. Action parameter None. Result variable None. Icon None Text Will appear as a heading in the menu window. See also .Endmenu,M-Line. ═══ 45.7. Passwrd ═══ Description Stops the menu flow and waits for a password Action parameter None. Result variable Menu variable A-Z. This variable will receive the user's work code. In order to get by the passwords, the user must type in a legal password . Icon None. Text None. ═══ 45.8. System ═══ Description Is used as an option in a menu or a group of Batch commands. When the option is chosen an exit to the operating system is made and the option runs a program,a group of commands or an operating system command. Action parameter The command line is used for activating the program, a group of commands or the operating system command. For example, in order to receive a list of files into a file, the parameter will be a command file name in which the command - DIR >DIRFILE.TMP is typed. Result variable None. Icon A bitmap name that will appear next to the text describing the choice ( a .bmp file without the .bmp extension) Text Text describing the option. See also .Task ═══ 45.9. Task ═══ Description Is used as an option in a menu or a group of Batch commands. When this option is chosen an OpenWin (.TSK) task is being executed. Action parameter The task name for operating without the TSK extension. Result variable A variable, if defined, will receive the exit value from the task. Icon A bitmap name that will appear next to the text describing the choice ( a .bmp file without the .bmp extension) Text Text describing the option in the menu See also .System ═══ 45.10. Goto ═══ Description Is used as an option in a group of Batch commands. When the menu flow reaches this command it diverts the flow to the mentioned label. Action parameter The label to divert to. Result variable None. Icon None. Text Text describing the option. See also .M-Line,Batch ═══ 46. Fields types ═══ Use this menu to get information about the different field types in the system. 1. Byte 2. Integer 3. Long 4. Money 5. Date 6. Time 7. Real 8. Float 9. Char 10. Bitmap ═══ 46.1. Byte ═══ This is a numeric field represented by one byte. It can have the following formats: 1. Positive 2. Negative The field length is between 1 and 11. ═══ 46.2. Integer ═══ This is a numeric field which can receive positive or negative whole numbers between 32767 and 32767. It can have the following formats: 1. Positive 2. Negative The field length is between 1 and 11. ═══ 46.3. Long ═══ This field is identical to an Integer field, but can receive numbers greater than 32767. This field can have the following formats: 1. Positive 2. Negative The field length is between 1 and 11. ═══ 46.4. Money ═══ This is a numeric Real field which is displayed with a comma after every three digits. It can have 0..9 formats. The field length is between 1 and 100. ═══ 46.5. Date ═══ This is a date field which is saved in four bytes: day, month, and two year bytes. When values are received in this field, the legality of the date is checked. The field can have the following formats: 1. American 2. European The length of the date field is either 7 or 10. ═══ 46.6. Time ═══ This field is used to save time variables of hours, minutes and seconds.This field is always characterized as Time, and its length can be either 5 or 8. ═══ 46.7. Real ═══ This is a real number field. It can have positive or negative numbers with up to 6 digits after the decimal point. The formats of these fields are 0..9, and the field length is between 1 and 100, including the decimal point. The length must be greater than the field format. ═══ 46.8. Float ═══ This is a real number field, like the Real field, but one which can receive greater numbers. ═══ 46.9. Char ═══ This is a char field which can be characterized in the following ways: 1. Rgh-T-Lf 2. Lf-T-Rgh 3. Numeric 4. Catalog 5. AmerDate 6. EuroDate 7. Time 8. Hidden-> 9. Hidden<- Most of the characteristics have a length of between 1 and 100. The date format has a length of either 7 or 10. The time format can have a length of either 5 or 8. ═══ 46.10. Bitmap ═══ In order to display a bitmap field, you define the field as a Char When you design the window, you define S_BITFLD Style to the field. The field should have a .bmp file name. ═══ 47. Fields formats ═══ Under this title there is information about the different field Formats in the system. Use the Index or the Expand Contents help option to see the different field Formats . ═══ 47.1. Positive ═══ This format makes it possible to enter positive numbers from the keyboard only. ═══ 47.2. Negative ═══ This format makes it possible to enter positive and negative numbers from the keyboard. ═══ 47.3. AmerDate ═══ The date format will be accepted and shown according to the American standard: month/day/year. ═══ 47.4. EuroDate ═══ The date format will be accepted and shown according to the European standard: day/month/year. ═══ 47.5. Time ═══ Time is presented in hours:minutes:seconds format ═══ 47.6. 0..9 ═══ This numeric format indicates the number of digits to be displayed after the decimal point. ═══ 47.7. Rgh-T-Lf ═══ In this field, the characters are right justified. ═══ 47.8. Lf-T-Rgh ═══ In this field, the characters are left justified. ═══ 47.9. Numeric ═══ This field will accept only numeric digits. ═══ 47.10. Catalog ═══ In this field, the characters are inserted from right to left. ═══ 47.11. Date ═══ This field is displayed in a date format structure. ═══ 47.12. Hidden-> ═══ Characters are inserted in this field from left to right, but remain hidden from view. ═══ 47.13. Hidden<- ═══ Characters are inserted in this field from right to left, but remain hidden from view ═══ 48. Edit Command Operations ═══ The Edit Operations The Edit Operations are operations defined in the Edit Operations WindowThese operations are actions that the Edit operations performs. Some of the edit operations are mandatory, some can appear only once in a group of commands and some can appear several times in the same group. See the detailed explanation for Edit Operations in the appendix. ═══ 48.1. APPEND ═══ Description Executes screen operations as preparation for receiving a new record. The values of the key fields are maintained. If the user's routine generates (ON) status at the result flag, the value of the last key field is re stored. Screen operation Opens an empty record under the current record. Routine execution Vital. Normally includes receiving values for fields and writing functions. Result flag Y9..A0. This operation repeats itself as long as the user's routine generates (ON) the result flag is turned off (OFF). ═══ 48.2. DELETE ═══ Description Executes a screen operation after a record has been deleted. Screen operation The screen operation refreshes the screen after a record has been deleted. A refresh operation is executed only if the result flag returned by the routine indicates the success of the delete operation. Routine for execution Vital. Normally this will include confirmation of the delete operation and a DELETE command. Result flag Y9..A0. The screen operation will be executed only if the result flag is turned off (OFF). ═══ 48.3. DISPLAY ═══ Description Shows the current record in the window. This command is vital for every edit window. Screen operation Presents a window line. Routine for execution Vital. Usually it includes a FIND command. It can include different commands used for linking between fields or tables. Result flag Marks a flag. ═══ 48.4. EXIT ═══ Description Ends the execution of the edit commands and leaves the Edit command. The flag defined in the Edit command line will have the value "=" (OFF). Screen operation None. Routine for execution Vital. Will be executed before exiting the Edit command. Result flag Marks a flag. ═══ 48.5. EXIT+,EXIT- ═══ Description Leaves the Edit command while turning on the flag defined in the Edit command line for the "+" or "-" values respectively. Screen operation None. Routine for execution Vital. Can include different functions, including activation of another task. It normally defines the position of the flag. Result flag Y9..A0 Optional. If the routine executed turns on the flag defined here, the edit commands will continue to run and the Edit command execution will not stop after execution of the routine. ═══ 48.6. FIRST ═══ Description Transfers the minimum values to the key fields defined for the edit window. Screen operation None. Routine for execution Vital. If you want the beginning key values to be different from the minimum values, you can transfer the requested values. Result flag Marks a flag. ═══ 48.7. INSERT ═══ Description Performs a screen operation in preparation for receiving a new record. The value of the key fields is retained. If the user's routine turns on (ON) the result flag, the value of the last key field is returned. Screen operation Opens an empty record in the location of the current chosen record. Routine for execution Vital.Normally includes receiving values for fields and writing them Result flag Y9..A0. This operation repeats itself as long as the user's routine leaves the result flag turned off (OFF). ═══ 48.8. LAST ═══ Description Transfers the maximum values to the key fields defined for the editing window. Screen actions None. Routine for execution Vital. If you want to limit the key values to maximum values, you can transfer the desired values. Result flag Marks a flag. ═══ 48.9. LOCATE ═══ Description Prepares the screen to receive a query for locating a record. Saves the key values and, if the result flag indicates that the operation has been stopped, restores the value of the last key. Screen operation Opens a line at the location of the current chosen record. When the locating succeeds, the window is refreshed. Routine for execution Vital. The routine includes receiving a query and locating functions. Result flag Y9..A0. Indicates the success or failure of the locating function. ═══ 48.10. NEXT ═══ Description Reads the following record according to the key value. If there isn't any record to be read, the value of the last key is retained. Screen operation Fits the position of the cursor. Routine for execution Vital. Normally includes a Read command that will read the next record. You can define a routine that will read the previous record in a different way and in different tests. Result flag Y9..A0. Used to return an answer from the routine. The off (OFF) position indicates that a record is currently being read. The on (ON) position indicates that no record has been found. ═══ 48.11. PREVIOUS ═══ Description Reads the previous record according to the key value. If no record exists, the value of last key is saved. Screen operation Fits the position of the cursor. Routine for execution Vital.It normally includes a Prev command. You can define a routine that will read the previous record in a different way and in different tests. Result flag Y9..A0. Used to return an answer from the routine. The off (OFF) position indicates that a record is currently being read. The on (ON) position indicates that no record has been found. ═══ 48.12. UPDATE ═══ Description Permits the updating of a record. Screen operation Restores the values of the record if the updating function is stopped. Routine for execution Vital. Normally includes input values and updating commands. Result flag Y9..A0. Indicates the success or failure of the updating operation. ═══ 49. Logic Flow Commands ═══ The OpenWin commands are the commands which you define in the Logic Flow Section to create the logic flow for the task. See the detailed explanation in the appendix. ═══ 49.1. Accept ═══ Description Enables the input of data to a field or to a number of fields combined by a sub-screen. The PUT-LIN command, or the Edit command, must precede this command. Identifier * Parameter 1 Sub-screen name. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Can have the following values: = (OFF) Input is ended normally by pressing enter, or clicking with the mouse on another sub-screen. + (ON) Input is ended by pressing esc, or the appropriate mouse button . See also Put-Lin ,Edit, Display ═══ 49.2. Add ═══ Description Addition. This operation can be performed on two numeric values, or on a numeric value and a date. Identifier Z-A,9-0,-,+ Parameter 1 The first term is a local variable, constant, or field from a file which includes a numeric value or date. Identifier Z-A,9-0,-,+ Parameter 2 The second term is a local variable, constant, or field from a file which includes a numeric value or date. Identifier Z-A,9-0 Result variable A local variable, or field from a file with a numeric value or date. Formats that will include the addition result. Result flag Can have the following values: = (OFF) The result of the addition equals 0. + (ON) The result of the addition is greater than 0 . + (ON) The result of the addition is smaller than 0 . If the addition involves a date field, the flag will be on (ON), in a + position. See also Diff-M,Diff-Y ,Mult , Sub ═══ 49.3. Add-M ═══ Description Adds a month to the date. Identifier Z-A ,9-0 Parameter 1 Date field. Identifier Z-A ,9-0 Parameter 2 A numeric field containing a value which defines the number of months you wish to add to a parameter 1. Identifier Z-A ,9-0 Result variable A date field that will get the calculated date. Result flag Always turned on (ON), in the + position. See also .Add, Add-Y, Diff-M,Diff-Y, Sub ═══ 49.4. Add-Y ═══ Description Adds a year to the date. Identifier Z-A ,9-0 Parameter 1 Date field. Identifier Z-A ,9-0 Parameter 2 A numeric field containing a value which defines the number of years you wish to add to a parameter 1. Identifier Z-A ,9-0 Result variable A field that will get the calculated date. Result flag Always turned on (ON) in the + position. See also .Add, Add-M, Diff-M,Diff-Y, Sub ═══ 49.5. Break ═══ Description Causes the task to examine the definitions in the Sub totals window in order to make the calculations defined in this window. If the breaking values change, it performs the routines marked for execution with the changing of the values. Identifier None. Parameter 1 A label which defines the group of examinations in the break window. Identifier Z-A ,9-0 Optional. Parameter 2 Optional. If you define a field with a real value (Not null) the command will close the break and act as if the last break occurred. Result flag Isn't effected. Result variable None. ═══ 49.6. Callers ═══ Description Calls another OpenWin task and begins its execution. When setting the sharedflag ZO is turned on (ON) in order to indicate to the summoned program that it is a secondary program, and not the main program. After th e summoned task is executed the calling program continues its execution. Identifier " Parameter 1 The name of the OpenWin task (.TSK) to be performed. Identifier None. Parameter 2 None. Result variable None. Result flag Optional - a flag defined as a result. flag It will get the value in the ZO flag after completing the called task. ═══ 49.7. Clr-Lin ═══ Description Clears a window presented by the Edit command or Put-Lin and presents the screen as it was before the window was displayed. Identifier # Parameter 1 The name of the window to be cleared. Identifier None. Parameter 2 None. Result variable None. Result flag Isn't effected . See also Put-Lin,Edit, Display ═══ 49.8. Comp ═══ Description Compares the values of two numbers. Identifier Z-A,9-0,-,+. Parameter 1 The first number of the comparison. It can be a local field, a field from a file, or a numeric field. Identifier Z-A,9-0,-,+. Parameter 2 The second number of the comparison. Identifier None. Result variable None. Result flag Vital. Can have the following values: = (OFF)Parameter 1 equals parameter 2. + (ON) Parameter 1 is greater than parameter 2. + (ON) Parameter 1 is smaller than parameter 2. See also Comps ═══ 49.9. Comps ═══ Description Compares two strings, character by character. Identifier Z-A,9-0,!. Parameter 1 First string of a comparison. It can be a local field, a field from a file, or a character constant Identifier Z-A,9-0,!. Parameter 2 Second string of a comparison with parameter 1. Identifier None. Result variable None. Result flag Vital. It can have the following values: = (OFF) Parameter 1 equals parameter 2. + (ON) Parameter 1 is greater than parameter 2. + (ON) Parameter 1 is smaller than parameter 2. See also Comp ═══ 49.10. Decode ═══ Description Calculates the numeric value of a char string. Identifier Z-A,9-0. Parameter 1 A char field which contains digits. Identifier None. Parameter 2 None. Identifier Z-A,9-0. Result variable A field with the numeric value of the string. Result flag = (OFF) The calculation succeeded +/- (ON) The calculation failed. See also Encode ═══ 49.11. Diff-M ═══ Description Calculates the difference in months between two dates. Identifier Z-A,9-0. Parameter 1 A date field. Identifier Z-A,9-0. Parameter 2 A date field whose value will be reduced from the value of the date in parameter 1. Identifier Z-A,9-0. Result variable A numeric field that will receive the difference in months. Result flag Can have the following values: = (OFF) Parameter 1 equals parameter 2. The difference = 0. + (ON) Parameter 1 is greater than parameter 2 and the difference is positive. - (ON) Parameter 1 is smaller than parameter 2 and the difference is negative. See also- Add,Diff-Y, Sub ═══ 49.12. Diff-Y ═══ Description Calculates the difference in years between two dates. Identifier Z-A,9-0. Parameter 1 A date field. Identifier Z-A,9-0. Parameter 2 A date field whose value will be reduced from the value of the date in parameter 1. Identifier Z-A,9-0. Result variable A numeric field which will receive the difference in years. Result flag Can have the following values: = (OFF) Parameter 1 equals parameter 2 and the difference = 0. + (ON) Parameter 1 is greater than parameter 2 and the difference is positive. - (ON) Parameter 1 is smaller than parameter 2 and the difference is negative. Also see Add,Diff-M,Sub ═══ 49.13. Delete ═══ Description Deletes a record from a file according to the current unique first key value. Identifier A-Z,9-1. Table Identifier. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Can have the following values: = (OFF) The delete attempt succeeded. +/- (ON) The delete attempt failed. See also- Rewrite,Write ═══ 49.14. Display ═══ Description Displays a window or sub-screen. The desired window must be defined before using the display command by the Put-Lin command, or the Edit command. Identifier #,*. Parameter1 A window or sub-screen name. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Isn't effected. See also- Put-Lin,Accept,Display , Edit ═══ 49.15. Div ═══ Description The division of two numbers. In the case of division by zero, the result will be zero. Identifier Z-A,0-9,-,+. Parameter 1 The divided . Can be a numeric constant , a local field, or a field from a file Identifier Z-A,0-9,-,+. Parameter 2 The divider. Identifier Z-A,0-9. Result variable The division result. Can be a local field or a field from a file. Result flag Can have the following values: = (OFF)The division result equals - 0. + (ON) The division result is greater than 0. - (ON) The division result is smaller than 0. See also Add,Mult,Sub ═══ 49.16. Edit ═══ Description The Edit command presents a window to be edited on screen and enables skipping the Put-Lin This enables and supervises the EDIT operations defined for the window to be edited in the EDIT operations window. At the beginning of this command, the following sequence of operations is performed, until either the edited window is filled or the records for presentation end: First ,Next ,Display ,Next ,Display ... The editing is done according to the requirements of the user and can be automatic, or as defined in the routine which the user programs in the EDIT commands window. At the end of the EDIT command, the control returns to an EDIT operation which waits for the next user's selection. The next command in the program after the Edit command will be executed only after the user selects the Exit option. Identifier # Parameter 1 The window name to be edited. Identifier None. Parameter 2 None. Identifier 0-9,A-Z,+ Result variable A numeric variable. If the value in this variable is 0, the window will appear in its full size. If the value is 1, the window will appear as an icon. Result flag Effected by the exit way chosen. = (OFF) To exit the window, the Exit option has been selected. + (ON) To exit the window, the Exit+ option has been selected. - (ON) To exit the window, the Exit- option has been selected. See a detailed explanation for each of the edit commands. ═══ 49.17. Encode ═══ Description Transfers the value of a numeric field to a char field. Identifier Z-A,9-0. Parameter 1 A numeric field whose value is converted to a string. Identifier None. Parameter 2 None. Identifier Z-A,9-0. Result variable A char field that will receive a string representing the numeric value of a parameter 1. Result flag Can have the following values: = (OFF) The transfer succeeded. +/- (ON) The transfer failed. See also- Decode ═══ 49.18. Ex-Sql ═══ Description Executes a command or a group of SQL commands defined in the SQL Query . . window. Identifier ? Parameter 1 A label which characterizes a group of SQL commands defined under this label in the SQL queries window. Identifier ! Parameter 2 Cursor. Use of the cursor is necessary in the command which refers to a SELECT query, or in the CLOSE command. The cursor is a char constant which specifies a specific SELECT query, enabling you to call the same queries mo re than once, with different values in the selected ranges. The Fetch command refers to a specific query by the cursor. You can open up to 10 queries with different cursors at the same time. Identifier 0-9,A-Z. Result variable A numeric field that will get the return code from the SQL server. If the value of this field is 100 when the query is executed, and there is an error, the system error message wi ll be displayed. Result flag Can have the following values: = (OFF) The query succeeded. + (ON) The query was rejected by the server. - (ON) There is no contact with the SQL server. See also Fetch ═══ 49.19. Ext-Val ═══ Description Transfers a numeric value to the environment menu variable defined in the menu "Task" command, in order to enable the conditioning of a task execution. Identifier (A-Z,0-9) Parameter 1 A whole numeric field which includes the value to be transferred. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Can have the following values: = (OFF) The execution succeeded. +/- (ON) The execution failed. ═══ 49.20. Fetch ═══ Description Transfers the data base value found by the SELECT query to the OpenWin variables. Identifier ? Parameter 1 The SELECT query label performed from which you want to Fetch. Identifier ! Parameter 2 Cursor. A char constant Identifier 0-9,A-Z. Result variable A numeric field that gets the return code from the SQL server. If the value of this field is 100 when the query is executed, and there is an error, the system error message will be displayed. Result flag Can have the following values: = (OFF) The function succeeded. + (ON) The function has been rejected by the server. - (ON) There is no contact with the server See also- Ex-Sql ═══ 49.21. Find ═══ Description Finds a record that fits a key value. Identifier the table Identifier 1-9,A-Z. Parameter 1 A key name. For Sequential, Temporary, Relative and Vector files the key name is always the reserved word RECORD. Identifier None. Parameter 2 None. Result variable None. Result flag Can have the following values: = (OFF) A record has been found. + (ON) A record hasn't been found. - (ON) There is no access to the record. ═══ 49.22. Get-Day ═══ Description Calculates the day of the week for a specified date. Identifier A-Z,0-9. Parameter 1 A date field. Identifier A-Z,0-9. Parameter 2 A char field. Will receive the name of the day of the week. Identifier A-Z,0-9. Result variable. A numeric field. Will get the day in the week as a number between 1 and 7. Result flag Always on in the + position. (ON) ═══ 49.23. Get-Dat ═══ Description Gets the date and hour synchronized with the system clock. Identifier A-Z,0-9. Parameter 1 A date field. Will receive the date from the system clock. Identifier A-Z,0-9. Parameter 2 A time field. Will receive the time from the system clock. Identifier None. Result variable None. Result flag Can have the following values: = (OFF) The operation succeeded. +/- (ON) The operation failed. ═══ 49.24. Get-Prn ═══ Description Checks the printer number, if chosen at the beginning of the task. Identifier None. Parameter 1 None. Identifier A-Z,0-9. Parameter 2 Optional. A char field which will receive the PRN file name, if a printer that prints to a file has been chosen Identifier A-Z,0-9. Result variable A numeric field that will receive the number of the printer selected. Result flag Can have the following values: = (OFF) The printing is to the screen. + (ON) The printing is to the printer. ═══ 49.25. Get-Usr ═══ Description Gets the user's name. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier A-Z,0-9. Result variable A char field. Will receive the name of the current user. Result flag Can have the following values: = (OFF) A user name exists. - (ON) A user name doesn't exist.. ═══ 49.26. Goto ═══ Description Performs a diversion to a label. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Isn't effected. Label A label to divert to. See also- Perform,Return ═══ 49.27. Insert ═══ Description Transfers a char string to another string in a fixed location. Identifier !,Z-A,9-0. Parameter 1 A char field to transfer into a result variable. Identifier A-Z,9-0. Parameter 2 A numeric field. The position of parameter 1 in the result variable. Identifier !,Z-A,9-0. Result variable A char field into which you insert parameter 1. Result flag Can have the following values: = (OFF) The insertion succeeded. + (ON) The insertion failed. See also- Moves,Substr,Strlen ═══ 49.28. Lock ═══ Description Performs a unique locking of resources in a certain value. Identifier 0,9,A-Z. Parameter 1 A variable that contains the system code defined in the environment. Identifier % Parameter 2 The name of the resource to be locked. This resource must be defined in the work environment. Identifier A-Z,0-9. Result variable A unique value (a field or key) upon which the resource will be locked. Result flag Can have the following values: = (OFF) Locking succeeded. + (ON) The locking failed. See also- Share, Unlock, Get-Env ═══ 49.29. Message ═══ Description Displays a message window. Identifier A-Z,0-9,-,+,!. Parameter 1 The context of the message. Usually is a char constant, but can also be a numeric constant, or a field. Identifier +,0-9,A-Z Parameter 2 Numeric value. Sets the user's requested way of reaction. 0 - OpenWin Help message is displayed and the user is asked to click on "ok". 1 - OpenWin Error message is displayed and the user is asked to click on "ok". 2 - The user is asked to choose between "yes" and "no". 3 - The user is asked to choose between "yes", "no" or "cancel". Identifier +,0-9,A-Z Result variable Numeric value. The number of warning beeps to be sounded ( 9 - 0 ). Result flag Can have the following values: = (OFF) The user typed "yes". + (ON) The user typed "No". - (ON) The user typed "cancel". ═══ 49.30. Move ═══ Description Enters a numeric value into a field. Identifier A-Z,0-9,-,+. Parameter 1 The numeric value to be moved. Identifier None. Parameter 2 None. Identifier A-Z,0-9. Result variable The field to which the numeric value will be moved. Result flag Can have the following values: = (OFF) The transferred value equals 0. + (ON) The transferred value is greater than 0 - (ON) The transferred value is smaller than 0. See also- Moves ═══ 49.31. Moves ═══ Description Enters a char value into a field. Identifier A-Z,0-9,!. Parameter 1 The value to be moved. Can be a char constant, or a field that contains a string. Identifier A-Z,0-9,!. Parameter 2 Optional. A string that will be added to the right side of the string in parameter 1. Identifier A-Z,0-9. Result variable The field to which the string will be moved. Result flag Isn't effected. See also- Move ═══ 49.32. Mult ═══ Description Multiplies two numbers. Identifier A-Z,0-9,-,+. Parameter 1 The multiplied. Can be a numeric constant or a numeric field. Identifier A-Z,0-9,-,+. Parameter 2 The multiplier. Identifier A-Z,0-9. Result variable The product. A numeric field that will receive the result of the multiplication. Result flag Can have the following values: = (OFF) The product equals 0. + (ON) The product is greater than 0. - (ON) The product is smaller than 0. See also- Add,Div, Sub ═══ 49.33. New-Scr ═══ Description Presents a background screen. This command is mandatory for screen commands, for example, Put-Lin and Edit. This command can be executed only once in a given task. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier 0-9,A-Z,!. Result variable A variable used as a screen heading. Result flag Isn't effected. See also- Clr-lin ═══ 49.34. Prev ═══ Description Reads the previous record in the table. Identifier A-Z,1-9. Parameter 1 One of the following options: A key name in a table. A record will be read with a key value previous to the current. For Sequential, Temporary, Relative and Vector files, the key name is the reserved word "RECORD" Identifier None. Parameter 2 Optional. The reserved word "NEXT", which is used for reading non-unique keys. Identifier None. Result variable None. Result flag Can have the following values: = (OFF) The previous record has been found. + (ON) The current record is the first in the table. - (ON) There is no access to the record. See also- Read. ═══ 49.35. Print ═══ Description Prints the contents of a window to the selected output device. Selection will be made during run time from the printers defined in the environment printers section . Identifier # Parameter 1 The name of the window to be printed. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Isn't effected. ═══ 49.36. Put-Lin ═══ Description Prepares the window for presentation on the screen. A New-Scr command must be performed once to enable this command. Identifier # Parameter 1 Window name. Identifier None. Parameter 2 None. Identifier +,0-9,A-Z. Result variable A numeric variable or a numeric constant. If the value in this variable is 0, the window will appear on the screen in its full size.If its value is 1, the window will appear as an icon. Result flag Isn't effected. See also- New-Scr, Accept, Display, Edit ═══ 49.37. Range ═══ Description Activates a range check for the ranges defined in the Range section. . Identifier None. Parameter 1 A label representing a group of ranges defined in the range window. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Will receive the following values: = (OFF) The checked fields are in range. + (ON) The checked fields are not in range. See also- Comp,Comps ═══ 49.38. Read ═══ Description Reads the record following the current record in the table. Identifier A-Z,1-9. Parameter 1 A key name in a table. A record with a key value greater than the current key value will be read. For Sequential, Temporary, Relative and Vector files, the key name is the reserved word "RECORD" Identifier None. Parameter 2 Optional. The reserved word "NEXT", which is used for reading non-unique keys. Identifier None. Result variable None. Result flag Can receive the following values: = (OFF) The next record has been found. + (ON) The current record is the last in the table. - (ON) There is no access to the record. See also- Prev, ═══ 49.39. Reopen ═══ Description Closes a physical table and enables the opening of another physical table with a structure that fits the table definition specified in the table definition section. Identifier A-Z,1-9. The Identifier of a table defined in the table definition window. Parameter 1 None. Identifier A-Z,0-9,!. Parameter 2 To close a table, skip this parameter. To open a table, choose a variable name which includes the name of the physical file to be opened. Note that the file structure must be identical with that of the table defined in the table definition win dow. Identifier A-Z,0-9. Result variable To close a table, skip this parameter. To open a table, choose a variable name which includes the extension of the physical table to be opened. Result flag Can receive the following values: = (OFF) The table has been opened successfully. +/- (ON) This physical table cannot be opened. ═══ 49.40. Re-Start ═══ Description Repeats the execution of a task from the beginning. This command cats like the last "Return" command in the task. It closes all the open "Breaks" if there are any and Print or display a report if the task is using printing commands. The values of local variables don't decrease to zero. If you wish to initialize them , use the Move(s) commands. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Isn't effected. ═══ 49.41. Return ═══ Description Indicates the ending of a routine that was characterized at the beginning by a label, and returns the flow to the command that called this routine. If this command ends a task that was called by a CALLERS command, the calling task will continue in the following command line. If the routine that ends the task is called from the Edit command, the control will return to the Edit command. If the routine that ends the task is called by the Perform command, the flow will continue from the command following the calling of the perform command. The task routines - a Return command at the end of a main routine (defined in the task General Parameters ) ends the routine and starts executing the next routine. After the execution of the last routine in the task, the task ends. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Isn't effected. See also- Goto,Perform ═══ 49.42. Rewrite ═══ Description Updates the contents of an existing record in a table. Identifier Table identifier, A-Z, 9-0. Parameter 1 None. The record with the current key value will be updated. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Can receive the following values: = (OFF) The record has been updated. + (ON) There is no record with the key value. - (ON) There is no access to this record. See also- Write ═══ 49.43. Search ═══ Description Searches for a character string in another string. Identifier A-Z,0-9. Parameter 1 A requested string. Identifier A-Z,0-9. Parameter 2 A string in which to search. Identifier A-Z,0-9. Result variable Optional. A numeric field that will get the location of the requested string in the string being searched. Result flag Can have the following values: = (OFF) The requested string has been found. + (ON) The string has not been found. ═══ 49.44. Set-Scr ═══ Description Displays or Hide a sub-screen. The desired sub-screen must be in a valid window previously defined using the display command by the Put-Lin command, or the Edit command. You cannot display (using Display command) or input data (using Accept command) to a sub-screen that is in Hide status. Identifier *. Parameter1 A sub-screen name. Identifier None. Parameter 2 None. Identifier None. Result variable Hide or Show Sets the sub-screen status. Result flag Isn't effected. See also- Put-Lin,Accept,Display , Edit ═══ 49.45. Seton ═══ Description Turns on a logical flag Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag A logical flag (A0-Z9). Will turn on in the + position. (ON) Goto Label Optional. If defined, the task will be diverted to this label. See also- Setoff ═══ 49.46. Setoff ═══ Description Turns off a logical flag Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag A logical flag (A0-Z9). Will turn off in the = position. See also- Seton ═══ 49.47. Share ═══ Description Executes a non-unique locking of resources with a certain value. Identifier A-Z, 9-0. Parameter 1 A variable that contains the current environment code. Identifier % Parameter 2 The name of the resource to be locked. This resource must be defined in the working environment. Identifier A-Z,0-9. Result variable A field or a key with whose value the resource will be locked. Result flag Can receive the following values: = (OFF) The locking succeeded. + (ON) The locking failed. See also- Lock,Unlock ═══ 49.48. Skip ═══ Description Form feeds one page in the printer. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Isn't effected. See also- Print command. ═══ 49.49. Sshift ═══ Description Moves the contents of a string left or right by a given number of characters. Identifier Z-A,9-0. Parameter 1 A char field whose contents must be moved. Identifier -,+. Parameter 2 Numeric. The number of characters to be moved. Identifier None. Result variable None. The moving is done in parameter 1. Result flag Can receive the following values: = (OFF) The moving succeeded. +/- (ON) The moving failed. Example- A local field called "field" of Lf-T-Rgh Char type is given, with length 6 and contents "123456". The command- "Sshift 0 field +3" will cause its contents to turn into "123".The command- "Sshift field -3" will convert it to "456". ═══ 49.50. Stop ═══ Description Stops the execution of a task and returns the control to the level at which the task was called. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag None. See also- Return ═══ 49.51. Strlen ═══ Description Calculates the length of a string. Identifier !,A-Z,0-9. Parameter 1 A field whose length is to be calculated. A char field. Identifier None. Parameter 2 None. Identifier A-Z,0-9. Result variable The length of the string in parameter 1. A numeric file. Result flag Can receive the following values: = (OFF) The calculation succeeded + (ON) The calculation failed. See also- Insert ═══ 49.52. Sub ═══ Description Subtracts numeric values. Can also refer to date fields. Identifier A-Z,0-9,-,+. Parameter 1 The subtracted. A numeric field or a date field. Identifier A-Z,0-9,-,+. Parameter 2 The subtraction. Identifier A-Z,0-9. Result variable The remainder. Usually a numeric field. If parameter 1 is a date and parameter 2 is a number, the result field has to be a date filed . If parameters 1 and 2 are date fields, the result field must be a numeric filed that will receive the difference in days between the dates. Result flag Can receive the following values: = (OFF) The subtraction result equals 0. + (ON) The subtraction result is greater than 0. - (ON) The subtraction result is smaller than 0. See also- Add, Diff-M,Diff-Y,Div, Mult ═══ 49.53. Substr ═══ Description Cuts a sub-string out of a char string Identifier +,A-Z,0-9. Parameter 1 The length of the requested sub-string. A field or a numeric constant. Identifier +,A-Z,0-9. Parameter 2 The location in the string from which the sub-string will be taken. A field or a numeric constant. Identifier A-Z,0-9. Result variable The string from which you cut the sub-string. The sub-string that is cut will change the contents of the string in this field. The field can be a local field or a field from a table. Result flag Can receive the following values- = (OFF) The cutting attempt succeeded. + (ON) The cutting attempt failed. See also- Sshift ═══ 49.54. Title ═══ Description Prints the title of a window. The title will contain the field descriptions. Identifier # Parameter 1 Window name. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Isn't effected. ═══ 49.55. Unlock ═══ Description Releases a resource lock with a specified value. Identifier A-Z, 9-0 Parameter 1 A field the contains the environment code. Identifier % Parameter 2 Resource name. Identifier A-Z,0-9. Result variable The value in which the resource is locked and which you wish to release. Can be a key or a field. Result flag Can receive the following values: = (OFF) The release request succeeded. + (ON) The release request failed. See also- Lock,Share ═══ 49.56. Write ═══ Description Writes a new record into a table according to the main key value. Identifier A-Z,1-9. The table Identifier to which the record should be written to. A record will be written with the current key value. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag Can receive the following values: = (OFF) The writing succeeded. - (ON) There is no access to the record. + (ON) The record already exists. See also- Rewrite ═══ 49.57. Perform ═══ Description Calls a routine identified by a label. The routine ends with a return command which restores the flow to the command following the calling command. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag None. Label A label which identifies the addressed routine. See also Return, Goto ═══ 49.58. Get-Env ═══ Description Retrieves the current environment code. Comes before a Lock command. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier A-Z,9-0 Result variable A field that will receive the environment code. Result flag Can receive the following values: = (OFF) An active environment was found. + (ON) No active environment was found. Label A label which identifies the addressed routine. See also Lock Unlock Share ═══ 49.59. VSetInx ═══ Description Sets and gets the current vector pointer (index) of a Local Variable with a repetition factor greater than 1. Identifier 0. Parameter 1 The vector name. Identifier +,0-9,A-Z. Parameter 2 Numeric. The index value of the desired vector.. Identifier A-Z,9-0 Result variable A field that will receive the current vector index value. Result flag Can receive the following values: = (OFF) Command performed. +/- (ON)Error. See also VSetInx VDelete VAdd VUpd VFind VSort ═══ 49.60. VDelete ═══ Description Deletes a vector appearance. Identifier None. Parameter 1 None. Identifier +,0-9,A-Z. Parameter 2 Numeric. The number of appearances to be deleted from the vector. Deletion is done from the current vector index onward. Identifier 0. Result variable The vector name. Result flag Can receive the following values: = (OFF) Command performed. +/- (ON) Error. See also VSetInx VDelete VAdd VUpd VFind VSort ═══ 49.61. VAdd ═══ Description Add appearances to a vector. Identifier 0-9,A-Z,!,+,-. Parameter 1 A field to be added to the vector. Identifier +,-,0-9,A-Z. Parameter 2 Numeric. The number of appearances to be added. If positive, after the current index; if negative, before the current index. Identifier 0 Result variable A vector name. Result flag Can receive the following values: = (OFF) Command performed. +/- (ON) Error. See also VSetInx VDelete VAdd VUpd VFind VSort ═══ 49.62. VUpd ═══ Description Same as VAdd, but updates the field appearances and does not add new ones. See also VSetInx VDelete VAdd VUpd VFind VSort ═══ 49.63. VFind ═══ Description Finds a value in one of the vector appearances and sets the current vector pointer (index) Identifier 0-9,A-Z,+,-,!. Parameter 1 A field (value) to be found. Identifier +,0-9,A-Z. Parameter 2 Numeric. The number of identical subsequent appearances to look for. Identifier 0 Result variable Vector name. Result flag Can receive the following values: = (OFF) Appearances were found. +/- (ON) Appearances were not found. See also VSetInx VDelete VAdd VUpd VFind VSort ═══ 49.64. VSort ═══ Description Sorts the vector appearances. Identifier None. Parameter 1 None. Identifier +,-,0-9,A-Z. Parameter 2 Numeric. Positive or negative. Sets the sorting order. Identifier 0 Result variable Vector name. Result flag Can receive the following values: = (OFF) Command performed. +/- (ON) Error. See also VSetInx VDelete VAdd VUpd VFind VSort ═══ 49.65. For ═══ Description Begins a "For" loop. It has the following format: FOR [] On the first step, this command checks the range's condition and, if its value is TRUE, it processes commands into the loop's block. After the first step, the loop's step is added to its variable and after the range's condition is checked. If its value is TRUE, the loop's block is processed. Otherwise, the loop's block is skipped. A "For" block begins at the "For" command and ends at the "EndBlck" command. Identifier None. Parameter 1 - The loop's condition. It must be a label from the "Range" section. Identifier 0,1-9,A-Z. Parameter 2 - The loop's variable. It may be a numeric field, a table field, or a local variable. Identifier 0,1-9,A-Z,+,-. Result variable - The loop's step. It may be a numeric field, a local variable, or a constant. It is an optional parameter. If it is left empty, the loop's step equals 1. Result flag = (OFF) Command performed. +/- (ON) Error. See also For, While, Until, QtLoop, EndBlck, ═══ 49.66. While ═══ Description Begins loop. It has the following format: WHILE This command checks the range's condition and if its value is TRUE, the loop's block is processed. If its value is FALSE, the loop's block is skipped. A "While" block begins at the "While" command and ends at the "EndBlck" command. Identifier None. Parameter 1 - The loop's condition. It must be a label from the "Range" section. Identifier None. Parameter 2 None. Identifier Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also For, While, Until, QtLoop, EndBlck, ═══ 49.67. Until ═══ Description Begins loop. It has the following format: UNTIL This command checks the range's condition and, if its value is FALSE, the loop's block is processed. If its value is TRUE, the loop's block is skipped. An "Until" block begins at the "Until" command and ends at the "EndBlck" command. Identifier None. Parameter 1 - The loop's condition. It must be a label from the "Range"section. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also For, While, Until, QtLoop, EndBlck, ═══ 49.68. QtLoop ═══ Description Break processing of "For", "While" and "Until" loops. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also For, While, Until, QtLoop, EndBlck, ═══ 49.69. EndBlck ═══ Description Defines the last line of a "For", "While" and "Until" loop block. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also For, While, Until, QtLoop, EndBlck, ═══ 49.70. If ═══ Description Begins conditional block. It has the following format: IF This command checks the range's condition and, if its value is TRUE, commands between "If" and "Else" (if they exist), or between "If" and "EndIf" (if an "Else" command doesn't exist), are processed. Then, the next command after "EndIf" is processed. If the range's condition value is FALSE, commands between "If"and "Else" (if they exist), or between "If" and "EndIf" (if an "Else command doesn't exist), are skipped and the next command after "EndIf," or after "Else" (if one exists), is processed. Identifier None. Parameter 1 - The "If" condition. It must be a label from the "Range" section. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also If, Else, EndIf, ═══ 49.71. Else ═══ Description Ends a true's conditional block within an If block and begins a false's conditional block. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also If, Else, EndIf, ═══ 49.72. EndIf ═══ Description Ends an If block. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also If, Else, EndIf, ═══ 49.73. Switch ═══ Description Begins switch's block. It has the following format: Switch This command begins a switch block and defines the switch variable. There may be many Case blocks within a switch block. A "Switch" block ends with an EndSwch command. Identifier 0,1-9,A-Z. Parameter 1 - The switch variable. It may be a field or local variable. Identifier None. Parameter 2 None. Identifier None. Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also Switch, Case, QtSwtch, EndSwch, ═══ 49.74. Case ═══ Description Begins case block. It has the following format: Case - field, local variable, or constant. Its type must corresponded to link type switch's variable. This command checks the value of the switch variable. If it equals the case value, all commands after this CASE, up to the QtSwtch command, or the EndSwch command, will be processed. Identifier 0,1-9,A-Z,+,-. Parameter 1 - field, local variable or constant. Its type must corresponded to link type switch's variable. Identifier None. Parameter 2 None. Identifier Result variable None. Result flag = (OFF) command performed. +/- (ON) Error. See also Switch, Case, QtSwtch, EndSwch, ═══ 49.75. QtSwtch ═══ Description Breaks the processing of a switch's block. This command switches control to the first command after the end of the switch block. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also Switch, Case, QtSwtch, EndSwch, ═══ 49.76. EndSwch ═══ Description Ends a switch's block. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also Switch, Case, QtSwtch, EndSwch, ═══ 49.77. Dialog ═══ Description As you know, the Acceptcommand enables the input of data to a field or to a number of fields to be grouped by a sub-screen. The dialog command enables you to activate more than one Accept simultaneously. To do this, you define a dialog group, beginning with a dialog command and ending at the E-Dialg command. Within this group, you can define many Accept commands and their related commands, for example: When a program meets a dialog command, it activates all the Accept commands within the Dialog group. The Dialog ends when one of the Accepts ends. When the dialog ends, the task flow continues from the active Accept command. In the above example there is a "While" loop that loops when any of the sub-screen fields is empty. Within this loop there is a dialog group with two Accept commands. Both Accepts will be activated until all the fields are filled by the user. Identifier 0,1-9,A-Z,+,-. Parameter 1 A numeric field or a local variable. If its value is positive, it indicates the Accept within the Dialog group which will be in focus. The number should be the relative number of the Accept command after the Dialog command. To set the second Accept to be in focus, the value of this parameter should be 2, etc. If its value is zero, the last sub-screen Accept that was in focus will get the focus. If its value is -1, none of the Accepts will get the focus. The focus is set by the user when he clicks with the mouse on the selected sub-screen. Identifier None. Parameter 2 None. Identifier Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also E-Dialg ═══ 49.78. E-Dialg ═══ Description Ends a Dialog's block. Identifier None. Parameter 1 None. Identifier None. Parameter 2 None. Identifier Result variable None. Result flag = (OFF) Command performed. +/- (ON) Error. See also Dialog ═══ 49.79. Ckpw ═══ Description Checks the user's Access Permission for a specified job. Identifier 0-9,A-Z,!. Parameter 1 The job name as it is defined in the user's permission utility. Identifier None. Parameter 2 None. Identifier Result variable None. Result flag Returns the Access code as defined in the user's permission utility. See also Get-Usr ═══ 50. U.D.R. Libraries ═══ If you have purchased the mathematics library or the statistics library, you will be able to use their functions as new commands. User-defined routines are used just like regular OpenWin commands, but before using them you have to do some preliminary work in order to integrate them within your specific application. To do so, you need some specific information. First, you have to know the exact name of the routine(s) you intend to use. Second, you have to know the names of the server(s) which executes those routines. Once you've got this information, you have to supply it your application environment by using the Define Environment module. This module contains a section called User Defined Routines . Enter the Command and Server names you wish to use as explained. When concluding this work, you may use these routines in the Logical flow of your task as if they were OpenWin commands with the same format. SERVER NAMES Two servers are available, one for mathematics routines (named MTHLAN) and the other for statistic routines (named STTLAN). IMPORTANT ! 1) The parameter for routines returning numeric results MUST BE of the data type Float. 2) For all routines, the flag is = - success, or + failure. In case of failure, an appropriate error message is printed. STATISTICS ROUTINE NAMES( SERVER NAME STTLAN) SAMPLE Samples a new value to a given group. Parameter 1 Alphanumeric, has the group name into which the value has to be sampled . Parameter 2 Numeric, the value to be sampled. Result None. DESAMP Deletes last sample made on the given group. Parameter 1 Alphanumeric, the group name. Parameter 2 None. Result None. RESAMP Deletes all the samples made on the given group. Parameter 1 Alphanumeric, the group name. Parameter 2 None. Result None. SIGMA Gives sum of up-to-date sample values on the given group. Parameter 1 Alphanumeric, the group name. Parameter 2 None. Result Numeric, the sum. PI Gives multiplication of up-to-date sample values on the given group. Parameter 1 Alphanumeric, the group name. Parameter 2 None. Result Numeric, the multiplication. AVRG Gives average value of a given sample-group. Parameter 1 Alphanumeric, the group name. Parameter 2 None. Result Numeric, the average. STDEV Gives standard deviation of a given sample-group. Parameter 1 Alphanumeric, the group name. Parameter 2 None. Result Numeric, the standard deviation. COVAR Gives coverage of two sample-groups. Parameter 1 Alphanumeric, the first sample-group name. Parameter 2 Alphanumeric, the second sample-group name. Result Numeric, the coverage. COREL Gives correlation coefficient of two sample-groups. Parameter 1 Alphanumeric, the first sample-group name. Parameter 2 Alphanumeric, the second sample-group name. Result Numeric, the correlation coefficient. Return codes, in case of failure, which may occur within error messages -1 Server inactive for input -2 Unable to create input communication with server -3 Server inactive for output -4 Unable to create output communication with server -5 Failed to send request to server -6 Failed to receive result from server -11 Unknown routine name -12 Failed to convert parameter to a double-precision floating point number -13 Invalid sample-group name -14 No more memory left for a new sample-group -15 No more space left within a sample-group for a new value -16 Unable to process computation on an un existing sample-group -17 The two sample-groups do not have same number of elements (relevant for COVAR and COREL routines) MATHEMATICS ROUTINE NAMES (MATH SERVER NAME MTHLAN) POWER Returns Parameter 1** Parameter 2. Parameter 1 Numeric, the base number. Parameter 2 Numeric, the power. Result Numeric, Parameter 1** Parameter 2. SQURT Returns square root of value. Parameter 1 Numeric, the input value. Parameter 2 None. Result Numeric, square root of Parameter 1. EXP Returns exponential function of value. Parameter 1 Numeric, input value. Parameter 2 None. Result Numeric, E** Parameter 1. LAN Return natural logarithm of value. Parameter 1 Numeric, input value. Parameter 2 None. Result Numeric, log-E( Parameter 1). LOG Returns base 10 logarithm of value. Parameter 1 Numeric, input value. Parameter 2 None. Result Numeric, log-10( Parameter 1). ABS Returns absolute value of input. Parameter 1 Numeric, input value. Parameter 2 None. Result Numeric, ABS( Parameter 1). FLOOR Returns highest integer less than or equal to input value. Parameter 1 Numeric, input value. Parameter 2 None. Result Numeric, FLOOR( Parameter 1). CEIL Returns lowest integer greater than or equal to input value. Parameter 1 Numeric, input value. Parameter 2 None. Result Numeric, CEIL( Parameter 1). MOD Returns remainder of division of two values. Parameter 1 Numeric, first input value. Parameter 2 Numeric, second input value. Result Numeric, remainder of Parameter 1/ Parameter 2. RANDOM Returns a random value. Parameter 1 None. Parameter 2 None. Result Numeric random value. TRUNC Truncates a number to a given position after decimal point. Parameter 1 Numeric, the value to be truncated. Parameter 2 Numeric, the position number. Result Numeric, TRUNC( Parameter 1). Return codes, in case of failure, which may occur within error messages -1 Server inactive for input -2 Unable to create input communication with server -3 Server inactive for output -4 Unable to create output communication with server -5 Failed to send request to server -6 Failed to receive result from server -11 Unknown routine name -12 Failed to convert parameter to a double-precision floating point number -13 and -14 inconsistent parameters to routine requirements -15 A very high result value ═══ ═══ Choose this option to save all changes made. If you exit the Window Design without pressing OK, no changes will be saved. ═══ ═══ Choose this option to cancel the last changes made. ═══ ═══ The window name All references to the window are made by writing the name of the window. This name defines the window exclusively. ═══ ═══ Style Select the style of the window requested. Different types of windows are presented below: ═══ ═══ Background color This color is the color of the window's background. ═══ ═══ Heading You can define the title for a window by entering a field Identifier and another field to be used as a title. ═══ ═══ Icon's name You must type in the name of an icon (a .bmp file without the .bmp extension) which will be presented when the window is reduced to its minimum size. ═══ ═══ Icon Position The icon position is set by writing the coordinates of the bottom left corner. The position includes two parameters: the deviation from the X axis and the deviation from the Y axis. ═══ ═══ Icon Dimensions The icon dimensions are set by writing down its width (X) and height (Y). ═══ ═══ Delete Window This option will delete the window definition and remove the window from the screen. The window fields must be deleted first. ═══ ═══ Windows List Choose this option to call up a window by selecting it from the window list. ═══ ═══ Delete Field This option will delete a field from the window definition and remove the field from the window. ═══ ═══ Object Details This option will open a window and display object details such as the field type or format, location , etc. ═══ ═══ Screen name A window name to which this field belongs. ═══ ═══ Presentation/Output field The field name and the field Identifier which you relate to the window. Display and input operations in this field relate to this field value. ═══ ═══ Input (Choice value) field When you define a field in a way which enables you to select from the list, for example List Box, you must enter the field from which the selection will be made. This should be a multiple factor field. If you don't wish to choose a field from the list, enter the name of any DUMMY field. If the field is a Push Button, the value of the field is displayed. ═══ ═══ Style A field can take different forms. You must select the desired form for display. ═══ ═══ Background color The background color of the field presented. ═══ ═══ Foreground (letters) color The color in which the context of the field will be presented. ═══ ═══ Title Place You may define the title of a field. The title is taken from the field description. ═══ ═══ SubScreen name In order to refer to a field in an input/output procedure you must relate it to a sub-screen. You can refer a number of fields to the same sub-window and join them to a single input/output group. ═══ ═══ ID and Help field You may define a numeric field. If you press F1 during run time while performing an input operation on this field, you will begin the search for a help panel with this number as resource ID at the help file.