Installation Instructions

Introduction to CobolScript® / Installation Instructions

C

icon key

Ü Important point

obolScript® is a powerful, easy to use, platform independent, internet-friendly programming language. With it, you will be able to quickly develop and test web-based systems, interface programs, and compact business applications. The natural syntax of CobolScript will help you to start programming productively in a short amount of time, provided you’ve had at least some exposure to other programming languages. This natural syntax, coupled with a variety of network and internet-specific commands, makes CobolScript a great alternative to more cryptic or complicated network programming languages. If you’re an experienced internet developer, we think you’ll find that certain web programming tasks that used to be difficult with your old language will be simple with CobolScript, and as a side benefit, your code will be more manageable and easier to maintain. If you’ve avoided web programming in the past because of its apparent complexity, CobolScript can open the door to a whole new style of application development for you, and can do it with a relatively small effort.

CobolScript is available for Microsoft Windows®, SunOS®, FreeBSD®, and Linux®. Any program developed and tested on one platform can be almost seamlessly ported to another supported platform. And like all web systems, CobolScript web apps can be executed from any machine that has a compatible browser and can access the web that is running CobolScript. For this reason, a well coded, web-based CobolScript system will not require modification if client machines are changed or upgraded, so long as the clients still have compatible browsers installed – a welcome change for anyone who has had to modify applications with client front-ends specific to their operating system.

Alternatively, a single web client can run different CobolScript applications that reside on separate servers. By linking small applications that are located on distinct servers to one another, you can create a complete web system, and the processing for this single, larger system will be spread across the servers. Figure 1.1 illustrates one possible architecture for such a system.


CobolScript Features

In addition to the standard language commands and the internet processing commands available in CobolScript, other features provide the means to quickly and easily create programs with a wide range of functionality:

· Internetworking commands such as FTPPUT, FTPGET, SENDMAIL, and GETMAIL for transferring files and emails from within a CobolScript program.

· File processing commands for reading and parsing both fixed-format and delimited data files.

· Flexible naming syntax that allows underscores ( _ ) and dashes ( - ) to be used interchangeably in variable names, to support both modern variable naming as well as COBOL-style variable naming.

· Advanced expression evaluator that does not require explicit spaces between expression components, even for subtraction operations, for programmers who are used to coding mathematical expressions in C or similar languages.

· Financial functions for calculating annuities and depreciation.

· Scientific, stochastic, and other higher math functions.

· Metric to English and English to metric system unit conversion functions.

· TCP/IP socket programming commands such as SENDSOCKET and RECEIVESOCKET, for creating client-server communications programs without web server software or FTP configuration.

· DNS commands such as GETHOSTNAME for incorporating internet information retrieval into programs.

· PIC X(n) picture clause that automatically calculates variable size based on VALUE clause, eliminating the need for time-consuming computations with FILLER variables, and an implied version of PIC X(n) that allows the FILLER keyword and picture clause to be eliminated entirely.

· REPLICA variable declaration syntax that permits the same elementary data item to be used in multiple group items.

· EXECUTE command for dynamic statement creation and execution.

· Intelligent error messaging that displays browser-based error messages when running programs from a browser, and text-based error messages when running programs from the command line, thereby speeding the debugging process.

Using these CobolScript features, you can develop programs to get and save web pages to text files, transfer files via FTP, send simple emails, retrieve emails, accept data from web page forms, create virtual HTML documents, and perform various file input and output operations.

CobolScript Professional Edition also contains a number of enhancements that enable professional development with CobolScript:

· CobolScript AppMaker, which makes it possible to create executables from CobolScript programs.

· CobolScript CodeBrowser, a browser-based utility to examine your code in colorized form.

· CobolScript LinkMaker, a tool that enables you to directly embed SQL calls in your CobolScript program to access any data source for which you have an ODBC driver. On Unix platforms, LinkMaker is used in conjunction with UnixODBC, a freeware product.

· The CobolScript Control Panel, a graphical administration tool accessible from your web server machine (so long as both CobolScript and web server software are installed), for accessing other CS Professional features, and for administering your CS Professional system.

· Multidimensional array support.

About this Manual

This developer’s guide should serve as both a guide for learning to program with CobolScript, and as a reference for your day-to-day programming. It should provide sufficient instruction for most experienced programmers to learn to develop CobolScript applications; however, in certain instances you may wish to find additional information:

· If you are completely new to the art of programming, you should probably familiarize yourself with introductory programming principles as well. Understanding the basics of programming will reduce the time it takes you to learn CobolScript.

· If you choose to program web applications using CobolScript, you should be familiar with HTML. HTML is relatively easy to learn, and many good web sites and books exist on the topic, so it would be redundant to include an HTML reference in this guide. A number of ‘WYSIWYG’ (What You See Is What You Get) software tools are also freely available and can assist you in prototyping your system and creating the HTML that will be displayed by your programs. Check www.download.com for the latest freeware and shareware WYSIWYG tools.

· Although web programming is addressed in this guide, you may also choose to seek more in-depth coverage of the subject, if, for instance, you want background information about CGI or about concepts not in this manual, such as cookie creation using CGI scripting.

· If you are interested in providing more real-time user feedback than is possible with just CGI scripting, or you want to distribute some of your web served application’s processing to client machines, consider learning more about an appropriate embedded language like JavaScript. These languages’ scripts can be embedded in the HTML that is displayed by your CobolScript programs, so you can provide real-time, client-based processing while still using CobolScript. Our preferred client-side scripting language is JavaScript, since it loads and executes relatively quickly, and will run on both Netscape Navigator® and Internet Explorer®.

If you are looking for books on any of the above topics, we’ve found the Peachpit Press Visual Quickstart Guide series to be affordable, concise, readable for beginners but not overly simplified, and filled with good examples. Peachpit Press is on the Web at www.peachpit.com.

Installing CobolScript

System Requirements

A Pentium®-compatible machine (166 MHz and higher preferred) is required for the Windows®, Linux®, and FreeBSD® versions of CobolScript, a RISC-processor machine for the SunOS® version. 32MB of RAM is recommended for CobolScript Standard, more for programs of substantial size. 64MB of RAM is recommended for CobolScript Professional Edition.

Installing CobolScript on a Windows®-compatible machine

Step 1. Download CobolScript.

Create a directory such as C:\DESKWARE or C:\COBOLSCRIPT where you will keep CobolScript and your CobolScript programs. Download the file(s) to that directory from the Deskware Registered User Web Site. If you have downloaded a zip file (with the extension .zip), unzip it using WinZip or a similar product. The cobolscript.exe file is the CobolScript interpreter, and the .cbl files are the sample CobolScript programs. As you have already discovered because you are reading this, this manual is the file cbmanual.pdf, and requires that you have a free copy of Adobe Acrobat Reader®, version 4.0 or higher, installed on your computer to read and print it.

Step 2. Install CobolScript.

No special configuration is required for CobolScript to run. However, we recommend that you modify your PATH environment variable in your AUTOEXEC.BAT file to point to the location of the CobolScript engine. To do this, first save a copy of your old C:\AUTOEXEC.BAT file to a backup file such as C:\AUTOEXEC.BAK, then open AUTOEXEC.BAT in a text editor such as notepad, and modify the SET PATH= line. For example, if a line in your AUTOEXEC.BAT file reads:

SET PATH=C:\MOUSE;%PATH%;C:\PP\BIN\WIN32

you would change it to:

SET PATH=C:\MOUSE;%PATH%;C:\PP\BIN\WIN32;C:\DESKWARE

if you have saved the CobolScript engine to the C:\DESKWARE directory.

Step 3. Run CobolScript.

CobolScript can be run from the command line. Start an MS-DOS prompt, and type:

cobolscript.exe

to run CobolScript and see the command line options. To run a specific program from the command line, type:

cobolscript.exe <program-name>

where <program-name> is the name of the program you wish to run, along with a path if the program is not in the current directory. For example:

cobolscript.exe test.cbl

cobolscript.exe ..\testdir\test.cbl

Þ Ü

For more information on running CobolScript from the command line, turn to the next chapter, Getting Started with CobolScript.

If you plan to do Web and CGI development, you will probably want to put CobolScript in your web server’s CGI directory. Usually this directory has “cgi” or “cgi-bin” in the name, as in c:\httpd\cgi-bin for the OmniHTTPd web server. Just place the cobolscript.exe file in this directory. See the section titled Running CobolScript from a Web Server and Browser in Chapter 2, Getting Started with CobolScript.

If you don’t already have a web server, OmniHTTPd is a freeware development-quality web server for Windows 95/98/NT®. Search the web for “OmniHTTPd” to find a copy.

Step 4. Configure ODBC on your computer.

If you have CobolScript Professional Edition and you want to access a database using LinkMaker, you will need to set up an ODBC data source on your computer. Refer to Appendix H for complete instructions on how to do this.

Installing CobolScript on a Linux®, SunOS®/Solaris®, or FreeBSD® machine

Step 1. Download CobolScript.

Create a directory such as /deskware or /cobolscript where you will keep CobolScript and your CobolScript programs. Download the file(s) to that directory from the Deskware Registered User Web Site. If you have downloaded the complete file, un-tar it with the appropriate command (depending on your OS). Below are some un-tarring examples:

tar -xvf linuxcob.tar

tar -xvf suncob.tar

tar -xvf bsdcob.tar

Similar steps should be followed with other tar files; just use the same syntax as above and substitute the appropriate filename. The cobolscript.exe file is the CobolScript interpreter, and the .cbl files are the sample CobolScript programs. As you have already discovered because you are reading this, this manual is the file cbmanual.pdf, and requires that you have a free copy of Adobe Acrobat Reader® 4.0 or higher installed on your computer to read and print it. Because there is not a version of Adobe Acrobat Reader® available for FreeBSD, if you have purchased this version of CobolScript you will have to print the manual from an Acrobat®-compatible OS (Windows®, Linux®, IRIX®, HP-UX®, AIX®, Solaris®, Macintosh®, etc.).

Step 2. Install CobolScript.

No special configuration is required for CobolScript to run. However, we recommend that you modify your PATH environment variable to point to the location of the CobolScript engine. To do this permanently (preferred), you can modify the appropriate line of your .profile file in your home directory. For example, if a line in your .profile file reads:

PATH=/bin:/sbin

you should change it to:

PATH=/bin:/sbin:/deskware

in the case where CobolScript is in the /deskware directory. If you are going to run CobolScript from your current directory only, make certain that "./" is also a component of the PATH variable.

To modify your PATH environment variable for the current session only, first type:

echo $PATH

at the command prompt to see the current value of your PATH environment variable. Next, on Linux® or Sun® machines, at the command prompt type:

PATH=$PATH:/deskware

where /deskware is the path to the CobolScript interpreter. In FreeBSD, you should instead type:

setenv PATH oldpath:/deskware

or alternatively:

set path=oldpath:/deskware

where oldpath is the original value of the PATH variable, and /deskware is the path to the CobolScript interpreter. Your path will be changed for the current session.

Step 3. Run CobolScript.

CobolScript can be run from the command line. Bring up an xterm or command prompt, and type:

cobolscript.exe

to run CobolScript and see the command line options. To run a specific program from the command line, type:

cobolscript.exe <program-name>

where <program-name> is the name of the program you wish to run, along with a path if the program is not in the current directory. For example::

cobolscript.exe test.cbl

cobolscript.exe ../testdir/test.cbl

Þ Ü

For more information on running CobolScript from the command line, turn to the next chapter, Getting Started with CobolScript.

If you plan to do Web and CGI development using CobolScript, you will probably want to put CobolScript in your web server’s CGI directory. Usually this directory has “cgi” or “cgi-bin” in the name, as in /home/httpd/cgi-bin on Apache. Just place the cobolscript.exe file in this directory.

If you are doing CGI development and intend to read and write to files in your cgi-bin directory, make certain that the permissions on these files (and on the cgi-bin directory, and its parent directories) are correctly set. Use the chmod command at the command prompt to properly set file permissions. If this is not done, you will encounter difficulties when running scripts from a web browser, since these scripts generally run as user 'nobody', who does not have the same authority as you do when you are logged in at a command prompt, creating these files.

Step 4. Set up ODBC on your computer.

If you have CobolScript Professional Edition and you want to access a database using LinkMaker, you will need to set up an ODBC data source on your computer. Refer to Appendix H for instructions on how to set up UnixODBC (a freeware product from UnixODBC.org) so that you can connect directly to your data source.