3700 Sim Comp Man
3700 Sim Comp Man
3700 Sim Comp Man
Copyright 2003 by MICROS Systems, Inc. Columbia, MD USA All Rights Reserved
Declarations
Warranties
Although the best efforts are made to ensure that the information in this manual is complete and correct, MICROS Systems, Inc. makes no warranty of any kind with regard to this material, including but not limited to the implied warranties of marketability and fitness for a particular purpose. Information in this manual is subject to change without notice. No part of this manual may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or information recording and retrieval systems, for any purpose other than for personal use, without the express written permission of MICROS Systems, Inc. MICROS Systems, Inc. shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this manual.
Trademarks
CorelDraw is a registered trademark of Corel Corporation. Crystal Reports is a registered trademark of Crystal Computer Services, Inc. FrameMaker is a registered trademark of Adobe Corporation. Microsoft, Microsoft Excel, Win32, Windows, Windows95, Windows 2000 (Win2K), and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the U.S. and/or other countries. Sybase SQL Anywhere is a registered trademark of Sybase Inc. Visio is a registered trademark of Visio Corporation.
Printing History
New editions of this manual incorporate new and changed material since the previous edition. Minor corrections and updates may be incorporated into reprints of the current edition without changing the publication date or the edition number.
Edition 1st 2nd 3rd Month June April November Year 1997 1998 2003 Software Version 1.00 2.00 3.00
ii
Table of Contents
Preface
This is Not Your Fathers SIM Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . This Documentation Will Never Improve . . . . . . . . . . . . . . . . . . . . . . . . . . . If You Are Reading This Manual Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conventions and Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi x xii xiii
iii
Glossary Index
iv
Preface
In this preface, you will find information about this manual. Refer to the preface if you have any questions about the organization, conventions, or contents of this manual..
In This Chapter...
This is Not Your Fathers SIM Manual . . . . . . . . This Documentation Will Never Improve . . . . . . If You Are Reading This Manual Online . . . . . . . Conventions and Symbols . . . . . . . . . . . . . . . . . . vi x xii xiii
vi
This reference material was printed in the SIM manuals of previous product lines. Now you can access this information online while you are working with SIM. The help file, 3700SIM.zip, is distributed on the MICROS CD-ROM, beginning with version 1.02A. It is also available from the MICROS ftp site (ftp.micros.com). The file is small less than 1 MB. It downloads quickly and will fit on a floppy disk even after being unzipped.
vii
Related Manuals
This section provides a list of the related MICROS documentation as well as a list of suggested reading materials.
MICROS Documentation
The 3700 Restaurant Enterprise System library includes: o 3700 Custom Reports Design Manual100134-508 o 3700 Feature Quick Reference Manual100134-506 o 3700 Feature Reference Manual100134-501 o 3700 Hardware Installation Guide100134-514 o 3700 Hardware Users Maintenance Guide100134-512 o PC Workstation Model 32 Setup Guide100016-085 o 3700 Reports Manual100134-511 o 3700 Site Preparation Guide100134-513 o 3700 Site Survey Manual100134-505 o 3700 SQL / Database Access Manual100134-507 o 3700 POS Configurator Users Guide100134-504 o 3700 Users Manual100134-502
viii
Suggested Reading
o Crystal Reports documentation o Microsoft Windows 95 Resource Kit o Microsoft Windows NT Server 3.51 documentation o Microsoft Windows NT 3.51 Resource Kit o Microsoft SQL Server 6.0 documentation o Sybase SQL documentation
ix
How to reach us
Postal Address If you can offer any criticisms or suggestions about this manual, please mail a note or postcard to: MICROS Systems, Inc. 7031 Columbia Gateway Drive Columbia, MD 21046 USA Attn: Manager, Documentation Table Service Restaurants Group E-mail Address As an alternative, you may address criticisms and suggestions regarding this manual by electronic mail to: 3700doc@micros.com. Please use the name of the manual as the subject line.
xi
xii
Conventions
The following conventions are used throughout this manual.
Convention [Key] Message Courier bold [Key1]+[Key2] | Meaning Keys on a PC or PC Workstation. Example: [Enter] Messages that may appear during the programming process. Example: Select Menu Item Range Information to be entered by a User. Example:
xiii
xiv
CHAPTER 1
This chapter contains an overview of the System Interface Module (SIM) and the Interface Script Language (ISL).
In This Chapter...
Getting to Know SIM and ISL . . . . . . . . . . . . . . . Features of SIM . . . . . . . . . . . . . . . . . . . . . . . . . . Creating SIM Applications with ISL . . . . . . . . . . 1-2 1-9 1-13
1-1
1-2
Many of the features of a PMS environment are available to other types of systems via a SIM Interface. SIM allows the 3700 to: o Enter and recall customer information o Recall orders and provide customer order history o Enhance traditional PMS functions handled on the POS side Accessing SIM ISL, a MICROS proprietary interpreted language, facilitates access to SIM. ISL scripts direct SIM to execute a series of instructions called events. SIM events are discussed later in this section. Enabling SIM The 3700 System must be configured to interpret instructions contained in the script. 3700 database programming links the script and the SIM Interface. Once enabled, SIM carries out the instructions in the script when an employee presses a specially programmed key to initiate an event.
Characteristics of ISL
Like BASIC ISL resembles BASIC (or variants) in its linear structure. The flow of scripts is in a step-by-step structure but does not require line numbering. Like BASIC and other structured languages, ISL supports decision-making language elements such as IfElse, and loop constructs using the ForEndFor and ForeverEndFor commands.
1-3
Language Elements and Components ISL contains language elements common to most interpreted languages. They include: o Commands allow the designer to: o o o o o Control the flow of instructions in the script Define and manipulate variables Communicate with a third-party system Read and write data to and from the server or a PCWS Send data to print devices
o ISL functions that enhance text handling and formatting. o System variables that read definition and totals information from the database and set system parameters o Operators (relational and logical) that perform mathematical actions on variable and constant operands o Format specifiers used with commands, that specify the format of input and output data Event Procedures ISL is also event-oriented. An event is a group of statements and commands defined by ISL EventEndEvent commands. Scripts provide a frame-like structure for sequences of events. A specially programmed key or a message response received from a third-party system initiates an event. Once an event executes successfully, SIM stops processing the script until another event begins. The example that follows performs the following tasks: o Displays an ISL-defined window on the UWS screen, o Prompts for a room number o Sends the room number and the number of the Transaction Employee to a thirdparty system (e.g., PMS)
1-4
event inq : 1 var room_num : N5 window 2, 19, Room Inquiry display 2, 2, Enter Room Number input room_num, txmsg room_num, @tremp waitforrxmsg endevent
// Execute when SIM Inquiry key 1 is pressed // Declare local variable // Create input window // Issue operator prompt // Accept input // Transmit room number and Transaction // Employee to third-party system // Wait for response from third-party
After the third-party system acknowledges receipt of the data, the event ends. If the employee at the UWS initiates another event, SIM begins processing the script again.
Script Writing
What is a Script File? ISL issues instructions to SIM through small programs called scripts. A script is an ASCII text file that you create in any common ASCII text editor. Scripts can contain one or more events to launch SIM applications. A single script is maintained for each SIM Interface defined for a System. The script is linked to a SIM Interface through 3700 database programming so that the script can be executed by the 3700 System. For specific programming requirements, refer to Programming the 3700 System for SIM on page 2-9. If You are Familiar with Script Writing Script writing is a common way to issue instructions to a computer, so you may be familiar with this concept. Scripts written for ISL have a specific format and include elements unique to this language. We recommend that you familiarize yourself with the language elements and script structure. Refer to Guidelines for Creating Scripts on page 3-6. If You are New to Script Writing This manual contains a brief introduction to this method of automating operations. If you have never used scripts before, we recommend that you review this introductory material to familiarize yourself with script writing. Refer to Getting Started with Script Writing on page 3-2.
1-5
Initiating an Event
SIM executes a scripts instructions, when any of several events occur. Following is a brief description of the available 3700 SIM events. For detailed information on each event, please see the Event...EndEvent command in SIM Online Help. o Event inq - this event is executed when a SIM inquiry key is pressed. This key is programmed in the 3700 database. o Event tmed - this event is executed when a SIM tender key is pressed. This key is programmed in the 3700 database. o Event rxmsg - this event is executed when a response is received from the thirdparty system interfaced to the 3700. o Event final_tender - this event executes when the last tender event occurs, but before a check has closed. o Event print_header, Event print trailer- these events print additional header or trailer information on custom receipts, guest checks, and credit card vouchers. o Event srvc_total - this event is executed when a check is service totalled. o Event trans_cncl - this event is executed when a SIM transaction cancel key is pressed. o Event init - this event is executed when POS operations is started. This event should be used to perform any initialization required by the script. No user input is allowed in this event. o Event exit - this event executes when POS operations is exiting. No user input is allowed in this event. o Event idle_no_trans - this event is used to run SIM scripts in the background, when POS operations is idle and no one is signed in.
1-6
1-7
1-8
Features of SIM
Methods of Displaying, Capturing, and Printing Data
Features of SIM
SIM provides a variety of features to help you create functional and useful SIM applications with ISL. The main features of SIM include support for: o Common communications message formats and interface methods for development of SIM Interfaces. This includes a variety of methods for displaying, capturing, and printing information. o Initiating a macro in 3700 POS operations. o Comprehensive file I/O processing operations.
Probably the most common place to both enter and display data is an ISL-defined window. Windows are drawn to your specifications and appear in front of the transaction detail and summary sections of the POS operations screen.
1-9
Features of SIM
Methods of Displaying, Capturing, and Printing Data
The Prompt Line To help users step through operations more easily, user prompts can be provided on the prompt line. Graphics Characters In addition to windows, you also can create other figures, such as a smaller box within a window, with right angles, as well as horizontal and vertical lines.
ISL creates these figures by displaying line draw graphics characters at locations defined by the Display command. You access the Graphics Character Set with the Chr function. A listing of the Graphics Character Set is provided with the detail description of the Display Command in SIM Online Help.
Touchscreens
SIM can make touchscreens pop up if they are defined by the Devices|Touchscreen form in the 3700 database or by ISL Touchscreen Commands. Programmed Touchscreens Programmed touchscreens are already defined in the Touchscreen form of the 3700 database. A programmed touchscreen that you might pop up in an event, is an alpha or alphanumeric one. For example, if an event prompts an operator to enter the name of a customer, the UWSs default alpha touchscreen displays so the operator can enter the customers name. ISL-Defined Touchscreens To accommodate those instances where a programmed touchscreen is not appropriate, we provide several commands that let ISL display touchscreens built within the script, or touchscreens created on-the-fly. An ISL-defined touchscreen comes in handy when you need to use function keys for a very specific purpose, and there is not a programmed touchscreen to accommodate your need.
1-10
Features of SIM
Methods of Displaying, Capturing, and Printing Data
Take the case where the user may be prompted to respond to a Yes-No question: The script instructs SIM to display touchscreen keys [Yes] and [No]. Depending on which key the operator selects, additional instructions are carried out. For example, if the operator chooses [Yes], output from the transaction is sent to a local printer instead of the remote roll printer.
Data Entry
The entry of data is accepted from a PC keyboard, a touchscreen, or a magnetic card reader. Normally, scripts that instruct an operator to collect data, such as name and address information, require entry using one of these methods. Touchscreen During the execution of a script, data entry from a touchscreen is accepted. To support data entry from the touchscreen, ISL includes commands for displaying a programmed or ISL-defined touchscreen when one is required. Normally, the script should display a touchscreen in order for the operator to select data from it. The data could be menu items, in which case, the script should pop up a sales transaction type touchscreen. Or, the script could direct the operator to enter the customers name, in which case, an alpha touchscreen should pop up for the operator to use. Magnetic Card Reader Data that can be stored as track data on a magnetic card is also accessible by SIM. Usually, track data includes a reference number, such as a credit card account number, and an expiration date. For instance, the account number of a country club member could be stored as track data, allowing the operator to capture it from the POS by swiping the members card through the magnetic card reader.
Printing
Supervised, unsupervised, and backup printing are accomplished by ISL through the use of several ISL commands and a variety of ISL system variables. Print Commands and Print Directives Print commands start print jobs, while the system variables, also called print directives, change the print characteristics of generated text. The print directives change the print type, similar to how standard parallel printer escape sequences work. For instance, if you want to print some text in red ink, you can do so with a print directive.
1-11
Features of SIM
Interfacing with Third-Party Systems
Supervised Printing and Unsupervised Supervised printing is supported only for guest check, customer receipt, and validation printers. Unsupervised printing includes remote and local order output, and the journal. Backup printers, other than those already defined in the 3700 database, can be specified in the case of unsupervised printing only. Type of Printers Supported All output can be generated at roll and slip printers.
1-12
1-13
1.
This term refers to information stored on the magnetic stripe of a credit card. The information is often stored on separate areas of the magnetic stripe, called tracks. For example, the account number and birthdate in this example are stored on Track 2 of the magnetic stripe.
1-14
Applying a Discount to a Check You can expedite certain POS transactions with SIM applications. If you make it possible for operators to complete common, repetitive transactions more quickly and efficiently, a property can improve the turnaround time of operations. A better turnaround time means that operators can spend less time at POS terminals and more time attending to customers needs. With ISL, you can tackle these types of transactions in small ways. Usually, you can do this by taking out the decision-making steps in certain procedures. Discounts are a good example. Frequently, an establishment will offer an item at a reduced price if a customer spends a certain amount. Deciding whether to apply a discount and which discount to use are left up to the operator, allowing room for errors to occur: the operator forgets to take the discount or applies the wrong discount. Applying a Discount to a Total Our SIM application removes these two steps from a discount procedure that an operator performs. The application automatically applies a discount if the check total is a certain amount, e.g., $50.00. Applying a Discount to an Item Another discount example, is applying a discount only to specific menu items. This might be necessary if, for instance, the restaurant doesnt want to reduce the price of an item and call it a Special. But rather, the restaurant wants to discount the item by a certain percentage and track the discount. The discount works like this: If a customer orders a certain entree, any appetizers on the check are half price. In this instance, a 50% discount is applied to the appetizer items.
1-15
Guest Check Information Detail Information that you might capture and store in a third-party database is name and address information, the customers telephone number, as well as directions to the customers residence. When a customer telephones our fictional pizzeria, an operator uses the customers telephone number to access any existing information in the pizza delivery systems database. As an added benefit, this SIM application also prints this customer information on the guest check. For instance, the directions to the customers residence prints on the check for the delivery person to reference. Previous Order History In addition to name and address information, a customers order history is also information that the third-party system maintains. By retrieving previous order history, the operator eliminates the additional steps required to post order information, namely menu items, to a guest check. If the customer always orders a large, pepperoni and mushroom pizza, these items can be retrieved from the third-party database, and posted to the check, without directly accessing the menu item keys again. In a fast-paced environment like a pizza delivery operation, where quick turnaround is critical, eliminating steps in the order entry process is a real advantage.
Customizing Output
Printing is an essential POS function that can be expanded to accommodate the unique preferences of a property. Currently, a 3700 System comes equipped with many different programming options that affect how things are printed, where they print, and when they will print. With ISL, you can further customize printing for a property by extending the functionality of the 3700 System beyond its normal programmable limits.
1-16
Weve already mentioned ISLs special printing abilities in the previous examples, such as printing customer information on guest checks and generating coupons for customers. Now lets examine how you can save servers time when they must send special instructions to kitchen staff about orders. Sending Special Messages to the Kitchen Our SIM application allows an operator to pick a message from a list, then send the message to the kitchen. The pick list includes messages frequently sent to the kitchen, which is a feature that current programming options for number lookups (NLUs) do not support. A remote roll printer in the kitchen generates the following message on a chit:
Creating Raffle Tickets Another good example of how you can use the special printing capabilities of ISL, is creating output other than guest checks, remote order chits, customer receipts, etc. Earlier in this section, we discussed how you can generate a coupon with ISL. Now, lets create a raffle ticket for hotel guests. This application requires that the 3700 System interface with a PMS. The application performs a common PMS task: collecting a guests name and room number when the operator closes a guest check in one of the hotels food and beverage outlets. For this application, ISL verifies the input with data already stored in the PMS database. Based on how many times the guest has patronized the hotels four star restaurant, for example, a raffle ticket chit is generated after the guest check prints.
1-17
The raffle ticket includes an excursion option, which was selected from a pick list of others, as well as the guests name and room number. ISL also automatically assigns a ticket number to the chit.
1-18
CHAPTER 2
Getting Started
This chapter contains a description of the message formats and interface methods that must be used to develop a SIM Interface. Also included, is a description of the 3700 database programming required to enable SIM and a SIM Interface.
In This Chapter...
Getting Started with ISL and SIM. . . . . . . . . . . . . Message Formats and Interface Methods . . . . . . . Programming the 3700 System for SIM . . . . . . . 2-2 2-3 2-3
2-1
2-2
Getting Started
Message Formats
There are two classes of message format: 2700 Compatibility fixed format and ISL format.
Note
To ease the migration to the new SIM Interface capabilities, you can use both formats over the same type of interface.
2-3
A description of each message segment follows. SOH The SOH character (start of header) serves as a message lead-in character that identifies the start of a new message. The SOH character is represented by the 7-bit hexadecimal value 01H, plus a parity bit, if applicable. ID This is the POS Source ID segment that includes information about the UWS. The UWS initiates the message and identifies the interface. The format of this segment is as follows:
Field POS UWS Number Length 9 Bytes Format 2 or 9 ASCII Digits Remarks May contain leading spaces or zeroes and is between 1 and 9999999, depending on 2/9 digit ID in PMS Definition File. Standard PMS format is 2 digits. May not contain intervening spaces
Interface Name
16 Bytes
16 ASCII Characters
STX The STX character (start of text) serves as a data field lead-in character that identifies the start of the message data block. The STX character is represented by the 7-bit hexadecimal value 02H, plus a parity bit, if applicable. FS The FS character (field separator) identifies this message as a SIM message data block. The FS character is represented by the 7-bit hexadecimal value 1CH, plus a parity bit, if applicable.
2-4
Getting Started
Application_Sequence The Application_Sequence segment comprises a two-digit sequence number and a retransmission flag. Each POS UWS application increments its own sequence number with each message. When a message is being retransmitted, the same sequence number will be used as the original message. In addition, a retransmit flag character is provided. The format of this segment is as follows:
Field Applications Sequence Number Retransmission Flag Character Length 2 Bytes 1 Byte Format 2 ASCII Digits Space or R Remarks May contain zeroes and is between 01 and 99 R character (ASCII 52H) is placed in this field if this is a retransmitted message.
The Application_Sequence number is initially set to 01 when the application starts. The application rolls the sequence number back to 01 after 99. If the third-party system receives a message containing the same sequence number as the previous message and the retransmit flag is set, the third-party should retransmit the last response. Application_Data Both the TxMsg and RxMsg commands define the Application_Data segment. Multiple fields can comprise this segment. Individual fields within the Application_Data segment are separated by the ASCII field separator character (1CH), inserted by ISL. In addition, the first field within the receive message Application_Data segment defines the name of the ISL procedure to execute when processing the response message. The detail description of the RxMsg command describes the relationship between the command and the Application_Data segment of an ISL message. ETX The ETX character (end of text) serves as a data field lead-out character that identifies the end of the message data block. The ETX character is represented by the 7-bit hexadecimal value 03H, plus a parity bit, if applicable.
2-5
Checksum The Checksum field is only used when communicating over an asynchronous serial interface. A TCP-based SIM Interface will ignore this field. When the Checksum is part of the message, however, format it as follows:
Field Checksum Length 4 Bytes Format 4 ASCII Hex characters Remarks Contains ASCII characters in the range 30H 39H and 41H - 46H (0-9 and A-F).
The Checksum is the 16-bit binary addition (excluding parity, if applicable) of all characters after the SOH, up to and including the ETX character. The Checksum is initially set to zero. For transmission, the Checksum is represented as four ASCII-Hex characters. EOT The End of Transmission character (EOT) identifies the end of the message. It is represented by the hexadecimal value 04H, plus a parity bit, if applicable. The total size of the message can be 32K from the SOH to the EOT.
Note
While the asynchronous serial interface messages are not limited, it is recommended that they be no more than 1024 bytes in length so that the interface remains responsive.
2-6
Getting Started
Interface Methods
SIM supports two types of interface: an asynchronous serial interface and a TCPbased interface. Both interface methods support the 3700-compatible fixed-format message and the ISL message format.
Note
Both the fixed and ISL formats may be used over the same interface.
TCP Interface
This interface is designed to connect the 3700 System to systems using the TCP/IP networking protocol. You can also use this interface to facilitate communications between the POS application and third-party applications that reside on the same platform as the 3700 System Software. This interface is also compatible with many forms of local area networks (LANs), including Ethernet, Token Ring, FDDI, Arcnet, PPP, etc. TCP Connection SIM connects to the TCP port as a client. The SIM Server should accept TCP connections from the 3700 POS client on the port micros-sim. If this service is not defined, the port number 5009 should be used as the default. This information is programmed in the Interfaces form in the 3700 database.
2-7
Error-Handling If the receiving system detects an error in the message or some other applicationsrelated error, it should provide an appropriate error message response to the POS application. In addition, if you are using the fixed message format, response messages should handle error messages. As such, to support these conditions, ISL should define specific error responses. Pinging The TCP connection has a typical keep-alive time-out of two hours. In order to detect a down interface more quickly and re-establish the connection, SIM periodically sends a ping message to the server. The server should detect the ping message and return the message in its original format. The format of the ping message should be as follows: SOH ID STX ETX EOT The ID source segment contains a null address: the POS UWS number will be zero and the interface name will contain spaces.
2-8
Getting Started
Prerequisites
In order to effectively implement the programming action steps described in this section, you should have an understanding of the following: o 3700 database structure o POS database programming concepts o POS Configurator For more information on programming a 3700 System database and usage of the POS Configurator module, refer to the 3700 POS Configurator Users Guide.
2-9
None
2-10
Getting Started
Note
The tender event must be executed while in a transaction, i.e., while a guest check is open.
2-11
2-12
Getting Started
CHAPTER 3
For those users who are new to script writing, or need to familiarize themselves with our script writing conventions, this chapter discusses some basic script writing concepts to apply when creating your scripts.
In This Chapter...
Getting Started with Script Writing. . . . . . . . . . . . What is a Script? . . . . . . . . . . . . . . . . . . . . . . . . . Creating a Script . . . . . . . . . . . . . . . . . . . . . . . . . . Script Writing Style . . . . . . . . . . . . . . . . . . . . . . . Writing and Editing Scripts . . . . . . . . . . . . . . . . . Testing Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . Encrypting Scripts . . . . . . . . . . . . . . . . . . . . . . . . Merging Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3-3 3-6 3-9 3-13 3-15 3-17 3-21
3-1
3-2
What is a Script?
Structure of a Script
What is a Script?
The means by which the ISL issues instructions to the SIM is through small programs known as scripts. A script is an ASCII text file that you create in any common ASCII text editor, such as Edit, the Notepad Windows editor. These scripts can contain one or more events to implement SIM applications. A separate script must be maintained for each SIM Interface defined for a System. The script is linked to a SIM Interface through 3700 database programming. Once you form this relationship through database programming, the script can be executed by the SIM. For specific programming requirements, refer to Programming the 3700 System for SIM on page 2-9.
Structure of a Script
The basic structure of your scripts should be written in a format similar to the sample script below. When writing your script, keep the following structure in mind. A brief description of each part follows the diagram.
Comments Comments are used to document the purpose and scope of events included in the script. Place comments anywhere in the script, but make sure each comment line is preceded by two backslash characters // (see page 3-9).
3-3
What is a Script?
Structure of a Script
Global Variable Declarations Global variables are initialized at the beginning of each script and maintained for the duration of the script. Event Declaration ISL is event-oriented. Almost all ISL statements will be contained in events or subroutines called by those events (see Event...EndEvent Command in the SIM Online Help. There are several types of events: o Event inq - this event is executed when a SIM inquiry key is presssed. This key must be programmed in the 3700 database. o Event tmed - this event is executed when a SIM tender key is pressed. This key must be programmed in the 3700 database. o Event rxmsg - this event is executed when a response is received from the thirdparty system interfaced to the 3700 System. o Event final_tender - this event is executed whenever the last tender event has occurred, but before a check has closed. o Event print_header - this event will print additional header or trailer information on custom receipts, guest checks, and credit card vouchers. o Event print trailer - this event will print additional trailer information on custom receipts, guest checks, and credit card vouchers. o Event srvc_total - this event is executed when a check is service totalled. o Event trans_cncl - this event is executed when a SIM transaction cancel key is pressed. o Event init - this event is executed when POS operations is started. This event should be used to perform any initialization required by the script. No user input is allowed in this event. o Event exit - this event executes when POS operations is exiting. No user input is allowed in this event. o Event idle_no_trans - this event is used to run SIM scripts in the background, when POS operations is idle and no one is signed in. If an employee should sign in, this event wont be called until the employee signs out again. The frequency at which the SIM script is called is determined by the @Idle_Seconds system variable.
3-4
What is a Script?
Structure of a Script
Local Variable Declaration Commands Local variables are purged after each event completes execution; the event terminates after an EndEvent, ExitCancel, ExitContinue, or any other command that causes the event to stop executing, successfully or not. Subroutine Declaration Subroutine procedures are called from other event or subroutine procedures, allowing common code to be used by multiple events. As a script writing convention, we recommend that you place all subroutines after all events in the script. See Sub..Endsub Command in the SIM Online Help.
3-5
Creating Scripts
Guidelines for Creating Scripts
Creating Scripts
Scripts consist of one or more events. Each event within the script represents a task that you want the SIM to perform. For instance, in Chapter One we discuss several different types of SIM applications. Each of these applications can exist as separate events within the same script.
o o
o Determine what variables (global, local) you need to declare. For a discussion of user variables, refer to User Variables on page 4-10. o Determine whether some of the events in the script perform similar tasks. If they do, you should consider creating a subroutine to save time in writing the script and to make the script process instructions more efficiently.
3-6
Creating Scripts
Examples of Scripts
o Translate the instructions you write into one or more lines of code. o Consult the ISL Quick Reference in the SIM Online Help to determine what commands, functions, and system variables allow you to perform the desired task. Learn what considerations are involved in writing ISL statements. Script Writing Style on page 3-9 covers these guidelines. Review the detail descriptions of the required language elements. The examples provided with detail descriptions can be helpful as templates from which you can build your own ISL statements.
o o
3-7
Creating Scripts
Examples of Scripts
Charge Denial
This script places a window with the title Charge Denied on the screen, and provides text in it with the reason why the charge was denied. The operator is then prompted to press the [Clear] key before cancelling the operation.
event rxmsg : denial_msg var reason_text : a32 rxmsg reason_text window 3, 34, Charge Denied display 2,@CENTER, reason_text waitforclear exitcancel endevent
event inq : 1 var cust_name : A32 var addr1 : A32 var addr2 : A32 var addr3 : A32 var special_instructions : A32
window 7, 50, Customer Info display 2,2, Phone Number: displayinput 2, 18, phone_num{:###-####}, Enter phone number display 3,2, Customer name: displayinput 3,18,cust_name, Enter customers name display 4,2, Address Line 1: displayinput 4,18,addr1, Enter address display 5,2, Address Line 2: displayinput 5,18,addr2, Enter address display 6,2, Address Line 3: displayinput 6,18,addr3, Enter address display 7,2, Instructions: displayinput 7,18,special_instructions, Enter instructions windowinput txmsg phone_num, cust_name, addr1, addr2, addr3,\//send information to //a third party system special_instructions waitforrxmsg endevent
3-8
Case
ISL statements are case-insensitive and the use of case in examples is purely for clarity and the authors choice of style. However, quoted strings are case-sensitive.
Length of Variables
The maximum character length for all variable names (user variables, subroutines, etc.) is 255.
Comments (//)
Declarations and commands will always be on their own line and should be the first non-white space characters. A comment may be placed on a line by beginning the comment with // characters. All characters to the right of the comment identifier // are ignored. For example: Window 2,19, ROOM INQUIRY//Create window //Prompt for room number Display 2,2, Enter Room Number
A comment may reside on its own line or to the right of a command and its arguments. Lines should be terminated with an ASCII carriage return, or an ASCII linefeed, or a carriage return/line feed pair.
3-9
3-10
Whitespace
Whitespace in ISL is defined as spaces or tab characters inserted into a program to either separate commands from their arguments or to improve program readability. For example, the programmer might find it easier to write: numrow = ( ( ( num_guest - 1 ) * 2 ) + header ) instead of: numrow=(((num_guest-1)*2)+header) Whitespace can be placed anywhere in a script between two distinct language elements. Language elements are: commands, functions, system variables, userdefined variables, input/output specifiers, comments (//), relational and boolean operators, and commas. A language element is an indivisible piece of information which, if broken apart with whitespace, will generate an ISL token error. For a complete listing of error messages, please see SIM Online Help. For example, the number -125.99 cannot be written as -125. 9 9. The command WaitForClear cannot be written as Wait For Clear. The table below shows examples of the incorrect use of whitespace. This incorrect usage will produce error messages.
ISL Language Within a variable name Within a numeric value Within a command format specifier Within a comment delimiter Within double-character relational operators Between the @ and a System Variable name num Incorrect Use of Whitespace _ columns = 1 45 Correct Use of Whitespace num_columns = 1 -198.45 A12 N5 $12 // comment... a<>b count @TNDTTL @YEAR
- 19 8. A N $ / 12 5 12
/ comment...
= 5
<=
3-11
The following table shows examples of where whitespace increases program readability:
No Whitespace var count[10]:N5 display 1,2,"Room is ",room txmsg "CHG",guest,@tndttl+1.00 With Whitespace var count[ 10 ] : N5 display 1, 2, "Room is ", room txmsg "CHG", guest, @tndttl + 1.00
3-12
Note
There is no need to compile the script or to process it in any other way before the SIM can read it.
Avoiding Errors
To avoid errors when writing and editing scripts, follow these basic guidelines: o Make sure the script has been assigned the filename pms###.isl and stored in the \micros\res\pos\etc directory. o Check your 3700 database programming. o Review the structure of the script. o o o o o Are all global variables declared at the beginning of the script? Within each event, have you declared all local variables before issuing the first command? Are the subroutines that you call in events also within the same script? Does the called subroutine have the same name as the actual subroutine? Look at your programming style. See Script Writing Style on page 3-9. Check that events correspond to the correct SIM Inquiry or SIM Tender keys initiating the event or tender event, respectively. For further details about creating these keys, refer to Programming the 3700 System for SIM on page 2-9
3-13
Check the script for syntax errors. For instance, make sure that if a command has a corresponding command ending the task, include it. For example, the Event command must be used with the EndEvent command, which should always be the last line of an event procedure.
3-14
Testing Scripts
Detecting Errors in Logic
Testing Scripts
Before you use the SIM application in a live environment, we recommend that you test it for errors.
o Test each step of the event, such as the flow and logic of IfEndIf and For loop statements. o Check any assumptions you make in the script. For instance, if a condition must exist in order for the next step to occur, check the condition. You might need to display an error message or perform another step until this condition is met.
3-15
Testing Scripts
Stepping Through the Script
Check the logic of each task. For example, if the script collects data from the user before querying a third-party database, you should make sure that the script prompts the user for data entry before starting the query. Correct any detected syntax errors. The ISL error message will provide the number of the line in the script where the error is found. Verify inputs and outputs. For example, if the script calls for a coupon to be generated when an operator closes a guest check, test for this case. Insure that the script handles all error conditions and presents a meaningful error to the user.
o o o
3-16
Encrypting Scripts
Encryption Program Files
Encrypting Scripts
Once youve created a script, you can use the ISL Encryption Program to code the script so that it is unreadable by anyone. This program converts the script into an encoded decimal format. Once encrypted, the script cannot be converted back to a readable format. Youll find instructions in this section that describe how to install the Encryption Program and how to use the Encryption Program in both interactive or command line modes.
ISLCRYPT.EXE
ISLCRYPT.DOC
Installing ISLCRYPT.EXE
Complete the following steps to install the encryption program. o Create a new directory called isl. For example: c:\>md isl o Copy ISLCRYPT.EXE from the distribution diskette to c:\isl. For example: c:\>copy a:\islcrypt.exe c:\isl
3-17
Encrypting Scripts
Command Syntax
Command Syntax
[path]islcrypt [[path]/input_file] [path]/output_file \ [ user_description ] ] Parameter islcrypt input_file output_file user_description The utility file name The ISL script file name you wish to encrypt The encrypted ISL script file name the user-defined text embedded in the file for identification Description
Guidelines
o Both the program and script may be located in any directory. See the following example: File islcrypt.exe script file c:\isl c:\3700\etc\pms1.isl Location
o The output_file and user_description are optional. The output_file name is required when using the user_description. o The user_description must be enclosed in quotes (for example, PMS Interface Script). The number of characters is limited to the DOS Command Line maximum. If no user_description is given, Micros Encrypted ISL Script File will be embedded in the file. o It is recommended that the output_file always be specified. If the output_file is not specified, the input_file will become the encrypted file. It is also recommended to enter a user_description, since once the file is encrypted, the file cannot be read by standard editing programs and the user_description will be the only way of identifying the script. o In order to access both the encryption program and the script, you must specify the full directory path name. If the full path name is not given, an error message will occur. All errors are listed in Error Messages on page 3-20
3-18
Encrypting Scripts
Using the Encryption Program
Warning!
Once the script has been encrypted, there is no way to reverse the procedure.
o Verify that the backup script exists. o Change to the directory holding the file to be encrypted.
3-19
Encrypting Scripts
Error Messages
3. Enter islcrypt at the prompt. The encryption program will prompt Input filename? 4. Enter the full directory path of the input_file. The Encryption Program will prompt Output filename? 5. Enter the full directory path of the output_file. The Encryption Program will prompt File description? 6. Enter a unique description of the output_file within quotes.
Error Messages
The following are possible error messages associated with the encryption process:
Message islcrypt: not found Description This error message indicates that the Encryption Program cannot be found because the full directory path was not specified, or incorrectly specified, in the command syntax. This error message indicates that the input_file does not exist, or the full directory path for the input_file was not specified, or incorrectly specified, in the command syntax. Action Check the directory path. Then re-enter the command syntax with the correct full directory path.
Check the directory path and the source directory for the input_file. Then, re-enter the command syntax with the correct full directory path.
3-20
Merging Scripts
Error Messages
Merging Scripts
We provide a utility that allows you to merge unencrypted scripts with encrypted scripts. The purpose of the ISL Merge Program is to allow you to distribute an unencrypted configuration file with an encrypeted script. Configuration files, also scripts, provide the script designer with flexibility when distributing the same encrypted script to multiple sites. For example, some variable information in the script may vary from site to site, such as the name of a restaurant, address, or telephone number. To make these changes, a user can change the unencrypted configuration file, then merge the configuration file with an encrypted script. The end result forms a complete encrypted output file, which is unique to the specifie site. Example The script below prints out a custom coupon using the ISL. A chain of restaurants has several sites where the coupons will be distributed. Each site must have its unique name, address, and telephone number printed on each coupon.
event inq : 1 //start the print job startprint @rcpt //print the site into printline "-----------------------------" printline site_name printline site_addr1 printline site_addr2 printline site_phone printline "-----------------------------" call print_coupon endprint endevent
Since the same script is distributed to each site, it is not possible to embed the site information into the main script. Consequently, a separate script is created for each site that contais the site configuration parameters.
3-21
Merging Scripts
Merge Program Files
//Set these variables to the site name, address, //and phone number var site_name : a40 = "My Restaurant" var site_addr1 : a40 = "12345 Main Street" var site_addr2 : a40 = "Baltimore, MD 21229" var site_phone : a40 = "301-210-6000"
Using the ISL Merge Program, we can merge this configuration file with the main script.
ISLMERGE.EXE
ISLMERGE.DOC
Installing ISLMERGE.EXE Complete the following steps to install the merge program. o Create a new directory called islmerge. For example: c:\>md islmerge o Copy ISLMERGE.EXE from the distribution diskette to c:\islmerge. For example: c:\>copy a:\islmerge.exe c:\islmerge
3-22
Merging Scripts
Command Syntax
Command Syntax
[path]islcrypt [[path]/input_file] [path]/output_file \ [ user_description ] ] Parameter unencrypted_source encrypted_source new_encrypted_source Description The utility file name The unencrypted ISL script file name you wish to merge; also called the configuration file The encrypted output file
Guidelines
o Both the program and script may be located in any directory. See the following example:
File Location
c:\islmerge c:\3700\etc\pms1.isl
o The output_file and user_description are optional. The output_file name is required when using the user_description. o Both the unencrypted_source and encrypted_source must be valid ISL scripts. o The size of the new_encrypted_source may not exceed 64K. o In order to access both the merge program and the source scripts, you must specify the full directory path name.
3-23
Merging Scripts
Using the Merge Program
3-24
CHAPTER 4
Using Variables
This chapter contains a description of the data types and operators supported by the ISL, and an introduction to user variables.
In This Chapter...
Variables and ISL . . . . . . . . . . . . . . . . . . . . . . . . . Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Relational and Logical Operators . . . . . . . . . . . . . User Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 4-3 4-5 4-10
4-1
4-2
Using Variables
Data Types
Data Types
The ISL supports several kinds of data types, including numeric, decimal, alphanumeric, and key data types, to specify different kinds of variables and constants. When a variable is declared using the Var1 command, its data type and size must also be declared. The type and size are referred to as the variable_specifier and type_specifier, respectively.
The table below lists the different kinds of data types and provides the abbreviations you must use when declaring them.
Data Type Numeric Abbreviation Nx Description These variables are used for numeric information and may comprise x digits (integers, not decimal), e.g., N4 supports -9999 to 9999. These variables are used for decimal amounts. Operator entries will assume a decimal place according to the currency's default setting, as specified in the System|Restaurant form for the base currency and the Sales|Currency form for foreign currencies; i.e., entering 1234 in the US will result in an amount of 12.34. They may comprise x digits, e.g., $4 in the US will support -99.99 to 99.99. These variables may include any noncontrol character, including punctuation marks. They may comprise x characters. Example var rowcnt : n3
Decimal
$x
Alphanumeric
Ax
1.
For complete description of the Var command, refer to the SIM Online Help.
4-3
Data Types
Abbreviation key
Example The examples below declare a 32-character alphanumeric variable and a four-digit room number variable, respectively. event : 1 var message_text : A32 var room_num : N4 . . .
4-4
Using Variables
Unary Operators
There are two unary operators:
Operator Description Negation operator (a minus sign). This is used to negate an expression. Will negate the result of the expression. The NOT operator can be applied to expressions in the same way as the unary minus operator. -3 -count -( ( count + 5 ) * -index ) Example
The NOT operator will negate the result of the expression. For example, the following expression is always TRUE: ( 3 < 4 ) The NOT operator will negate the sense of the above expression; thus the following expression is always FALSE: NOT ( 3 < 4 )
NOT
Given that ISL expressions are true if they evaluate to a non-zero value, and false if they are zero, the NOT operator will change non-zero values to 0 and 0 values to nonzero. The expression NOT 3 is valid and will evaluate to a 0. The NOT operator is generally used in If, ElseIf, and While statements to control program flow.
4-5
The following example is a subroutine of a loop that executes until the variable done becomes true. sub get_id( ref id ) var done : N3
done = 0 while NOT done input id, Enter id if id > 0 AND id < MAX_ID done = 1 else errormessage Not Valid endif endwhile endsub
4-6
Using Variables
Binary Operators
The following table lists the available binary and logical operators in order of precedence (highest to lowest); AND and OR, the logical operators, have a lower precedence than all the binary operators;
Operation multiplication division modulus plus minus bit-wise and bit-wise or equality greater than or equal greater than less than or equal inequality less than logical and logical or Operator * / % + & | = >= > <= <> < AND OR Allowable Operand Types: Nx, $x, and Ax Nx, $x Nx, $x Nx, $x Nx, $x Nx, $x Nx Nx Nx, $x Ax, Key Nx, $x, Ax, Key Nx, $x, Ax, Key Nx, $x, Ax, Key Nx, $x, Ax, Key Nx, $x, Ax, Key Nx Nx
4-7
Precedence
o ISL expression operands are evaluated from left to right until the end of the expression is reached. For example, note the following expression: 1 + 5 + 2 This evaluates to 8. o When expressions mix operators (i.e., + and *), then ISL will use the precedence table to determine which subexpression within the expression will evaluate first. In the following example, the * operator has higher precedence than the + operator, therefore, the last two operands will be combined first, even though they are not the first in the expression: 1 + 5 * 2
4-8
Using Variables
o The result is 11 (1 + 10), rather than 12 (6 * 2). The precedence rules are used for all operators. Note the following example: a < 1 OR b > 3 Since the < operator has greater precedence than the OR operator, a < 1 and b > 3 are evaluated first, and both results are combined with the OR operator. Overriding and Clarifying Precedence You can use parentheses to override the default precedence rules. Parentheses are used for two reasons: o To override the default expression evaluation o To clarify the expression Subexpressions enclosed in parentheses always override the operator evaluation. For example, note the following expression: (1 + 5) * 2 The 1 + 5 is evaluated first since it is within parentheses, even though the multiplier * has higher precedence. The following expression: a < 1 OR b < 3 can be rewritten as: (a < 1) OR (b < 3) It is good practice to always place parentheses around subexpressions, to reduce programming errors and to make scripts easier to understand and maintain. For example, the following expression: offset + width * 2 <= w_width / stlen + 1 is equivalent to: (offset + (width * 2) ) The second expression is clearer. <= ( ( w_width / stlen) + 1)
4-9
User Variables
Declaring User Variables
User Variables
User variables are defined by you, the interface designer, and may be used to get operator input, such as customer name and address information, a room number, etc. They can also reference an entry in a message received over a SIM Interface.
Guidelines o The variable name must begin with a letter A-Z, a-z, or the underline character (_). o The first character cannot be a number. It may subsequently include any character in the range A-Z, a-z, 0-9, or the underscore _ character. o String variables will initially equal a null string " ". o Numeric variables will initially equal a 0.
4-10
Using Variables
User Variables
Local and Global Variables
Global Variables
If a variable is declared outside of an Event procedure, it is considered global. The variable is called global because it can be referenced by any event or subroutine in the script. As a result, the ISL must maintain the contents of the variable the duration of a script. The variable is then reset at the start of a new transaction (i.e., when tendering a check). Also, since the variable will be used by other events and subroutines in the script, you only need to declare a global variable once, at the top of the script, before any events or subroutines. Please refer to the Retain/Discard Global Variable command in SIM Online help.
Local Variables
Conversely, a variable is considered local when it is declared inside an event procedure. Local variables are only maintained while the event procedure is being executed; executing the EndEvent command, or any other command that stops the script, purges the local variable from the event procedure. Thus, you must declare local variables within event procedures. Local Variables Used by Subroutines Local variables declared by a parent event procedure are visible within a child subroutine. This functionality is possible because a local variable is accessible to the event in which it is included, and to any child subroutine called by the parent event. Moreover, the contents of a local variable, declared in the parent event, can be changed by the operation of a subroutine called by the same parent event. Consequently, the new contents of the local variable are retained when the subroutine is complete.
4-11
User Variables
Array Variables
Array Variables
Arrays of variables can also be declared by including an array size with the declaration. The syntax for an array variable is: Var variable_name[array_size]:variable_specifier The example below declares an array of strings named message_text, containing eight elements, each 32 characters in length.
var message_text[8]:A32
Note
The use of brackets in the example above does not denote an optional entry, but is actually part of the system.
For more information on the Var command, please see the SIM Online Help.
4-12
Using Variables
User Variables
Using List Arrays and Records
List Arrays
The SIM provides more than one method for sending and receiving variable amounts of data within one message. The simplest method is to send a list. A list consists of a list_size and the array_variable that contains the list. The list_size is any user-defined integer variable. The array_variable is any user-defined array, as shown on page -12. Specifying a List Array A list is specified for an RxMsg or TxMsg command by using empty array brackets ( [] ) after the array name. Example: Rxmsg list_size, list[] When specifying a list array, follow these guidelines: o The variables used for the list size and the list are user-defined. o The list size variable should always precede the list array variable. o Array system variables (e.g., @DTL_OBJNUM) cannot be used as list arrays. o The values in the list[ ] should be formatted into as many lines as are specified in list_size. In the example below, list_size is 5, thus five values from the list[ ] will be formatted if these ISL statements are executed. var list_size : N5 var list[ 10 ] : A20 txmsg list_size, list[]
4-13
User Variables
Using List Arrays and Records
o Using the same example, if we let the [fs] symbol stand for the field separator and the message from PMS is: 5[fs]L1[fs]L2[fs]L3[fs]L4[fs]L5 then: listsize = 5 list[ 1 ] = "L1" list[ 2 ] = "L2" list[ 3 ] = "L3" list[ 4 ] = "L4" list[ 5 ] = "L5" o The PMS should read the first value in the message and receive that many elements from the rest of the message. The RxMsg command reads the data from the message in a similar manner. For example: var listsize : N5 var list[ 10 ] : A20 rxmsg listsize, list[] If message from PMS is: 2[fs]L1[fs]L2,then: listsize = 2 list[1] = "L1" list[2] = "L2" If message from PMS is: 4[fs]L1[fs]L2[fs]L3[fs]L4, then: listsize = 4 list[1] = "L1" list[2] = "L2" list[3] = "L3" list[4] = "L4"
4-14
Using Variables
User Variables
Using List Arrays and Records
In another example, the script collects a guest name from the operator, transmits the guest name to the PMS, receives a list of names from the PMS, and displays the list in a window: event inq : 1 var name : A20 input name, "Enter guest name" txmsg "GST_INQ", guest waitforrxmsg endevent event rxmsg : GST_RSP var guest_count : N5 //declare list size var guest_name[10] : A20 //declare list //receive up to 10 names rxmsg guest_count, guest_name[] //open up window window guest_count, 25, "Guest List" listdisplay 1, 1, guest_name //display names waitforclear endevent
o Lists can be intermingled with other non-list variables, as well as other lists. In the following example, one single variable and two lists, each with its size variable, are received from the PMS: rxmsg status, guest_count, guest_name[],\ action_count, action_list[]
4-15
User Variables
Using List Arrays and Records
For each list, only one array may be assigned. It is possible, for example, for the PMS to send not only the guest name, but also the room number. One way to handle this would be to receive two lists within one message: event rxmsg : GST_RSP var guest_count : N5 var guest_name[10] : A20 var guest_room[10] : N5 rxmsg guest_count, guest_name[], guest_count,\ guest_room[] . . endevent
Implicit List_Sizes
There are occasions where the script writer may desire to use lists, but does not want to actually specify the list_size, since the list_size is not specified in the data. For example, assume that a PMS message contains 20 fields. In order for the ISL to read the message, a separate variable must be specified in the Rxmsg command for each field. var n[20] : n5 rxmsg n[1], n[2], n[3], n[4], n[5], n[6], n[7],\ n[8],\n[9], n[10], n[11], n[12], n[13], n[14], n[15],\ n[16], n[17], n[18], n[19], n[20] The ISL provides a method for specifying list_sizes implicitly for those cases when the data does not contain a list_size. An implicit list_size is identified by a pound symbol (#) placed before the list_size. Alternatively, the example above could be written as: var n[20] rxmsg #20, n[] Only integer expressions may be placed in the implicit list_size field. Integer variables may also be used. var size : n2 = 20 var n[size] : n5 rxmsg #size, n[] Implicit list_sizes may be used anywhere standard list_sizes may be used.
4-16
Using Variables
User Variables
Promotion
Records
ISL also provides a more powerful, yet more complicated, syntax for specifying variable amounts of data called records. In this format, the variables following the list size are considered to be in groups of records. The syntax for receiving this type of information is: listsize, list1[] : list2[] : list3[] ... The colon separates fields within a record and must be used when specifying records. For example, if the PMS received an inquire on SMITH, then it may want to group the data as follows: 3[fs]Smith[fs]1423[fs]Smithers[fs]1827[fs]Smithson[fs] 1887 Note that each record consists of a name followed by a room number. To receive the message above, use the following statement: rxmsg count, name[] : room[] In this case, the variables would be set as follows: count = name[1] name[2] name[3] room[1] room[2] room[3] 3 = = = = = = "Smith" "Smithers" "Smithson" 1423 1827 1887
The same format would be used for transmitting data. A list specification is a special case of a record format, where each record consists of one element.
Promotion
ISL allows the programmer to freely combine and assign variables of the different types. For example, it is possible to add a string and an integer, and assign it to a decimal value.
4-17
User Variables
Promotion
var amt : $10 amt = 12 + "25" + 100.45 Whenever two variables and/or constants are operated upon with an operator, and they are not the same types, one will be promoted (have its type changed) before the operation takes place. Strings promote to integers and integers promote to decimal values. A final promotion occurs when the expression is assigned to a variable. Therefore, the expression is promoted (or demoted) to the variable type. For example, if the following variables are declared: var string : A20 var integer : N10 var decimal : $10
Then the following statements are assigned within an Event procedure, the statements would be equivalent to:
Assignment string = "12" + 35 string = "14.15" + 2 string = "14.15" + 2.00 integer = "14" + 12.5 integer = "14.5" + 12.5 string = "47" string = "16" string = "16.15" integer = 26
integer = 27 expression was real, and then demoted to integer
Equivalent To
decimal = 13.23
decimal = 13.00 "12.23" + 1 yields an integer 13, which is then assigned to decimal
Strings are converted to integers by using the first digits in the string field. 12.35 converts to an integer 12, since . does not belong in an integer. 12NUM also converts to 12. Therefore, it is legal to write: integer = "ABC123"// integer = 0
4-18
Using Variables
User Variables
Promotion
Only relational operators are allowed between strings; see Relational and Logical Operators on page 4-5. Correct: integer = "12" > "35" Incorrect: integer = "12" + "35
4-19
User Variables
Promotion
4-20
Using Variables
CHAPTER 5
ISL Printing
This chapter contains an introduction to the ISL command and system variables that facilitate output to print devices.
In This Chapter...
Getting Started with ISL Printing . . . . . . . . . . . . . Starting an ISL Print Job . . . . . . . . . . . . . . . . . . . Detecting the Status of Print Jobs . . . . . . . . . . . . Using Print Directives . . . . . . . . . . . . . . . . . . . . . Backup Printing . . . . . . . . . . . . . . . . . . . . . . . . . . Reference Strings . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 5-3 5-7 5-8 5-11 5-12
5-1
5-2
ISL Printing
Supervised
Unsupervised
5-3
Supervised and Unsupervised Printing The StartPrint[WithStatus command should be used for supervised print jobs only, such as guest checks and customer receipts. When this command is used, the system will wait until the print job is completed before continuing with the script. Then, the completion status of the print job will be stored in the system variable @PRINTSTATUS. If the print job fails, the script can be designed to check @PRINTSTATUS and reroute the print job to another printer. On the other hand, the StartPrint command is defined for unsupervised print jobs only, like journal printing. After executing the StartPrint command, for example, the system would immediately return to processing the script, and let the print job execute in the background. The system variable @PRINTSTATUS always returns successful results for these commands. Form Feeds To force continuous paper to the beginning of a new line, the StartPrint commands can be issued with a Form Feed (FF) command. To turn off the Form Feed feature, a No Form Feed (NOFF) command is provided. Backup Printing and Reference Lines The commands used for unsupervised print jobs also allow for the specification of a backup printer in case the print job fails. This backup printer overrides any backup printer already programmed in the database for the specified printer. In addition, you can also specify text, called a reference line, to appear in printer error messages returned when both supervised and unsupervised print jobs fail.
5-4
ISL Printing
Although using this method is valid, it has a primary disadvantage. For instance, the destination printer for ISL print jobs may differ for each UWS. Thus, each script would need to specify the printer to which each UWS must print, limiting the flexibility of the script. Considerations o Although it is legal to specify a printer object number of 0, all print jobs printing to 0 will not printanywhere. o An invalid object number value (-1) will generate an ISL error.
5-5
ISL Printer System Variables The printer system variables available in ISL include the following:
System Variable @CHK @RCPT @JNL @ORDR[115] @VALD Guest Check Printer Customer Receipt Printer Journal Printer Remote Order or Local Backup Printer Validation Printer Description
A table describing all options available with each valid ISL printer is provided with the detail description of the StartPrint[WithStatus] command. See StartPrint[WithStatus]...EndPrint[FF/NOFF] commands in the SIM Online Help.
5-6
ISL Printing
Note
This feature is not supported for unsupervised print jobs (order and journal printing). In the case of unsupervised print jobs, its print status is always set to Y, regardless of how the print job is completed.
The PrintStatus System Variable Basically, the way in which the status can be returned is a function of how each command operates. When using the StartPrintEndPrint command, the script will immediately continue executing after the EndPrint command. That is, printing occurs at the same time the script is being executed, so these commands do not allow for the print status to be set. However, when EndPrint is used with a WithStatus command, SIM will wait for the print job to completely generate before returning control to the script. Because SIM knows whether or not the print job completed successfully, the @PRINTSTATUS can be set to Y or N. For example, you may want to abort a supervised print job if the printer runs out of paper or has a paper jam while generating a validation chit. In either of these instances of printer failure, the @PRINTSTATUS returned by the StartPrintWithStatus command would be N. With this status, the script could redirect the print job to another printer, or prompt the operator to fix the problem (e.g., check the printer), based on the print status.
5-7
5-8
ISL Printing
Considerations o Print directives (@DWON and @DWOFF) may be inserted between expressions, but only affect the expression to the right. o The print directives are reinitialized at the end of each printed line. o If no print directives are specified, then printing will be in black and single-wide. Example The following example illustrates how the same expression can be printed in four different ways by using a combination of these print directives: Printline Print line//prints in black Printline @redon, Print line//prints in red Printline @dwon, Print line//prints in black, // double-wide Printline @dwon, @redon, Print line//prints doublewide // in red ink
5-9
5-10
ISL Printing
Backup Printing
Print Directives and Subroutines
Backup Printing
Backup printing is supported for unsupervised print jobs only. That is, whenever the StartPrint command is issued, an unsupervised print job will occur. If the print job is unable to complete successfully, it will go to the backup printer defined in the 3700 for each printer type (i.e., @chk, @rcpt, ...). However, there are instances when a backup printer different from the one defined in the 3700 should be specified. To accommodate these instances, the StartPrint command accepts an optional second argument. This optional argument specifies the object number of the backup printer, overriding the backup printer programmed in the 3700 database. For example, if the Check Printer is normally backed up by the Customer Receipt Printer but the script requires that a print job to the Check Printer back up to the Journal Printer, the following command should be issued:
STARTPRINT @chk, @jnl// back up to @jnl instead of @rcpt
Considerations o All supervised print jobs (StartPrintWithStatus) do not have a backup, and therefore, do not accept a backup argument. o SIM will only route the print job to the backup printer defined in the 3700 Database if the primary printer specified is a system variable. Otherwise, the ISL does not know to which printer type the job should be re-routed. For example, assume that the @CHK system variable equals 2. STARTPRINT @chk// ISL can determine backup printer STARTPRINT 2// ISL cannot determine backup printer In the first line, SIM will correctly determine the backup for the Check Printer, since @chk is explicitly specified. In the second line, the number 2 is used instead, and ISL cannot correctly determine the backup printer, and so, no backup is used. o All unsupervised print jobs in the 3700 system can only accept up to 4096 characters of print data. Any print jobs with more than 4096 characters will generate an error. If a script must perform a print job greater than 4096 characters, it should use supervised print, and perform its own backup printing by using the @PRINTSTATUS system variable.
5-11
Reference Strings
Print Directives and Subroutines
Reference Strings
Whenever the SIM is performing a print job and an error occurs during printing (paper out, door open), an error message will appear on the display of the UWS explaining the error. Included in this error message is a line of text identifying the print job. Normally, ISL will leave this line blank. However, this reference line can be specified in both the StartPrint and StartPrintWithStatus commands. STARTPRINT @chk // use default backup STARTPRINT @chk, @rcpt // no reference line STARTPRINT @chk, @rcpt, "Printing Customer Coupon" //ref line STARTPRINTWITHSTATUS @chk // no reference line STARTPRINTWITHSTATUS @chk, "Printing Customer Coupon" //ref line
5-12
ISL Printing
CHAPTER 6
In This Chapter...
System Variables . . . . . . . . . . . . . . . . . . . . . . . . . . Specifying System Variables . . . . . . . . . . . . . . . . 6-2 6-3
6-1
System Variables
System Variables
System variables return status information from the 3700 RES System or the PMS System, etc., as well as provide you with access to transaction totals and other transaction parameters. Using the system variables that the ISL supports, you can: o Access the system transaction variables and totals information and o Set certain operational parameters. Specifying System Variables If this is the first time that you have used ISL system variables, review this section to determine the quidelines to follow when specifying system variables. A detailed description of each system variable in alphabetical order and in order by category of function is provided in SIM Online Help.
6-2
6-3
o Before using a system variable, review the detail description carefully for any special considerations. o The majority of system variables must be used in conjunction with other commands, functions, or other system variables. For instance, the @DWON system variable can only be used with the Printline command. Some system variables are only valid within a certain event. For example, @CCNUMBER and @CCDATE will only return valid values if issued from within a tender/media event referencing a credit card tender type. You may or may not be required to place a system variable strategically within the script. For example, the @WARNINGS_ARE_FATAL system variable must be placed at the top of the script. But the @LINES_EXECUTED system variable can be placed anywhere in a script.
o Just as there are user variables that you can specify as arrays, there are array system variables. Array system variables require that you reference an array index. Using an Index to Specify System Variables on page 6-4 describes how to issue these types of system variables.
6-4
Array Subscripts
The difference between system array variables and user-declared array variables, is that system array variables already have been declared and filled with the corresponding information. Consequently, there is no need to declare the subscripts of the array. For example, the user-declared array variable must be declared as follows: var myarray[5] : A20 myarray[1] = myarray[2] = myarray[3] = myarray[4] = myarray[5] = mytest mytest mytest mystes mytest
But a system array variable can be specified as: @si[3] For a system array variable, the variable data type and size, and subscript are assumed by the ISL to reference Sale Itemizer #3. If executed by a script, this system array variable would return the totals posted to this sales itemizer on the current guest check.
The array index for @SI must evaluate to an index between 1 and 8. All array indices start at 1, and not 0. For example, @si[0] will generate an error.
6-5
Note
The embedded-index method remains in ISL to retain compatibility with older scripts and should not be used with new scripts.
6-6
CHAPTER 7
Format Specifiers
In This Chapter...
Format Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . Using Format Specifiers . . . . . . . . . . . . . . . . . . . . 7-2 7-3
7-1
Format Specifiers
Format Specifiers
Format Specifiers The Interface Script Language (ISL) provides commands to display information, get operator entries, display touchscreens, execute keyboard macros, as well as transmit and receive messages over the interface. A detailed description of each ISL command is provided in the SIM Online Help. Format specifiers can be part of the syntax of certain commands. Format specifiers allow you to change the format of both input and output data. Review Using Format Specifiers on page 7-3 to learn the ways in which this language element can be used in command syntax.
7-2
Format Specifiers
Note
The meaning of the data within the braces will be explained later.
Types of Format Specifiers There are two types of specifiers: input and output. Input specifiers are placed after input variables in commands that get data from a user: Display, DisplayMSInput, Input, and InputKey. Output specifiers are placed after variables and expressions that are being converted to ASCII for outputting data to the screen, printer, or a message to a PMS.
7-3
Specifier Attributes The general layout of a format specifier is: { [input_specifier] [output_specifer] } o The input_specifier and output_specifier consists of individual specifiers, which are usually one character. o Spaces and tabs may be used in a format specifier for clarity. The following two format specifiers are equivalent: {-=08} { - = 0 8 } Input and output specifiers can appear within one format specifier. However, not all of the individual specifiers may have meaning. For example, it is possible to put input specifiers after a variable that is going to be displayed, but since data is not being entered into the variable, the input specifiers are meaningless and will be ignored.
Input Specifiers
The input specifiers only have meaning for commands that receive input from the user. They will be ignored if they appear in commands that only output data (for example, the Display command). All input specifiers must be placed before any output specifiers. If they are present, they must also be placed in the order listed in the following table:
Input Specifier Mn Description Data being typed in by the operator should not be echoed back to the display Specify the track number (n) and what data to read from the magnetic card. For use with the Input, InputKey, DisplayInput, and DisplayMSInput commands only. The M character is not case sensitive.
7-4
Format Specifiers
- Input Specifier
The - specifier is used to hide data being entered by the operator. For example, authorization codes or passwords should not be echoed to the display as the operator types them in. The following command prompts the operator for an authorization code, but echoes it back to the display as it is being typed: Input auth_code, Enter authorization code It can be rewritten so that no data is echoed: Input auth_code{-}, Enter authorization code If the - specifier is used in commands that require both operator input and the data to be displayed, then not only will the data not be echoed, it will also not be displayed in the window after it is entered. Instead, the field will contain asterisks where data is expected.
M Input Specifier
The M specifier is used when magnetic card data may be entered in lieu of the operator typing the data in. The M specifier defines whether the data is on a mag card, and which track and field the data should be read from. For example, it is possible to use the M specifier to get an authorization code from track 2, field 1, starting offset 3, and copy in 10 characters. There are two M formats: o Format 1 Syntax: Mn,* o Format 2 Syntax: Mn, field, start, count | * These fields are defined as follows:
Field Description
Mn:
the track number (M2); this can be followed by a star (*) to specify all fields on the track, or use the following fields to read specific information: the field position within the specified track; this is a positive integer starting offset (character) within the field; for example, if you want to take the last four characters of the Blaine Richard string, you would start the offset at 11 number of characters to be read from the start (first character) to the end of the field (place an asterisk * to include all characters)
field: start:
count:
7-5
Format One In format 1, the data from the entire track (2) will be placed into the variable when the mag card is swiped. The following command allows the user to enter a code or swipe a magnetic card: Input auth_code{ M2,* }, Enter authorization code If the mag card is swiped, then all the data from track 2 (M2) will be placed into the variable auth_code. Format Two Format 2 defines exactly where the data in the track occurs. If the authorization code appears in field 1 of track 2, and furthermore, starts at character 3 in the field and consists of 10 characters, then the command can be rewritten as: Input auth_code{ M2,1,3,10 }, Enter authorization code If the operator swipes the card, the appropriate data will be extracted from the field and placed into auth_code.
Note
You can substitute a * for count, to specify ALL data from the start offset in the field.
Field Positions for Credit Cards The following is an illustration of the standard field positions for credit cards: Track 2:
Field # Data 1 16/19 Digit Account Number YYMM 2
The following Input command allows the operator to enter the credit card name or swipe the card and have the name transferred from track 2, field 1. Input card_num{M2, 1, 1, *}, Enter account number The following is an illustration of the standard field position for the MICROS Employee Card (Note: this card is Track 2 only):
Field # Data 10 Digit Employee Number 1
7-6
Format Specifiers
The following Input command will get the employee number from the operator or the mag card and will not echo the data as it is being entered: Input empl_num{ - M2,1,1,10 }, Enter employee number For more information concerning the field numbers, please see the 3700 Hardware Installation Guide.
Output Specifiers
Output specifiers are used after variables and expressions that are being converted to ASCII. The output specifiers are similar to the C language printf() specifiers. The following table lists some representative commands for each of these output types:
Commands Display, WaitForConfirm, and Window PrintLine TxMsg Screen Printing PMS Output Type
Syntax
The proper syntax for using the output_specifiers is as follows: [<|=|>|*] [+] [0] [size] [D|X|O|B] [^] ["] [:format_string] Output specifiers must also be placed in the order listed in the following table:
Output Specifier < = Description Left justification; the size specifier may be used to specify the size of the field Center justification; the size specifier may be used to specify the size of the field
7-7
Description Right justification; the size specifier may be used to specify the size of the field Trim leading and trailing spaces; the size specifier may be used to specify the size of the field Place sign at start of field Pad with zeroes (as opposed to spaces) Where size is the number of the characters in the required field. The size must be a positive integer or an expression that is a positive integer Decimal (Default); display numerics in decimal format Hexadecimal; display numerics in hexadecimal format Octal; display numerics in octal format Binary; display numerics in binary format Place a space on each side of the data to be displayed Place double quotes around the data to be displayed
+ 0 size
D X O B ^ "
:format_stri Similar to the BASIC language PRINT USING command. All characters will be displayed except for the # character, which will be ng replaced by characters from the variable or expression preceding the format specifier.
Examples of Specifiers
The following are examples of how Input and Output Specifiers may be used. For complete examples and explanations of the ISL commands, please see the ISL Command Reference in the SIM Online Help.
Input Specifier
The following lines would read data from a Credit Card:
displaymsinput 1, 2, account_num{m2, 1, 1, *, 019}, Enter Account Number,\ 2, 2, expiration_date{m2, 2, 1, *}, Enter Expiration
7-8
Format Specifiers
Output Specifiers
Justification Specifiers The justification specifiers <, =, and > are only meaningful when the size of the expression being formatted is greater than the size of the variable itself. All integers and decimal expressions are right justified, and all string expressions are left justified, by default. The following section gives examples and shows how these specifiers can be used to justify data:
Expression 125 { 8 } 125 { <8 } 125 { =8 } 125 { >8 } abc { 8 } abc { =8 } 125 125 125 125 abc abc Output
* Specifier The * specifier is used when the expression should be displayed with leading and trailing spaces removed.
Expression 125 {*} 125 {*} word 1 and word 2 {*} 125 125 word 1 and word 2 Output
+ Specifier The + specifier is used to override the default behavior of displaying negative numbers with the - sign to the right of the number by causing the - to appear on the left.
Expression -891 -891 {+} 891-891 Output
If the SetSignOnLeft command is executed, then the sign will always appear on the left side of the number. The + specification in this case will be superfluous.
7-9
0 Specifier The 0 specifier is used to pad the data being displayed with ASCII 0s instead of spaces. The 0 specifier is only meaningful if the size specifier is also used:
Expression 199 { 0 } 199 { 5 } 199 { 05 } 199 { <05 } 199 199 00199 19900 Output
size Specifier The size specifier defines the width of the expression being displayed. If no size specifier is present, then the width of the data formatted will be equal to the number of characters in the data. If the size specifier is 8, then 8 characters will be displayed, irrespective of the width of the actual data being displayed. The output data will be padded with spaces (unless the 0 specifier is used) or truncated if the size specifier is less than the length of the data to be displayed. There are two types of size specifiers: absolute and expression. All size specifiers must evaluate to positive integers. Negative numbers and/or decimal values are not allowed. Absolute specifiers are an integer value, for example, 5. The size specified must not begin with a 0, since the 0 will be mistaken for the 0 specifier. Expression sizes use standard ISL expressions to specify the size. However, the expression must be enclosed in parentheses, or an error will be displayed. (In this example, the value of width is assumed to be 3.)
Expression abcdefghij abcdefghij { 8 } abcdefghij { =8 } abcdefghij { (width*2) } abcdefghij { width+2 } abcdef ERROR: not enclosed in ( ) abcdefghij abcdefgh abcdefgh Output
7-10
Format Specifiers
D,X,O, and B Specifiers The radix specifiers (D, X, O, and B) determine the numeric base of the integer expression being displayed. They have no meaning for decimal and string data. The default is base 10 (D).
Expression 100 100 {H} 100 {B} 100 {08B} 100 64 1100100 01100100 Output
:format_string Specifier The format_string is the data that follows the colon : specifier. The format_string consists of ASCII characters and the # character. Format_strings are used when the data displayed should be interspersed with spaces and/or other characters to fit conventional display methods. For example, a 10-digit phone number should be displayed as: (nnn)nnn-nnnn When the SIM encounters a format_string, all # characters will be replaced with data from the preceding expression. All other characters will be output as-is. Characters are replaced starting from the right side of the format string. Output format specifiers may be used in a format specifier along with the format_string specifier. Any # characters in excess of the expression being formatted will be replaced with spaces, unless the 0 output specifier is used. For example, to display a U.S phone number, assume that the variable phone_num contains the phone number and is equal to 3012108000. Also assume that room_num contains a room number and is equal to 17031.
Expression phone_num phone_num {:###-###-####} phone_num {:(###) ###-####} room_num room_num {:##-###} room_num {:Floor ## room ###} Output 3012108000 301-210-8000 (301) 210-8000 17031 17-031 Floor 17 room 031
7-11
It may be necessary sometimes to display the # character and not have it replaced with a character from the output expression. In this case, precede the # character with a single quote.
Expression phone_num {:Phone # ###-###-####} Output Phone # 301-788-4531
It is possible to include format specifiers after each expression being formatted in one command. For example: TXMSG room_number { 04 }, guest_name { <24 }, @cknum
7-12
Format Specifiers
APPENDIX A
This appendix describes DLLs and how to access them using SIM.
In This Chapter...
What is a DLL? . . . . . . . . . . . . . . . . . . . . . . . . . . Using DLLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3700 SIM DLL Support . . . . . . . . . . . . . . . . . . . . Using 3700 SIM DLL Commands . . . . . . . . . . . . A-2 A-3 A-4 A-5
A-1
What is a DLL?
Dynamic Linking
What is a DLL?
The 3700 System Interface Module (SIM) can use Windows Dynamic-Link Libraries (DLLs). DLLs are modules that contain functions and data. They provide a way of separating applications into small manageable pieces that can be easily modified and reused.
Dynamic Linking
Dynamic linking provides a means of giving applications access to function libraries at run time. DLLs are not copied into an applications executable files. Instead, they are linked to an application when it is loaded and executed. Dynamic link libraries reside in their own separate files. Applications load them into memory when they are needed, and share a single copy of the DLL code in physical memory. A single DLL can be used by several applications simultaneously. This in turn saves memory and reduces swapping. Windows allows only a single instance of a DLL to be loaded into memory at any time. When a DLL is being loaded, Windows checks all the modules already in memory. If it doesnt find a match, then it loads the DLL. If it does find a match, and the matching module is a DLL, it doesnt load it again. The following are steps that an application takes when calling a function in a DLL: o The application uses the LoadLibrary or LoadLibraryEx function to load the DLL at runtime. This, for example, can be a .EXE or a .DLL. o The application calls the GetProcAddress function to get the addresses of the exported DLL functions and it is mapped into the address space of the calling process. o The application then calls the exported DLL functions using the function pointers returned by GetProcAddress. DLLs can define two kinds of functions: exported and internal. The exported functions can be called by other applications. Internal functions can only be called from within the DLL where they are defined. DLLs can contain code, data, and resources such as bitmaps, icons, and cursors. These are stored as executable programs.
A-2
Using DLLs
Sharing Components
Using DLLs
DLLs are used for three general purposes: o Sharing components o Encapsulating (hiding) data and code o Performing system-level operations
Sharing Components
DLLs provide an easy way for multiple applications to share components. These components can be: o Code - a DLL provides one copy of its code for all applications that need it. o Data - by storing and retrieving data, applications can communicate with each other. The DLL provides a function for applications to store and retrieve data in its data segment. o Custom Controls - these can be placed in DLLs for use by multiple applications. They can be written by developers and marketed as separate DLLs or used in applications. o Resources - icons, bitmaps, fonts, and cursors can be placed in DLLs. Device divers are also DLLs that provide system resources.
A-3
Customization
Using DLLs gives you the flexibility of customization. Now you are no longer confined to the text based window that SIM uses for input and output. For example, you could create a custom interface to a PMS that returns guest information to the 3700 POS operations module.
Creativity
Using the resources available with DLLs, you can use fonts, bitmaps, cursors etc. to create appealing user interfaces.
A-4
DLLLoad
DLLLoad loads the external DLL. It needs to be called only once during the lifetime of the SIM script. The syntax is: DLLLoad handle, name where handle is a SIM N9 variable, and name is a SIM string expression. The name parameter is used to identify the DLL, and the resulting handle is stored in the handle variable. An example of this would be: var dll_handle:N9 DLLLoad dll_handle, myops.dll If the command fails, then dll_handle will be 0. If not, then dll_handle is the handle used for any further accesses for the other DLL functions. This function is just a wrapper around the Windows LoadLibrary() function. All the rules which apply to path settings apply here. If the DLL is already loaded, then Windows will prevent it from being loaded again.
A-5
DLLs should be included in the following locations for each workstation platform: o o o Win32 \Micros\RES\POS\Bin HHT \Micros\RES\CAL\HHT\MICROS\Bin WinCE \Micros\RES\CAL\WS4\Files\CF\Micros\Bin
Note: When using SIM on a Win CE platform, be sure to include the full path to the DLL in the script. Do NOT place the DLL in the Windows folder as this folder is not saved to disk during a reboot.
DLLFree
This command is used to free a loaded DLL. The syntax is: DLLFree handle where handle is the handle obtained in a DLLLoad command. This function is automatically called when OPS exits, or the SIM script is reread. It can be called to free up resources loaded by the DLL.
DLLCall
The DLLCall command is used to call a function contained in the DLL. The syntax for this command is: DLLCall handle, dll_name( [parm1 [parm2 [parm3...]]] ) or DLLCall_CDECL handle, dll_name( [parm1 [parm2[ parm3]]] ) where handle is the previously loaded library handle, dll_name is the name of the function, and parm# are the optional parameters. This command performs two tasks: o The first is to get the address of the function using the Windows GetProcAddress() function. If this function fails, then an ISL error will be generated. o The second is to call the DLL function.
A-6
Since it is not possible for SIM to check the validity of the parameters, it is up to the SIM script writer to ensure that the proper number, type, and calling convention is used. Note that it is not possible for a DLL to return a value back to SIM. More specifically, if one is returned, it is ignored. Passing information back to the SIM script should be done using references, which are explained in the sections that follow.
Parameter Passing
There are only three types of variables in SIM: integer, monetary, and string. Therefore, only these types may be used as parameters to the DLL. However, each type may be passed in by value or by reference, and each type may also be passed in as an array. Therefore, there are 12 possible parameter types. To pass by reference, place the string ref before the parameter. For example: // Pass by value DLLCall handle, my_function( count ) // Pass by reference DLLCall handle, my_function( ref count ) Only variables can be passed in by reference. Complex expressions must be passed in by value. // Will generate an error DLLCall handle, my_function( ref count + 1 ) DLLCall handle, my_function( ref (1 + 3 ) ) When generating the parameter list, SIM will dynamically allocate data for each parameter, and this allocated data (or a reference to it) will be passed to the DLL. No references to the stored copy of the data will be passed. If by reference, SIM will copy in the new values to the data variables once the function has completed. Therefore, do not pass in huge arrays by reference when not needed, since SIM will attempt to copy in each array element, even if it has not changed. All pointers passed to the DLL are passed in as 32-bit pointers. All strings are C nulterminated strings. All integer values are signed. All arrays are passed as a pointer to a list of pointers or integers. The length of the array must either be passed in as an argument, or known prior by the DLL.
A-7
Though there are 12 ways of passing in parameters, there are only five separate ways to declare them in C.
1. 2. 3. 4. 5. int a int *a int a[] char *a char *a[] // integer // integer pointer // array of integers // string pointer // array of string pointers
The following table lists the different possibilities, and how they map to the parameter type.
SIM Type integer integer by reference integer array integer array by reference string string reference string array string array by reference amount amount by reference amount array amount array by reference C Declaration int a int *a int a [] int a [] char *a char *a char *a [] char *a [] char *a char *a char *a char *a same as amount array same as amount same as string array same as string same as integer array Comments
Integers
By value N1-N9 integers are passed in as 32-bit signed values. N10 and above are passed in as pointers to a string which contains the numeric value expressed as a string. For example, an N12 numeric variable whose value is 12345 will be passed in as 12345. If the number is negative, then a - will be the first character in the string. (The reason for this is that a 32-bit integer can only have 9 digits.)
A-8
By value examples var a:N9 = 4 var b:N10 = 3012108000 DLLCall handle, my_function( a, 10, (1 + a) * 10, b ) The dll prototype should look as follows: void my_function( int p1, int p2, int p3, char *p4 ); The dll function should expect these parameters: 4 10 50 3012108000 By reference N1-N9 integers are passed in as pointers to a 32-bit value. The DLL can change this value, and this change will be reflected in the variable. N10 variables are passed in as strings. The length of the string is guaranteed to be the length of the string variable. An N12 variable with a value of 123 will be passed in as 123, but the space occupied by the string will be at least 13. This means that the DLL can safely copy in a string longer than 123. By reference examples var a:N9 = 12 var b:N12 = 3012108000 DLLCall handle, my_function( ref a, ref b ) The dll prototype should look like: void my_function( int *p1, char *p2 ) The dll function should expect these parameters: pointer to 12 3012108000
Strings
All string parameters are passed in as a pointer. When by reference, SIM will copy the string data back into the original variable.
A-9
By value The string parameter is passed in as a pointer to a nul-terminated string. By value examples var a:A20 = 12345 DLLCall handle, my_function( a, hello ) The dll prototype should look like: void my_function( char *p1, char *p2 ) The dll function should expect these parameters: 12345 hello By reference The string parameter is passed in as a pointer to a nul-terminated string. However, the memory reference will be guaranteed to have allocated enough space for the declared string. For example, if a string is declared as A20 but is set to 12345, then the string passed in will be 12345, but will have 20 characters allocated (not including the nul terminator) The DLL can then write up to 20 characters into the string. By reference example var a:A20 DLLCall handle, my_function( ref a ) The dll prototype should look as follows: void my_function( char *p1 ) The dll should expect these parameters: The dll could copy a string of up to 20 characters in. memset( p1, -, 20 ) p1[ 20 ] = 0
A-10
Monetary Data
All SIM monetary data ($ variables) are kept as strings internally. Each string consists of the digits which make up the value. There is no representational difference between monetary amounts and numeric data N10 and greater. The difference between the two is determined by the operations allowed on the values. The operations involved are the assignment and arithmetic ones. Therefore, monetary amounts are passed to the DLL as numeric strings. However, they will have the decimal point inserted into the proper place. By value The string parameter is passed in as a pointer to a nul-terminated string. A - will be placed at the beginning of the string if it is negative. By value example var a:$12 = 12.34 DLLCall handle, my_function( a, a + 1.11, 5.67 ) The dll prototype should look as follows: void my_function( char *p1, char *p2, char *p3 ) The dll should expect these parameters: 12.34 13.45 5.67 By reference The string parameter is passed in as a pointer to a 0-padded nul-terminated string. The string will be padded with as many zeroes to make it the same as its declared length. A $12 variable string will have 12 digits and 1 decimal point. (The nul is not included) By reference example var a:$12 = 12.34 DLLCall handle, my_function( ref a ) The dll prototype should look like: void my_function( char *p1 ) The dll should expect these parameters: 0000000012.34
A-11
Array References
All arrays are passed in as an array of pointers or integers. As with SIM subroutine calls, all arrays must have a [] following them. Note that arrays and arrays by reference use the same declaration. The only difference between the two is that the values are copied back to the variables when the function is done. N1-N9 numeric values are passed in as integers. var array[ 20 ] : N9 // Passing in by value. // DLL prototype should be: void my_function( int array[] ); DLLCall handle, my_function( array[] ) // Passing in by reference. // DLL prototype should be: void my_function( int *array[] ); DLLCall handle, my_function( ref array[] ) All other types are passed in as strings. var array1[ 20 ] : $12 var array2[ 40 ] : A40 // Passing in by value // DLL prototype should be: // void my_function( char *array1[], char *array2[] ); DLLCall handle, my_function( array1[], array2[] ) // Passing in by reference // DLL prototype should be: // void my_function( char *array1[], char *array2[] ); DLLCall handle, my_function( ref array1[], ref array2[])
A-12
APPENDIX B
Database Access
This appendix provides instructions for accessing the system database from any client platform.
In This Chapter...
About the Database Utility . . . . . . . . . . . . . . . . . . Sample File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2 B-4
B-1
Available Functions
To be consistent with the rest of the MDS System, the calling convention of the API function has changed from _stdcall to _cdecl. Consequently, SIM developers will now use the DLLCALL_CDECL SIM command instead of DLLCALL. The following functions are available through the MDSSysUtilsProxy.dll: sqlExecuteQuery sqlGetRecordSet sqlCloseConnection sqlIsConnectionOpen sqlInitConnection sqlGetFirst sqlGetLast sqlGetNext sqlGetPrev sqlGetLastErrorString
B-2
Database Access
B-3
Sample File
Available Functions
Sample File
The following sample demonstrates how the functions are used to obtain access to the database:
var hODBCDLL : N12 = 0 event var var var var inq : 1 constatus : N9 sql_cmd : A2000 emp_id : A10 = 900 fn : N12 = 0
// --------------------- Load SIMODBC.dll ------------------if hODBCDLL = 0 DLLLoad hODBCDLL, MDSSysUtilsProxy.dll endif if hODBCDLL = 0 exitwitherror Unable to Load MDSSysUtilsProxy.dll endif // ----------------------------------------------------------// Connect to micros 3700 database DLLCALL_CDECL hODBCDLL, sqlIsConnectionOpen(ref constatus) if constatus = 0 DLLCALL_CDECL hODBCDLL, sqlInitConnection(micros,ODBC; UID=custom;PWD=custom, ) endif sql_cmd = select * from micros.mi_def DLLCALL_CDECL hODBCDLL, sqlGetRecordSet(sql_cmd) sql_cmd = DLLCALL_CDECL hODBCDLL, sqlGetLastErrorString(ref sql_cmd) if (sql_cmd <> ) ErrorMessage Error From SQL -> , sql_cmd endif sql_cmd = DLLCALL_CDECL hODBCDLL, sqlGetFirst(ref sql_cmd) if sql_cmd = exitwitherror There Is No Matching Record endif
B-4
Database Access
Sample File
Available Functions
if (@WSTYPE <> 3) fopen fn, sqldataout.txt, Write else fopen fn, \cf\micros\etc\sqldataout.txt, Write endif while sql_cmd <> fwrite fn, sql_cmd DLLCALL_CDECL hODBCDLL, sqlGetNext(ref sql_cmd) endwhile fclose fn // Execute query that doesnt return a recordset // ------------------------------------------------------format sql_cmd as update micros.emp_def set id = 999, where id = 999 , \ \
DLLCALL_CDECL hODBCDLL, sqlExecuteQuery(sql_cmd) sql_cmd = DLLCALL_CDECL hODBCDLL, sqlGetLastErrorString(ref sql_cmd) if (sql_cmd <> ) ErrorMessage Error From SQL -> , sql_cmd endif endevent
B-5
Sample File
Available Functions
B-6
Database Access
Glossary
Argument
An Argument is a generic term for an item, or group of items, that is used in the syntax of a command, that refers to the information that is required by the command. It may be an alphanumeric character, group of characters, or word(s) that receive the action of a command or function. For example, the Call command requires an argument (i.e., the variable name) in order to work. See also: Array; Constant; Equation; Expression; Function; Input Expression; Prompt Expression; String Expression; Syntax; System Variable; and User Variable.
Array
An Array is a set of values, based on the name of a User Variable. A User Variable Array (or Array Variable) identifies each value by the variable name and the index number, in brackets. For example, an Array called Rooms that has 20 values would be identified from Rooms [1] to Rooms [20]. See also: User Variable.
Concatenate
Concatenate means to join two or more text strings together to form a single contiguous string.
Glossary-1
Constant
Constant
A Constant is a value that does not change (the opposite of a variable). For example, the Window command can use a constant (i.e., window 5, 36). See also: Expression; Variable.
Encryption
The ISL Encryption Program is a utility that converts a script into an encrypted (hexadecimal) format. It is used as a security precaution for proprietary information.
Equation
An Equation is a mathematical formula. The ISL may use the following operators within a formula: addition (+), subtraction (-), division (/), multiplications (*), greater than (>), or less than (<). Parentheses may be used to isolate parts of the equation, as necessary. See also: Expression; Formula; Operator.
Expression
An Expression is a place holder argument that can be one of the following: User Variable System Variable Constant String Function Equation See also: Argument; Hex Expression; Input Expression; Numeric Expression; String Expression.
Format Specifiers
See: Operators.
Glossary-2
Formula
Formula
A Formula can be used to calculate numeric values, compare one value to another, and select an action based on a comparison, and join multiple string expressions into a single string. The ISL may use the following operators within a formula: addition (+), subtraction (-), division (/), multiplications (*), greater than (>), or less than (<). Parentheses may be used to isolate parts of the equation, as necessary. See also: Equation; Operator.
Function
A Function is a built-in ISL procedure used to evaluate fields, make calculations, or convert data. See also: Expression.
Global Commands
Global Commands are those commands that are allowed outside of an Event procedure. They are initialized at the beginning of each script and then maintained for the duration of that script. The following ISL commands are global: ContinueOnCancel DiscardGlobalVar ExitOnCancel Prorate RetainGlobalVar SetSignOnLeft SetSignOnRight UseCompatFormat UseISLFormat UseISLTimeOuts UseSTDTimeOuts Var See also: Local Commands.
Glossary-3
Global Variable
Global Variable
A Global Variable is declared outside an Event procedure, and usually initialized at the beginning of each script. The value of each global variable is maintained throughout all Events, unless the script is changed or the DiscardGlobalVar command is used. See also: Local Commands.
Hex Expression
A Hex Expression is a variable or function whose value must be a hexadecimal number. This variable is used with the GetHex and Bit functions. See also: Expression.
Input Expression
An Input Expression is an Array or User Variable that requires user input. The input expression is used by the DisplayInput, DisplayMS, Input, and InputKey commands. See also: Array; Expression; User Variable.
Integer
An Integer is a positive or negative whole number or a zero, always without decimal places.
ISL
See: SIM.
Glossary-4
Language Element
Language Element
Language Elements are indivisible pieces of information which, if broken apart with whitespace, will generate an ISL error. The following items are considered language elements: Command Names Function Names System Variables Relational and Boolean Operators Input and Output Specifiers Comment Symbols (//) Continuation Line Symbol (\) Commas Any Word and/or Symbol required by the Syntax
Local Commands
Most ISL commands are considered Local Commands, in that they must be placed inside an Event procedure and only affect the processing within that Event. See also: Global Commands.
Local Variable
A Local Variable must always be declared inside an Event procedure, and will only be used by the Event and any subroutines called by that Event. Local variables are purged after each Event is complete, (when an EndEvent is executed). See also: Global Variables.
Nesting
Nesting is the act of using an If, For, Forever, or While command inside another. Since each of these commands is executed until its corresponding EndIf, EndFor, or EndWhile command is found, the entire If...EndIf, For...EndFor, ForEver...EndFor, or While...EndWhile nest must exist before the outer End... command. Nesting also refers to the ability to call a subroutine from within another subroutine.
Glossary-5
Null String
Null String
A Null String (" ") is a string expression that contains no characters. All string variables are initially set to null at the beginning of each Event procedure. See also: Expression; Variable.
Number of Records
Number of Records is used to send and receive variable amounts of data via a list or a list array.
Numeric Expression
A Numeric Expression is a variable or function whose value must be a number. A number expression is used when specifying a touchscreen number within the 3700 database. See also: Expression.
Offset
An Offset is a decimal integer that is used to calculate a position of a field within a string. For example, this may be used to extract certain field information from a credit card.
Operator
1. An Operator is an employee who is privileged to place orders and/or control guest checks. Each operator maintains their own set of sales totals. Examples of operators include waiters or other order takers who record sales. 2. An Operator is a mathematical symbol that determines what action is taken on variables or constants in the equation. See also: Equation; Formula.
Prompt
A Prompt is a string expression which is displayed in the prompt line of the System Unit display. The prompt is used to instruct the user regarding a required action.
Glossary-6
Script
Script
A Script contains a series of commands, functions, and arguments that perform a particular task at the UWS and/or the PMS.
SIM
The 3700 System Interface Module (SIM) is a software module that allows the 3700 to interface with a variety of other data systems, including sophisticated Property Management Systems (PMS), automated delivery systems, and other electronic database systems. SIM uses an Interface Script Language (ISL), which allows the interface designer to invoke touchscreens, direct operator prompting, define interface message formats and subsequent 3700 System processing, and execute keyboard macros on a UWS.
String
A String is a series of connected characters (letters, numbers, symbols, spaces) stored and used as text. In ISL, a string is always in quotes. See also: Subroutine; User Variable.
String Expression
A String Expression is a variable or function whose value must be a string. See also: Expression.
Subexpression
A Subexpression is an expression within an expression. Subexpressions are used with binary operators. For example in the following expression: a + (b + c) + d, (b + c) is a subexpression. See also: Expression; Operators.
Glossary-7
Subroutine
Subroutine
A Subroutine allows common code to be used by multiple events. Each subroutine has a unique name which is used to define it within the script, outside any Event procedure. Use the Call command to execute a subroutine.
Syntax
A command or function Syntax is used to show the proper usage and rules that are required to execute it correctly within a script.
System Variable
A System Variable is a predefined name that identifies a value which contains information from the 3700 database. See also: Argument; Expression.
Token
A Token can be any individual language element inside a script. See also: Language Element; Token Error.
Token Error
A Token Error can occur any time an individual language element is usedincorrectly. For example, incorrect use of whitespace, missing commas, or erroneous data at the end of a command statement, etc. See also: Language Element; Token.
Glossary-8
User Variable
User Variable
A User Variable is a user-defined name which is assigned a value within a script. The value will remain the same until a newer value is assigned; if no newer value is assigned, the original value is maintained. See also: Argument; Expression.
Variable
A Variable is a container whose value changes (the opposite of a constant). See also: Constant.
Glossary-9
Variable
Glossary-10
Index
Symbols
@ (see System Variables and Print Directives)
E
Edit writing scripts Employee Card Encryption See ISL Encryption Program Error Messages ISL Encryption Program Event...EndEvent command Events initiating Examples Address & Phone Charge Denial Charge Posting 3-3 7-6
A
Account name Account number Adobe Acrobat Reader Asynchronous Serial Interface 7-6 7-6 ii-xii 2-7
B
BASIC compared to ISL 1-3
C
Case Character Length Collecting Customer Information Commands (ISL list) See Online Help Commands (ISL) definition display displayinput displaymsinput event...endevent Comments (//) Continuation Lines (\) Coupons Creating SIM Inquiry Key Creating SIM Tender Key Credit Card Customizing Output 3-9 3-9 1-16
F
Field types and sizes Format Specifiers definition input specifiers output specifiers Reference List See Online Help using Formats, Message See Message Formats Frequent Diners Functions (ISL) definition Reference List See Online Help) 4-12 7-3 to 7-12 1-4, 7-3 7-4 to 7-7 7-7 to 7-12 7-3 1-14 1-4
1-4 7-4, 7-7 7-4, 7-7 7-4, 7-7 3-4 3-9 3-10 1-14 2-11 2-11 7-6 1-16
G
Graphics Character Set See Online Help Graphics Characters Guest Check Information Detail 1-10 1-16
D
Data Entry Database Programming Datatypes abbreviations types of Discount applying to item applying to total Displaying Data 1-11 2-11 4-3 4-3 1-15 1-15 1-9
I
Input Operations Input Specifiers Interface Methods ISL (Interface Script Language) definition event procedures file names and location language elements printing 1-9 7-4 to 7-7 2-7 1-3 1-4 2-12 1-4
Index 1
Index
L
@printstatus backup printing backup printing/reference lines commands and system variables getting started print directives reference strings startprint commands supervised vs unsupervised
structure
5-7 5-11 5-4 5-2 5-2 5-8 5-12 5-3 5-3 3-3 3-4 3-5 3-5
Operators binary boolean definition format See Format Operators Reference List See Online Help relational rules unary Output Operations Output Specifiers
P
PMS Interface Specifications pms###.isl script name Previous Order History Print Directives and subroutines Printing @printstatus backup printing Data error messages 2-3 2-12 1-16 5-10 5-7 5-4, 5-11 1-9 5-4, 5-12 1-11, 5-8 5-5 5-5 5-3 5-3 1-12, 5-4 2-11 2-10 1-10
Case character length comments (//) continuation lines (\) language elements whitespace
variables and ISL Encryption Program definition error messages installing using ISL Events local variable declaration subroutine declaration ISL processing ISLCRYPT.EXE definition
3-9 3-9 3-9 3-10 3-11 3-11 to 3-12 4-2 3-17 3-20 3-17, 3-22 3-19 to 3-20 3-4 3-5 3-5 3-12 3-17, 3-22
StartPrint commands
supervised vs unsupervised Programming the Database action steps quick reference Prompt Line
L
List Arrays and Records Local Variables declaration commands used by subroutines Logical (Boolean) Operators 4-13 to 4-17 3-5 4-11 4-8
R
Receive Messages 3-5
S
Script creating definition editing encrypting naming purpose storing structure of testing writing 3-6 3-3 3-13 3-17 2-12 3-3 2-12 3-3 3-15 3-13 3-13 3-9 to 3-12
M
Magnetic Card Magnetic Card Reader data entry Message Formats fixed ISL 7-6 1-11 2-3 2-3
O
Online Help ii-vi
avoiding errors
writing style
Index 2
Index
T
SIM Applications benefits of examples of types of SIM Inquiry Key function SIM Interface interface methods message formats for SIM See System Interface Module SIM Tender Key creating function key codes Specifiers attributes definition examples input output types of using Storing SIM Scripts System Interface Module accessing enabling features of System Variables array index limits definition embedded index vs array-index ISL printers print type specifying specifying array indices System Variables (ISL) Reference List See Online Help
U
User Variables array variables declaring global variables implicit list_sizes list arrays and records local variables promotion records variable size variables 4-12 4-10 4-11 4-16 4-13 to 4-17 4-11 4-17 to 4-18 4-17 4-12
2-11 1-7 2-11 7-4 7-3 7-8 7-4 7-7 7-3 7-3 2-12 1-6 to 1-11 2-9 to 2-11 1-9 to 1-12 6-5 1-4 6-6 5-6 5-8 6-3 6-4 1-4
V
Variables user variables
W
Whitespace Windows ISL defined 3-11 to 3-12 1-9
T
TCP Interface Tender/Media Form enabling SIM tender key Third-Party System interfacing with Touchscreen displaying data ISL-defined programmed Touchscreen Designer creating SIM Tender key 2-7 2-11 1-8, 1-12 1-10 1-10 1-10 2-11
Index 3
Index
W
Index 4