************************************* * * * DB/C Newsletter * * September 1995 * * * ************************************* Editor's Notes It finally happened. The 'American National Standard for Information Technology - Programming Language - PL/B' is available in printed form. You may purchase a copy for $125 from ANSI at (212) 642-4900. Ask for document number ANSI.X3.238-1994. I was saddened to hear that Mick Jagger sold the right to use one of my favorite Rolling Stones songs to Bill Gates for use in the Windows 95 ad campaign. Mick didn't sell it cheap though. I have read two numbers: $4 million and $12 million. Even if it's only(!) $4,000,000, one has to wonder if using the song will increase Windows 95 sales by 50,000 copies. In any case, we certainly don't want to be left out of the stampede of those converting to Windows 95 - and we want to make sure that you aren't either. For your information, DB/C 8.0 for MS-DOS runs fine on the production release of Windows 95. And we are busy finishing up DB/C 9.0 for Windows which is a 32 bit Windows 95/NT application. The release of DB/C 9.0 will happen when beta testing is complete. We expect that to occur in the next 60 days. Check out the WWW page of Orgaplus, a German distributor of DB/C. Their WWW server is a good example of how to provide marketing information through the Internet. The address is 'http://www.orgaplus.de/'. While you're surfing the net you might check out our updated home page at 'http://www.swc.com/'. In the March 1995 Newsletter we gave an overview of many of the new features in DB/C 9.0. This month we will give the details of syntax and use for some of the features new to DB/C 9.0. don.wills@swc.com Ten New Features in DB/C 9.0 1. Single record unlock The syntax of the unlock statement is: UNLOCK file UNLOCK file, numexp UNLOCK ifile UNLOCK ifile, numexp UNLOCK afile UNLOCK afile, numexp The statement formats that contain 'numexp' are the single record unlock statements. The record whose FPOSIT value is the same as the evaluated value of the numeric expression 'numexp' is unlocked. No other locks are affected. If the value does not correspond with a record that is currently locked, the UNLOCK statement does nothing. 2. Support for linefeed type text files In Windows (MS-DOS) and OS/2 text files, the carriage return and line feed (CR-LF) pair of characters denotes the end of record. In UNIX text files, the line feed (LF) character denotes the end of record. In Mac OS text files, the carriage return (CR) character denotes the end of record. These types of files can be accessed by using the 'TEXT' operand on the FILE, IFILE and AFILE statements that access them. The utilities that read text files (SORT, REFORMAT, INDEX, etc.) can read these files. Also, the '-T' option can be used to create text files that have the appropriate end of record character or characters. DB/C 9.0 allows access to linefeed (or UNIX-type) text files in Windows, OS/2 and Mac OS. This is accomplished by using the new 'DATA' operand on FILE, IFILE and AFILE statements. All utilities will read text files that have a line feed as the end of record character. The new '-D' option of BUILD, CREATE, SORT and REFORMAT will create line feed-only type text files. 3. Move LIST to LIST The syntax for the list form of the move statement is: MOVE listvar to listvar Each individual variable in the source (first listvar) list of variables is moved to the corresponding variable in the destination (second listvar) list of variables. Any variable of type other than numeric or character is ignored and skipped over. Nested lists are expanded. Arrays are treated as a single variable for both source and destination. If any character destination variable value is truncated the EOS flag is set. Otherwise the EOS flag is cleared. 4. NULL numeric and character variable values Numeric variables contain a value. Character variables contain a fixed number of characters along with two pointers (formpointer and lengthpointer) that cause various interpretations of the characters. In DB/C 9.0, numeric and character variables can also take on the NULL value. Note that the NULL value is not the numeric value zero and it is not the null character string value that is implied by a formpointer of zero. To set a variable to the NULL value use the SETNULL statement. The syntax of the setnull statement is: SETNULL list where list is a comma delimited list of character and numeric variables, arrays of character and numeric variables, and list variables. Any numeric reference to a numeric variable that has a NULL value will return the value zero. Any display reference to a numeric variable that has the NULL value will return a string of zero characters. Any reference to a character variable that has the NULL value will also return a string of zero characters. Whenever a variable that has the NULL value is modified in any way, the variable becomes non-NULL. The isnull operator can be used to ascertain if the value of a variable is NULL. ISNULL is a unary operator with precedence the same as unary minus. It returns one if the value of the variable is NULL and zero if the value of the variable is not NULL. The concept of a NULL valued variables corresponds exactly with the SQL NULL value and is very useful in conjunction with SQL. 5. Run-time access to variable names The syntax of the record statement is: label1 RECORD label1 RECORD WITH NAMES label2 RECORD DEFINITION label1 RECORD LIKE label2 label1 RECORD LIKE label2 WITH NAMES RECORDEND The 'WITH NAMES' forms of the record statement allow the getname statement to provide the list variable name (label1) and name of the variables contained in the list. The syntax of the getname statement is: GETNAME variable prep charvar where 'variable' is the source variable and 'charvar' is the destination. The getname statement causes the name of the source variable to be stored in the destination. If the name is not available because the source was not part of a 'WITH NAMES' definition, the OVER flag is set and the destination formpointer and lengthpointer are set to zero. If the name is truncated because the destination is not large enough, the EOS flag is set. 6. The pushreturn and popreturn statements The syntax of the pushreturn and popreturn statements is: PUSHRETURN programlabel PUSHRETURN labelvar POPRETURN labelvar where 'programlabel' is an execution label and 'labelvar' is a label variable. The pushreturn statement causes the program label value to be pushed onto the return stack. If the source label variable contains an invalid value, an E 551 error occurs. If the return stack is full, an E 501 error occurs. The popreturn statement causes the program label value on the top of the return stack to be moved into the destination label variable. The return stack no longer contains the value moved. If there are no entries on the return stack before the popreturn is attempted, the OVER flag is set and the destination label variable is set to an invalid value. The pushreturn and popreturn statements can be used in a manner similar to the call and return statements, except that no parameters are associated with the execution label value stored on the stack. In other words, the pushreturn and popreturn should not be used in a given context until all call parameters have been retrieved with the getparm statement. 7. Program labels in the call parameter list If a parameter in a call with parameters statement is prefixed with the tilde ('~') character, then the label following the tilde is either a label variable or an execution label. The destination of that parameter (in the routine statement) must be a typeless variable (VAR type variable). For example, the following is valid: lblvar1 label call x with ~label1 movelabel label1 to lblvar1 call x with ~lblvar1 label1 beep stop x routine var1 var1 var @ return 8. PCL and Postscript printer output The 'L=PCL' and 'L=PS' options are used in the splopen statement to specify that the resulting print files are HP printer control language (PCL) or Adobe Postscript (PS) compatible, respectively. Here is an example: prtfile pfile splopen prtfile, "JUNK.PRT", "L=PS" When printing to a PCL or PS file, these additional print statement control codes are allowed: *FONT=charexp *LINEWIDTH=numexp *P=hpos:vpos *LINE=hpos:vpos where 'charexp' is the font name, 'numexp' is the width of line (in pixels), hpos is the horizontal position (in pixels), and vpos is the vertical position (in pixels). 9. Compressed index files DB/C 9.0 index files (.ISI) files have a new format that is not backward compatible. The primary advantage of version 9.0 index files is that the index is compressed. The amount of compression depends on the size of the key and on the data, but a decrease in index size to 60% of the version 8.0 size is not unusual. You do not need to re-index your files to run DB/C 9.0. DB/C 9.0 will read and write version 8.0 index files. Therefore, we recommend that when you convert to DB/C 9.0, you continue to use the DB/C 8.0 INDEX utility until you are confident that you don't need to go back to DB/C 8.0. 10. Multiple directories in a single logical volume The format for a DB/C standard filename is: filename.extension:volume where 'filename' is 1 to 8 characters, 'extension' is 1 to 3 characters, and 'volume' is 1 to 8 characters. The 'volume' part of the filename is translated to an operating system directory with this run-time option: DBCVOL_volume=dirlist The 'dirlist' value is a semi-colon delimited list of directories. When a file is accessed, the list of directories is searched for a file with the name matching the 'filename.extension'. When a file is created, the list of directories is searched for a matching file. If a file with the same name is found, the file is created in that directory. If no file is found, then the file is created in the first directory in the list of directories. DB/C Class Schedule The next DB/C class is not yet scheduled.