************************************* * * * DB/C Newsletter * * January 1997 * * * ************************************* Editor's Notes Beta testing of both FSS 1.0 and DB/C 9.1 is progressing well. The release of both products should happen by the end of January. Check the DB/C WWW page later in January for details (www.swc.com/dbc.html). In addition to offering the DB/C classes in Oak Brook, we are probably going to offer the same classes electronically on CD-ROM or video tape. If you have any suggestions about what we should include in the classes or in what form these should be produced, I would like to hear from you. We expect the first of these to be available by April 1997. If you don't already have the DB/C Newsletter delivered to your email address and would like to have it emailed to you once a month, just send an email message to 'majordomo@swc.com' and put the line 'subscribe dbcnews' in the body of the email message (omit the ' characters). The newsletter will be delivered to the email address from which the message was sent. Several people have asked if it is possible to write WWW interface programs in DB/C. The answer is yes and this month's article describes how to do it. If you put a DB/C WWW interface into production, let me know. We would like to share such interesting success stories with the readers of this newsletter. don.wills@swc.com DB/C and CGI The WWW is now mainstream. Wherever you look today in newspapers, in television advertising, and in many other surprising places, you will find WWW page addresses. The purpose of these WWW pages may be advertising, information, commerce or fun. Whatever the purpose, they are everywhere. Many of these WWW pages are becoming more than just passive advertising or information pages - they are interactive. These interactive pages usually have one or more fields that need to be filled out, and then you press a submit or OK button to send the data to the WWW server. The server then responds with a data screen or an appropriate response. This interaction is similar to traditional data entry processing. The Common Gateway Interface (CGI) is the most widely used standard for processing the information that is submitted from interactive WWW pages. It is a fairly simple standard that was originally designed for UNIX, but has been adapted to other WWW server operating systems. Detailed information about the CGI standard can be found at: http://www.w3.org/pub/WWW/CGI/Overview.html A good introductory book about CGI is 'CGI Programming in C & Perl' by Thomas Boutell (Addison Wesley). In this article, we won't go into all of the details of CGI, but we will provide enough information to get you started using DB/C with CGI. To illustrate DB/C and CGI, we will use a simple example that tests to see if a number is prime. This user inputs a number that is sent to the WWW server. The WWW server responds by telling the user whether that number is prime or not. If you want to see this example running, goto this WWW page: http://www.swc.com/prime.html Just fill in the field with a number and click on the Test button. The Hyper Text Markup Language (HTML) is the special language that is used to specify the format of a WWW page. HTML is the output of the various WWW authoring tools like Microsoft Frontpage. By using a tool like Frontpage, you don't actually need to learn HTML. You can also create a WWW page directly with a text editor by just embedding the HTML tags. Here is the complete 'prime.html' file used in our example: Prime Number Tester
Prime Number Tester

Enter number:

Each HTML tag is inside the < > characters. Many HTML tags have a scope of action. The / means end of scope or end of section. The
tag means line break. This tag:
is the tag that defines this WWW page as an input form. The three tags that start with 'Prime number test result" write outfile, seq; "

Prime number test result

" write outfile, seq; *sl, result write outfile, seq; "" close outfile rollout "type outfile.txt" stop . errors error1 move "QUERY_STRING not found" to result goto html error2 move "testnum variable not found" to result goto html error3 move ("value entered is not numeric: " + chop work80) to result goto html . translate + to blank and certain %nn escape strings to corresponding chars translatework80 lroutine work80a char 80 . work variable repchar char 1 . work variable rep "+ " in work80 move 1 to n loop reset work80 move work80 to work80a reset work80 to n scan "%" in work80 break if not equal move "%" to repchar match "%25" to work80 goto xlate1 if equal move "&" to repchar match "%26" to work80 goto xlate1 if equal move "=" to repchar match "%3d" to work80 goto xlate1 if equal match "%3D" to work80 goto xlate1 if equal move " " to repchar . all other characters translate to blank xlate1 movefptr work80 to n bump work80 by 3 if eos reset work80 to n cmove repchar to work80 lenset work80 break endif reset work80a to n cmove repchar to work80a append work80 to work80a reset work80a move work80a to work80 add 1 to n repeat reset work80 return endroutine . end of program And that's all there is to the DB/C CGI interface! DB/C Class Schedule Class Date Location DB/C 9 Fundamentals January 21-23, 1997 Oak Brook, IL DB/C 9 Advanced Features January 28-30, 1997 Oak Brook, IL For information, contact Judi Tamkevic at: voice 630.572.0240 fax 630.572.0390 email dbc@swc.com