Before reading and participating in this tutorial, there are certain things that you need:
- First, this tutorial assumes that you have basic computer skills and basic knowledge of your operating system (such as how to browse for files, run programs, install programs, etc.)
- You should have basic typing and keyboard skills (you should be able to find and describe each key of your keyboard).
- In order to run Business Rules! (abbreviation - BR):
- You need to have full read, write, and delete permissions to the location where Business Rules (BR) is installed. BR will not start without them. If you plan to use Client/Server, then you will also need full permissions on C:\windows\system32\ directory.
- You need to have an active license to use Business Rules! If your license has expired, write down your serial number and contact us at our website. A copy of BR is now available free for individual personal use.
Introduction to Business Rules!
The key to becoming a good programmer is learning to explain things in the language that a computer understands. Computers understand a language that consists of a series of 1s and 0s, which can make talking to a computer pretty tough. What makes it less difficult is “teaching” a computer is a language such as Business Rules!, which uses lots of easy-to-remember words and terms to describe its own functions.
This step-by-step tutorial will show you how to give instructions to a computer using the Business Rules! programming environment. When you finish, you will be familiar with and be able to use most of the Business Rules! capabilities that professional programmers use. You'll be able to write your own code and impress people by making sense out of complex programs.
Before you plunge into the world of programming, there are a few things that you should become familiar with: the operating system you're using, how to enter and exit Business Rules!, how to move around within Business Rules!, and the general form of a Business Rules! syntax sentence.
If you are already familiar with some of this information, we suggest that you quickly skim through the following sections, take the quizzes, and go on to Chapter 1.
This tutorial has been designed to be used with Release 4.1 or later of Business Rules!. If you are using an earlier version, you may notice that Business Rules! sometimes operates differently from what we describe. In most cases the differences are not major, but they may cause you some confusion. Therefore, we highly recommend that you use Release 4.1 or later of Business Rules! with this tutorial if at all possible.
Using this Tutorial
Basic Operation and Programming Fundamentals
This tutorial is written in such a way that no matter which operating system or which version of Business Rules! you use, your programs will run. Business Rules! usually operates the same on all systems; occasionally, we will want to tell you about slight differences that occur from one system to another. You should find out what operating system you are using (such as Windows, Macintosh, or Linux). Keep in mind that although we will alert you to the operating system differences, this tutorial will not teach you how to use your operating system. This will not be a problem once you have started Business Rules!, but you may need to ask for assistance or refer to your system manual for information about what to do before starting or after stopping Business Rules!.
As you become more familiar with programming and with Business Rules!, you will discover that there are three levels of software:
The first level is the operating system. This is the software that directs the complicated electronics involved with the operation of a computer. Some of the most common operating systems are Windows, Macintosh, and Linux.
The second level of software that you will be using is Business Rules!, which is what we call a programming environment or programming language.
The third level of software is the one that you will be writing: application software. It is called application software because it is applied to a specific problem, such as balancing a checkbook or figuring out monthly expenses.
Application software written with Business Rules! runs on top of both the operating system and the Business Rules! system.
The Business Rules! system runs "on top of" the operating system, which means that the operating system must already be installed on the machine before the Business Rules! system can be used.
The model of Business Rules! that a programmer uses would match the type of operating system being used, but all Business Rules! programs work alike under different Business Rules! models. You should also find out which version number of Business Rules! you are using. If you type wbversion$ in the Business Rules! command console and press ENTER, this will print the wbversion$ (version of Business Rules!) that you are presently running in the line below. Keep this in mind until we explain how to start Business Rules! in the next section.
Find your wbversion$ (version of Business Rules!)
Starting Business Rules!
Okay, it's time to start up Business Rules!.
Business Rules! must first be installed to either a hard drive or the server and you MUST have full read, write, and delete permissions to the location where it is installed in order to write a program and run Business Rules!. You must also know the location (drive and sub-directory / folder) of this installation (example below). If you are unsure about either of these two conditions (or about what we're even talking about), you should check with somebody before continuing. This tutorial will start you at the beginning and tell you all that you need to know about the basic capabilities of Business Rules!
Business Rules! needs full permissions in order to work properly and must be installed before you can start.
You may start Business Rules! by running the BR! executable, often named BR32.EXE. It is customary for many BR! programmers to rename the BR! executable as BR.exe or BR32.exe. However, when downloading the BR executable from the ADS FTP site, you will see various BR executables under names such as brnative420-2011-05-10.exe (denotes the Windows standalone executable, version 4.20, released on 5/10/2011). For now, we will refer to the BR executable as BR32.exe
There are two forms of the BR! command. One is for all Linux operating systems, and one is for Windows, Mac and all other operating systems or Business Rules! models. Read the following instructions for your system:
Linux: Enter the command br32 in lower case letters, then press ENTER.
Windows, Mac: Find br32.exe and create a shortcut where it will be easy for you to access.
As soon as you have opened BR32.exe, (in Linux, typed in the appropriate command and pressed ENTER) your screen will go blank for a moment. You will then see a sign-on screen with some information about Business Rules!. This screen is commonly referred to as the splash screen. When the system is ready to use, the splash screen will disappear and a status line will appear at the bottom of the screen. (Press OK to go on with Windows and other non-Linux systems). A message in the left corner of this status line will say "READY"; immediately above the R in this message will be a flashing cursor.
If you typed in the appropriate command and the system gave you an error message, you are probably not accessing the right directory. Check with somebody or refer to your operating system manual about the correct way to do so.
Additionally, SystemPC font is preferred to be installed on your machine. If this font is missing, you will see an error on the first BR startup (but not on subsequent startups, as BR switches to use a different font).
One other important component of the Business Rules programming environment is wbconfig.sys configuration file, usually located in the same directory as the BR executable. The wbconfig.sys file is the configuration file which contains various options and settings used by a specific company.
Newer version of BR which use .br program extensions by default also use brconfig.sys configuration file instead of wbconfig.sys. However, when brconfig.sys file is not found in the same folder as BR32.exe, then BR uses wbconfig.sys file instead as a fallback. In Client/Server configurations, wbconfig.sys file may be in a folder different from where BR32.exe resides. Also, it is possible to specify an alternate configuration file name as a command line argument during BR startup.
Quick Quiz 0.1
- What is the exact command I must use to run Business Rules!?
- What is the drive and directory location of your Business Rules!?
- What operating system are you using?
- What version of Business Rules! are you using?
0.2 Status Line
Start Business Rules! again and take a look at the status line. If you are using the Linux operating system and you cannot see the status line, try pushing the Esc key. This will allow you to view the status line, but you must then push Esc again (which causes the status line to disappear) before going on. If you are using Windows and you cannot see the status line, try typing the command CONFIG STATUSLINE ON and pressing ENTER.
The status line always takes up the bottom row of your screen. It provides you with important information about the status of Business Rules!. It keeps you abreast of what the Business Rules! system is currently doing; it tells you when an error has occurred; and it always displays the serial and release numbers of your version of Business Rules!. Each part of the Status Line is called a "Field". Some fields always display information, and some display information only at special times or when it is needed.
These are the 8 fields of the Status Line in order of their placement from left to right:
- Mode - tells the operator or programmer what mode BR! is in. READY should be a mode that is familiar to you. There are a total of eighteen different modes. You will quickly become familiar with the ERROR, INSERT, ATTN, and INPUT modes.
- Message - contains information about what action is required from the programmer or operator in a particular situation.
- Error Code - contains the error number of the last error that occurred. Every possible error has an error code, used to find the description of the error that has occurred in your program.
- Program Line Number - identifies an important line of the program when the program is in one of the following modes:
- ATTN mode - the line number field contains the number of the program line, which is to be executed next.
- ERROR mode - the line number field contains the number of the program line where the error was discovered.
- PAUSE mode - the line number field contains the number of the program line that contains the PAUSE statement.
- STEP mode - the line number field contains the number of the program line which is to be executed next.
- Program Name - the name you assign the program before saving. The program name portion of the status line displays the last eight characters of the name of the currently executing program.
- Procedure Status - displays information about the currently active procedure file. A "P" followed by a number that represents the nested level of the currently active procedure will appear in this position whenever a procedure or sub-procedure is being executed. When a program calls a procedure, or when a procedure is initiated with the PROC command, "P1" is displayed. If that procedure then calls another procedure, “P2” is displayed, and so on. When no procedure file is running this portion of the status line is blank.
- Serial Number - the number assigned to you when you receive Business Rules!
- Row and Column # of Cursor - tells you where your cursor is currently located on the screen with row and column coordinates.
Here's what it looks like:
Quick Quiz 0.2
1) What part of the status line tells you the mode that Business Rules! is operating in?
a) The READY area, which is in the left corner of the status line.
b) The serial number, which is just right of center in the status line.
c) The MODE area, which is in the left corner of the status line.
2) Each separate item in the status line is a:
3) The first place to find information about an error which has occurred is in:
a) The Business Rules! manual.
b) The error code appendix in this tutorial.
c) The error code and message that appears in the status line.
0.3 Using the keyboard
To get some practice with moving the cursor around within a single Business Rules! line, type in the number 10, an exclamation point, and then hold down the key for the letter W until you have two rows of Ws, as follows:
You should discover that the W is automatically repeated when you hold that key down. You should also discover that the W’s are repeated or wrapped around to the next row when the last space in the first row is filled.
The information that you have just typed in is a Business Rules! statement, called a remark, or comment. The 10 is the program line number, and the exclamation point that appears after it indicates that this line is a remark, not an instruction telling Business Rules! to do something. Business Rules! assumes that anything appearing after a single exclamation point in a program line is a helpful or instructional comment that the programmer is making for his or her own use. We are using it for this example because it allows you to type in anything--whether it makes sense or not--without causing an error.
Quitting Business Rules!
The only proper way to stop Business Rules! (quit or exit BR!) is by using the SYSTEM, SYS or SY command (each of these do the same thing , so you may just want to use SY because it is short). Using this command returns all computer control back to the operating system. Let's try this command out now:
Type in the word SYSTEM, and then press ENTER.
This should cause the status line to disappear, and the operating system (the Windows desktop, or in Linux, the command prompt on a black screen) to appear again. Keep in mind that the SYSTEM command can be used only when the message in the left corner of the status line says READY. Also, be sure to remember that any programs or data that you are working on will be lost forever if you quit Business Rules! before saving them. (Read the next chapter to learn about the SAVE command.)
You probably can guess that there are other ways to stop Business Rules!, such as turning off your machine or using a combination of the Alt, Ctrl and Del keys. These are not good alternatives. They could cause you to lose information. Also, if you are using a multi-user system like Linux, they could cause problems with the system's operation.
Remember that you may restart Business Rules! with br32.exe.
Quick Quiz 0.3
1) Which command allows you to exit Business Rules!?
c) System / sys
2) When you exit the Business Rules! system without first saving the program you are working on, what happens to the program?
a) It becomes lost forever.
b) It remains in the computer's memory until you start Business Rules! again.
c) The Business Rules! system automatically saves it under the name WORKBAK.
Answers: 1-c, 2-a
NEXT: Chapter 1