home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft_Programmers_Library.7z / MPL / basic / basknow.txt < prev    next >
Encoding:
Text File  |  2013-11-08  |  3.9 MB  |  110,021 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1.  Microsoft BASIC Professional Development System
  2.  =============================================================================
  3.  
  4.  
  5.  1. How Microsoft BASIC ON ERROR Handles DOS General Drive Failure
  6.  
  7.  Product Version(s): 6.00 6.00b 7.00
  8.  Operating System:   MS-DOS
  9.  Flags: ENDUSER | B_QuickBas
  10.  Last Modified:  2-FEB-1990    ArticleIdent: Q19842
  11.  
  12.  Error trapping in Microsoft BASIC programs (invoked with the ON ERROR
  13.  statement) will trap a DOS general drive failure.
  14.  
  15.  A DOS general drive failure occurs if an error occurs while trying to
  16.  read the specified drive (for example, the drive door is not closed or
  17.  the disk is improperly formatted). The general drive failure message
  18.  is usually of the following form:
  19.  
  20.     General failure reading drive A:
  21.     (Abort, Retry, Ignore)?
  22.  
  23.  BASIC error trapping invoked with the BASIC ON ERROR statement traps
  24.  the DOS general drive failure and returns a BASIC error number 57,
  25.  "Device I/O error."
  26.  
  27.  
  28.  2. LIB Errors During SETUP.EXE If Directory Has "-" in Its Name
  29.  
  30.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  31.  Operating System:   MS-DOS          | OS/2
  32.  Flags: ENDUSER |
  33.  Last Modified:  7-FEB-1990    ArticleIdent: Q37304
  34.  
  35.  If you specify a library directory name that contains a minus sign
  36.  (such as LIB-BAS) during the SETUP.EXE program for Microsoft BASIC
  37.  Compiler Version 6.00 or 6.00b, or Microsoft BASIC Professional
  38.  Development System (PDS) Version 7.00, the LIB.EXE manager may have
  39.  problems creating the BASIC stand-alone and run-time libraries.
  40.  
  41.  This problem occurs because when the Library Manager (LIB) is run from
  42.  the SETUP program, it uses the pathname to your library directory in
  43.  its "Operations:+" step and is confused by an operator (such as "-")
  44.  in the directory name.
  45.  
  46.  For example, if you specified the directory name C:\LIB-BAS for your
  47.  BASIC libraries, a library build would look like the following:
  48.  
  49.     Microsoft (R) Library Manager  Version 3.11
  50.     Copyright (C) Microsoft Corp 1983-1988.  All rights reserved.
  51.  
  52.     Library name:BRUN60ER.LIB
  53.     Library does not exist.  Create? (y/n) Y
  54.     Operations:+ C:\LIB-BAS\BRUN60R.LIB
  55.     LIB : error V2155: BAS\BRUN60ER.LIB : module not in library; ignored
  56.     &
  57.     Operations:+ .\B4 ;
  58.     LIB : error V2157: C:\LIB.obj : cannot access file
  59.  
  60.  The LIB thinks the "-" character in the LIB-BAS directory is an extra
  61.  operation trying to subtract BAS\BRUN60ER.LIB. It then tries to add a
  62.  file called C:\LIB.obj, which does not exist.
  63.  
  64.  Then, when trying to compile a BASIC program and link it with the
  65.  BRUN60ER.LIB library, the compile will seem to work correctly, but the
  66.  link can return errors, such as the following:
  67.  
  68.     LINK : warning L4021: no stack segment
  69.     LINK : error L2029: Unresolved externals:
  70.       < here would be a list of the unresolved library references >
  71.  
  72.  If you avoid the following operators in the directory name for BASIC
  73.  libraries, the LIB shouldn't have any problems initially creating the
  74.  libraries:
  75.  
  76.     +  -  -+  *  -*
  77.  
  78.  
  79.  3. How DEFINT, DEFSNG, DEFDBL Affect Type of DEF FN Function
  80.  
  81.  Product Version(s): 5.35 5.36 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  82.  Operating System:   MS-DOS                         | OS/2
  83.  Flags: ENDUSER | B_QuickBas B_BasicInt
  84.  Last Modified: 17-JAN-1991    ArticleIdent: Q21311
  85.  
  86.  This article discusses the default type declaration of DEF FN
  87.  user-defined functions in Microsoft BASIC.
  88.  
  89.  The DEFINT, DEFLNG, DEFDBL, and DEFSNG statements affect the first
  90.  letter of the variable part of a DEF FN function name, and not the FN
  91.  part of the function name. This information applies to all Microsoft
  92.  BASIC compilers and interpreters for MS-DOS, MS OS/2, Macintosh, and
  93.  CP/M-80.
  94.  
  95.  Microsoft BASIC Compiler versions 6.00 and later, and QuickBASIC
  96.  versions 4.00 and later for the IBM PC, introduced the DEFLNG
  97.  statement for long integer declaration, which also behaves this way.
  98.  
  99.  Example
  100.  -------
  101.  
  102.  The following program prints 1.2 (a noninteger):
  103.  
  104.     10 DEFINT F   ' DEFINT F doesn't affect the DEF FN below.
  105.     20 DEF FNAB=1.2
  106.     30 PRINT FNAB
  107.  
  108.  The following program prints 1 (truncated to an integer):
  109.  
  110.     10 DEFINT A   ' DEFINT A does affect the DEF FN below.
  111.     20 DEF FNAB=1.2
  112.     30 PRINT FNAB
  113.  
  114.  
  115.  4. BRUNxx.EXE Run-Time Module Must Reload from Disk After SHELL
  116.  
  117.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  118.  Operating System:   MS-DOS          | OS/2
  119.  Flags: ENDUSER | SR# G881101-5556 B_QuickBas
  120.  Last Modified:  1-FEB-1990    ArticleIdent: Q37767
  121.  
  122.  When the SHELL statement is executed, some portions of the BASIC
  123.  run-time module (BRUNxx.EXE) are unloaded. This is done to free up as
  124.  much memory as possible for COMMAND.COM. When the SHELL is complete,
  125.  the run-time module must be reloaded.
  126.  
  127.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  128.  6.00b for MS-DOS and MS OS/2, Microsoft BASIC Professional Development
  129.  System (PDS) Version 7.00 for MS-DOS and MS OS/2, and to Microsoft
  130.  QuickBASIC Compiler Versions 4.00, 4.00b, 4.50 and earlier for MS-DOS.
  131.  
  132.  If the run-time module is located on a floppy disk removed during the
  133.  SHELL statement, it must be re-inserted before the BASIC program can
  134.  continue. If the program cannot find the run-time module, it will
  135.  prompt you for its location.
  136.  
  137.  To avoid the need to reload the run-time module after SHELL, you can
  138.  compile with the /O (stand alone) option, which includes the run-time
  139.  routines into the BASIC .EXE program at LINK time.
  140.  
  141.  
  142.  5. "Device I/O" Error Using LPRINT or "LPT1:" After a CHAIN
  143.  
  144.  Product Version(s): 6.00 6.00b 7.00
  145.  Operating System:   OS/2
  146.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00
  147.  Last Modified: 17-JAN-1990    ArticleIdent: Q32214
  148.  
  149.  The following problem occurs in OS/2 protected mode programs compiled
  150.  with Microsoft BASIC Compiler Versions 6.00 and 6.00b or Microsoft
  151.  BASIC Professional Development System (PDS) Version 7.00 for MS OS/2.
  152.  Using LPRINT, or sending output to the "LPT1:" device name, then
  153.  chaining to a second routine that uses the printer produces the
  154.  following error:
  155.  
  156.     Device I/O error in line 0 of module PROG2
  157.  
  158.  This problem can be worked around in OS/2 protected mode by sending
  159.  output to the DOS "LPT1" (without a colon) device name instead of
  160.  using LPRINT or "LPT1:". This problem does not occur in OS/2 real
  161.  mode.
  162.  
  163.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  164.  Compiler Versions 6.00 and 6.00b and in Microsoft BASIC PDS Version
  165.  7.00. We are researching this problem and will post new information
  166.  here as it becomes available.
  167.  
  168.  The following chained programs demonstrate the "Device I/O" error.
  169.  These programs must be compiled with the BRUN library option for
  170.  protected mode.
  171.  
  172.     ' prog1
  173.     OPEN "O",15,"LPT1:"
  174.     PRINT #15,"program 1"
  175.     CHAIN "prog2"
  176.  
  177.     ' prog2
  178.     PRINT #15,"program 2"
  179.     CLOSE #15
  180.  
  181.  The problem occurs only when sending output to the BASIC "LPT1:"
  182.  printer device. If the DOS device, "LPT1" (without a colon) is used,
  183.  the problem does not occur. For example, the following programs CHAIN
  184.  correctly:
  185.  
  186.     ' prog1
  187.     OPEN "O",15,"LPT1"
  188.     PRINT #15,"program 1"
  189.     CHAIN "prog2"
  190.  
  191.     ' prog2
  192.     PRINT #15,"program 2"
  193.     CLOSE #15
  194.     SYSTEM
  195.  
  196.  
  197.  6. MS-DOS BASIC Compiler Does Not Provide ISAM File Support
  198.  
  199.  Product Version(s): 5.35 5.36 6.00 6.00b 7.00
  200.  Operating System:   MS-DOS
  201.  Flags: ENDUSER |
  202.  Last Modified:  2-FEB-1990    ArticleIdent: Q21331
  203.  
  204.  Microsoft BASIC Compiler Versions 5.35, 5.36, 6.00, and 6.00b for
  205.  MS-DOS does not support Index Sequential Files (ISAM). You must write
  206.  your own routine or use a third-party vendor's routine that is
  207.  compatible with the BASIC compiler.
  208.  
  209.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  210.  MS-DOS does support ISAM files. BASIC PDS 7.00 currently supports
  211.  single-user ISAM, however.
  212.  
  213.  
  214.  7. A Single-Precision Number as a File Number Causes "Overflow"
  215.  
  216.  Product Version(s): 6.00 6.00b | 6.00 6.00b
  217.  Operating System:   MS-DOS     | OS/2
  218.  Flags: ENDUSER | B_QuickBas
  219.  Last Modified:  2-FEB-1990    ArticleIdent: Q37339
  220.  
  221.  A program compiled with Microsoft BASIC Compiler Version 6.00 or
  222.  6.00b, or QuickBASIC Version 4.00 or 4.00b, generates an "Overflow"
  223.  error message if you are using a single-precision variable as the
  224.  number of a file to be opened.
  225.  
  226.  This behavior does not occur in Microsoft QuickBASIC Version 4.50 for
  227.  MS-DOS or Microsoft BASIC Professional Development System (PDS)
  228.  Version 7.00 for MS-DOS and MS OS/2.
  229.  
  230.  The following sample code demonstrates the problem. If the file number
  231.  "F" is redefined as an integer, the program works correctly. The
  232.  program also can be forced to work correctly using any of the
  233.  following alternatives:
  234.  
  235.  1. By compiling with the /o, /d, /v, or /x compiler-option switches
  236.  
  237.  2. By putting line numbers on affected lines
  238.  
  239.  3. By deleting a few lines of code in the subroutine
  240.  
  241.  Earlier versions of Microsoft QuickBASIC do not have this problem.
  242.  
  243.  The following is an example:
  244.  
  245.     DIM SHARED f9$(22, 9), id$(9), size%(9), fdr$(9)
  246.     CLS
  247.     f = 1
  248.     fi$ = "FILENAME.DAT"
  249.     CALL OPEN.ISAM(f, fi$)
  250.     END
  251.  
  252.     SUB OPEN.ISAM (f, fid$) STATIC
  253.          OPEN "r", f, fid$, 256
  254.             FIELD #f, 256 AS f9$
  255.          fdr$(f) = SPACE$(256)
  256.             size%(f) = LOF(f) / 256
  257.             id$(f) = fid$
  258.     END SUB
  259.  
  260.  
  261.  8. "Feature Unavailable" Using FRE(-3) in .EXE Compiled in 7.00
  262.  
  263.  Product Version(s): 7.00
  264.  Operating System:   MS-DOS
  265.  Flags: ENDUSER | SR# S900125-132
  266.  Last Modified: 26-FEB-1990    ArticleIdent: Q58123
  267.  
  268.  The FRE(-3) function, which returns available expanded memory in the
  269.  QuickBASIC Extended (QBX.EXE) environment, normally gives a "Feature
  270.  Unavailable" (run-time error 73) in .EXE files created with BC.EXE. An
  271.  exception is if an executable .EXE file is linked with overlays that
  272.  are each no larger than 64K, and if a LIM 4.0 EMS expanded memory
  273.  driver (defined below) is installed, then the FRE(-3) function returns
  274.  a value for the amount of free expanded memory. This information
  275.  applies to Microsoft BASIC Professional Development System (PDS)
  276.  Version 7.00 for MS-DOS.
  277.  
  278.  The FRE(-3) function returns the amount of free LIM 4.0 EMS expanded
  279.  memory available for arrays, SUBs, and functions in the QBX.EXE
  280.  environment.
  281.  
  282.  Note that the only way that compiled BASIC .EXE applications can take
  283.  advantage of expanded memory is with linked overlays, but then only if
  284.  each overlay is smaller than 64K. (If expanded memory is not
  285.  accessible, overlays just swap to disk.) The FRE(-3) function returns
  286.  a value for an .EXE program only when a LIM 4.0 EMS driver is
  287.  installed and the .EXE program is able to successfully store its
  288.  overlays in expanded memory.
  289.  
  290.  To check the amount of available expanded memory from an EXE program,
  291.  see Pages 204-206 in Ray Duncan's "Advanced MS-DOS Programming, 2nd
  292.  Edition" (Microsoft Press, 1988). The method described there uses
  293.  assembly language and interrupts.
  294.  
  295.  Note: LIM 4.0 EMS is defined as follows:
  296.  
  297.     LIM  = Lotus, Intel, Microsoft
  298.     4.0  = Version number 4.0 (of the standard LIM EMS)
  299.     EMS  = Expanded Memory Specification, a standard for addressing
  300.            expanded memory
  301.  
  302.  For more information about linker overlays in BASIC PDS 7.00, search
  303.  for a separate article with the following keywords:
  304.  
  305.     BASIC and 7.00 and linker and overlays and modules
  306.  
  307.  Also see Pages 612-614 of the "Microsoft BASIC 7.0: Programmer's
  308.  Guide," in the section "Linking with Overlays".
  309.  
  310.  
  311.  9. LINK Overlays Not Supported in BASIC 6.00/6.00b, or QuickBASIC
  312.  
  313.  Product Version(s): 6.00 6.00b
  314.  Operating System:   MS-DOS
  315.  Flags: ENDUSER | docerr B_QuickBas
  316.  Last Modified: 30-MAY-1990    ArticleIdent: Q31153
  317.  
  318.  Microsoft QuickBASIC versions 1.00, 1.02, 2.00, 2.01, 3.00, 4.00,
  319.  4.00b, and 4.50 for MS-DOS and Microsoft BASIC Compiler versions 6.00
  320.  and 6.00b for MS-DOS do NOT support code overlays. These versions of
  321.  BASIC compiler and QuickBASIC are not designed to output the special
  322.  object format necessary to support overlays under MS-DOS.
  323.  
  324.  The description of LINK.EXE provided in the "Microsoft CodeView and
  325.  Utilities: Software Development Tools for MS-DOS" manual, supplied
  326.  with Microsoft BASIC Compiler versions 6.00 and 6.00b, is a general
  327.  description for the linker. However, this description is misleading.
  328.  Although Pages 285-286 discuss linker overlays, overlays are not
  329.  supported by these versions of BASIC.
  330.  
  331.  Microsoft has introduced support for linker overlays in Microsoft
  332.  BASIC Professional Development System (PDS) version 7.00 under MS-DOS.
  333.  For more information, search for a separate article with the following
  334.  words:
  335.  
  336.     how and use and LINK and overlays and BASIC and PDS and 7.00
  337.  
  338.  Other Microsoft languages, such as Microsoft C and Microsoft FORTRAN,
  339.  also support linker overlays.
  340.  
  341.  The error message "L2048 cannot find overlay manager" will be
  342.  generated if you try to link with overlays using BASIC compiler
  343.  version 6.00.
  344.  
  345.  Overlays are useful in a memory-restricted environment because overlay
  346.  capability allows programs to load portions of code from disk into
  347.  memory when needed, and overlays in memory not currently being used
  348.  are automatically swapped out when loading the needed overlays.
  349.  
  350.  The CHAIN, RUN, and SHELL statements in BASIC offer capabilities that
  351.  are similar to code overlays, but more limited.
  352.  
  353.  
  354.  10. "Formal Parameter Specification Illegal" from BC But Not QB
  355.  
  356.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  357.  Operating System:   MS-DOS          | OS/2
  358.  Flags: ENDUSER | B_QuickBas
  359.  Last Modified:  2-FEB-1990    ArticleIdent: Q27856
  360.  
  361.  For the following statement, the BC.EXE compiler correctly generates
  362.  the compile-time error message "Formal parameter specification
  363.  illegal," while the QuickBASIC QB.EXE editor does not produce any
  364.  error messages:
  365.  
  366.     DECLARE SUB prompt (prompt$)
  367.  
  368.  This error message results from the requirement in QuickBASIC Versions
  369.  4.00, 4.00b, and 4.50, in Microsoft BASIC Compiler Versions 6.00 and
  370.  6.00b, and in Microsoft BASIC Professional Development System (PDS)
  371.  Version 7.00 that procedure and variable names must be different.
  372.  Therefore, programs may not contain functions or subprograms whose
  373.  names are the same as those of variables.
  374.  
  375.  Note that the QB.EXE environment of QuickBASIC Versions 4.00, 4.00b,
  376.  and 4.50 and the QBX.EXE environment of BASIC PDS 7.00 correctly gives
  377.  you a "Duplicate Definition" error on the following CALL or SUB
  378.  statement:
  379.  
  380.     CALL PROMPT(PROMPT$)
  381.  
  382.  Therefore, the lack of warning of "Duplicate Definition" for the
  383.  DECLARE statement is a minor issue.
  384.  
  385.  An error message occurs even in the case in which the variable and
  386.  procedure names differ by a data-typing character (for example, %, &,
  387.  !, #, $). The error message displays because the compiler makes no
  388.  distinction between the variable "prompt$" and the subprogram name
  389.  "prompt".
  390.  
  391.  The requirement that procedure and variable names be different was
  392.  introduced in QuickBASIC Version 4.00 and BASIC compiler Version 6.00.
  393.  This was not a requirement in earlier versions.
  394.  
  395.  
  396.  11. "Error During Run-Time Initialization": Mixing /FPa and /FPi
  397.  
  398.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  399.  Operating System:   MS-DOS               | OS/2
  400.  Flags: ENDUSER | B_QuickBas
  401.  Last Modified:  4-SEP-1990    ArticleIdent: Q31505
  402.  
  403.  When you link separate modules together to make an .EXE program, all
  404.  the modules must have been compiled with the same math package. The
  405.  two math packages available in Microsoft BASIC Compiler versions 6.00
  406.  and 6.00b and in Microsoft BASIC Professional Development System (PDS)
  407.  versions 7.00 and 7.10 are as follows:
  408.  
  409.  1. BC /FPi (IEEE coprocessor-emulation math, the default)
  410.  2. BC /FPa (alternate math)
  411.  
  412.  If you LINK modules or libraries together that were compiled with both
  413.  the BC /FPa and /FPi options, the .EXE program gives the following
  414.  error message at run time and usually hangs:
  415.  
  416.     Error during run-time initialization
  417.  
  418.  Combining math packages can cause unpredictable results in the .EXE
  419.  program at run time. After the error message appears, a warm boot
  420.  (CTRL+ALT+DEL) does not work. To reboot, you must turn the computer
  421.  off, then back on.
  422.  
  423.  To avoid this problem, make sure when you LINK routines that they were
  424.  compiled with the same math package. Also, remember that the QB.EXE
  425.  environment of the BASIC compiler and the QBX.EXE environment of BASIC
  426.  PDS 7.00 and 7.10 do not support the alternate math package. In other
  427.  words, object modules compiled with the /FPa switch cannot be placed
  428.  into a Quick library (.QLB file) for use in QB.EXE or QBX.EXE.
  429.  
  430.  
  431.  12. PCOPY & Multiple Pages Not Supported in MS OS/2 Protected Mode
  432.  
  433.  Product Version(s): 6.00 6.00b 7.00
  434.  Operating System:   OS/2
  435.  Flags: ENDUSER | SR# G880910-3123 docerr
  436.  Last Modified:  2-FEB-1990    ArticleIdent: Q35519
  437.  
  438.  Multiple video pages are not supported in the protected mode of MS
  439.  OS/2. As stated on Page 40 of the "Microsoft BASIC Compiler 6.0:
  440.  User's Guide" and on Page 522 of the "Microsoft BASIC 7.0:
  441.  Programmer's Guide," the SCREEN function ignores the active and visual
  442.  page parameters.
  443.  
  444.  Since multiple pages are not supported, the PCOPY function is not
  445.  allowed in MS OS/2 protected mode. This fact needs to be added to the
  446.  section on BASIC language changes for MS OS/2 protected mode.
  447.  
  448.  Through BASIC, there is no way to manipulate the video buffer directly
  449.  in MS OS/2 protected mode. However, it can be done through the use of
  450.  OS/2 API calls. The following API calls can be used to modify the
  451.  video buffer:
  452.  
  453.     VioGetBuf
  454.     VioShowBuf
  455.     VioGetPhysBuf
  456.     VioScrLock
  457.     VioScrUnLock
  458.  
  459.  The VioGetBuf function retrieves the address and length of the logical
  460.  video buffer (LVB). The address of the buffer is returned in a long.
  461.  The high 2 bytes are the segment and the low 2 bytes are the offset,
  462.  as in the following example:
  463.  
  464.     x = VioGetBuf(pointer, length, 0)
  465.     segment& = pointer / &H10000
  466.     offset& = pointer MOD &H10000
  467.  
  468.  To modify the buffer, change the segment to the segment value returned
  469.  and use PEEK and POKE to read and modify the information. Once the
  470.  information is changed, VioShowBuf is used to display the changes.
  471.  
  472.  The VioGetPhysBuf function retrieves the selector of the physical
  473.  video buffer. The physical video buffer contains the current screen
  474.  image. To modify the screen, change the segment to the selector
  475.  returned and use PEEK and POKE to read and modify the screen. This
  476.  method is faster than using VioGetBuf/VioShowBuf because you are
  477.  directly modifying the screen.
  478.  
  479.  For more information about these VIO API calls, please refer to your
  480.  OS/2 documentation. Listed below are two sample programs that use the
  481.  methods discussed above.
  482.  
  483.  Code Examples
  484.  -------------
  485.  
  486.  'The following program uses VioGetPhysBuf:
  487.  DEFINT A-Z
  488.  TYPE PhysBufData
  489.       bufstart AS LONG
  490.       buflength AS LONG
  491.       selector1 AS INTEGER
  492.       selector2 AS INTEGER
  493.  END TYPE
  494.  
  495.  DECLARE FUNCTION VioGetBuf (_
  496.     SEG p1 AS LONG,_
  497.     SEG p2 AS INTEGER,_
  498.     BYVAL p3 AS INTEGER)
  499.  
  500.  DECLARE FUNCTION VioShowBuf (_
  501.     BYVAL p1 AS INTEGER,_
  502.     BYVAL p2 AS INTEGER,_
  503.     BYVAL p3 AS INTEGER)
  504.  
  505.  DECLARE FUNCTION VioGetPhysBuf (_
  506.     SEG p1 AS PhysBufData,_
  507.     BYVAL p2 AS INTEGER)
  508.  
  509.  DECLARE FUNCTION VioScrLock (_
  510.     BYVAL p1 AS INTEGER,_
  511.     SEG p2 AS INTEGER,_
  512.     BYVAL p3 AS INTEGER)
  513.  
  514.  DECLARE FUNCTION VioScrUnLock (_
  515.     BYVAL p1 AS INTEGER)
  516.  
  517.  CLS
  518.  FOR i = 1 TO 10
  519.      PRINT "This is a test"
  520.  NEXT i
  521.  DIM stuff AS PhysBufData
  522.  x = VioScrLock(1, status, 0)
  523.  PRINT
  524.  PRINT "Lock Status: "; status
  525.  stuff.bufstart = &HB8000
  526.  stuff.buflength = 43 * 80 * 2
  527.  x = VioGetPhysBuf(stuff, 0)
  528.  IF (x) THEN
  529.      PRINT "Error: "; x; " occurred."
  530.      END
  531.  ELSE
  532.      PRINT
  533.      PRINT "Start: "; HEX$(stuff.bufstart)
  534.      PRINT "Length: "; stuff.buflength
  535.      PRINT "Selector1: "; stuff.selector1
  536.      PRINT "Selector2: "; stuff.selector2
  537.      PRINT
  538.      PRINT
  539.      PRINT "Enter a key to begin changing..."
  540.      WHILE INKEY$ = "": WEND
  541.      offset = 0
  542.      DEF SEG = stuff.selector1
  543.      FOR i = offset TO offset& + stuff.buflength - 1 STEP 2
  544.         POKE i, 65     'Character
  545.         POKE i + 1, &H17'Attribute
  546.      NEXT i
  547.      DEF SEG
  548.      x = VioScrUnLock(0)
  549.  END IF
  550.  PRINT "Enter a key to quit..."
  551.  WHILE INKEY$ = "": WEND
  552.  END
  553.  
  554.  'The following program uses VioGetBuf/VioShowBuf:
  555.  DEFINT A-Z
  556.  TYPE PhysBufData
  557.       bufstart AS LONG
  558.       buflength AS LONG
  559.       selector1 AS INTEGER
  560.       selector2 AS INTEGER
  561.  END TYPE
  562.  
  563.  DECLARE FUNCTION VioGetBuf (_
  564.     SEG p1 AS LONG,_
  565.     SEG p2 AS INTEGER,_
  566.     BYVAL p3 AS INTEGER)
  567.  
  568.  DECLARE FUNCTION VioShowBuf (_
  569.     BYVAL p1 AS INTEGER,_
  570.     BYVAL p2 AS INTEGER,_
  571.     BYVAL p3 AS INTEGER)
  572.  
  573.  DECLARE FUNCTION VioGetPhysBuf (_
  574.     SEG p1 AS PhysBufData,_
  575.     BYVAL p2 AS INTEGER)
  576.  
  577.  DECLARE FUNCTION VioScrLock (_
  578.     BYVAL p1 AS INTEGER,_
  579.     SEG p2 AS INTEGER,_
  580.     BYVAL p3 AS INTEGER)
  581.  
  582.  DECLARE FUNCTION VioScrUnLock (_
  583.     BYVAL p1 AS INTEGER)
  584.  
  585.  CLS
  586.  FOR i = 1 TO 10
  587.      PRINT "This is a test"
  588.  NEXT i
  589.  DIM pointer AS LONG
  590.  DIM length AS INTEGER
  591.  DIM handle AS INTEGER
  592.  x = VioGetBuf(pointer, length, 0)
  593.  segment& = pointer / &H10000
  594.  offset& = pointer MOD &H10000
  595.  IF (x) THEN
  596.      PRINT "Error: "; x; " occurred."
  597.      END
  598.  ELSE
  599.      PRINT "POINTER = "; HEX$(pointer)
  600.      PRINT "LENGTH = "; length
  601.      PRINT
  602.      PRINT "SEGMENT = "; HEX$(segment&)
  603.      PRINT "OFFSET = "; HEX$(offset&)
  604.      PRINT
  605.      PRINT "Enter a key to begin changing the buffer..."
  606.      WHILE INKEY$ = "": WEND
  607.      CLS
  608.      DEF SEG = segment&
  609.      FOR i = offset TO offset& + length - 1 STEP 2
  610.        POKE i, 65     'Character
  611.        POKE i + 1, &H17'Attribute
  612.      NEXT i
  613.      DEF SEG
  614.      PRINT "Enter a key to see the changes..."
  615.      WHILE INKEY$ = "": WEND
  616.      x = VioShowBuf(0, length, 0)
  617.  END IF
  618.  PRINT "Enter a key to quit..."
  619.  WHILE INKEY$ = "": WEND
  620.  END
  621.  
  622.  
  623.  13. ERDEV & ERDEV$ "Advanced Feature" Error in OS/2 Protected Mode
  624.  
  625.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  626.  Operating System:   MS-DOS               | OS/2
  627.  Flags: ENDUSER | docerr
  628.  Last Modified:  8-JAN-1991    ArticleIdent: Q35653
  629.  
  630.  The statements ERDEV and ERDEV$ give the run-time error message
  631.  "Advanced Feature Unavailable" when compiled and run in OS/2 protected
  632.  mode because these functions are set by DOS interrupt 24H, which is
  633.  not available in OS/2 protected mode.
  634.  
  635.  ERDEV and ERDEV$ are not supported in OS/2 protected mode. This
  636.  restriction should be added to Page 40 of the "Microsoft BASIC
  637.  Compiler 6.0: User's Guide" for Versions 6.00 and 6.00b and to Page
  638.  520 of the "Microsoft BASIC 7.0: Programmer's Guide" for Microsoft
  639.  BASIC Professional Development System (PDS) Versions 7.00 and 7.10.
  640.  
  641.  Code Example
  642.  ------------
  643.  
  644.  I% = ERDEV
  645.  A$ = ERDEV$
  646.  
  647.  
  648.  14. /FPa; "Symbol Defined More Than Once" Linking BASIC and Pascal
  649.  
  650.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  651.  Operating System:   MS-DOS          | OS/2
  652.  Flags: ENDUSER | SR# G880915-3308 buglist6.00 buglist6.00b buglist7.00
  653.  Last Modified:  2-MAR-1990    ArticleIdent: Q35902
  654.  
  655.  If you compile Microsoft BASIC and Microsoft Pascal modules with the
  656.  alternate-math library (/FPa) option, a "Symbol Defined More than
  657.  Once" error occurs when you LINK the BASIC and Pascal modules. This
  658.  problem occurs in Microsoft BASIC Compiler Versions 6.00 and 6.00b for
  659.  MS-DOS and MS OS/2, and in Microsoft BASIC Professional Development
  660.  System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  661.  
  662.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  663.  Compiler Versions 6.00 and 6.00b and in Microsoft BASIC PDS Version
  664.  7.00. We are researching this problem and will post new information
  665.  here as it becomes available.
  666.  
  667.  The programs correctly link together if you compile the BASIC program
  668.  with the stand-alone (BC /O) option.
  669.  
  670.  To duplicate the problem, follow the steps below:
  671.  
  672.  1. Compile the BASIC program -- BC prog /Fpa;
  673.  
  674.  2. Compile the Pascal routine -- PL /FPa /C  progr.pas
  675.  
  676.  3. Link the BASIC and Pascal modules -- LINK prog + progr /noe;
  677.  
  678.  4. The linker displays the following error:
  679.  
  680.        LIBPASA.LIB(fcall.ASM) : error L2025: __fpmath : symbol defined
  681.        more than once
  682.        pos: 1339E Record type: 7F04
  683.  
  684.  
  685.  
  686.  15. How to Call OS/2 Function DosAllocHugeSeg and DosGetHugeShift
  687.  
  688.  Product Version(s): 6.00 6.00b 7.00
  689.  Operating System:   OS/2
  690.  Flags: ENDUSER |
  691.  Last Modified:  1-FEB-1990    ArticleIdent: Q35904
  692.  
  693.  Below is a sample program that makes a call to the MS OS/2 functions
  694.  DosAlocHugeSeg, DosGetHugeShift, DosReallocHuge, and DosMemAvail. This
  695.  program can be compiled in Microsoft BASIC Compiler Versions 6.00 and
  696.  6.00b for MS OS/2 and Microsoft BASIC Professional Development System
  697.  (PDS) Version 7.00 for MS OS/2.
  698.  
  699.  The following is code example:
  700.  
  701.  DECLARE FUNCTION DosAllocHuge%(_
  702.                   BYVAL P1 AS INTEGER,_
  703.                   BYVAL P2 AS INTEGER,_
  704.                   SEG P3 AS INTEGER,_
  705.                   BYVAL P4 AS INTEGER,_
  706.                   BYVAL P5 AS INTEGER)
  707.  
  708.  DECLARE FUNCTION DosGetHugeShift%(SEG P1 AS INTEGER)
  709.  
  710.  DECLARE FUNCTION DosReallocHuge%(_
  711.                   BYVAL P1 AS INTEGER,_
  712.                   BYVAL P2 AS INTEGER,_
  713.                   BYVAL P3 AS INTEGER)
  714.  
  715.  DECLARE FUNCTION DosMemAvail%(SEG P1 AS LONG)
  716.  
  717.  DEFINT A-Z
  718.  DIM mem AS LONG
  719.  
  720.  CLS
  721.  MEM=0
  722.  x=DosMemAvail%(mem)
  723.  
  724.  IF (x) THEN
  725.     PRINT "An error occurred.  The number is : ";x
  726.  ELSE
  727.     PRINT "The amount of available memory is : ";mem
  728.  END IF
  729.  
  730.  INPUT "Enter the number of Segments : ";NUMSEG
  731.  
  732.  SIZE=0
  733.  SELECTOR=0
  734.  SHAREID=0
  735.  input "Enter the Number of MAXSEG for REALLOCATION: ";MAXNUMSEG
  736.  print
  737.  x=DosAllocHuge%(numseg,size,selector,shareid,maxnumseg)
  738.  
  739.  IF (x) THEN
  740.     Print "An error occurred.  The number is : ";x
  741.  ELSE
  742.     PRINT "The selector is : ";selector
  743.  END IF
  744.  SHIFTCOUNT=0
  745.  
  746.  x=DosGetHugeShift%(shiftcount)
  747.  
  748.  IF (x) THEN
  749.     Print "An error occurred.  The number is : ";x
  750.  ELSE
  751.     PRINT "The Huge Shift Count is : ";shiftcount
  752.  END IF
  753.  
  754.  print
  755.  INPUT "Enter the number of segments in reallocation : ";NUMSEG
  756.  SIZE=0
  757.  print
  758.  x=DosReAllocHuge%(numseg,size,selector)
  759.  
  760.  IF (x) THEN
  761.     Print "An error occurred.  The number is : ";x
  762.  ELSE
  763.     PRINT "Memory was been reallocated"
  764.  END IF
  765.  
  766.  end
  767.  
  768.  
  769.  16. Example of BASIC Calling MS OS/2 Function DosStartSession
  770.  
  771.  Product Version(s): 6.00 6.00b 7.00
  772.  Operating System:   OS/2
  773.  Flags: ENDUSER |
  774.  Last Modified:  1-FEB-1990    ArticleIdent: Q35905
  775.  
  776.  Below is a sample program that makes a call to the MS OS/2 function
  777.  DosStartSession. This program can be compiled in Microsoft BASIC
  778.  Compiler Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC
  779.  Professional Development System (PDS) Version 7.00.
  780.  
  781.  The full pathname must be specified for the program to be executed. If
  782.  this is not done when you are using OS/2 Version 1.00, an error 203 is
  783.  generated. OS/2 Version 1.10 and 1.20 produce an error 2.
  784.  
  785.  The following is a code example:
  786.  
  787.  'This information can be found in BSEDOSPC.BI
  788.  TYPE ADDRESS
  789.    Offset    as INTEGER
  790.    Segment   as INTEGER
  791.  END TYPE
  792.  
  793.  TYPE STARTDATA
  794.    cb    as INTEGER
  795.    Related   as INTEGER
  796.    FgBg      as INTEGER
  797.    TraceOpt  as INTEGER
  798.    PgmTitle  as ADDRESS
  799.    PgmName   as ADDRESS
  800.    PgmInputs as ADDRESS
  801.    TermQ     as ADDRESS
  802.  END TYPE
  803.  
  804.  DECLARE FUNCTION DosStartSession%(_
  805.                   SEG P1 AS StartData,_
  806.                   SEG P2 AS INTEGER,_
  807.                   SEG P3 AS INTEGER)
  808.  
  809.  DIM info AS STARTDATA
  810.  DIM apinputs AS ADDRESS, apname AS ADDRESS, aptitle AS ADDRESS
  811.  DIM title AS STRING*32
  812.  DIM flname AS STRING*32
  813.  DIM pinput AS STRING*32
  814.  
  815.  title="BASIC TEST"+chr$(0)
  816.  INPUT "Enter filename with extension", flname
  817.  flname=flname+chr$(0)
  818.  pinput=chr$(0)
  819.  
  820.  apname.segment=varseg(flname)
  821.  apname.offset=varptr(flname)
  822.  
  823.  apinputs.segment=varseg(pinputs)
  824.  apinputs.offset=varptr(pinputs)
  825.  
  826.  aptitle.segment=varseg(title)
  827.  aptitle.offset=varptr(title)
  828.  
  829.  info.cb=24
  830.  info.Related=0
  831.  info.FgBg=1
  832.  info.TraceOpt=0
  833.  info.PgmTitle=aptitle
  834.  info.PgmName=apname
  835.  info.PgmInputs=apinputs
  836.  
  837.  y=DosStartSession%(info,a%,b%)
  838.  
  839.  if (y) then
  840.     print "An error occurred.  The number is : ";y
  841.  else
  842.     Print "Successful"
  843.     while inkey$="" :wend
  844.  end if
  845.  END
  846.  
  847.  
  848.  17. LINE Statement with BF Option Outside Window Will Hang
  849.  
  850.  Product Version(s): 6.00   | 6.00
  851.  Operating System:   MS-DOS | OS/2
  852.  Flags: ENDUSER | buglist6.00 fixlist6.00b SR# S881221-109 viewport
  853.  Last Modified: 17-JAN-1990    ArticleIdent: Q40546
  854.  
  855.  If a LINE statement with the BF (box filled) option is executed
  856.  outside the boundaries of the physical view port set up by the VIEW
  857.  statement, the computer will hang. The program runs properly inside
  858.  the QuickBASIC QB.EXE environment, but fails when compiled with BC.EXE
  859.  from Microsoft BASIC Compiler Version 6.00.
  860.  
  861.  Microsoft has confirmed this to be a problem with BC.EXE in Microsoft
  862.  BASIC Compiler Version 6.00. This problem was corrected in Microsoft
  863.  BASIC Compiler Version 6.00b.
  864.  
  865.  This problem does not occur in Microsoft QuickBASIC Versions 4.00,
  866.  4.00b, and 4.50, or in Microsoft BASIC Professional Development System
  867.  (PDS) Version 7.00.
  868.  
  869.  The following program sets up a physical view port with the VIEW
  870.  statement and then draws a line using the BF option, starting inside
  871.  the box and moving outside the window's boundaries. If the program is
  872.  compiled with Version 6.00 of Microsoft BASIC Compiler, the program
  873.  will hang upon attempting to draw the first box that lies outside the
  874.  window view port.
  875.  
  876.  The following is a code example:
  877.  
  878.  SCREEN 2
  879.  xmin = 0: ymin = 0
  880.  xmax = 1000: ymax = 1000
  881.  dx = (xmax - xmin) / 10
  882.  dy = (ymax - ymin) / 10
  883.  VIEW (200, 50)-(400, 150)
  884.  WINDOW SCREEN (xmin, ymin)-(xmax, ymax)
  885.  LINE (xmin, ymin)-(xmax, ymax), 1, B
  886.  x0 = xmin
  887.  loop1:  x0 = x0 + dx
  888.          LOCATE 5, 35: PRINT USING "x0=####"; x0
  889.          LINE (x0, ymin + dy)-(x0 + 5, ymax - dy), 1, BF
  890.  stall:  x$ = INKEY$: IF x$ = "" THEN GOTO stall
  891.          IF x$ = CHR$(27) THEN END
  892.          GOTO loop1
  893.  
  894.  
  895.  18. BUILDRTM Puts C Routines in BC 6.00 Extended Run-Time Library
  896.  
  897.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  898.  Operating System:   MS-DOS          | OS/2
  899.  Flags: ENDUSER |
  900.  Last Modified:  2-FEB-1990    ArticleIdent: Q37092
  901.  
  902.  You can include Microsoft C routines in a Microsoft BASIC Compiler
  903.  Version 6.00 or 6.00b or a Microsoft BASIC Professional Development
  904.  System (PDS) Version 7.00 extended run-time library by using the
  905.  BUILDRTM utility, provided that the C routine does not have C graphics
  906.  support (such as GRAPH.H). The following is an example of this for a
  907.  void function called "test" located in a source file named PROG1.C:
  908.  
  909.  1. Compile the C program with the medium or large model as follows:
  910.  
  911.        CL prog1 /Al
  912.  
  913.  2. Create an export list and include the new routine(s) to be added to
  914.     the BASIC compiler extended run-time library, as follows (call this
  915.     file "EXP.LST"):
  916.  
  917.        #Here is the export list example.
  918.        #OBJECTS
  919.        prog1
  920.        #EXPORTS
  921.        _test
  922.        #LIBRARIES
  923.        llibcer.lib
  924.  
  925.  3. Invoke BUILDRTM using the EXP.LST to create the new run-time
  926.     library with the following:
  927.  
  928.        BUILDRTM /LR /FPI NEWRUN EXP.LST
  929.  
  930.  The above steps are covered more completely on Pages 13-19 of the
  931.  "Microsoft BASIC Compiler 6.0: User's Guide" or Pages 661-668 of the
  932.  "Microsoft BASIC 7.0: Programmer's Guide."
  933.  
  934.  The above steps produce a new run-time library called "NEWRUN.EXE" and
  935.  a matching "NEWRUN.LIB" file. Now your Microsoft BASIC programs can be
  936.  linked with NEWRUN to allow a program to call the C void function
  937.  "_test" at any time. For example, if you want your new BASIC program,
  938.  named PROG2.BAS, to call "_test," compile normally as follows:
  939.  
  940.     BC PROG2.BAS;
  941.  
  942.  This produces the PROG2.OBJ file. Then link with your new extended
  943.  run-time library using IMPORT.OBJ as the first object file. This helps
  944.  LINK understand that there are more support routines than the standard
  945.  run-time library. The following is an example:
  946.  
  947.     LINK IMPORT.OBJ+PROG2.OBJ,PROG2.EXE,,NEWRUN.LIB/NOD;
  948.  
  949.  This produces the .EXE file PROG2.EXE, which requires the NEWRUN.EXE
  950.  extended run-time library to run.
  951.  
  952.  
  953.  19. Asynchronous SHELL Leaves Cursor Turned Off in New Process
  954.  
  955.  Product Version(s): 6.00 6.00b 7.00
  956.  Operating System:   OS/2
  957.  Flags: ENDUSER |
  958.  Last Modified:  2-FEB-1990    ArticleIdent: Q28157
  959.  
  960.  The following program starts CMD.EXE as an asynchronous process.
  961.  However, CMD.EXE starts without a cursor visible.
  962.  
  963.     x=SHELL("CMD.EXE")
  964.  
  965.  This is because there can be only one cursor on the screen at a time.
  966.  When you do an asynchronous shell, the shelled program is subordinate
  967.  to the main program that controls the screen/keyboard. Thus the cursor
  968.  displayed is that of the main program. The cursor is turned off
  969.  immediately after the shell (in the main program), so it disappears
  970.  from the screen. If the cursor is explicitly turned on in the main
  971.  program, there will be a cursor in the (asynchronously) shelled
  972.  program.
  973.  
  974.  
  975.  20. Bound EXE Must Run on DOS 2.10 Default Drive
  976.  
  977.  Product Version(s): 6.00 6.00b | 6.00 6.00b
  978.  Operating System:   MS-DOS     | OS/2
  979.  Flags: ENDUSER | docerr
  980.  Last Modified:  2-FEB-1990    ArticleIdent: Q27904
  981.  
  982.  The following is a change/addition to Page 3 of the "Microsoft BASIC
  983.  Compiler 6.0: User's Guide" for Versions 6.00 and 6.00b:
  984.  
  985.     If you use DOS Version 2.10, note that all bound executable files
  986.     must be run from the default disk drive. (A "bound executable" is a
  987.     Family API application, which can run under OS/2 protected mode,
  988.     OS/2 real mode, or MS-DOS.)
  989.  
  990.  Note: This correction does not apply to the documentation for
  991.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  992.  because BASIC PDS 7.00 requires DOS Version 3.00 or later.
  993.  
  994.  For instance, if the default drive is A, the following command does
  995.  not work:
  996.  
  997.     B:SETUP
  998.  
  999.  Before running a bound executable file under DOS Version 2.10, you
  1000.  should move to the directory and drive that contain that file.
  1001.  
  1002.  The above is not a limitation with bound executable files under DOS
  1003.  Versions 3.x.
  1004.  
  1005.  This information is taken from the README.DOC disk file.
  1006.  
  1007.  
  1008.  21. Sample Program That Makes OS/2 CALL DosSetDateTime
  1009.  
  1010.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1011.  Operating System:   MS-DOS          | OS/2
  1012.  Flags: ENDUSER |
  1013.  Last Modified:  2-FEB-1990    ArticleIdent: Q27905
  1014.  
  1015.  Below is an example of how to make the DosSetDateTime OS/2 call.
  1016.  
  1017.  ' The user-defined TYPE and function DECLARE are found in BSEDOSPE.BI
  1018.  TYPE DateTime
  1019.       Hour        AS STRING*1
  1020.       Minutes     AS STRING*1
  1021.       Seconds     AS STRING*1
  1022.       Hundredths  AS STRING*1
  1023.       Day         AS STRING*1
  1024.       Month       AS STRING*1
  1025.       Year        AS INTEGER
  1026.       Timezone    AS INTEGER
  1027.       DayOfWeek   AS STRING*1
  1028.  END TYPE
  1029.  
  1030.  DECLARE FUNCTION DosSetDateTime%(SEG P1 AS DateTime)
  1031.  
  1032.  DIM dayt AS DateTime
  1033.  CLS
  1034.  input "Enter the HOUR : ";h%
  1035.  dayt.hour=chr$(h%)
  1036.  input "Enter the Minutes : ";m%
  1037.  dayt.minutes=chr$(m%)
  1038.  input "Enter the Seconds : ";s%
  1039.  dayt.seconds=chr$(s%)
  1040.  input "Enter the Hundredths : ";hd%
  1041.  dayt.hundredths=chr$(hd%)
  1042.  input "Enter the Month : ";mn%
  1043.  dayt.month=chr$(mn%)
  1044.  input "Enter the Date  : ";dt%
  1045.  dayt.day=chr$(dt%)
  1046.  input "Enter the Year  : ";yr%
  1047.  dayt.year=yr%
  1048.  input "Enter the TimeZone (number of hours from Greenwich Mean Time) : ";tz%
  1049.  dayt.timezone=tz%*60%
  1050.  
  1051.  x=DosSetDateTime%(dayt)
  1052.  
  1053.  IF (x) THEN
  1054.    Print "An error occurred.  The error number is : ";x
  1055.  ELSE
  1056.    print "The system time and date have been reset."
  1057.  END IF
  1058.  END
  1059.  
  1060.  
  1061.  22. CALLing Pascal and FORTRAN Modules in QuickBASIC Programs
  1062.  
  1063.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1064.  Operating System:   MS-DOS          | OS/2
  1065.  Flags: ENDUSER | B_QuickBas
  1066.  Last Modified:  2-FEB-1990    ArticleIdent: Q27906
  1067.  
  1068.  The following information is from the README.DOC disk file for
  1069.  Microsoft BASIC Compiler Version 6.00 for MS-DOS and OS/2. This
  1070.  information also applies to BASIC compiler 6.00b, to Microsoft BASIC
  1071.  Professional Development System (PDS) Version 7.00, and to QuickBASIC
  1072.  Versions 4.00, 4.00b, and 4.50 for MS-DOS (and is also found in the
  1073.  README.DOC disk file for all these products except BASIC PDS 7.00).
  1074.  
  1075.  Modules compiled with Microsoft Pascal or FORTRAN can be linked with
  1076.  compiled BASIC programs, as described in the "Microsoft Mixed-Language
  1077.  Programming Guide" (which comes with Microsoft Macro Assembler
  1078.  Versions 5.00 and 5.10 or Microsoft C Versions 5.00 and 5.10). These
  1079.  modules can also be incorporated in Quick libraries for use in the
  1080.  QuickBASIC QB.EXE or BASIC PDS 7.00 QBX.EXE environments. However,
  1081.  BASIC programs containing code compiled with Microsoft Pascal must
  1082.  allocate at least 2K of near-heap space for Pascal. This can be done
  1083.  using the DIM statement to allocate a static array of 2K or greater in
  1084.  the NMALLOC named common block, as shown in the following example:
  1085.  
  1086.     DIM name%(2048)
  1087.     COMMON SHARED /NMALLOC/ name%()
  1088.  
  1089.  The Pascal run time assumes it always has at least 2K of near-heap
  1090.  space available. If the Pascal code cannot allocate the required
  1091.  space, BASIC may hang. This applies to Pascal code in Quick libraries
  1092.  as well as to Pascal code linked into executable files. The situation
  1093.  is similar for FORTRAN I/O, which also requires near buffer space, and
  1094.  which can be provided by the same means as the Pascal near malloc
  1095.  space.
  1096.  
  1097.  
  1098.  23. MS-DOS 3.20 Patch for Coprocessor Math Exceptions in BC and QB
  1099.  
  1100.  Product Version(s): 6.00 6.00b 7.00
  1101.  Operating System:   MS-DOS
  1102.  Flags: ENDUSER | B_QuickBas
  1103.  Last Modified: 22-JAN-1990    ArticleIdent: Q27911
  1104.  
  1105.  The information below is taken from the following files, and only
  1106.  applies to the product versions shown:
  1107.  
  1108.  1. The README.DOC file from the Program Disk of Microsoft BASIC
  1109.     Compiler Versions 6.00 and 6.00b for MS-DOS
  1110.  
  1111.  2. The UPDATE.DOC file from the Program Disk for QuickBASIC Version
  1112.     4.00b
  1113.  
  1114.  Note: This information was not included with Microsoft BASIC
  1115.  Professional Development System (PDS) Version 7.00 for MS-DOS (except
  1116.  for a brief mention in the PACKING.LST file) but it still applies
  1117.  since PATCH87.EXE is shipped with BASIC PDS 7.00.
  1118.  
  1119.  This article is relevant only if your system has all of the following
  1120.  characteristics:
  1121.  
  1122.  1. Uses MS-DOS Version 3.20
  1123.  
  1124.  2. Boots from a hard-disk drive
  1125.  
  1126.  3. Has a math coprocessor (for instance, an 8087 or 80287 chip)
  1127.  
  1128.  4. Runs programs that use floating-point math
  1129.  
  1130.  The following DOS patch is not necessary if you have PC-DOS; the patch
  1131.  only applies to MS-DOS. (Attempting to patch PC-DOS may give you an
  1132.  error such as the following: "File Not Found: IO.SYS".)
  1133.  
  1134.  For systems that satisfy all of the preceding conditions, you may be
  1135.  able to eliminate floating-point math problems by installing a small
  1136.  patch in DOS. The problem that usually arises is hanging when a math
  1137.  exception occurs. Math exceptions are items such as "divide by zero"
  1138.  or "overflow" errors. If you are not sure whether you need the patch,
  1139.  perform the following steps:
  1140.  
  1141.  1. Copy the program PATCH87.EXE (included in this release) to the
  1142.     root directory of your hard-disk drive.
  1143.  
  1144.  2. Reboot your system from the hard disk, and do not perform any
  1145.     floppy-disk operations after rebooting. It is very important
  1146.     that you avoid floppy-disk I/O after rebooting because that will
  1147.     affect the reliability of the diagnostic test that you are about
  1148.     to perform.
  1149.  
  1150.  3. If necessary, use the CD command to move to the root directory
  1151.     of your hard-disk drive.
  1152.  
  1153.  4. Run the PATCH87.EXE program by entering the following command at
  1154.     the DOS prompt:
  1155.  
  1156.        PATCH87
  1157.  
  1158.  5. The program performs a diagnostic test on your system to determine
  1159.     whether it needs the DOS patch, and if the patch is needed, whether
  1160.     the patch can be installed successfully. If the program tells you
  1161.     that you need to install the DOS patch, and that it can be done,
  1162.     follow the procedure described in the next section.
  1163.  
  1164.  Please note that the floating-point problem has been eliminated in
  1165.  versions of MS-DOS later than Version 3.20. This includes MS-DOS
  1166.  Versions 3.21 and 3.30. If you performed the preceding test and
  1167.  determined that you should install the DOS patch on your system,
  1168.  perform the following steps:
  1169.  
  1170.  1. Format a blank floppy disk. (Do not use the /s formatting option to
  1171.     transfer system files to the disk.)
  1172.  
  1173.  2. Use the SYS command to copy IO.SYS and MS-DOS.SYS from the root
  1174.     directory of your hard disk to the new floppy disk. For instance,
  1175.     if you boot from Drive C, enter the following commands:
  1176.  
  1177.        C: SYS A:
  1178.  
  1179.  3. Use the COPY command to copy COMMAND.COM and SYS.COM to the same
  1180.     floppy disk.
  1181.  
  1182.  4. Use the COPY command to copy the program PATCH87.EXE (included in
  1183.     this release) to the same floppy disk.
  1184.  
  1185.  5. Change the current drive and directory to the floppy disk by
  1186.     entering the following command:
  1187.  
  1188.        A:
  1189.  
  1190.  6. Install the DOS patch by entering the following command:
  1191.  
  1192.        PATCH87 /F
  1193.  
  1194.  Please note that if you experience any disk errors during Steps 2
  1195.  through 6, do not proceed with Step 7. Reboot from your hard disk and
  1196.  repeat the entire process.
  1197.  
  1198.  7. If you have not experienced any errors, use the SYS command to
  1199.     transfer the files IO.SYS and MS-DOS.SYS from the floppy disk back
  1200.     to your hard disk. For instance, if the boot directory of your
  1201.     system is the root directory of Drive C, enter the following
  1202.     command at the DOS prompt:
  1203.  
  1204.        A: SYS C:
  1205.  
  1206.  8. The DOS patch has been installed. Reboot the system.
  1207.  
  1208.  
  1209.  24. BASIC 6.00 & 7.00 Can't Make Family API (Bound) Applications
  1210.  
  1211.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1212.  Operating System:   MS-DOS          | OS/2
  1213.  Flags: ENDUSER |
  1214.  Last Modified: 22-JAN-1990    ArticleIdent: Q27921
  1215.  
  1216.  Microsoft BASIC Compiler Versions 6.00 and 6.00b and Microsoft BASIC
  1217.  Professional Development System (PDS) Version 7.00 for MS OS/2 cannot
  1218.  create "bound" applications (Family API applications). (A given bound
  1219.  EXE application can run under OS/2 protected mode, OS/2 real mode,
  1220.  and/or MS-DOS.) The compiler can only create EXE files that run under
  1221.  either OS/2 protected mode or real mode but not both. ("Real mode"
  1222.  includes both the DOS 3.x-compatibility box in OS/2, and straight
  1223.  MS-DOS.)
  1224.  
  1225.  To have the functionality of BASIC, the BASIC run-time module contains
  1226.  routines that are outside OS/2's Family API (Applications Programming
  1227.  Interface).
  1228.  
  1229.  
  1230.  25. EGA and VGA Graphics Are Not Supported in OS/2 Protected Mode
  1231.  
  1232.  Product Version(s): 6.00 6.00b 7.00
  1233.  Operating System:   OS/2
  1234.  Flags: ENDUSER |
  1235.  Last Modified: 31-JAN-1990    ArticleIdent: Q27925
  1236.  
  1237.  EGA and VGA graphics are not supported in Microsoft BASIC Compiler
  1238.  Versions 6.00 and 6.00b and Microsoft BASIC Professional Development
  1239.  System (PDS) Version 7.00 programs in the protected mode of OS/2.
  1240.  (Note also that COLOR is ignored in SCREEN 1.)
  1241.  
  1242.  The BASIC compiler talks directly to the hardware to perform EGA or
  1243.  VGA graphics. Applications that sit in OS/2 "ring 4" are not allowed
  1244.  to perform EGA or VGA graphics in the protected mode of OS/2.
  1245.  
  1246.  If the application needs to talk to the hardware, it must go through a
  1247.  device driver. There is currently not a device driver for EGA or VGA
  1248.  graphics in OS/2 protected mode.
  1249.  
  1250.  
  1251.  26. QBX /NOF (NOFrills) Option Saves 19K, Not 22K in BASIC 7.00
  1252.  
  1253.  Product Version(s): 7.00
  1254.  Operating System:   MS-DOS
  1255.  Flags: ENDUSER | docerr
  1256.  Last Modified: 31-JAN-1990    ArticleIdent: Q58218
  1257.  
  1258.  The "Microsoft BASIC 7.0: Getting Started" manual incorrectly states
  1259.  on Page 15 that the /NOFrills command-line option for QBX.EXE reduces
  1260.  memory usage by 22K.
  1261.  
  1262.  However, the manual correctly states on Page 16 that QBX actually uses
  1263.  about 19K less memory with the /NOF command-line option.
  1264.  
  1265.  This information applies to QBX.EXE in Microsoft BASIC Professional
  1266.  Development System (PDS) Version 7.00 for MS-DOS.
  1267.  
  1268.  Please note that the /NOF option for QBX.EXE is unrelated to the /NOF
  1269.  (/NOFarcalls) option for the linker (LINK.EXE) in BASIC PDS 7.00.
  1270.  
  1271.  
  1272.  27. Routines Compiled /FPa (Alt. Math) Can't Be in Quick Library
  1273.  
  1274.  Product Version(s): 6.00 6.00b 7.00 7.10
  1275.  Operating System:   MS-DOS
  1276.  Flags: ENDUSER | B_QuickBas
  1277.  Last Modified:  4-SEP-1990    ArticleIdent: Q27928
  1278.  
  1279.  The linker error message "L2025: Symbol defined more than once" occurs
  1280.  when you attempt to create a Quick library (LINK /Q) from .OBJ modules
  1281.  that were compiled with the alternate math package (BC /FPa) option.
  1282.  
  1283.  Routines compiled with BC /FPa (the alternate math package switch)
  1284.  cannot be placed into a Quick library because the QB.EXE or QBX.EXE
  1285.  environment does not support the use of the alternate math package.
  1286.  The QuickBASIC and QuickBASIC extended environments support only the
  1287.  IEEE coprocessor-emulation math package (/FPi). The alternate math
  1288.  package (/FPa) is only supported in compiled EXE programs.
  1289.  
  1290.  This information applies to the QB.EXE environment supplied with
  1291.  Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS, and to
  1292.  the QBX.EXE environment supplied with Microsoft BASIC Professional
  1293.  Development System (PDS) versions 7.00 and 7.10.
  1294.  
  1295.  The purpose of the alternate floating-point math package is to provide
  1296.  faster floating-point calculations on computers that do not have a
  1297.  coprocessor. The alternate math package is significantly faster than
  1298.  the IEEE coprocessor-emulation math package when run on a computer
  1299.  without a coprocessor installed.
  1300.  
  1301.  Note that the alternate math package is about 50 percent slower than
  1302.  the Microsoft Binary Format (MBF) floating-point math found in the
  1303.  noncoprocessor version of QuickBASIC versions 3.00 and earlier.
  1304.  (QuickBASIC versions 4.00, 4.00b, and 4.50, Microsoft BASIC Compiler
  1305.  versions 6.00 and 6.00b, and Microsoft PDS versions 7.00 and 7.10 only
  1306.  offer support for the older MBF math with a /MBF compiler option and
  1307.  some MBF numeric conversion functions. These BASIC versions have
  1308.  adopted IEEE and alternate math to be compatible with the other
  1309.  Microsoft language products [FORTRAN, Pascal, and C] and to support
  1310.  the math coprocessor.)
  1311.  
  1312.  For the greatest speed, applications should be compiled with the BC
  1313.  /FPi switch and run on a computer with a coprocessor installed.
  1314.  
  1315.  
  1316.  28. Cannot Create Dynamic Link Libraries from BC 6.00 Modules
  1317.  
  1318.  Product Version(s): 6.00 6.00b 7.00
  1319.  Operating System:   OS/2
  1320.  Flags: ENDUSER |
  1321.  Last Modified: 31-JAN-1990    ArticleIdent: Q27929
  1322.  
  1323.  Under MS OS/2 protected mode, you cannot create dynamic link libraries
  1324.  (DLLs) out of BASIC modules created with Microsoft BASIC Compiler
  1325.  Version 6.00 or 6.00b or Microsoft BASIC Professional Development
  1326.  System (PDS) Version 7.00.
  1327.  
  1328.  The following are a number of fundamental reasons why you cannot
  1329.  create dynamic link libraries out of compiled BASIC programs:
  1330.  
  1331.  1. Microsoft BASIC Compiler Versions 6.00 and 6.00b and Microsoft
  1332.     BASIC PDS Version 7.00 code is not reentrant.
  1333.  
  1334.  2. These compilers assume that the data (DS) and stack (SS) segments
  1335.     are the same, which is not allowed in a .DLL.
  1336.  
  1337.  3. Compiled BASIC routines cannot be called directly from an EXE
  1338.     written in another language, since a BASIC EXE must be the
  1339.     initiating program. This is not compatible with a dynamic link
  1340.     library.
  1341.  
  1342.  However, you can add your own BASIC routines to the BASIC run-time
  1343.  module with the BUILDRTM utility provided with BASIC compiler Versions
  1344.  6.00 and 6.00b and Microsoft BASIC PDS 7.00. The BASIC run-time module
  1345.  is a dynamic link library.
  1346.  
  1347.  BASIC compiler routines can also call routines contained in dynamic
  1348.  link libraries other than the BASIC run-time library.
  1349.  
  1350.  
  1351.  29. Sample Program That Makes OS/2 Call DosGetDateTime
  1352.  
  1353.  Product Version(s): 6.00 6.00b 7.00
  1354.  Operating System:   OS/2
  1355.  Flags: ENDUSER |
  1356.  Last Modified: 31-JAN-1990    ArticleIdent: Q27931
  1357.  
  1358.  Below is a sample program that CALLs the OS/2 routine DosGetDateTime.
  1359.  
  1360.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  1361.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  1362.  System (PDS) Version 7.00.
  1363.  
  1364.  ' The user-defined TYPE and function DECLARE are found in
  1365.  ' BSEDOSPE.BI
  1366.  
  1367.  TYPE DateTime
  1368.       Hour        AS STRING*1
  1369.       Minutes     AS STRING*1
  1370.       Seconds     AS STRING*1
  1371.       Hundredths  AS STRING*1
  1372.       Day         AS STRING*1
  1373.       Month       AS STRING*1
  1374.       Year        AS INTEGER
  1375.       Timezone    AS INTEGER
  1376.       DayOfWeek   AS STRING*1
  1377.  END TYPE
  1378.  
  1379.  DECLARE FUNCTION DosGetDateTime%(SEG P1 AS DateTime)
  1380.  DECLARE FUNCTION FDAY$ (x%)
  1381.  
  1382.  DIM dayt AS DateTime
  1383.  CLS
  1384.  x=DosGetDateTime%(dayt)
  1385.  
  1386.  IF (x) THEN
  1387.    Print "An error occurred.  The error number is : ";x
  1388.  ELSE
  1389.    t$=str$(asc(dayt.hour))+":"+str$(asc(dayt.minutes))+":"_
  1390.       +str$(asc(dayt.seconds))  +":"+str$(asc(dayt.hundredths))
  1391.  
  1392.    d$=str$(asc(dayt.month))+"/"+right$(str$(asc(dayt.day)),2)_
  1393.        +"/"+right$(str$(dayt.year),4)
  1394.  
  1395.    Print "TIME : ";t$
  1396.    Print "DATE : ";d$
  1397.    print "Number of hours from Greenwich Mean Time : ";(dayt.timezone)/60%
  1398.    print "The day of the week : "; fday$(asc(dayt.dayofweek))
  1399.  END IF
  1400.  end
  1401.  
  1402.  FUNCTION FDAY$(x%) STATIC
  1403.  
  1404.  SELECT CASE x%
  1405.     case 0
  1406.         fday$="Sunday"
  1407.     case 1
  1408.         fday$="Monday"
  1409.     case 2
  1410.         fday$="Tuesday"
  1411.     case 3
  1412.         fday$="Wednesday"
  1413.     case 4
  1414.         fday$="Thursday"
  1415.     case 5
  1416.         fday$="Friday"
  1417.     case 6
  1418.         fday$="Saturday"
  1419.     case else
  1420.         fday$="XXXXXXXXX"
  1421.    END SELECT
  1422.  END FUNCTION
  1423.  
  1424.  
  1425.  30. Sample Program That Makes OS/2 Call to DosChdir
  1426.  
  1427.  Product Version(s): 6.00 6.00b 7.00
  1428.  Operating System:   OS/2
  1429.  Flags: ENDUSER |
  1430.  Last Modified:  1-FEB-1990    ArticleIdent: Q27936
  1431.  
  1432.  The following sample program makes an OS/2 call to DosChdir.
  1433.  
  1434.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  1435.  6.00b for MS OS/2 and Microsoft BASIC Professional Development System
  1436.  (PDS) Version 7.00 for MS OS/2.
  1437.  
  1438.  ' The function declaration is found in BSEDOSFL.BI
  1439.  
  1440.  DECLARE FUNCTION DosChdir%(_
  1441.                   BYVAL P1s AS INTEGER,_
  1442.                   BYVAL P1o AS INTEGER,_
  1443.                   BYVAL P2 AS LONG)
  1444.  DIM a AS LONG
  1445.  
  1446.  Input "Enter Directory: ";dr$
  1447.  dr$=dr$+chr$(0)
  1448.  x%=DosChdir%(varseg(dr$),sadd(dr$),a)
  1449.  IF (x) THEN
  1450.    Print "An error occurred.  The number is : ";x
  1451.  ELSE
  1452.    Print "Directory changed for the process."
  1453.  END IF
  1454.  END
  1455.  
  1456.  
  1457.  31. Sample Program That Makes OS/2 Call to DosQCurDir
  1458.  
  1459.  Product Version(s): 6.00 6.00b 7.00
  1460.  Operating System:   OS/2
  1461.  Flags: ENDUSER |
  1462.  Last Modified: 31-JAN-1990    ArticleIdent: Q27937
  1463.  
  1464.  Below is a sample program that makes an OS/2 call to DosQCurDir.
  1465.  
  1466.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  1467.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  1468.  System (PDS) Version 7.00.
  1469.  
  1470.  ' The function declaration is found in BSEDOSFL.BI
  1471.  
  1472.  DECLARE FUNCTION DOSQCURDIR%(_
  1473.          BYVAL P1 AS INTEGER,_
  1474.          BYVAL P2s AS INTEGER,_
  1475.          BYVAL P2o AS INTEGER,_
  1476.          SEG P3 AS INTEGER)
  1477.  
  1478.  DIM dirp AS STRING*80
  1479.  
  1480.  DEFINT a-z
  1481.  
  1482.  dpl=80
  1483.  number=0
  1484.  
  1485.  x=DosQCurDir%(number,varseg(dirp),varptr(dirp),dpl)
  1486.  
  1487.  IF (x) THEN
  1488.    Print "An error occurred.  The number is : ";x
  1489.  ELSE
  1490.    dr$=left$(dirp,instr(1,dirp,chr$(0)))
  1491.    Print "The DIR path : ";dr$
  1492.  END IF
  1493.  END
  1494.  
  1495.  
  1496.  32. Sample Program That Makes OS/2 Call to DosSetFileMode
  1497.  
  1498.  Product Version(s): 6.00 6.00b 7.00
  1499.  Operating System:   OS/2
  1500.  Flags: ENDUSER |
  1501.  Last Modified: 31-JAN-1990    ArticleIdent: Q27938
  1502.  
  1503.  Below is a sample program that makes an OS/2 call to DosSetFileMode.
  1504.  
  1505.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  1506.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  1507.  System (PDS) Version 7.00 for MS OS/2.
  1508.  
  1509.  ' The function declaration is found in BSEDOSFL.BI
  1510.  
  1511.  DECLARE FUNCTION DosSetFileMode%(_
  1512.                   BYVAL P1s AS INTEGER,_
  1513.                   BYVAL P1o AS INTEGER,_
  1514.                   BYVAL P2 AS INTEGER,_
  1515.                   BYVAL P3 AS LONG)
  1516.  DIM c AS LONG
  1517.  
  1518.  INPUT "Enter the Filename : ";flname$
  1519.  flname$=flname$+chr$(0)
  1520.  PRINT "Attributes can be: Normal = 0"
  1521.  PRINT "                   Read only = 1"
  1522.  PRINT "                   Hidden = 2"
  1523.  PRINT "                   System = 4"
  1524.  PRINT "                   Directory = 16"
  1525.  PRINT "                   Archived = 32"
  1526.  INPUT "Enter desired file attribute : ";attr%
  1527.  
  1528.  x=DosSetFileMode%(varseg(flname$),sadd(flname$),attr%,c)
  1529.  
  1530.  IF (x) THEN
  1531.     print "An error has occurred.  The error number is ";x
  1532.  ELSE
  1533.    print "Attribute has been changed."
  1534.  END IF
  1535.  END
  1536.  
  1537.  
  1538.  33. Sample Program That Makes OS/2 Call to DosMkdir
  1539.  
  1540.  Product Version(s): 6.00 6.00b 7.00
  1541.  Operating System:   OS/2
  1542.  Flags: ENDUSER |
  1543.  Last Modified: 31-JAN-1990    ArticleIdent: Q27939
  1544.  
  1545.  Below is a sample program that makes a call to the OS/2 DosMkdir
  1546.  routine.
  1547.  
  1548.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  1549.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  1550.  System (PDS) Version 7.00 for MS OS/2.
  1551.  
  1552.  ' The function declaration is found in BSEDOSFL.BI.
  1553.  
  1554.  DECLARE FUNCTION DosMkdir%(_
  1555.                   BYVAL P1s AS INTEGER,_
  1556.                   BYVAL P1o AS INTEGER,_
  1557.                   BYVAL P2 AS LONG)
  1558.  
  1559.  DIM a AS LONG
  1560.  
  1561.  Input "Enter the directory : ";dr$
  1562.  dr$=dr$+chr$(0)
  1563.  
  1564.  x=DosMkdir(varseg(dr$),sadd(dr$),a)
  1565.  
  1566.  IF (x) THEN
  1567.     print "An error has occurred.  The error number is ";x
  1568.  ELSE
  1569.    print "Directory was made"
  1570.  END IF
  1571.  END
  1572.  
  1573.  
  1574.  34. How to Modify the BASIC 6.00 Run-Time Module with BUILDTRM
  1575.  
  1576.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1577.  Operating System:   MS-DOS          | OS/2
  1578.  Flags: ENDUSER |
  1579.  Last Modified:  7-FEB-1990    ArticleIdent: Q28020
  1580.  
  1581.  Using BUILDRTM, you can modify the default BASIC run-time modules. The
  1582.  runtime can be customized to a particular application. You can add
  1583.  routines to or delete routines from the BASIC runtime.
  1584.  
  1585.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  1586.  6.00b for MS-DOS and MS OS/2 and to Microsoft BASIC Professional
  1587.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2. The
  1588.  following are the default run-time module names for the applicable
  1589.  products:
  1590.  
  1591.     BC 6.00          BC 6.00b        PDS 7.00
  1592.     -------          --------        --------
  1593.  
  1594.     BRUN60ER.EXE     BRUN61ER.EXE    BRT70ENR.EXE
  1595.     BRUN60AR.EXE     BRUN61AR.EXE    BRT70EFR.EXE
  1596.                                      BRT70ANR.EXE
  1597.                                      BRT70AFR.EXE
  1598.  
  1599.  For more information, please refer to Section 3.3 of the "Microsoft
  1600.  BASIC Compiler 6.0: User's Guide" for Microsoft BASIC Compiler Version
  1601.  6.00 or 6.00b, or Chapter 21 of the "Microsoft BASIC 7.0: Programmer's
  1602.  Guide" for Microsoft BASIC PDS Version 7.00.
  1603.  
  1604.  The following is an example:
  1605.  
  1606.     ===== EXPORT.LST =====
  1607.  
  1608.     #OBJECTS
  1609.     NOLPT.OBJ
  1610.     NOGRAPH.OBJ
  1611.     MYROUTINE.OBJ
  1612.  
  1613.     #EXPORTS
  1614.     myroutine1
  1615.     myroutine2
  1616.     myroutine3
  1617.  
  1618.     ===== COMMAND LINE to CREATE the RUNTIME =====
  1619.  
  1620.     BUILDRTM newruntime export.lst
  1621.  
  1622.     ===== COMMAND LINE to USE the RUNTIME =====
  1623.  
  1624.     LINK IMPORT.OBJ your objects,executable,,NEWRUNTIME.LIB /NOD
  1625.  
  1626.  
  1627.  35. MS Floating Point Is Faster Than BC /FPa Alternate Math
  1628.  
  1629.  Product Version(s): 6.00 6.00b 7.00  | 6.00 6.00b 7.00
  1630.  Operating System:   MS-DOS           | OS/2
  1631.  Flags: ENDUSER |
  1632.  Last Modified:  2-FEB-1990    ArticleIdent: Q28023
  1633.  
  1634.  An EXE compiled with the Alternate Math package (BC /FPa) performs
  1635.  floating-point calculations more slowly than an EXE compiled with
  1636.  QuickBASIC Versions 3.00 and 2.x Microsoft Floating Point.
  1637.  
  1638.  However, an EXE compiled with the alternate math package is between 40
  1639.  and 50 percent faster than an EXE compiled with IEEE Floating Point
  1640.  (with no /FPa switch) when run on a computer that does not have a
  1641.  coprocessor.
  1642.  
  1643.  Microsoft BASIC Compiler Versions 6.00 and 6.00b and Microsoft BASIC
  1644.  Professional Development System (PDS) Version 7.00 do not support
  1645.  Microsoft Floating Point. If you want the greatest floating-point
  1646.  speed on a computer that does not have a coprocessor, compile with the
  1647.  BC /FPa switch. ("FPa" stands for "Floating Point Alternate-Math
  1648.  Library"). If you want the greatest floating-point speed on a computer
  1649.  that has a coprocessor, compile with the BC /FPi switch. ("FPi" stands
  1650.  for "Floating Point In-line Instructions"). In-line Instructions is
  1651.  the default when you compile with BC and without /FPa or /FPi switch.
  1652.  
  1653.  Microsoft Floating Point is an older format found in the
  1654.  noncoprocessor version of QuickBASIC Version 3.00. It also is found in
  1655.  all prior versions of QuickBASIC (Versions 2.10, 2.00, 1.02, 1.01,
  1656.  1.00).
  1657.  
  1658.  Microsoft BASIC Compiler Versions 6.00 and 6.00b and Microsoft BASIC
  1659.  PDS Version 7.00 do not support Microsoft Floating Point. These
  1660.  products have adopted IEEE and Alternate Math in order to be linkable
  1661.  with FORTRAN, PASCAL, and C.
  1662.  
  1663.  Compiling with BC /FPa gives you the Alternate Math floating-point
  1664.  format. (The QuickBASIC interpreter uses only IEEE and cannot use
  1665.  Alternate Math.)
  1666.  
  1667.  Compiling without /FPa gives you IEEE floating-point format. IEEE
  1668.  floating-point format is fastest when run on a computer that has a
  1669.  coprocessor installed.
  1670.  
  1671.  
  1672.  36. EXE May Be Slower in OS/2 Protected Mode than in DOS
  1673.  
  1674.  Product Version(s): 6.00 6.00b 7.00  | 6.00 6.00b 7.00
  1675.  Operating System:   MS-DOS           | OS/2
  1676.  Flags: ENDUSER |
  1677.  Last Modified:  2-FEB-1990    ArticleIdent: Q28024
  1678.  
  1679.  Because of the event scheduling in OS/2, programs run under protected
  1680.  mode may run more slowly than they did under DOS. This is expected
  1681.  behavior.
  1682.  
  1683.  Microsoft BASIC Compiler Versions 6.00 and 6.00b and Microsoft BASIC
  1684.  Professional Development System (PDS) Version 7.00 are all capable of
  1685.  compiling programs to run under OS/2 protected mode.
  1686.  
  1687.  
  1688.  37. SETUP Program Can Create Subdirectory Only If Parent Exists
  1689.  
  1690.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1691.  Operating System:   MS-DOS          | OS/2
  1692.  Flags: ENDUSER | B_QuickBas
  1693.  Last Modified:  7-FEB-1990    ArticleIdent: Q28027
  1694.  
  1695.  The SETUP.EXE program can create a subdirectory only if the parent
  1696.  directory already exists. For example, if you want to place the
  1697.  library files in a subdirectory named \BC6\LIB, the directory \BC6
  1698.  must exist before SETUP is run.
  1699.  
  1700.  This information applies to the SETUP.EXE program in Microsoft BASIC
  1701.  Compiler Versions 6.00 and 6.00b for MS-DOS and OS/2, Microsoft BASIC
  1702.  Professional Development System (PDS) Version 7.00 for MS-DOS and MS
  1703.  OS/2, and Microsoft QuickBASIC Versions 4.00, 4.00b, and 4.50 for the
  1704.  MS-DOS.
  1705.  
  1706.  This is also a limitation of DOS. You cannot use the MKDIR command to
  1707.  create a subdirectory in a directory that does not exist.
  1708.  
  1709.  
  1710.  38. QB Fast Load Format Source Code Cannot Be Used in MS CodeView
  1711.  
  1712.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  1713.  Operating System:   MS-DOS               | OS/2
  1714.  Flags: ENDUSER |
  1715.  Last Modified: 17-JAN-1991    ArticleIdent: Q28030
  1716.  
  1717.  Microsoft CodeView is not able to read the QuickBASIC source file if
  1718.  it is saved in Fast Load format. If you plan to use the Microsoft
  1719.  CodeView debugger, be sure that the source file is saved in ASCII
  1720.  format.
  1721.  
  1722.  To save a file in ASCII format, use the Save As command on the File
  1723.  menu in the QB.EXE environment of Microsoft BASIC Compiler version
  1724.  6.00 or 6.00b, or in the QBX.EXE environment of Microsoft BASIC
  1725.  Professional Development System (PDS) version 7.00 or 7.10.
  1726.  
  1727.  To compile a BASIC program for use with CodeView, follow these steps:
  1728.  
  1729.  1. BC filename /Zi [other switches]
  1730.  
  1731.  2. LINK filename /Co [other switches]
  1732.  
  1733.  
  1734.  39. No "Incompatible Runtime" CHAIN Error with Mismatched COMMON
  1735.  
  1736.  Product Version(s): 6.00   | 6.00
  1737.  Operating System:   MS-DOS | OS/2
  1738.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 runtime
  1739.  Last Modified: 30-MAY-1990    ArticleIdent: Q28038
  1740.  
  1741.  The problem under Microsoft BASIC Compiler version 6.00 and 6.00b is
  1742.  as follows:
  1743.  
  1744.  1. A routine that has a blank COMMON block is built into a custom
  1745.     run-time module with BUILDRTM.EXE.
  1746.  
  1747.  2. Main1 contains the same blank COMMON (matched exactly in length).
  1748.  
  1749.  3. Main2 contains the same blank COMMON plus some more blank COMMON.
  1750.  
  1751.  4. Main3 contains the same blank COMMON as Main2.
  1752.  
  1753.  5. Main1 chains to Main2, which puts something in the EXTENDED portion
  1754.     of COMMON, then chains to Main3. Main3 expects something to be
  1755.     there, but it is gone.
  1756.  
  1757.  There should be an error on the chain to Main2 since we cannot enlarge
  1758.  blank COMMON when there is a set size of blank COMMON in the custom
  1759.  run-time module. An error should have been generated during the chain.
  1760.  When Main2 is run as a stand alone, the "incompatible runtime module"
  1761.  error message appears.
  1762.  
  1763.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  1764.  Compiler versions 6.00 and 6.00b, and in Microsoft BASIC Professional
  1765.  Development System (PDS) version 7.00. We are researching this problem
  1766.  and will post new information here as it becomes available.
  1767.  
  1768.  When using Microsoft BASIC PDS version 7.00 for MS-DOS and MS OS/2,
  1769.  any inclusion of a COMMON block into a custom run-time module will
  1770.  result in an "incompatible runtime module" error, even if the COMMON
  1771.  statement(s) in the run-time match the COMMON in the program(s).
  1772.  If you link IMPORT.OBJ as the first .OBJ file on the link line,
  1773.  this is not a problem.
  1774.  
  1775.  The following is code example for Microsoft BASIC Compiler versions
  1776.  6.00 and 6.00b:
  1777.  
  1778.  MAIN1:
  1779.  
  1780.    common a,b,c     'This COMMON matches the COMMON in the custom run time
  1781.    a=1
  1782.    b=2
  1783.    c=3
  1784.    chain "main2"
  1785.    end
  1786.  
  1787.  MAIN2:
  1788.  
  1789.    common a,b,c,d,e  'It is not legal to add more elements to the blank
  1790.                      'COMMON if you are using a custom run time.
  1791.    d=4
  1792.    e=5
  1793.    chain "main3"
  1794.    end
  1795.  
  1796.  MAIN3:
  1797.  
  1798.    common a,b,c,d,e
  1799.    print a,b,c,d,e
  1800.    end
  1801.  
  1802.  
  1803.  40. LOCATE Has 8 lines Resolution DOS & Real Mode, 16 in Protected
  1804.  
  1805.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1806.  Operating System:   MS-DOS          | OS/2
  1807.  Flags: ENDUSER |
  1808.  Last Modified:  2-FEB-1990    ArticleIdent: Q28042
  1809.  
  1810.  The BASIC statement LOCATE X,Y,1,0,7 executed under DOS and real mode
  1811.  generates a cursor block eight lines tall. Executing the same
  1812.  statement under protected mode generates a small block of a cursor.
  1813.  For a full-height cursor under protected mode, the statement must be
  1814.  LOCATE X,Y,1,0,15. This is expected behavior and is documented in the
  1815.  "Microsoft BASIC 7.0: Language Reference" on Page 196.
  1816.  
  1817.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  1818.  6.00b for MS-DOS and MS OS/2, and to Microsoft BASIC Professional
  1819.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  1820.  
  1821.  
  1822.  41. Misleading QB.EXE Message Using Reserved Word in SUB
  1823.  
  1824.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1825.  Operating System:   MS-DOS          | OS/2
  1826.  Flags: ENDUSER | B_QuickBas
  1827.  Last Modified:  2-FEB-1990    ArticleIdent: Q28158
  1828.  
  1829.  Illegally using the reserved word "SEG" in a SUB statement can give
  1830.  you a misleading error message.
  1831.  
  1832.  To generate the misleading message, start up the QB.EXE environment of
  1833.  Microsoft BASIC Compiler Version 6.00 or 6.00b or Microsoft QuickBASIC
  1834.  Version 4.00, 4.00b, or 4.50, and type the following:
  1835.  
  1836.     SUB foo(SEG x AS INTEGER)
  1837.  
  1838.  The environment highlights the SEG keyword and returns the following:
  1839.  
  1840.     Expected: variable or BYVAL or SEG or )
  1841.  
  1842.  This is because the parser correctly detects that SEG is illegal in a
  1843.  SUB statement, but shares the error message with DECLARE, so SEG is
  1844.  misleadingly listed as "expected."
  1845.  
  1846.  This error message has been clarified in the QBX.EXE environment of
  1847.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  1848.  MS-DOS and MS OS/2. This situation now produces the following error,
  1849.  indicating that the SEG keyword is not allowed in that context:
  1850.  
  1851.     Expected: parameter or )
  1852.  
  1853.  
  1854.  42. QB /L A: Does Not Find QB.QLB If SET LIB=A: Is Not Set
  1855.  
  1856.  Product Version(s): 6.00 6.00b 7.00
  1857.  Operating System:   MS-DOS
  1858.  Flags: ENDUSER |
  1859.  Last Modified:  2-FEB-1990    ArticleIdent: Q28160
  1860.  
  1861.  Problem:
  1862.  
  1863.  If the default Quick library file QB.QLB is on Drive A and no LIB
  1864.  environment variable is set, then the following command line fails to
  1865.  find QB.QLB:
  1866.  
  1867.     QB /L A:
  1868.  
  1869.  Response:
  1870.  
  1871.  This is how the Quick library search is supposed to work. If no
  1872.  argument is given to the /L switch, QB.EXE looks for a filename of
  1873.  QB.QLB. Otherwise, if you specify a drive such as Drive A, QB.EXE
  1874.  assumes that you are specifying a Quick library name other than
  1875.  QB.QLB.
  1876.  
  1877.  The following are easy workarounds:
  1878.  
  1879.  1. Specify QB /L A:QB, which is only two characters longer.
  1880.  
  1881.  2. An alternate workaround is to perform the following command from
  1882.     the DOS command line before running QB /L:
  1883.  
  1884.        SET LIB=A:
  1885.  
  1886.  
  1887.  43. Missing END IF in FOR NEXT Gives Different Errors in QB and BC
  1888.  
  1889.  Product Version(s): 6.00 6.00b 7.00   | 6.00 6.00b 7.00
  1890.  Operating System:   MS-DOS            | OS/2
  1891.  Flags: ENDUSER |
  1892.  Last Modified:  2-FEB-1990    ArticleIdent: Q28162
  1893.  
  1894.  The following program gives a "NEXT without FOR" error in QB.EXE and
  1895.  the QBX.EXE environment shipped with Microsoft BASIC Professional
  1896.  Development System (PDS) Version 7.00 for MS-DOS, and a "BLOCK IF
  1897.  WITHOUT END IF" error from an EXE compiled in BC.EXE (the following is
  1898.  a code example):
  1899.  
  1900.     for i=1 to 10
  1901.        if x=10 then
  1902.          a=c
  1903.        else
  1904.           d=c
  1905.      next i
  1906.  
  1907.  Both error messages are correct, depending on how you view the program.
  1908.  This feature will not be changed.
  1909.  
  1910.  
  1911.  44. Unexpected PRINT USING ".##" Rounding for .xx5
  1912.  
  1913.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1914.  Operating System:   MS-DOS          | OS/2
  1915.  Flags: ENDUSER |
  1916.  Last Modified:  2-FEB-1990    ArticleIdent: Q28163
  1917.  
  1918.  Problem:
  1919.  
  1920.  For the following statement
  1921.  
  1922.     PRINT USING " ###.##"; .245, .255, .265, .275, .285
  1923.  
  1924.  the output is as follows
  1925.  
  1926.     0.25  0.25  0.26  0.28  0.28
  1927.  
  1928.  whereas you would expect the following
  1929.  
  1930.     0.25  0.26  0.27  0.28  0.29
  1931.  
  1932.  or with IEEE rounding, you would expect the following:
  1933.  
  1934.        0.24  0.26  0.26  0.28  0.28
  1935.  
  1936.  Response:
  1937.  
  1938.  The internal representation of the numbers used by BASIC differs
  1939.  slightly from the decimal numbers typed into the source code.
  1940.  
  1941.  IEEE floating-point format cannot accurately represent numbers that
  1942.  are not of the form 1.x to the power of y (where x and y are base 2
  1943.  numbers). The internal representation will be slightly more or
  1944.  slightly less than the decimal numbers typed into the source code.
  1945.  
  1946.  The internal representations are correctly rounded and displayed. This
  1947.  is not a software problem.
  1948.  
  1949.  
  1950.  45. "String Formula Too Complex" with Recursive String Function
  1951.  
  1952.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1953.  Operating System:   MS-DOS          | OS/2
  1954.  Flags: ENDUSER | B_QuickBas
  1955.  Last Modified:  2-FEB-1990    ArticleIdent: Q28165
  1956.  
  1957.  The program below, which recursively invokes a string function, causes
  1958.  a "String Formula Too Complex" run-time error. This program shows a
  1959.  design limitation in Microsoft BASIC Compiler Version 6.00 and 6.00b,
  1960.  Microsoft BASIC Professional Development System (PDS) Version 7.00,
  1961.  and in QuickBASIC that is not usually encountered.
  1962.  
  1963.  In the following program, QuickBASIC is computing RIGHT$(TEXT$,1),
  1964.  assigning the value to a temporary string descriptor, and then
  1965.  recursing on REVERSE$(LEFT$(TEXT$,LEN(TEXT$)-1)):
  1966.  
  1967.     DECLARE FUNCTION Reverse$ (Text$)
  1968.     CLS
  1969.     PRINT Reverse$ ("123456789 1234567890")
  1970.  
  1971.     FUNCTION Reverse$ (Text$)
  1972.     IF LEN(Text$) = 0 THEN
  1973.       EXIT FUNCTION
  1974.     ELSE
  1975.       Reverse$ = RIGHT$(Text$, 1) + Reverse$ (LEFT$(Text$, LEN(Text$) -1))
  1976.     END IF
  1977.     END FUNCTION
  1978.  
  1979.  The temporary string descriptor is not released until the recursion is
  1980.  completed. Each recursive REVERSE$ function call locks one string
  1981.  descriptor. Because QuickBASIC allows only 20 temporary descriptors
  1982.  (more than enough for most applications), after around 20 function
  1983.  calls the program gives the error "String Formula Too Complex."
  1984.  
  1985.  The workaround is to use a real string descriptor as follows (which
  1986.  will be allocated from stack space):
  1987.  
  1988.     Temp$ = Reverse$(LEFT$(Text$,LEN(Text$)-1))
  1989.     Reverse$ = RIGHT$(Text$,1) + Temp$
  1990.  
  1991.  
  1992.  46. QB Uses Up Default String Space When Concatenating Far String
  1993.  
  1994.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  1995.  Operating System:   MS-DOS          | OS/2
  1996.  Flags: ENDUSER | B_QuickBas
  1997.  Last Modified:  2-FEB-1990    ArticleIdent: Q28166
  1998.  
  1999.  Problem:
  2000.  
  2001.  When running the program below inside the QB.EXE environment, after
  2002.  about 72 iterations of concatenating a variable-length string onto a
  2003.  fixed-length string, an "Out of String Space" error is generated.
  2004.  However, the FRE("") and FRE(-1) functions both return the same value
  2005.  all the way through the loop. Note that the array of fixed-length
  2006.  strings is dynamically allocated, putting it into the far heap.
  2007.  
  2008.  The program runs properly when compiled and run as an EXE file.
  2009.  
  2010.  Response:
  2011.  
  2012.  The problem is that QuickBASIC assumes that a far fixed-length string
  2013.  will always stay far.
  2014.  
  2015.  However, the BASIC run-time routines must have the string in DGROUP in
  2016.  order to manipulate it with string functions like LTRIM$ and RTRIM$.
  2017.  LTRIM$ and RTRIM$ require two copies of the string at one point, and
  2018.  the program eventually runs out of string space in the default data
  2019.  segment in DGROUP. This will also happen in a version of the program
  2020.  compiled with BC /O if the strings are made longer. This limitation of
  2021.  BASIC is inherent in its construction, and Microsoft currently has no
  2022.  plans to change this construction.
  2023.  
  2024.  The following is a code example:
  2025.  
  2026.     REM $DYNAMIC
  2027.     DIM srv(0) AS STRING * 28000
  2028.  
  2029.     abc$ = STRING$(330,"0")
  2030.  
  2031.     srv(0) = abc$
  2032.     FOR t = 1 to 79
  2033.        srv(0) = RTRIM$(srv(0)) + abc$
  2034.        PRINT t, LEN(RTRIM$(srv(0))), FRE(""), FRE(-1)
  2035.     NEXT t
  2036.  
  2037.  
  2038.  47. A RETURN Without a GOSUB in a Subprogram Hangs in EXE
  2039.  
  2040.  Product Version(s): 6.00    | 6.00
  2041.  Operating System:   MS-DOS  | OS/2
  2042.  Flags: ENDUSER |
  2043.  Last Modified: 11-JUL-1990    ArticleIdent: Q28154
  2044.  
  2045.  Executing a RETURN statement without a corresponding GOSUB in a
  2046.  subprogram hangs an EXE program when compiled without the BC /D
  2047.  option. You must compile with the BC /D option (or compile in the
  2048.  QuickBASIC environment) to trap a "RETURN without GOSUB" programming
  2049.  error (just as you must use BC /D to trap array bounds violations).
  2050.  
  2051.  This information applies to BC.EXE in Microsoft BASIC Compiler
  2052.  versions 6.00 and 6.00b for MS-DOS and MS OS/2, to BC.EXE in Microsoft
  2053.  BASIC Professional Development System (PDS) version 7.00 for MS-DOS
  2054.  and MS OS/2, and to BC.EXE in QuickBASIC versions 4.00, 4.00b, and
  2055.  4.50 for MS-DOS.
  2056.  
  2057.  Compile the test program below with BC.EXE and then link it. If you
  2058.  compile with the BC /D option, the program gives run-time error,
  2059.  "RETURN without GOSUB." If you don't compile with /D, the program
  2060.  hangs the computer at run time without telling you about your
  2061.  programming mistake.
  2062.  
  2063.  To avoid hanging due to a programming error like this, use the QB.EXE
  2064.  or QBX.EXE environment as a debugger, since the interpreter
  2065.  environment correctly traps the "Return without GOSUB" error. The
  2066.  program should be modified to remove the "Return without GOSUB"
  2067.  programming error.
  2068.  
  2069.  Code Example
  2070.  ------------
  2071.  
  2072.  ' test.bas
  2073.     defint a-z
  2074.     declare sub atest ( x )
  2075.  
  2076.       i = 1
  2077.       print i
  2078.       call atest (i)
  2079.       print i
  2080.     end
  2081.  
  2082.     sub atest ( j )
  2083.        print j
  2084.        j = 2
  2085.        print j
  2086.        return
  2087.     end sub
  2088.  
  2089.  
  2090.  48. BC 6.00 Example Calling OS/2 API Function DosSetMaxFH
  2091.  
  2092.  Product Version(s): 6.00 6.00b 7.00
  2093.  Operating System:   OS/2
  2094.  Flags: ENDUSER |
  2095.  Last Modified:  1-FEB-1990    ArticleIdent: Q35906
  2096.  
  2097.  Below is a sample program that makes a call to the MS OS/2 function
  2098.  DosSetMaxFH. This program can be compiled in Microsoft BASIC Compiler
  2099.  Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC Professional
  2100.  Development System (PDS) Version 7.00 for MS OS/2.
  2101.  
  2102.  By default, 20 file handles are allocated to a file. To increase the
  2103.  number of file handles available, the DosSetMaxFH function must be
  2104.  called. The maximum number of file handles is 255. When determining
  2105.  the required number of handles, add several for dynamic-link modules
  2106.  (these modules use several handles), and three more for the default
  2107.  system I/O handles.
  2108.  
  2109.  The following is a code example:
  2110.  
  2111.  'This information is found in BSEDOSFL.BI
  2112.  DECLARE FUNCTION DOSSETMAXFH%(BYVAL P1 AS INTEGER)
  2113.  
  2114.  INPUT "Enter the maximum number of file handles : ",fh%
  2115.  x=DosSetMaxFH%(fh%)
  2116.  
  2117.  IF (x) THEN
  2118.     Print "An error occurred.  The error number is ";x
  2119.  ELSE
  2120.     Print "Maximum number of file handles has been changed."
  2121.  END IF
  2122.  
  2123.  ON ERROR GOTO DONE
  2124.  
  2125.  for i = 1 to 255
  2126.    fl$="xxxxx"+mid$(str$(i),2,len(str$(i)))
  2127.    open fl$ for output as i
  2128.  next i
  2129.  stop
  2130.  
  2131.  done:
  2132.    Print i
  2133.  
  2134.  end
  2135.  
  2136.  
  2137.  49. It Is Illegal to Pass a CONST Type Constant in COMMON
  2138.  
  2139.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  2140.  Operating System:   MS-DOS          | OS/2
  2141.  Flags: ENDUSER |
  2142.  Last Modified:  2-FEB-1990    ArticleIdent: Q28283
  2143.  
  2144.  A user-defined CONST constant cannot be passed in COMMON.
  2145.  
  2146.  CONST constants never need to be passed in COMMON since you can put
  2147.  the CONST definitions in a $include file to include for use in any
  2148.  desired module.
  2149.  
  2150.  A given user-defined CONST constant is local to each separately
  2151.  compiled module, and can be used throughout a given source file.
  2152.  
  2153.  The following is an example of illegally passing a CONST type symbol
  2154.  in COMMON. In the QB.EXE environment that comes with Microsoft BASIC
  2155.  Compiler Versions 6.00 and 6.00b or in the QBX.EXE environment
  2156.  supplied with Microsoft BASIC Professional Development System (PDS)
  2157.  Version 7.00, the following program correctly gives a "duplicate
  2158.  definition" error on x in the COMMON SHARED:
  2159.  
  2160.     CONST x = 5
  2161.     COMMON SHARED x, y, z   ' "duplicate definition" error for x
  2162.     TYPE person
  2163.       test AS STRING * x
  2164.     END TYPE
  2165.     DIM joe AS person
  2166.  
  2167.  Please note that when you use STRING * x, x must be a CONST type or a
  2168.  numeric constant, according to the "Microsoft QuickBASIC 4.0: BASIC
  2169.  Language Reference" manual on Page 430.
  2170.  
  2171.  The following shows how the above program can be modified to work
  2172.  correctly:
  2173.  
  2174.     CONST x = 5
  2175.     COMMON SHARED y, z
  2176.     TYPE person
  2177.       test AS STRING * x
  2178.     END TYPE
  2179.     DIM joe AS person
  2180.  
  2181.  
  2182.  50. OS/2 Protected Mode Restrictions for BASIC Compiler 6.00/6.00b
  2183.  
  2184.  Product Version(s): 6.00 6.00b 7.00
  2185.  Operating System:   OS/2
  2186.  Flags: ENDUSER |
  2187.  Last Modified:  2-FEB-1990    ArticleIdent: Q28442
  2188.  
  2189.  The following is a list of restrictions under MS OS/2 protected mode
  2190.  for Microsoft BASIC Compiler Versions 6.00 and 6.00b and Microsoft
  2191.  BASIC Professional Development System (PDS) Version 7.00:
  2192.  
  2193.   1. Programs using statements that refer directly to addresses in the
  2194.      machine's physical memory may need modification when run in
  2195.      protected mode, for example, CALL ABSOLUTE, DEF SEG, PEEK, POKE,
  2196.      BLOAD, BSAVE, VARPTR, and VARSEG.
  2197.  
  2198.   2. Graphics are limited to screens 1 and 2. EGA and VGA graphics are
  2199.      not supported in protected mode.
  2200.  
  2201.   3. Except for BEEP, no sound is supported. SOUND or PLAY statements
  2202.      are not allowed in protected mode. As a workaround, you can make
  2203.      an OS/2 CALL to create a sound with a specified frequency and
  2204.      duration.
  2205.  
  2206.   4. Light pens and joysticks are not allowed in protected mode.
  2207.  
  2208.   5. CALL INT86, INT86OLD, INT86X, INTERRUPT, and INTERRUPTX are not
  2209.      available in protected mode.
  2210.  
  2211.   6. COLOR is ignored in Screen 1 in protected mode.
  2212.  
  2213.   7. INP and OUT are not available in protected mode.
  2214.  
  2215.   8. IOCTL and IOCTL$ are not available in protected mode.
  2216.  
  2217.   9. PALETTE [USING] is not available in protected mode.
  2218.  
  2219.  10. WAIT is not available in protected mode.
  2220.  
  2221.  11. If a program in real mode is using the serial communications port
  2222.      (COM1 or COM2), then you cannot use that port in protected mode at
  2223.      the same time. This is an OS/2 restriction. The reverse is also
  2224.      true: if a program in protected mode is using the communications
  2225.      port (COM1 or COM2), then you cannot use that port in real mode at
  2226.      the same time.
  2227.  
  2228.  
  2229.  51. Example of Calling OS/2 Function DosRmDir
  2230.  
  2231.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  2232.  Operating System:   MS-DOS          | OS/2
  2233.  Flags: ENDUSER |
  2234.  Last Modified:  2-FEB-1990    ArticleIdent: Q28443
  2235.  
  2236.  The following is a sample program that makes OS/2 call to DosRmDir:
  2237.  
  2238.  ' The DosRmDir FUNCTION declaration is found in the file BSEDOSFL.BI
  2239.  
  2240.     DECLARE FUNCTION DosRmDir%(_
  2241.             BYVAL P1s AS INTEGER,_
  2242.             BYVAL P1o AS INTEGER,_
  2243.             BYVAL P2 AS LONG)
  2244.  
  2245.     DIM a AS LONG
  2246.  
  2247.     Input "Enter Directory to be removed : ";dr$
  2248.     dr$=dr$+chr$(0)
  2249.  
  2250.     x=DosRmdir(varseg(dr$),sadd(dr$),a)
  2251.     IF (x) THEN
  2252.        print "An error has occurred.  The error number is ";x
  2253.     ELSE
  2254.        print "Directory ";dr$;" was REMOVED"
  2255.     END IF
  2256.     END
  2257.  
  2258.  
  2259.  52. Example of Calling OS/2 DosGetVersion and DosGetMachineMode
  2260.  
  2261.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  2262.  Operating System:   MS-DOS          | OS/2
  2263.  Flags: ENDUSER |
  2264.  Last Modified:  2-FEB-1990    ArticleIdent: Q28444
  2265.  
  2266.  Below is a sample program that makes calls to the OS/2 functions
  2267.  DosGetVersion and DosGetMachineMode.
  2268.  
  2269.  ' The function declarations are found in BSEDOSPC.BI
  2270.  
  2271.  DECLARE FUNCTION DosGetVersion%(_
  2272.          SEG P1 AS INTEGER)
  2273.  
  2274.  DECLARE FUNCTION DosGetMachineMode(_
  2275.          BYVAL P1s AS INTEGER,_
  2276.          BYVAL P1o AS INTEGER)
  2277.  
  2278.  DEFINT A-Z
  2279.  CLS
  2280.  DIM mode AS STRING*1
  2281.  
  2282.  x=DosGetMachineMode%(varseg(mode),varptr(mode))
  2283.  IF (x) THEN
  2284.     Print "An error occurred. The number is : ";x
  2285.  ELSE
  2286.     IF mode=chr$(0) THEN
  2287.        print "Real Mode"
  2288.     ELSE
  2289.        print "Protect Mode"
  2290.     END if
  2291.  END IF
  2292.  
  2293.  x=DosGetVersion(version)
  2294.  IF (x) THEN
  2295.     Print "An error occurred. The number is : ";x
  2296.  ELSE
  2297.     Print "The version number is : ";
  2298.     Print  peek(varptr(version)+1);".";peek(varptr(version))
  2299.  END IF
  2300.  
  2301.  
  2302.  53. Example of Calling OS/2 DosSetFSInfo and DosQFSInfo
  2303.  
  2304.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  2305.  Operating System:   MS-DOS          | OS/2
  2306.  Flags: ENDUSER |
  2307.  Last Modified:  2-FEB-1990    ArticleIdent: Q28445
  2308.  
  2309.  Below is a sample program that makes OS/2 calls to DOSSetFSInfo and
  2310.  DOSQFSInfo.
  2311.  
  2312.  ' The function declarations are found in file BSEDOSFL.BI
  2313.  
  2314.  TYPE FSAllocate1
  2315.       Filesysid    AS LONG
  2316.       SecPerUnit   AS LONG
  2317.       NumUnits     AS LONG
  2318.       AvailUnits   AS LONG
  2319.       ByteSec     AS INTEGER
  2320.  END TYPE
  2321.  
  2322.  TYPE FSAllocate2
  2323.       VolumeDate  AS INTEGER
  2324.       VolumeTime  AS INTEGER
  2325.       VLen        AS STRING*1
  2326.       VLabel      AS STRING*11
  2327.  END TYPE
  2328.  
  2329.  TYPE SetInfo2
  2330.       Vlen        AS STRING*1
  2331.       VLabel      AS STRING*11
  2332.  END TYPE
  2333.  
  2334.  DECLARE FUNCTION DOSSetFSInfo%(_
  2335.          BYVAL P1 AS INTEGER,_
  2336.          BYVAL P2 AS INTEGER,_
  2337.          BYVAL P3s AS INTEGER,_
  2338.          BYVAL P3o AS INTEGER,_
  2339.          BYVAL P4 AS INTEGER)
  2340.  
  2341.  DECLARE FUNCTION DOSQFSInfo%(_
  2342.          BYVAL P1 AS INTEGER,_
  2343.          BYVAL P2 AS INTEGER,_
  2344.          BYVAL P3s AS INTEGER,_
  2345.          BYVAL P3o AS INTEGER,_
  2346.          BYVAL P4 AS  INTEGER)
  2347.  
  2348.  'Routine to Shift and Print Information
  2349.  
  2350.  DECLARE FUNCTION wdate$(p1 as integer)
  2351.  DECLARE FUNCTION wtime$(p1 as integer)
  2352.  DECLARE FUNCTION RightShift%(P1 as LONG,P2 as Integer)
  2353.  DECLARE FUNCTION LeftShift%(P1 as LONG, P2 as Integer)
  2354.  DECLARE FUNCTION unsigned&(P1 as integer)
  2355.  
  2356.  DEFINT a-z
  2357.  DIM info1 AS FSAllocate1
  2358.  DIM info2 AS FSAllocate2
  2359.  DIM info3 AS SetInfo2
  2360.  cls
  2361.  
  2362.  Input "Enter Drive Number (0=default, 1=A, etc) : ",drivenumber
  2363.  level = 1
  2364.  bufsize=18
  2365.  
  2366.  x = DosQFSInfo%(drivenumber,level,varseg(info1),varptr(info1),bufsize)
  2367.  
  2368.  print
  2369.  Print "Level One Information"
  2370.  print
  2371.  IF (x) THEN
  2372.     Print "An error occurred.  The number is : ";x
  2373.  ELSE
  2374.     print "File System ID : ";info1.Filesysid
  2375.     print "Number of sectors per allocation unit : ";info1.secperunit
  2376.     print "Number of allocation units : ";info1.numunits
  2377.     print "Available allocation units : ";info1.availunits
  2378.     print "Bytes per sector : ";info1.bytesec
  2379.  END IF
  2380.  
  2381.  level=2
  2382.  bufsize=16
  2383.  print
  2384.  Print "Level Two Information"
  2385.  print
  2386.  
  2387.  x = DosQFSInfo%(drivenumber,level,varseg(info2),varptr(info2),bufsize)
  2388.  
  2389.  IF (x) THEN
  2390.     Print "An error occurred.  The number is : ";x
  2391.  ELSE
  2392.     PRINT "Volume Creation Date : ";wdate$(info2.VolumeDate)
  2393.     PRINT "Volume Creation Time : ";wtime$(info2.VolumeTime)
  2394.     PRINT "Length of Label : ";asc(info2.Vlen)
  2395.     PRINT "Volume Label : ";info2.Vlabel
  2396.  END IF
  2397.  
  2398.  print
  2399.  input "Enter the new VOLUME name : ";info3.Vlabel
  2400.  info3.vlen=chr$(len(info3.vlabel))
  2401.  info3.vlabel=info3.vlabel+chr$(0)
  2402.  level=2
  2403.  bufsize=12
  2404.  
  2405.  x = DosSetFSInfo%(drivenumber,level,varseg(info3),varptr(info3),bufsize)
  2406.  
  2407.  IF (x) THEN
  2408.     Print "An error occurred.  The number is : ";x
  2409.  ELSE
  2410.     Print "The volume label is changed."
  2411.     level=2
  2412.     bufsize=16
  2413.     print
  2414.     Print "Level Two Information"
  2415.     print
  2416.     x = DosQFSInfo%(drivenumber,level,varseg(info2),varptr(info2),bufsize)
  2417.     IF (x) THEN
  2418.       Print "An error occurred.  The number is : ";x
  2419.    ELSE
  2420.       PRINT "Volume Creation Date : ";wdate$(info2.VolumeDate)
  2421.       PRINT "Volume Creation Time : ";wtime$(info2.VolumeTime)
  2422.       PRINT "Length of Label : ";asc(info2.Vlen)
  2423.       PRINT "Volume Label : ";info2.Vlabel
  2424.    END IF
  2425.  END IF
  2426.  
  2427.  END
  2428.  
  2429.  FUNCTION wdate$(d%) static
  2430.  DIM dl AS LONG
  2431.      dl=unsigned&(d%)
  2432.      mn=(RightShift%(dl,5)) AND (&h0f)
  2433.      IF mn < 10 THEN
  2434.         mn$="0"+ltrim$(str$(mn))
  2435.      ELSE
  2436.         mn$=ltrim$(str$(mn))
  2437.      END IF
  2438.      dy= dl AND (&h1f)
  2439.      IF dy < 10 THEN
  2440.         dy$="0"+ltrim$(str$(dy))
  2441.      ELSE
  2442.         dy$=ltrim$(str$(dy))
  2443.      END IF
  2444.      yr$=str$(RightShift(dl,9)+1980)
  2445.      wdate$=mn$+"/"+dy$+"/"+ltrim$(yr$)
  2446.  END FUNCTION
  2447.  
  2448.  FUNCTION wtime$(d%)
  2449.  DIM dl AS LONG
  2450.     dl=unsigned&(d%)
  2451.     hr=RightShift%(dl,11) AND (&h1f)
  2452.     IF hr < 10 THEN
  2453.        hr$="0"+ltrim$(str$(hr))
  2454.     ELSE
  2455.        hr$=ltrim$(str$(hr))
  2456.     END IF
  2457.     mt=(RightShift%(dl,5) AND (&h3f))
  2458.     IF mt < 10 THEN
  2459.        mt$="0"+ltrim$(str$(mt))
  2460.     ELSE
  2461.        mt$=ltrim$(str$(mt))
  2462.     END IF
  2463.     wtime$=ltrim$(hr$)+":"+mt$+string$(5,32)
  2464.  END FUNCTION
  2465.  
  2466.  FUNCTION RightShift%(number&,amount)
  2467.     Rightshift=number&\2^amount
  2468.  END FUNCTION
  2469.  
  2470.  FUNCTION LeftShift%(number&,amount)
  2471.    LeftShift=number&*(2^amount)
  2472.  END FUNCTION
  2473.  
  2474.  FUNCTION unsigned&(num)
  2475.     IF num >=0 THEN
  2476.        unsigned&=num
  2477.     ELSE
  2478.        unsigned&=65536+num
  2479.     END IF
  2480.  END FUNCTION
  2481.  
  2482.  
  2483.  54. Example of Calling OS/2 Function DosGetEnv
  2484.  
  2485.  Product Version(s): 6.00 6.00b 7.00
  2486.  Operating System:   OS/2
  2487.  Flags: ENDUSER |
  2488.  Last Modified:  2-FEB-1990    ArticleIdent: Q28446
  2489.  
  2490.  Below is a sample program that invokes the OS/2 function DosGetEnv.
  2491.  
  2492.  ' The function declarations are found in file BSEDOSPC.BI
  2493.  
  2494.  DECLARE FUNCTION DosGetEnv%(_
  2495.          SEG P1 AS INTEGER,_
  2496.          SEG P2 AS INTEGER)
  2497.  cls
  2498.  x=DosGetEnv(y%,z%)
  2499.  
  2500.  IF (x) then
  2501.    Print "An error occurred.  The error number is ";x
  2502.  ELSE
  2503.    Print "Address to Place Segment Handle : ";y%
  2504.    Print "Address to Place Command Line Start : ",z%
  2505.  END IF
  2506.  
  2507.  def seg = y%
  2508.  
  2509.  PRINT "THE INFORMATION IN THE ENVIRONMENT TABLE :" : PRINT
  2510.  
  2511.  For i = 0 to z%-20
  2512.    t%=peek(i)
  2513.    IF t%=42 THEN
  2514.       hold%=i
  2515.    END IF
  2516.  
  2517.    IF t% = 0 THEN
  2518.      print " "
  2519.    ELSE
  2520.      print chr$(t%);
  2521.    END IF
  2522.  next i
  2523.  print
  2524.  i = 0
  2525.  PRINT "The Command Line Argument is : ";
  2526.  
  2527.  DO
  2528.   t%=peek(z%+i)
  2529.   print chr$(t%);
  2530.   i = i + 1
  2531.  LOOP WHILE t% <> 0
  2532.  PRINT " "
  2533.  
  2534.  print
  2535.  PRINT "POKING SOME INFORMATION INTO THE ENVIRONMENT TABLE... " : print
  2536.  PRINT
  2537.  
  2538.  IF hold%<>0 THEN
  2539.     for i = 0 to 9
  2540.       poke hold%-i, 74-i
  2541.     next i
  2542.     def seg
  2543.     PRINT "The information was poked into the environment variable FOO;"
  2544.     PRINT "which was previously set to **********"
  2545.  
  2546.     print "The NEW contents of FOO  : ";environ$("FOO") : print
  2547.     Print "When the program is exited, notice the environment table";
  2548.     Print "isn't changed."
  2549.     PRINT "BASCOM uses only a copy of the actual DOS environment table"
  2550.     print
  2551.  ELSE
  2552.     print "The FOO environment variable is not set. "
  2553.     print "To have the complete demo, set the FOO=**********"
  2554.  END IF
  2555.  END
  2556.  
  2557.  
  2558.  55. Calling OS/2 DOSInsMessage, DOSGetMessage, DOSPutMessage
  2559.  
  2560.  Product Version(s): 6.00 6.00b 7.00
  2561.  Operating System:   OS/2
  2562.  Flags: ENDUSER |
  2563.  Last Modified:  2-FEB-1990    ArticleIdent: Q28447
  2564.  
  2565.  Below is an example of calling OS/2 DOSInsMessage, DOSGetMessage, and
  2566.  DOSPutMessage.
  2567.  
  2568.  ' The function declarations are found in file BSEDOSPC.BI
  2569.  
  2570.  TYPE ADDRESS
  2571.       OFFSET  AS INTEGER
  2572.       SEGMENT AS INTEGER
  2573.  END TYPE
  2574.  
  2575.  DECLARE FUNCTION DOSINSMESSAGE%(_
  2576.          BYVAL P1s AS INTEGER,_
  2577.          BYVAL P1o AS INTEGER,_
  2578.          BYVAL P2  AS INTEGER,_
  2579.          BYVAL P3s AS INTEGER,_
  2580.          BYVAL P3o AS INTEGER,_
  2581.          BYVAL P4  AS INTEGER,_
  2582.          BYVAL P5s AS INTEGER,_
  2583.          BYVAL P5o AS INTEGER,_
  2584.          BYVAL P6  AS INTEGER,_
  2585.          SEG   P7  AS INTEGER)
  2586.  
  2587.  DECLARE FUNCTION DOSGETMESSAGE%(_
  2588.          BYVAL P1s AS INTEGER,_
  2589.          BYVAL P1o AS INTEGER,_
  2590.          BYVAL P2  AS INTEGER,_
  2591.          BYVAL P3s AS INTEGER,_
  2592.          BYVAL P3o AS INTEGER,_
  2593.          BYVAL P4  AS INTEGER,_
  2594.          BYVAL P5  AS INTEGER,_
  2595.          BYVAL P6s AS INTEGER,_
  2596.          BYVAL P6o AS INTEGER,_
  2597.          SEG   P7  AS INTEGER)
  2598.  
  2599.  DECLARE FUNCTION DOSPUTMESSAGE%(_
  2600.          BYVAL P1  AS INTEGER,_
  2601.          BYVAL P2  AS INTEGER,_
  2602.          BYVAL P3s AS INTEGER,_
  2603.          BYVAL P3o AS INTEGER)
  2604.  
  2605.  DEFINT a-z
  2606.  
  2607.  DIM VarTable(9) AS ADDRESS   'Array of address of Strings
  2608.  VarCount=2
  2609.  CLS
  2610.  MsgIn$="This is a test.  My Name is %1 %2"+chr$(0)
  2611.  MsgInLen=len(MsgIn$)
  2612.  
  2613.  DIM MsgOut AS STRING*80
  2614.  
  2615.  MsgOutLen=len(MsgOut)
  2616.  MsgOut=string$(MsgOutLen-1,32)
  2617.  
  2618.  one$="Joe"+chr$(0)
  2619.  two$="Smith"+chr$(0)
  2620.  
  2621.  VarTable(0).offset=sadd(one$)
  2622.  VarTable(0).segment=varseg(one$)
  2623.  VarTable(1).offset=sadd(two$)
  2624.  VarTable(1).segment=varseg(two$)
  2625.  
  2626.  x=DosInsMessage%(varseg(VarTable(0)),varptr(VarTable(0)),VarCount,_
  2627.                   varseg(MsgIn$),sadd(MsgIn$),MsgInLen,_
  2628.                   varseg(MsgOut),varptr(MsgOut),MsgOutLen,number)
  2629.  
  2630.  IF (x) THEN
  2631.     Print "An error occurred.  The number is : ";x
  2632.  ELSE
  2633.    print MsgOut
  2634.  END IF
  2635.  
  2636.  DIM buffer as STRING*80
  2637.  BufferLen=80
  2638.  
  2639.  'This is a file by the OS/2 Message Utilities.
  2640.  'See Microsoft OS/2 Programmer's Guide, Section 20.5, Pages 205-212)
  2641.  
  2642.  Filename$="JoeSmith.msg"+chr$(0)
  2643.  
  2644.  FOR i = 100 to 104
  2645.  x=DosGetMessage%(varseg(VarTable(0)),varptr(VarTable(0)),VarCount,_
  2646.                   varseg(buffer),varptr(buffer),BufferLen,_
  2647.                   i,varseg(filename$),sadd(filename$),number)
  2648.  
  2649.  IF (x) THEN
  2650.     Print "An error occurred.  The number is : ";x
  2651.  ELSE
  2652.    x=DosPutMessage(1,number,varseg(buffer),varptr(buffer))
  2653.    IF (x) THEN
  2654.       Print "An error occurred.  The number is : ";x
  2655.    END IF
  2656.  END IF
  2657.  NEXT i
  2658.  locate 10,1
  2659.  
  2660.  END
  2661.  
  2662.  
  2663.  56. Example Calling OS/2 DosFindFirst, DosFindNext, DosFindClose
  2664.  
  2665.  Product Version(s): 6.00 6.00b 7.00
  2666.  Operating System:   OS/2
  2667.  Flags: ENDUSER |
  2668.  Last Modified:  2-FEB-1990    ArticleIdent: Q28448
  2669.  
  2670.  Below is an example of calling OS/2 DosFindFirst, DosFindNext, and
  2671.  DosFindClose.
  2672.  
  2673.  'Declarations found in file BSEDOSFL.BI
  2674.  'Compiler options: /D/W (/V requires modifications to the code)
  2675.  CONST TRUE=-1
  2676.  CONST FALSE=0
  2677.  
  2678.  TYPE FILEFINDBUF
  2679.          fdateCreation  AS INTEGER
  2680.          ftimeCreation  AS INTEGER
  2681.          fdateLastAccess AS INTEGER
  2682.          ftimeLastAccess AS INTEGER
  2683.          fdateLastWrite AS INTEGER
  2684.          ftimeLastWrite AS INTEGER
  2685.          cbFile         AS LONG
  2686.          cbFileAlloc    AS LONG
  2687.          attrFile       AS INTEGER
  2688.          cchName        AS STRING * 1
  2689.          achName        AS STRING * 13
  2690.  END TYPE
  2691.  
  2692.  DECLARE FUNCTION DosFindFirst%( _
  2693.          BYVAL P1s AS INTEGER,_
  2694.          BYVAL P1o AS INTEGER,_
  2695.          SEG   P2 AS INTEGER,_
  2696.          BYVAL P3 AS INTEGER,_
  2697.          SEG   P4 AS FILEFINDBUF,_
  2698.          BYVAL P5 AS INTEGER,_
  2699.          SEG   P6 AS INTEGER,_
  2700.          BYVAL P7 AS LONG)
  2701.  
  2702.  DECLARE FUNCTION DosFindNext%( _
  2703.          BYVAL P1 AS INTEGER,_
  2704.          SEG   P2 AS FILEFINDBUF,_
  2705.          BYVAL P3 AS INTEGER,_
  2706.          SEG   P4 AS INTEGER)
  2707.  
  2708.  DECLARE FUNCTION DosFindClose%( _
  2709.          BYVAL P1 AS INTEGER)
  2710.  
  2711.  'Routines to print Date/Time and File Type
  2712.  
  2713.  DECLARE FUNCTION wdate$(p1 as integer)
  2714.  DECLARE FUNCTION wtime$(p1 as integer)
  2715.  DECLARE FUNCTION RightShift%(P1 as LONG,P2 as Integer)
  2716.  DECLARE FUNCTION LeftShift%(P1 as LONG, P2 as Integer)
  2717.  DECLARE FUNCTION FileType$(P1 as Integer)
  2718.  
  2719.  DEFINT a-z
  2720.  
  2721.  COLOR 15,1
  2722.  DIM buffer AS FileFindBuf
  2723.  DIM filelist(255) as FileFindBuf
  2724.  DIM reserved  AS LONG
  2725.  
  2726.  CLS
  2727.  print "Test of DOSFINDFIRST..."
  2728.  
  2729.  INPUT "Enter the Filename(s) : ";flname$
  2730.  flname$=flname$+chr$(0)
  2731.  
  2732.  atr= 0+2+4+16    'normal + hidden + system + subdirectory
  2733.  dirh=1
  2734.  searchcount=1
  2735.  bufflen=36
  2736.  
  2737.  x=DosFindFirst%(varseg(flname$),sadd(flname$),_
  2738.                  dirh,atr,buffer,bufflen,searchcount,reserved)
  2739.  IF (X=0) THEN
  2740.     DO
  2741.       counter=counter+1
  2742.       filelist(counter)=buffer
  2743.       buffer.achname=string$(13,32)  'assign blanks
  2744.       buffer.fdatelastwrite=0
  2745.       buffer.ftimelastwrite=0
  2746.     LOOP WHILE (DosFindNext%(dirh,buffer,bufflen,searchcount) = 0 )
  2747.  ELSE
  2748.      PRINT "No MATCH was found"
  2749.      END
  2750.  END IF
  2751.  CLS
  2752.  
  2753.  print  "FILENAME : "; : LOCATE 1,30 : PRINT "FILE SIZE : ";
  2754.  locate 2,1 : PRINT "LAST WRITE DATE : ";
  2755.  locate 3,1 : PRINT "LAST WRITE TIME : ";
  2756.  locate 4,1 : PRINT "FILE TYPE : ";
  2757.  COLOR 5
  2758.  
  2759.  i = 1
  2760.  
  2761.  done=FALSE
  2762.  
  2763.  key 15, chr$(&h00)+chr$(&h01) 'ESC KEY to EXIT
  2764.  on key (15) gosub FINISH
  2765.  on key (11) gosub UP
  2766.  on key (14) gosub DOWN
  2767.  key (15) on
  2768.  key (11) on
  2769.  key (14) on
  2770.  
  2771.  locate 20,1 : Print "Enter ESC to quit, UP/DOWN ARROWS to scroll list";
  2772.  
  2773.  while (not DONE)
  2774.  lp:
  2775.   LOCATE 1,14 : PRINT filelist(i).achname;
  2776.   LOCATE 1,45 : PRINT filelist(i).cbfile;"/";filelist(i).cbfilealloc;"       "
  2777.   LOCATE 2,20 : PRINT wdate$(filelist(i).fdatelastwrite);"        ";
  2778.   LOCATE 3,20 : PRINT wtime$(filelist(i).ftimelastwrite);"        ";
  2779.   LOCATE 4,15 : PRINT filetype$(filelist(i).attrfile);"       ";
  2780.   a$=inkey$
  2781.   if a$="" then goto lp
  2782.  wend
  2783.  
  2784.  color 15
  2785.  x=DosFindClose%(dirh)
  2786.  IF (x) THEN
  2787.    color 7 : PRINT "An error occurred. The number is : ";x : color 15
  2788.  ELSE
  2789.    color ,0
  2790.    cls
  2791.  END IF
  2792.  END
  2793.  STOP
  2794.  
  2795.  FINISH:
  2796.     DONE = TRUE
  2797.     RETURN
  2798.     STOP
  2799.  UP:
  2800.     IF i = 1 THEN
  2801.        locate 24,1
  2802.        color 7
  2803.        print "At the top of the list                       ";
  2804.        color 5
  2805.     ELSE
  2806.        locate 24,1 : print string$(78,32);
  2807.        i = i - 1
  2808.     END IF
  2809.     RETURN
  2810.     STOP
  2811.  DOWN:
  2812.     IF i = counter THEN
  2813.        locate 24,1
  2814.        color 7
  2815.        Print "At the bottom of the list                  ";
  2816.        color 5
  2817.     ELSE
  2818.        i = i + 1
  2819.        locate 24,1 : print string$(78,32);
  2820.     END IF
  2821.     RETURN
  2822.     STOP
  2823.  
  2824.  FUNCTION wdate$(d%) static
  2825.  DIM dl AS LONG
  2826.      dl=unsigned&(d%)
  2827.      mn=(RightShift%(dl,5)) AND (&h0f)
  2828.      IF mn < 10 THEN
  2829.         mn$="0"+ltrim$(str$(mn))
  2830.      ELSE
  2831.         mn$=ltrim$(str$(mn))
  2832.      END IF
  2833.      dy= dl AND (&h1f)
  2834.      IF dy < 10 THEN
  2835.         dy$="0"+ltrim$(str$(dy))
  2836.      ELSE
  2837.         dy$=ltrim$(str$(dy))
  2838.      END IF
  2839.      yr$=str$(RightShift(dl,9)+1980)
  2840.      wdate$=mn$+"/"+dy$+"/"+ltrim$(yr$)
  2841.  END FUNCTION
  2842.  
  2843.  FUNCTION wtime$(d%)
  2844.  DIM dl AS LONG
  2845.     dl=unsigned&(d%)
  2846.     hr=RightShift%(dl,11) AND (&h1f)
  2847.     IF hr < 10 THEN
  2848.        hr$="0"+ltrim$(str$(hr))
  2849.     ELSE
  2850.        hr$=ltrim$(str$(hr))
  2851.     END IF
  2852.     mt=(RightShift%(dl,5) AND (&h3f))
  2853.     IF mt < 10 THEN
  2854.        mt$="0"+ltrim$(str$(mt))
  2855.     ELSE
  2856.        mt$=ltrim$(str$(mt))
  2857.     END IF
  2858.     wtime$=ltrim$(hr$)+":"+mt$+string$(5,32)
  2859.  END FUNCTION
  2860.  
  2861.  FUNCTION FileType$(attr)
  2862.    SELECT CASE attr
  2863.       CASE 0
  2864.          FileType$="Normal File"
  2865.       CASE 1
  2866.          FileType$="Read-Only File"
  2867.       CASE 2
  2868.          FileType$="Hidden File"
  2869.       CASE 4
  2870.          FileType$="System File"
  2871.       CASE &h10
  2872.          FileType$="Subdirectory"
  2873.       CASE &h20
  2874.          FileType$="File Archive"
  2875.       CASE ELSE
  2876.          FileType$="Unknown Type"
  2877.    END SELECT
  2878.  END FUNCTION
  2879.  
  2880.  FUNCTION RightShift%(number&,amount)
  2881.     Rightshift=number&\2^amount
  2882.  END FUNCTION
  2883.  
  2884.  FUNCTION LeftShift%(number&,amount)
  2885.    LeftShift=number&*(2^amount)
  2886.  END FUNCTION
  2887.  
  2888.  FUNCTION unsigned&(num)
  2889.     IF num >=0 THEN
  2890.        unsigned&=num
  2891.     ELSE
  2892.        unsigned&=65536+num
  2893.     END IF
  2894.  END FUNCTION
  2895.  
  2896.  
  2897.  57. "Device Unavailable" Using Communications Port in Real Mode
  2898.  
  2899.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00B 7.00
  2900.  Operating System:   MS-DOS          | OS/2
  2901.  Flags: ENDUSER |
  2902.  Last Modified: 26-FEB-1990    ArticleIdent: Q30855
  2903.  
  2904.  If a "Device Unavailable" message occurs when trying to do
  2905.  communications under real mode (the DOS 3.x compatibility box in
  2906.  OS/2), then setcom40 must be run. This process allows the program to
  2907.  access the COM port in real mode. Setcom40 sets the serial-port
  2908.  address before starting the real mode program.
  2909.  
  2910.  Real mode applications use the BIOS COM-port base addresses, which
  2911.  begin at 400H to determine the presence of serial ports. However, the
  2912.  OS/2 COM.SYS device driver fills these addresses with zeros to keep
  2913.  real mode programs from interfering with protected mode applications
  2914.  that might try to access the COM ports.
  2915.  
  2916.  Setcom40 sets the port base addresses to values that real mode
  2917.  applications will recognize.
  2918.  
  2919.  The following syntax writes the port address for COMx in the BIOS area
  2920.  of the disk, where x is the number of the serial port:
  2921.  
  2922.     setcom40 comx=on
  2923.  
  2924.  The following syntax removes the address from the BIOS area of the
  2925.  disk when the real mode application no longer requires it:
  2926.  
  2927.     setcom40 comx=off (where x is the number of the serial port)
  2928.  
  2929.  For more information, please refer to Page 190 in the "Microsoft
  2930.  Operating System/2 Beginning User's Guide" of the Microsoft OS/2 SDK
  2931.  (Software Development Kit) Version 1.00.
  2932.  
  2933.  
  2934.  58. Sample BASIC Program That Makes OS/2 Call to DosSearchPath
  2935.  
  2936.  Product Version(s): 6.00 6.00b 7.00
  2937.  Operating System:   OS/2
  2938.  Flags: ENDUSER |
  2939.  Last Modified:  1-FEB-1990    ArticleIdent: Q35271
  2940.  
  2941.  Below is a sample program that makes a call to the MS OS/2 function
  2942.  DosSearchPath. This program can be compiled in Microsoft BASIC Compiler
  2943.  Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC Professional
  2944.  Development System (PDS) Version 7.00 for MS OS/2.
  2945.  
  2946.  'This information is in the include File: BSEDOSPC.BI
  2947.  
  2948.  DECLARE FUNCTION DOSSEARCHPATH%(_
  2949.          BYVAL P1 AS INTEGER,_
  2950.          BYVAL P2o AS INTEGER,_
  2951.          BYVAL P2s AS INTEGER,_
  2952.          BYVAL P3o AS INTEGER,_
  2953.          BYVAL P3s AS INTEGER,_
  2954.          BYVAL P4o AS INTEGER,_
  2955.          BYVAL P4s AS INTEGER,_
  2956.          BYVAL P5 AS INTEGER)
  2957.  
  2958.  DEFINT a-z
  2959.  
  2960.  DIM Buffer   AS STRING*60
  2961.  CLS
  2962.  bufferlen=len(buffer)
  2963.  buffer=string$(bufferlen,32)
  2964.  
  2965.  PRINT " 0 - SEARCH DIRECTORY GIVEN AS PATH"
  2966.  PRINT " 1 - SEARCH DEFAULT THEN PATH"
  2967.  PRINT " 2 - SEARCH STRING OF DIRECTORIES"
  2968.  PRINT " 3 - SEARCH DEFAULT THEN DIRECTORIES IN ENVIRONMENT VARIABLE GIVEN"
  2969.  INPUT "Enter OPTION : ";opt
  2970.  INPUT "Enter the PATH : ";pathref$
  2971.  pathref$=pathref$+chr$(0)
  2972.  INPUT "Enter the FILENAME : ";flname$
  2973.  flname$=flname$+chr$(0)
  2974.  
  2975.  x=DosSearchPath%(opt,varseg(PathRef$),sadd(PathRef$),_
  2976.                   varseg(FlName$),sadd(FlName$),_
  2977.                   varseg(buffer),varptr(buffer),bufferlen)
  2978.  
  2979.  IF (x) THEN
  2980.     Print "An error occurred.  The number is : ";x
  2981.  ELSE
  2982.     Print Buffer
  2983.  END IF
  2984.  end
  2985.  
  2986.  
  2987.  59. Missing Text: DECLARE Statement
  2988.  
  2989.  Product Version(s): 6.00 6.00b | 6.00 6.00b
  2990.  Operating System:   MS-DOS     | OS/2
  2991.  Flags: ENDUSER | docerr
  2992.  Last Modified:  2-FEB-1990    ArticleIdent: Q28962
  2993.  
  2994.  There is a documentation error on Page 43 of the "Microsoft BASIC
  2995.  Compiler 6.0: Programming in BASIC: Selected Topics" manual for
  2996.  Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS and MS
  2997.  OS/2. The last sentence of the first paragraph in the Note that
  2998.  appears in the center of the page is missing some text.
  2999.  
  3000.  The sentence should read as follows:
  3001.  
  3002.     A DECLARE statement ensures that only the correct number and type
  3003.     of arguments are passed to a procedure, and allows your program to
  3004.     call procedures defined in separate modules. See the "BASIC
  3005.     Language Reference" manual for more information on DECLARE.
  3006.  
  3007.  This documentation error was corrected in the documentation for
  3008.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  3009.  MS-DOS and MS OS/2.
  3010.  
  3011.  
  3012.  60. LINK /PAC and /F Options Are Not Supported by BASIC Compiler
  3013.  
  3014.  Product Version(s): 6.00 6.00b 7.00
  3015.  Operating System:   MS-DOS
  3016.  Flags: ENDUSER | B_QuickBas
  3017.  Last Modified:  2-FEB-1990    ArticleIdent: Q31881
  3018.  
  3019.  The /F (far call translation) and /PAC (packcode) options of LINK.EXE
  3020.  Version 5.01.20 should not be used with BASIC programs.
  3021.  
  3022.  The LINK section on Pages 276-278 of the "Microsoft CodeView and
  3023.  Utilities: Software Development Tools for MS-DOS" manual states that
  3024.  if the /F and /PAC options are used together, slightly faster code and
  3025.  smaller executable file size are generated.
  3026.  
  3027.  This process is performed by directing the linker to group together
  3028.  neighboring code segments and by optimizing far CALLs.
  3029.  
  3030.  However, this information does not apply to BASIC. When you link
  3031.  compiled BASIC routines with LINK /F/PAC, the executable .EXE file
  3032.  size remains the same as the .EXE file size when linked without these
  3033.  options, and speed is not increased.
  3034.  
  3035.  This information applies to the BC.EXE that comes with QuickBASIC
  3036.  Versions 4.00, 4.00b, and 4.50, to Microsoft BASIC Compiler Versions
  3037.  6.00 and 6.00b for MS-DOS and MS OS/2, and to Microsoft BASIC
  3038.  Professional Development System (PDS) Version 7.00 for MS-DOS and MS
  3039.  OS/2.
  3040.  
  3041.  
  3042.  61. Example of Using SetUEvent, ON UEVENT to Detect Mouse Presence
  3043.  
  3044.  Product Version(s): 6.00 6.00b 7.00 7.10
  3045.  Operating System:   MS-DOS
  3046.  Flags: ENDUSER | B_QuickBas
  3047.  Last Modified: 17-JAN-1991    ArticleIdent: Q31936
  3048.  
  3049.  The following example uses the SetUEvent routine and the ON UEVENT
  3050.  statement to trap a user-defined event. An event occurs in the sample
  3051.  program below if the Microsoft Mouse is not installed. The program
  3052.  traps the event if and when it occurs, and then prints a message.
  3053.  
  3054.  The user-defined event-trapping feature is found in QuickBASIC version
  3055.  4.00b, Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS,
  3056.  and Microsoft BASIC Professional Development System (PDS) versions
  3057.  7.00 and 7.10 for MS-DOS. The SetUEvent routine and the ON UEVENT
  3058.  statement are not found in QuickBASIC version 4.00 or earlier.
  3059.  
  3060.  For more information on the CALL INTERRUPT statement used in the code
  3061.  example below to call the Microsoft Mouse, query on the following
  3062.  words in this database:
  3063.  
  3064.     mouse and CALL and INTERRUPT
  3065.  
  3066.  INTERRUPT is an external routine located in QB.LIB on the QuickBASIC
  3067.  release disk.
  3068.  
  3069.  Code Example
  3070.  ------------
  3071.  
  3072.  DECLARE SUB mouse (m0, m1, m2, m3)
  3073.  ' change following line to include QBX.BI if in BASIC PDS 7.00/7.10
  3074.  REM $INCLUDE: 'QB.BI'
  3075.  
  3076.  ON UEVENT GOSUB handler
  3077.  UEVENT ON
  3078.  
  3079.  m0 = 0: CALL mouse(m0, m1, m2, m3)                 'Initialize the MOUSE
  3080.     IF NOT m0 THEN CALL SetUEvent    'If no Mouse installed print message
  3081.  '-------------- Other program code can be written here -----------------
  3082.  END
  3083.  handler:
  3084.     PRINT "No Mouse installed"
  3085.  END
  3086.  
  3087.  SUB mouse (m0, m1, m2, m3) STATIC         'Talks to the MOUSE.COM driver
  3088.  DIM inregs AS RegType: DIM outregs AS RegType
  3089.     inregs.ax = m0                                    'Load the registers
  3090.     inregs.bx = m1
  3091.     inregs.cx = m2
  3092.     inregs.dx = m3
  3093.     CALL INTERRUPT(51, inregs, outregs)   'Call the mouse driver interrupt
  3094.     m0 = outregs.ax
  3095.     m1 = outregs.bx                             'Return values from driver
  3096.     m2 = outregs.cx
  3097.     m3 = outregs.dx
  3098.  END SUB
  3099.  
  3100.  
  3101.  62. Two Ways to Pass Arrays in Compiled BASIC to Assembler Routine
  3102.  
  3103.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  3104.  Operating System:   MS-DOS               | OS/2
  3105.  Flags: ENDUSER | B_QuickBas
  3106.  Last Modified:  8-AUG-1990    ArticleIdent: Q32216
  3107.  
  3108.  An array in a compiled BASIC program can be passed to an assembly
  3109.  language program in the two ways shown below. The array can be passed
  3110.  either through the CALL statement's parameter list or, for static
  3111.  arrays only, through a COMMON block.
  3112.  
  3113.  Microsoft does not support passing dynamic arrays through COMMON to
  3114.  assembler (since this depends upon a Microsoft proprietary dynamic
  3115.  array descriptor format that changes from version to version). Dynamic
  3116.  arrays can be passed to assembler only as parameters in the CALL
  3117.  statement.
  3118.  
  3119.  This information applies to the following products:
  3120.  
  3121.  1. Microsoft QuickBASIC Compiler versions 4.00, 4.00b, and 4.50
  3122.  
  3123.  2. Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS and
  3124.     MS OS/2
  3125.  
  3126.  3. Microsoft BASIC Professional Development System (PDS) versions 7.00
  3127.     and 7.10 for MS-DOS and MS OS/2
  3128.  
  3129.  For more information about passing other types of parameters between
  3130.  BASIC and MASM, search in the Software/Data Library for the following
  3131.  word:
  3132.  
  3133.     BAS2MASM
  3134.  
  3135.  The following information pertains to passing an array to an assembly
  3136.  routine through the CALL parameter list:
  3137.  
  3138.  If the array is passed through the parameter list, all the information
  3139.  about the array must be passed. This includes the length of each item,
  3140.  the number of items, and the segment and offset of the base element of
  3141.  the array. The first two items may be hardcoded into the assembler
  3142.  program, but the latter two must be passed because there is no way of
  3143.  knowing where the array will be located before the program starts. The
  3144.  following is an example:
  3145.  
  3146.     DECLARE SUB PutInfo (BYVAL Segment%, BYVAL Offset%)
  3147.     DIM a%(100)
  3148.     CALL PutInfo(VARSEG(a%(0)),VARPTR(a%(0)))
  3149.  
  3150.  The assembly-language program pulls the information off the stack,
  3151.  then continues with its purpose. Please note that this method works
  3152.  with both static and dynamic arrays.
  3153.  
  3154.  The following information pertains to passing an array to an assembly
  3155.  language routine through a COMMON block:
  3156.  
  3157.  Passing information through a COMMON block to an assembly language
  3158.  program is fairly simple. In the assembly language program, a segment
  3159.  is set up with the same name as the COMMON block and then grouped with
  3160.  DGROUP, as follows:
  3161.  
  3162.     BNAME segment 'BC_VARS'
  3163.       x  dw 1 dup (?)
  3164.       y  dw 1 dup (?)
  3165.       z  dw 1 dup (?)
  3166.     BNAME ends
  3167.  
  3168.    dgroup group BNAME
  3169.  
  3170.  The above assembler code matches the following BASIC code named COMMON
  3171.  block:
  3172.  
  3173.     DEFINT A-Z
  3174.     COMMON /BNAME/ x,y,z
  3175.  
  3176.  Passing arrays through the COMMON block is done in a similar fashion.
  3177.  However, only static arrays may be passed to assembler through COMMON.
  3178.  
  3179.  Note: This information does not apply to passing far
  3180.  variable-length-strings in BASIC PDS version 7.00 or 7.10. For
  3181.  information on accessing far variable-length-strings in BASIC PDS
  3182.  version 7.00 or 7.10, see Chapter 13, "Mixed-Language Programming with
  3183.  Far Strings," in the "Microsoft BASIC 7.0: Programmer's Guide" for
  3184.  versions 7.00 and 7.10.
  3185.  
  3186.  When static arrays are used, the entire array is stored in the COMMON
  3187.  block. Consider the following example:
  3188.  
  3189.  BASIC Program
  3190.  -------------
  3191.  
  3192.        DECLARE SUB PutInfo ()
  3193.        DIM b%(100)
  3194.        COMMON /BNAME/ a%, b%(), c%
  3195.        CALL PutInfo
  3196.        CLS
  3197.        PRINT a%, c%
  3198.        FOR i = 0 TO 100
  3199.         PRINT b%(i);
  3200.        NEXT i
  3201.        END
  3202.  
  3203.  Assembly Program
  3204.  -----------------
  3205.  
  3206.        ;Note, this program uses MASM version 5.x directives.
  3207.  
  3208.        .model Medium
  3209.  
  3210.         BNAME segment COMMON 'BC_VARS'
  3211.           a  dw 1 dup (?)
  3212.           b  db 202 dup (?)      ;Note that all the space for the
  3213.                                  ;array is set up
  3214.           c  dw 1 dup (?)
  3215.         BNAME ends
  3216.  
  3217.         dgroup group BNAME
  3218.  
  3219.         .code
  3220.  
  3221.              public PutInfo
  3222.         PutInfo      proc   far
  3223.              push   bp
  3224.              mov    bp,sp
  3225.              push   di
  3226.  
  3227.              inc    word ptr dgroup:a
  3228.              inc    word ptr dgroup:c
  3229.  
  3230.              mov    cx,101
  3231.              mov    di,offset dgroup:b
  3232.  
  3233.         repeat:
  3234.              mov    [di],cx
  3235.              add    di,2
  3236.              loop   repeat
  3237.  
  3238.              pop    di
  3239.              pop    bp
  3240.              ret
  3241.         PutInfo      endp
  3242.              end
  3243.  
  3244.  As noted in the assembly source, the space for the array must be set up
  3245.  in the COMMON segment.
  3246.  
  3247.  When dynamic arrays are used, the array is not placed in the COMMON
  3248.  block. Instead, a multibyte array descriptor is placed on the COMMON
  3249.  block. The dynamic array descriptor changes from version to version,
  3250.  and is not released by Microsoft -- it is considered Microsoft
  3251.  proprietary information.
  3252.  
  3253.  
  3254.  63. Using B_OnExit Across a CHAIN Hangs System; Compiled BASIC
  3255.  
  3256.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  3257.  Operating System:   MS-DOS          | OS/2
  3258.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 B_QuickBas
  3259.  Last Modified: 17-JAN-1990    ArticleIdent: Q32217
  3260.  
  3261.  Chaining to and from programs that use B_OnExit causes the system to
  3262.  hang.
  3263.  
  3264.  Microsoft has confirmed this to be a problem in Microsoft QuickBASIC
  3265.  Versions 4.00 and 4.00b (buglist4.00, buglist4.00b), in Microsoft
  3266.  BASIC Compiler Version 6.00 and 6.00b for MS-DOS and MS OS/2, and in
  3267.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  3268.  MS-DOS and MS OS/2. We are researching this problem and will post new
  3269.  information here as it becomes available.
  3270.  
  3271.  Please note that the B_OnExit routine is documented on Pages 319-321
  3272.  of the "Microsoft QuickBASIC 4.0: Learning and Using" manual for
  3273.  Microsoft QuickBASIC Versions 4.00 and 4.00b (this is the same manual
  3274.  for Microsoft BASIC Compiler Versions 6.00 and 6.00b), and in the
  3275.  "Microsoft BASIC 7.0: Programmer's Guide" on Pages 474-475.
  3276.  
  3277.  The following steps reproduce the problem using source code provided
  3278.  farther below:
  3279.  
  3280.  1. Use the following software to reproduce the problem:
  3281.  
  3282.     a. Microsoft QuickBASIC Versions 4.00, 4.00b, Microsoft BASIC
  3283.        Compiler Version 6.00 or 6.00b, or Microsoft BASIC PDS Version
  3284.        7.00.
  3285.  
  3286.     b. Microsoft C Compiler Version 5.10
  3287.  
  3288.  2. Type the following command lines:
  3289.  
  3290.        BC BUGTEST.BAS;
  3291.        BC BUGNEXT.BAS;
  3292.        CL /c /AM BUGC.C
  3293.        LINK /NOE BUGTEST+BUGC;
  3294.        LINK /NOE BUGNEXT+BUGC;
  3295.  
  3296.  3. Run BUGTEST.EXE from the DOS prompt.
  3297.  
  3298.  4. At the "CHAIN Y/N?" prompt, type Y.
  3299.  
  3300.  The system locks up when BUGNEXT exits.
  3301.  
  3302.  Please note the following:
  3303.  
  3304.  1. You must link BUGC.OBJ with BUGNEXT.OBJ even though it is not
  3305.     called.
  3306.  
  3307.  2. Both programs apparently run correctly until you exit BUGNEXT.
  3308.  
  3309.  Code Example
  3310.  ------------
  3311.  
  3312.  'BUGTEST.BAS
  3313.  
  3314.          DECLARE SUB IntProc CDECL
  3315.          DEFINT A-Z
  3316.          PRINT "[***** ENTRY TO MAIN  *****]"
  3317.          CALL InProc
  3318.          INPUT "CHAIN Y/N";T$
  3319.          IF T$="Y" OR T$="y" THEN
  3320.             CHAIN "BUGNEXT.EXE"
  3321.          END IF
  3322.          SYSTEM
  3323.          END
  3324.  
  3325.  'BUGNEXT.BAS
  3326.  
  3327.          DEFINT A-Z
  3328.          PRINT "[***** CHAIN *****]"
  3329.          SYSTEM
  3330.          END
  3331.  
  3332.  /* BUGC.C */
  3333.  
  3334.  #include <malloc.h>
  3335.  extern pascal far B_OnExit();  /* Declare the routine */
  3336.  
  3337.  void IntProc()
  3338.  {
  3339.    void TermProc();             /* Declare TermProc routine */
  3340.    printf ("\nIn the C IntProc routine\n");
  3341.    B_OnExit(TermProc);          /* Log termination routine with BASIC */
  3342.  }
  3343.  
  3344.  void TermProc()                         /* The TermProc function is */
  3345.  {                                       /* called before any restarting */
  3346.    printf ("\nIn C TermProc routine\n"); /* or termination of the program. */
  3347.  }
  3348.  
  3349.  
  3350.  64. DosGetPid and DosGetInfoSeg Get Process Identification (PID)
  3351.  
  3352.  Product Version(s): 6.00 6.00b 7.00
  3353.  Operating System:   OS/2
  3354.  Flags: ENDUSER |
  3355.  Last Modified:  1-FEB-1990    ArticleIdent: Q32219
  3356.  
  3357.  Two MS OS/2 API calls return the process identification (PID) of the
  3358.  current process. The two calls are DosGetPid and DosGetInfoSeg, which
  3359.  are illustrated in a code example below.
  3360.  
  3361.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  3362.  6.00b for MS OS/2, and to Microsoft BASIC Professional Development
  3363.  System (PDS) Version 7.00 for MS OS/2.
  3364.  
  3365.  DosGetPid is the simplest and most direct way of retrieving the
  3366.  current PID. This function is passed the address of a structure
  3367.  containing three integers or words. The function declarations are as
  3368.  follows:
  3369.  
  3370.        TYPE PidInfo
  3371.             Pid as integer        'Process Pid
  3372.             Tid as integer        'Thread Pid
  3373.             pidParent as integer 'Parent Pid
  3374.        END TYPE
  3375.  
  3376.        DECLARE FUNCTION DosGetPid%(_
  3377.                     SEG P1 AS PidInfo)
  3378.  
  3379.  The PID information is returned in the structure.
  3380.  
  3381.  The information returned by DosGetInfoSeg also helps find the PID, but
  3382.  the procedure is more difficult. This function returns the address of
  3383.  both the GDT and LDT. The LDT contains the process information. To
  3384.  locate the PID, you must set the segment to the LDT (DEF SEG=address
  3385.  of LDT), then look at the bytes that contain the desired information.
  3386.  The program below demonstrates this method. (This program also
  3387.  contains an example of DosGetPid.)
  3388.  
  3389.         'Declarations used below can be found in BSDOSPC.BI
  3390.         TYPE PidInfo
  3391.              Pid as integer
  3392.              Tid as integer
  3393.              pidParent as integer
  3394.         END TYPE
  3395.         DECLARE FUNCTION DosGetInfoSeg%(_
  3396.                      SEG P1 AS INTEGER,_
  3397.                      SEG P2 AS INTEGER)
  3398.         DECLARE FUNCTION DosGetPid%(_
  3399.                      SEG P1 AS PidInfo)
  3400.  
  3401.         DEFINT A-Z
  3402.         CLS
  3403.         DIM info AS PidInfo
  3404.  
  3405.         x=DosGetInfoSeg%(global,localo)
  3406.  
  3407.         IF (x) THEN
  3408.           Print "Error, the number is : ";x
  3409.         ELSE
  3410.           Print "The Global Segment : ";Global
  3411.           Print "The Local Segment : ";localo
  3412.           def seg=localo            'Change Segment
  3413.           pid1=peek(0)+(256*(peek(1))) 'First Word in segment
  3414.           pid2=peek(2)+(256*(peek(3))) 'Second Word
  3415.           pid3=peek(6)+(256*(peek(7))) 'Fourth Word
  3416.           def seg
  3417.           print "         Current Process ID : ";pid1
  3418.           print "       Process ID of Parent : ";pid2
  3419.           print "Thread ID of Current Thread : ";pid3
  3420.         END IF
  3421.  
  3422.         x=DosGetPid%(info)
  3423.  
  3424.         IF (x) THEN
  3425.           Print "Error, the number is : ";x
  3426.         ELSE
  3427.           print "         Current Process ID : ";info.pid
  3428.           print "       Process ID of Parent : ";info.pidParent
  3429.           print "Thread ID of Current Thread : ";info.tid
  3430.         END IF
  3431.  
  3432.  
  3433.  65. Cannot Use Alternate Math Library Without Compiling BC /FPa
  3434.  
  3435.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  3436.  Operating System:   MS-DOS          | OS/2
  3437.  Flags: ENDUSER |
  3438.  Last Modified:  2-FEB-1990    ArticleIdent: Q32415
  3439.  
  3440.  The alternate math libraries should not be used without compiling with
  3441.  the BC /FPa switch; otherwise, unpredictable results may occur.
  3442.  
  3443.  The following alternate math libraries can be used in MS OS/2
  3444.  protected mode:
  3445.  
  3446.     BC 6.00           BC 6.00b         PDS 7.00
  3447.     -------           --------         --------
  3448.  
  3449.     BRUN60AP.DLL      BRUN61AP.DLL     BRT70ANP.DLL
  3450.     BCOM60AP.LIB      BCOM61AP.LIB     BRT70ANP.LIB
  3451.                                        BRT70AFP.DLL
  3452.                                        BRT70AFP.LIB
  3453.  
  3454.  The following alternate math libraries can be used in MS-DOS or MS
  3455.  OS/2 real mode:
  3456.  
  3457.     BC 6.00           BC 6.00b         PDS 7.00
  3458.     -------           --------         --------
  3459.  
  3460.     BRUN60AR.EXE      BRUN61AP.EXE     BRT70ANR.EXE
  3461.     BCOM60AR.LIB      BRUN61AP.LIB     BRT70ANR.LIB
  3462.                                        BRT70AFR.EXE
  3463.                                        BRT70AFR.LIB
  3464.  
  3465.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  3466.  6.00b for MS-DOS and MS OS/2 and to Microsoft BASIC Professional
  3467.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  3468.  
  3469.  
  3470.  66. Linker Module-Definition Files for MS OS/2 or Windows
  3471.  
  3472.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  3473.  Operating System:   MS-DOS          | OS/2
  3474.  Flags: ENDUSER |
  3475.  Last Modified:  1-FEB-1990    ArticleIdent: Q33137
  3476.  
  3477.  A module-definition file, used by LINK.EXE, describes the name,
  3478.  attributes, exports, imports, and other characteristics of an
  3479.  application or library for MS OS/2 (or Microsoft Windows). This file
  3480.  is required for dynamic link libraries (DLLs) that run under MS OS/2
  3481.  (and for Microsoft Windows applications and libraries).
  3482.  
  3483.  Note that Microsoft BASIC Compiler Versions 6.00 and 6.00b and
  3484.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  3485.  cannot make Microsoft Windows applications or libraries. These
  3486.  products can only make OS/2 applications.
  3487.  
  3488.  For more information about the module-definition file used by LINK,
  3489.  see Page Update 39 in the "Microsoft CodeView and Utilities: Software
  3490.  Development Tools for MS OS/2 and MS-DOS: Update" manual.
  3491.  
  3492.  For more information about BASIC compatibility with Microsoft Windows,
  3493.  search for a separate article with the following words:
  3494.  
  3495.     Windows and SDK and BASIC and compiler
  3496.  
  3497.  
  3498.  67. 7.00 Problem Passing Near Fixed String to Recursive FUNCTION
  3499.  
  3500.  Product Version(s): 7.00   | 7.00
  3501.  Operating System:   MS-DOS | OS/2
  3502.  Flags: ENDUSER | buglist7.00 fixlist7.10
  3503.  Last Modified: 20-SEP-1990    ArticleIdent: Q58409
  3504.  
  3505.  The problem described below is so rare that it will not be encountered
  3506.  by most readers.
  3507.  
  3508.  When passing a fixed-length string variable as a variable-length
  3509.  string parameter to a recursive FUNCTION procedure in the program
  3510.  below, the fixed-length string variable is nulled (reduced to "") when
  3511.  the FUNCTION procedure returns if you compiled with BC.EXE using near
  3512.  strings. Renaming the FUNCTION procedure eliminates this problem.
  3513.  
  3514.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  3515.  Professional Development System (PDS) version 7.00 for MS-DOS and MS
  3516.  OS/2. This problem was corrected in BASIC PDS version 7.10.
  3517.  
  3518.  Note that this problem occurs only if the original variable is a
  3519.  fixed-length string and you are executing from a program compiled to
  3520.  use near strings. If the original variable is a variable-length string
  3521.  or the program uses far strings (either in the QBX.EXE environment or
  3522.  in a compiled program), this error does not occur.
  3523.  
  3524.  The program below demonstrates the error. To reproduce the problem,
  3525.  compile and link the program using Microsoft BASIC PDS 7.00 as
  3526.  follows:
  3527.  
  3528.     BC /o Recfun.bas;
  3529.     LINK Recfun.bas;
  3530.  
  3531.  Executing the program below shows that the string variable "parm1" is
  3532.  nulled after the return from the recursive function call to "CTRL".
  3533.  
  3534.  To work around the problem, do one of the following:
  3535.  
  3536.  1. Add the /Fs (far strings) option to the compile line.
  3537.  
  3538.  2. Rename the CTRL FUNCTION procedure to FUN2 (or some other name).
  3539.  
  3540.  3. Change the DIM statement for "original" to read as follows:
  3541.  
  3542.        DIM original AS STRING
  3543.  
  3544.  Code Example
  3545.  ------------
  3546.  
  3547.  The following program, RECFUN.BAS, shows the problem:
  3548.  
  3549.     DECLARE FUNCTION Fun1% (parm1 AS STRING)
  3550.     DECLARE FUNCTION ctrl% (parm1 AS STRING, parm2 AS STRING)
  3551.     CONST CASEONE = "1"
  3552.     CONST CASETWO = "2"
  3553.     DIM original AS STRING * 3   'Remove "* 3" to work around problem.
  3554.     CLS
  3555.     original = "ooo"
  3556.     retval% = Fun1%(original)
  3557.     END
  3558.  
  3559.     FUNCTION ctrl% (parm1 AS STRING, parm2 AS STRING)
  3560.       DIM retval       AS INTEGER
  3561.       IF parm2 = CASEONE THEN
  3562.         PRINT "Caseone: parm1=["; parm1; "]": SLEEP 1
  3563.       ELSE
  3564.         PRINT "Case two:"
  3565.         PRINT "before recursion:  parm1=["; parm1; "]": SLEEP 1
  3566.         retval = ctrl%(parm1, CASEONE)
  3567.         PRINT "after recursion :  parm1=["; parm1; "]": SLEEP 1
  3568.       END IF
  3569.     END FUNCTION
  3570.  
  3571.     FUNCTION Fun1% (parm1 AS STRING)
  3572.       DIM retval         AS INTEGER
  3573.       retval = ctrl%(parm1, CASETWO)
  3574.     END FUNCTION
  3575.  
  3576.  Workaround
  3577.  ----------
  3578.  
  3579.  To work around the problem, rename CTRL to FUN2 as follows:
  3580.  
  3581.     DECLARE FUNCTION Fun1% (parm1 AS STRING)
  3582.     DECLARE FUNCTION fun2% (parm1 AS STRING, parm2 AS STRING)
  3583.     CONST CASEONE = "1"
  3584.     CONST CASETWO = "2"
  3585.     DIM original AS STRING * 3   'Remove "* 3" to make it work
  3586.     CLS
  3587.     original = "ooo"
  3588.     retval% = Fun1%(original)
  3589.     END
  3590.  
  3591.     FUNCTION Fun1% (parm1 AS STRING)
  3592.       DIM retval         AS INTEGER
  3593.       retval = fun2%(parm1, CASETWO)
  3594.     END FUNCTION
  3595.  
  3596.     FUNCTION fun2% (parm1 AS STRING, parm2 AS STRING)
  3597.       DIM retval       AS INTEGER
  3598.       IF parm2 = CASEONE THEN
  3599.         PRINT "Caseone: parm1=["; parm1; "]": SLEEP 1
  3600.       ELSE
  3601.         PRINT "Case two:"
  3602.         PRINT "before recursion:  parm1=["; parm1; "]": SLEEP 1
  3603.         retval = fun2%(parm1, CASEONE)
  3604.         PRINT "after recursion :  parm1=["; parm1; "]": SLEEP 1
  3605.       END IF
  3606.     END FUNCTION
  3607.  
  3608.  
  3609.  68. Example to Load OS/2 Disk Directory into String Array
  3610.  
  3611.  Product Version(s): 6.00 6.00b 7.00
  3612.  Operating System:   OS/2
  3613.  Flags: ENDUSER |
  3614.  Last Modified: 31-JAN-1990    ArticleIdent: Q33178
  3615.  
  3616.  This article discusses two methods to put a disk directory listing
  3617.  into a string array under OS/2 protected mode. (Note: This article was
  3618.  written because the FILES statement in BASIC only outputs to the
  3619.  screen, not to a file or to string variables.)
  3620.  
  3621.  Example 1 shows a simple method to SHELL to the DIR command, redirect
  3622.  the output to a file, and input from the file into string variables.
  3623.  (Example 1 also works correctly in MS-DOS.)
  3624.  
  3625.  Example 2 shows how to invoke OS/2 API functions (DosFindFirst and
  3626.  DosFindNext) to retrieve a disk directory into string variables.
  3627.  
  3628.  This article applies to Microsoft BASIC Compiler Versions 6.00 and
  3629.  6.00b for MS-DOS and MS OS/2 and to Microsoft BASIC Professional
  3630.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  3631.  
  3632.  Note: In Microsoft BASIC PDS 7.00, the DIR$ function can be used to
  3633.  accomplish the same thing as these two routines show. The use of DIR$
  3634.  is documented on Page 107 of the "Microsoft BASIC 7.0: Language
  3635.  Reference" manual.
  3636.  
  3637.  For an article about how to invoke MS-DOS (or OS/2 real mode)
  3638.  functions to accomplish the same thing, query in this Knowledge Base
  3639.  on the following keywords:
  3640.  
  3641.     INTERRUPT and FINDFIRST and FINDNEXT
  3642.  
  3643.  In MS OS/2 protected mode, you can use the API CALLs DosFindFirst and
  3644.  DosFindNext to retrieve a disk directory listing and load it into a
  3645.  string array, as shown in Example 2 below. Example 2 does NOT apply to
  3646.  QuickBASIC Versions 4.50 and earlier because they cannot compile
  3647.  programs for OS/2 protected mode.
  3648.  
  3649.  Example 1 (the simplest technique) is as follows:
  3650.  
  3651.  ' Works in QuickBASIC 2.00, 2.01, 3.00, 4.00, 4.00b, 4.50, and
  3652.  ' BASIC compiler 6.00 and 6.00b.
  3653.  nf = 200   ' Handles directory listing up to 200 lines.
  3654.  DIM buffer$(nf)
  3655.  INPUT "Enter Search Path: ", path$   ' Enter path such as c:
  3656.  SHELLSTRING$ = "dir " + path$ + " >dirfile.dat"
  3657.  SHELL SHELLSTRING$   ' SHELL to the MS-DOS DIRectory command.
  3658.  OPEN "dirfile.dat" FOR INPUT AS #1
  3659.  pntr% = 0
  3660.  WHILE NOT EOF(1) AND pntr% < nf
  3661.    pntr% = pntr% + 1
  3662.    INPUT #1, buffer$(pntr%)  ' Inputs one directory line at a time.
  3663.    PRINT buffer$(pntr%)
  3664.  WEND
  3665.  CLOSE #1
  3666.  KILL "dirfile.dat"
  3667.  END
  3668.  
  3669.  Example 2 is as follows:
  3670.  
  3671.  The following sample program is for MS OS/2 protected mode (to be
  3672.  compiled only in BASIC compiler Version 6.00 or 6.00b in MS OS/2
  3673.  protected mode or BASIC PDS Version 7.00 in MS OS/2 protected mode):
  3674.  
  3675.  'The TYPE below is taken from the following include file: BSEDOSFL.BI
  3676.  TYPE FILEFINDBUF
  3677.          fdateCreation   AS INTEGER
  3678.          ftimeCreation   AS INTEGER
  3679.          fdateLastAccess AS INTEGER
  3680.          ftimeLastAccess AS INTEGER
  3681.          fdateLastWrite  AS INTEGER
  3682.          ftimeLastWrite  AS INTEGER
  3683.          cbFile          AS LONG
  3684.          cbFileAlloc     AS LONG
  3685.          attrFile        AS INTEGER
  3686.          cchName         AS STRING * 1
  3687.          achName         AS STRING * 13
  3688.  END TYPE
  3689.  
  3690.  DECLARE FUNCTION DosFindFirst%( _
  3691.          BYVAL P1s AS INTEGER,_
  3692.          BYVAL P1o AS INTEGER,_
  3693.          SEG   P2  AS INTEGER,_
  3694.          BYVAL P3  AS INTEGER,_
  3695.          SEG   P4  AS FILEFINDBUF,_
  3696.          BYVAL P5  AS INTEGER,_
  3697.          SEG   P6  AS INTEGER,_
  3698.          BYVAL P7  AS LONG)
  3699.  
  3700.  DECLARE FUNCTION DosFindNext%( _
  3701.          BYVAL P1 AS INTEGER,_
  3702.          SEG   P2 AS FILEFINDBUF,_
  3703.          BYVAL P3 AS INTEGER,_
  3704.          SEG   P4 AS INTEGER)
  3705.  
  3706.  DEFINT a-z
  3707.  
  3708.  DIM buffer AS FileFindBuf
  3709.  DIM filelist(255) as string*13
  3710.  DIM reserved  AS LONG
  3711.  
  3712.  CLS
  3713.  
  3714.  INPUT "Enter the Filename(s) : ";flname$
  3715.  flname$=flname$+chr$(0)
  3716.  
  3717.  atr= 0+2+4+16    'normal + hidden + system + subdirectory
  3718.  dirh=1
  3719.  searchcount=1
  3720.  bufflen=36
  3721.  x=DosFindFirst%(varseg(flname$),sadd(flname$),_
  3722.                  dirh,atr,buffer,bufflen,searchcount,reserved)
  3723.  IF (X=0) THEN
  3724.     DO
  3725.       counter=counter+1
  3726.       filelist(counter)=buffer.achName
  3727.       buffer.achName=string$(13,32)  'assign blanks
  3728.     LOOP WHILE (DosFindNext%(dirh,buffer,bufflen,searchcount) = 0 )
  3729.  ELSE
  3730.      PRINT "No MATCH was found"
  3731.      END
  3732.  END IF
  3733.  
  3734.  for i = 1 to counter
  3735.      print filelist(i)
  3736.  next i
  3737.  
  3738.  END
  3739.  
  3740.  
  3741.  69. Sample Program That Makes OS/2 Call to DosQCurDisk Function
  3742.  
  3743.  Product Version(s): 6.00 6.00b 7.00
  3744.  Operating System:   OS/2
  3745.  Flags: ENDUSER |
  3746.  Last Modified: 31-JAN-1990    ArticleIdent: Q35273
  3747.  
  3748.  Below is a sample program that makes a call to the MS OS/2 function
  3749.  DosQCurDisk. This program can be compiled in Microsoft BASIC Compiler
  3750.  Versions 6.00 and 6.00b for MS OS/2 and in Microsoft BASIC
  3751.  Professional Development System (PDS) Version 7.00 for MS OS/2.
  3752.  
  3753.  'The declarations are in BSEDOSFL.BI
  3754.  
  3755.  DECLARE FUNCTION DosQCurDisk%(_
  3756.                   SEG P1 AS INTEGER,_
  3757.                   SEG P2 AS LONG)
  3758.  
  3759.  DIM number AS INTEGER
  3760.  DIM LogicalDriveMap AS LONG
  3761.  
  3762.  x=DosQCurDisk%(number,LogicalDriveMap)
  3763.  if (x) then
  3764.      print "An error occurred.  The number is : ";number
  3765.  else
  3766.      print "Logical Drive Map; ";LogicalDriveMap
  3767.  end if
  3768.  end
  3769.  
  3770.  
  3771.  70. Sample Program That Makes MS OS/2 Call to DosSleep Function
  3772.  
  3773.  Product Version(s): 6.00 6.00b 7.00
  3774.  Operating System:   OS/2
  3775.  Flags: ENDUSER |
  3776.  Last Modified: 31-JAN-1990    ArticleIdent: Q35274
  3777.  
  3778.  Below is a sample program that makes a call to the MS OS/2 function
  3779.  DosSleep. This program can be compiled in Microsoft BASIC Compiler
  3780.  Versions 6.00 and 6.00b for MS OS/2 and in Microsoft BASIC
  3781.  Professional Development System (PDS) Version 7.00 for MS OS/2.
  3782.  
  3783.  'The declaration is in BSEDOSPC.BI
  3784.  DECLARE FUNCTION DOSSLEEP%(BYVAL P1 AS LONG)
  3785.  
  3786.  DIM a AS LONG
  3787.  
  3788.  INPUT "Enter the amount of time to SLEEP (in seconds) :";longer
  3789.  
  3790.  longer=longer*1000
  3791.  
  3792.  x=timer
  3793.  y=DosSleep%(longer)
  3794.  z=timer
  3795.  
  3796.  IF (y) THEN
  3797.    Print "An error occurred.  The number is : ";x
  3798.  ELSE
  3799.    Print "The amount of time you slept is : ";z-x
  3800.  END IF
  3801.  end
  3802.  
  3803.  
  3804.  71. Sample Program That Makes MS OS/2 Call to DosScanEnv Function
  3805.  
  3806.  Product Version(s): 6.00 6.00b 7.00
  3807.  Operating System:   OS/2
  3808.  Flags: ENDUSER |
  3809.  Last Modified: 31-JAN-1990    ArticleIdent: Q35275
  3810.  
  3811.  Below is a sample program that makes a call to the MS OS/2 function
  3812.  DosScanEnv. This program can be compiled in Microsoft BASIC Compiler
  3813.  Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC Professional
  3814.  Development System (PDS) Version 7.00 for MS OS/2.
  3815.  
  3816.  'The declarations are in BSEDOSPC.BI
  3817.  TYPE address
  3818.       offset AS INTEGER
  3819.       segment AS INTEGER
  3820.  END TYPE
  3821.  
  3822.  DECLARE FUNCTION DOSSCANENV%(_
  3823.          BYVAL P1s AS INTEGER,_
  3824.          BYVAL P1o AS INTEGER,_
  3825.          SEG P2 AS Address)
  3826.  
  3827.  DEFINT a-z
  3828.  DIM info AS address
  3829.  
  3830.  INPUT "Enter the item to be searched for in the Environment Table : ";item$
  3831.  item$=ucase$(item$)+chr$(0)
  3832.  
  3833.  x=DosScanEnv%(varseg(item$),sadd(item$),info)
  3834.  
  3835.  IF (x) THEN
  3836.     print "An error occurred.  The error number is ";x
  3837.  ELSE
  3838.     counter=0
  3839.     def seg = info.segment
  3840.     do
  3841.       c$=chr$(peek(info.offset+counter))
  3842.       result$=result$+c$
  3843.       counter=counter+1
  3844.     loop while c$<>chr$(0)
  3845.     print item$;" = ";result$
  3846.  END IF
  3847.  END
  3848.  
  3849.  
  3850.  72. Sample Program That Makes MS OS/2 Call to DosPhysicalDisk
  3851.  
  3852.  Product Version(s): 6.00 6.00b 7.00
  3853.  Operating System:   OS/2
  3854.  Flags: ENDUSER |
  3855.  Last Modified:  1-FEB-1990    ArticleIdent: Q35276
  3856.  
  3857.  Below is a sample program that makes a call to the MS OS/2 function
  3858.  DosPhysicalDisk. This program can be compiled in Microsoft BASIC
  3859.  Compiler Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC
  3860.  Professional Development System (PDS) Version 7.00 for MS OS/2.
  3861.  
  3862.  'The declaration is in BSEDOSFL.BI
  3863.  
  3864.  DECLARE FUNCTION DOSPHYSICALDISK%(_
  3865.          BYVAL P1 AS INTEGER,_
  3866.          BYVAL P2s AS integer,_
  3867.          BYVAL P2o AS integer,_
  3868.          BYVAL P3 AS INTEGER,_
  3869.          BYVAL P4s AS INTEGER,_
  3870.          BYVAL P4o AS INTEGER,_
  3871.          BYVAL P5 AS INTEGER)
  3872.  
  3873.  DEFINT a-z
  3874.  DIM DataPtr AS LONG
  3875.  DIM ParmLength AS INTEGER
  3876.  DIM DataBuff AS STRING*2
  3877.  DIM ParmBuff AS STRING*3
  3878.  
  3879.  databuff="**"
  3880.  
  3881.  func = 1
  3882.  DataLength = 2
  3883.  ParmLength = 0
  3884.  
  3885.  x=DosPhysicalDisk%(func,varseg(DataBuff),varptr(DataBuff),datalength,_
  3886.                     0,0,parmlength)
  3887.  
  3888.  IF (x) THEN
  3889.     Print "An error occurred.  The number is : ";x
  3890.  ELSE
  3891.     PRINT "Number partitionable drives: ";
  3892.     PRINT asc(mid$(databuff,1,1));asc(mid$(databuff,2,2))
  3893.  END IF
  3894.  
  3895.  func = 2
  3896.  DataLength = 2
  3897.  ParmLength = 3
  3898.  ParmBuff="1:"+chr$(0)
  3899.  x=DosPhysicalDisk%(func,varseg(DataBuff),varptr(DataBuff),datalength,_
  3900.                     varseg(Parmbuff),varptr(ParmBuff),parmlength)
  3901.  
  3902.  IF (x) THEN
  3903.     Print "An error occurred.  The number is : ";x
  3904.  ELSE
  3905.     PRINT "Handle: ";
  3906.     PRINT asc(mid$(databuff,1,1));asc(mid$(databuff,2,2))
  3907.  END IF
  3908.  END
  3909.  
  3910.  
  3911.  73. Sample Program That Makes MS OS/2 Call to DosDelete Function
  3912.  
  3913.  Product Version(s): 6.00 6.00b 7.00
  3914.  Operating System:   OS/2
  3915.  Flags: ENDUSER |
  3916.  Last Modified:  1-FEB-1990    ArticleIdent: Q35277
  3917.  
  3918.  Below is a sample program that makes a call to the MS OS/2 function
  3919.  DosDelete. This program can be compiled in Microsoft BASIC Compiler
  3920.  Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC Professional
  3921.  Development System (PDS) Version 7.00 for MS OS/2.
  3922.  
  3923.  'The declaration is in BSEDOSFL.BI
  3924.  DECLARE FUNCTION DOSDELETE%(_
  3925.                   BYVAL P1o AS INTEGER,_
  3926.                   BYVAL P1s AS INTEGER,_
  3927.                   BYVAL P2 AS LONG)
  3928.  
  3929.  DEFINT A-Z
  3930.  DIM reserved AS LONG
  3931.  
  3932.  INPUT "Enter the file to be deleted : ";fl$
  3933.  fl$=fl$+chr$(0)
  3934.  
  3935.  x=DosDelete%(varseg(fl$),sadd(fl$),reserved)
  3936.  
  3937.  IF (x) THEN
  3938.    Print "An error occurred.  The number is : ";x
  3939.  ELSE
  3940.    Print fl$; "was DELETED"
  3941.  END IF
  3942.  end
  3943.  
  3944.  
  3945.  74. Sample Program That Makes MS OS/2 Call to DosBeep Function
  3946.  
  3947.  Product Version(s): 6.00 6.00b 7.00
  3948.  Operating System:   OS/2
  3949.  Flags: ENDUSER |
  3950.  Last Modified:  1-FEB-1990    ArticleIdent: Q35278
  3951.  
  3952.  Below is a sample program that makes a call to the MS OS/2 function
  3953.  DosBeep. This program can be compiled in Microsoft BASIC Compiler
  3954.  Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC Professional
  3955.  Development System (PDS) Version 7.00.
  3956.  
  3957.  REM $INCLUDE: 'bsedospc.bi'
  3958.  DEFINT a-z
  3959.  PRINT "Test of DOSBEEP..."
  3960.  i = &H25
  3961.  WHILE ((INKEY$ = "") and (i < &H7EFF))
  3962.     i = i + &H100
  3963.     x = DOSBEEP(i, 400)
  3964.  WEND
  3965.  
  3966.  
  3967.  75. Sample Program That Makes MS OS/2 Call to DosQFileMode
  3968.  
  3969.  Product Version(s): 6.00 6.00b 7.00
  3970.  Operating System:   OS/2
  3971.  Flags: ENDUSER |
  3972.  Last Modified:  1-FEB-1990    ArticleIdent: Q35279
  3973.  
  3974.  Below is a sample program that makes a call to the MS OS/2 function
  3975.  DosQfileMode. This program can be compiled in Microsoft BASIC Compiler
  3976.  Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC Professional
  3977.  Development System (PDS) Version 7.00.
  3978.  
  3979.  'The declaration is in BSEDOSFL.BI
  3980.  DECLARE FUNCTION DOSQFILEMODE%(_
  3981.                   BYVAL P1s AS INTEGER,_
  3982.                   BYVAL P1o AS INTEGER,_
  3983.                   SEG P2 AS INTEGER,_
  3984.                   BYVAL P3 AS LONG)
  3985.  DIM c AS LONG
  3986.  INPUT "Enter the Filename : ";flname$
  3987.  flname$=flname$+chr$(0)
  3988.  x=dosqfilemode%(varseg(flname$),sadd(flname$),attr%,c)
  3989.  IF (x) then
  3990.     print "An error has occurred.  The error number is ";x
  3991.  else
  3992.    print "Attribute Number is ";hex$(attr%)
  3993.  end if
  3994.  
  3995.  
  3996.  76. LINK "Symbol Defined More Than Once" Mixing Math Packages
  3997.  
  3998.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  3999.  Operating System:   MS-DOS          | OS/2
  4000.  Flags: ENDUSER |
  4001.  Last Modified:  2-FEB-1990    ArticleIdent: Q37342
  4002.  
  4003.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  4004.  6.00b for MS-DOS and MS OS/2 and to Microsoft BASIC Professional
  4005.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  4006.  
  4007.  You can pass variables between BASIC and other languages that have the
  4008.  alternate math package if each of the modules is compiled using that
  4009.  option. The error message L2025, "symbol defined more than once",
  4010.  results from any attempt to link modules that were compiled using
  4011.  different math package options.
  4012.  
  4013.  The code example below, which shows a BASIC program calling a C
  4014.  function, should be compiled and linked using the following syntax:
  4015.  
  4016.     bc cf.bas /FPa [other optional switches are OK];
  4017.     cl /AM /Gs /FPa /c cfunc.c
  4018.     link cf+cfunc /noe;
  4019.  
  4020.  The alternate math package is not available in QuickBASIC, or in
  4021.  versions of the BASIC compiler earlier than Version 6.00.
  4022.  
  4023.  The following is sample code:
  4024.  
  4025.  ' BASIC PROGRAM CF.BAS:
  4026.  DECLARE function cfunc# CDECL (byval x AS double)
  4027.  input "enter a floating point number ";x#
  4028.  print x#;" * 2 = ";cfunc(x#)
  4029.  
  4030.  /*   C FUNCTION CFUNC.C:   */
  4031.     double  cfunc(double value)
  4032.     {
  4033.        return  (value * 2);
  4034.     }
  4035.  
  4036.  
  4037.  77. Sample BASIC 6.00/7.00 Program to CALL OS/2 Mouse Functions
  4038.  
  4039.  Product Version(s): 6.00 6.00b 7.00
  4040.  Operating System:   OS/2
  4041.  Flags: ENDUSER | O_OS2API O_OS2SDK
  4042.  Last Modified: 26-MAR-1990    ArticleIdent: Q37410
  4043.  
  4044.  Below is a sample program that calls the following MS OS/2 API
  4045.  function calls for accessing the mouse in MS OS/2 protected mode:
  4046.  
  4047.     MouReadEventQue
  4048.     MouSetEventMask
  4049.     MouOpen
  4050.     MouRemovePtr
  4051.     MouDrawPtr
  4052.  
  4053.  This program can be compiled in MS OS/2 protected mode in Microsoft
  4054.  BASIC Compiler Version 6.00 or 6.00b for MS OS/2 and in Microsoft
  4055.  BASIC Professional Development System (PDS) Version 7.00 for MS OS/2.
  4056.  
  4057.  Code Example
  4058.  ------------
  4059.  
  4060.  ' Summary of Program:
  4061.  '
  4062.  ' The following program loops until any key is pressed.
  4063.  ' As the mouse is moved, a "smiley" face is displayed.
  4064.  ' Pressing the left mouse button causes the face to
  4065.  ' change colors. The colors are random.
  4066.  ' Pressing the right mouse button causes the screen to
  4067.  ' clear and be the same color as the last face.
  4068.  '
  4069.  ' The following is taken from BSESUBMO.BI
  4070.  ' OS/2 Subroutine Include File - Mouse Support
  4071.  ' Copyright (c) 1987,1988 Microsoft Corporation
  4072.  
  4073.  TYPE MOUEVENTINFO
  4074.        fs        AS INTEGER
  4075.        Time      AS LONG
  4076.        row       AS INTEGER
  4077.        col       AS INTEGER
  4078.  END TYPE
  4079.  
  4080.  TYPE NOPTRRECT
  4081.        row       AS INTEGER
  4082.        col       AS INTEGER
  4083.        cRow      AS INTEGER
  4084.        cCol      AS INTEGER
  4085.  END TYPE
  4086.  
  4087.  TYPE PTRSHAPE
  4088.        cb        AS INTEGER
  4089.        col       AS INTEGER
  4090.        row       AS INTEGER
  4091.        colHot    AS INTEGER
  4092.        rowHot    AS INTEGER
  4093.  END TYPE
  4094.  
  4095.  DECLARE FUNCTION MouReadEventQue%( _
  4096.        SEG   P1 AS MOUEVENTINFO,_
  4097.        SEG   P2 AS INTEGER,_
  4098.        BYVAL P3 AS INTEGER)
  4099.  
  4100.  DECLARE FUNCTION MouSetEventMask%( _
  4101.        SEG   P1 AS INTEGER,_
  4102.        BYVAL P2 AS INTEGER)
  4103.  
  4104.  DECLARE FUNCTION MouOpen%( _
  4105.        BYVAL P1s AS INTEGER,_
  4106.        BYVAL P1o AS INTEGER,_
  4107.        SEG   P2 AS INTEGER)
  4108.  
  4109.  DECLARE FUNCTION MouClose%( _
  4110.        BYVAL P1 AS INTEGER)
  4111.  
  4112.  DECLARE FUNCTION MouRemovePtr%( _
  4113.        SEG   P1 AS NOPTRRECT,_
  4114.        BYVAL P2 AS INTEGER)
  4115.  
  4116.  DECLARE FUNCTION MouDrawPtr%( _
  4117.        BYVAL P1 AS INTEGER)
  4118.  
  4119.  DEFINT a-z
  4120.  DIM MouEvent as MOUEVENTINFO
  4121.  DIM Pointer as PTRSHAPE
  4122.  CLS
  4123.   x=MouOpen(0,0,hMouse) 'OPEN MOUSE DRIVER
  4124.   IF x THEN
  4125.      PRINT "*** Unable to load Mouse Driver ***"
  4126.      END
  4127.   ELSE
  4128.      x=MouDrawPtr(hMouse)  'Draw the mouse
  4129.      mask=&h001F '(2 buttons 1F)
  4130.      x=MouSetEventMask(mask,hMouse)
  4131.      ReadType=0
  4132.      while inkey$=""
  4133.         x=MouReadEventQue(MouEvent,ReadType,hMouse)
  4134.         'Structure is all zeros if no event
  4135.         IF (MouEvent.time<>0) THEN
  4136.            IF (MouEvent.fs AND &h0004) THEN  'left button
  4137.               y=INT(16 * RND)
  4138.               color ,y
  4139.            END IF
  4140.  
  4141.            IF (MouEvent.fs AND &h0010) THEN  'right button
  4142.               CLS
  4143.            END IF
  4144.               CALL HideMouse(MouEvent.Row,MouEvent.Row,MouEvent.Col,_
  4145.                              MouEvent.col,hMouse)
  4146.               locate MouEvent.row+1,MouEvent.col+1 : print chr$(1);
  4147.         END IF
  4148.      WEND
  4149.   END IF
  4150.  
  4151.  SUB HideMouse(a,b,c,d,driver) STATIC
  4152.  DIM NoMouse  as NoPtrRect
  4153.     NoMouse.row=a
  4154.     NoMouse.cRow=b
  4155.     NoMouse.col=c
  4156.     NoMouse.cCol=d
  4157.     x=MouRemovePtr(NoMouse,driver)
  4158.  END SUB
  4159.  
  4160.  
  4161.  78. BSEDOSPC.BI Is Missing DosSetSigHandler Definition; for OS/2
  4162.  
  4163.  Product Version(s): 6.00 6.00b 7.00 7.10
  4164.  Operating System:   OS/2
  4165.  Flags: ENDUSER | docerr
  4166.  Last Modified:  8-JAN-1991    ArticleIdent: Q37420
  4167.  
  4168.  The include file BSEDOSPC.BI fails to include the definition for
  4169.  DosSetSigHandler. It should be defined as follows:
  4170.  
  4171.     DECLARE FUNCTION DosSetSigHandler%( _
  4172.             BYVAL P1seg AS INTEGER,_
  4173.             BYVAL P1offset AS INTEGER,_
  4174.             SEG   P2 AS LONG,_
  4175.             SEG   P3 AS INTEGER,_
  4176.             BYVAL P4 AS INTEGER,_
  4177.             BYVAL P5 AS INTEGER)
  4178.  
  4179.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  4180.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development System
  4181.  (PDS) Versions 7.00 and 7.10 for MS OS/2.
  4182.  
  4183.  
  4184.  79. Sample Program That Makes OS/2 Function Call DosMove
  4185.  
  4186.  Product Version(s): 6.00 6.00b 7.00
  4187.  Operating System:   OS/2
  4188.  Flags: ENDUSER |
  4189.  Last Modified:  1-FEB-1990    ArticleIdent: Q37426
  4190.  
  4191.  Below is a sample program that makes a call to the MS OS/2 function
  4192.  DosMove. This program can be compiled in Microsoft BASIC Compiler
  4193.  Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC Professional
  4194.  Development System (PDS) Version 7.00 for MS OS/2.
  4195.  
  4196.  The sample program is as follows:
  4197.  
  4198.  ' This definition is from the include file BSEDOSFL.BI
  4199.  DECLARE FUNCTION DosMove%(_
  4200.                   BYVAL P1S AS INTEGER,_
  4201.                   BYVAL P1O AS INTEGER,_
  4202.                   BYVAL P2S AS INTEGER,_
  4203.                   BYVAL P2O AS INTEGER,_
  4204.                   BYVAL P3 AS LONG)
  4205.  
  4206.  DIM reserved AS LONG
  4207.  
  4208.  INPUT "Enter the ORIGINAL filename : ";f1$
  4209.  INPUT "Enter the NEW filename : ";f2$
  4210.  
  4211.  f1$=f1$+chr$(0)
  4212.  f2$=f2$+chr$(0)
  4213.  
  4214.  x=DosMove%(varseg(f1$),sadd(f1$),varseg(f2$),sadd(f2$),reserved)
  4215.  
  4216.  IF (x) THEN
  4217.    Print "An error occurred.  The number is : ";x
  4218.  ELSE
  4219.    Print UCASE$(f1$)" ===> " UCASE$(f2$)
  4220.  END IF
  4221.  END
  4222.  
  4223.  
  4224.  80. Sample Program That Makes OS/2 Function Call DosSelectDisk
  4225.  
  4226.  Product Version(s): 6.00 6.00b 7.00
  4227.  Operating System:   OS/2
  4228.  Flags: ENDUSER |
  4229.  Last Modified:  1-FEB-1990    ArticleIdent: Q37427
  4230.  
  4231.  Below is a sample program that makes a call to the MS OS/2 function
  4232.  DosSelectDisk. This program can be compiled in Microsoft BASIC
  4233.  Compiler Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC
  4234.  Professional Development System (PDS) Version 7.00 for MS OS/2.
  4235.  
  4236.  The sample program is as follows:
  4237.  
  4238.  ' This definition is from the include file BSEDOSFL.BI
  4239.  DECLARE FUNCTION DosSelectDisk%(BYVAL P1 AS INTEGER)
  4240.  
  4241.  DIM number AS INTEGER
  4242.  INPUT "Enter disk number (A - &H0001, B - &H0002, etc.): ";number
  4243.  x=DosSelectDisk%(number)
  4244.  IF (x) THEN
  4245.      Print "DosSelectDisk returned an error ";x
  4246.  ELSE
  4247.      shell "dir"
  4248.      print "Hit any key to continue..."
  4249.      while inkey$="" : wend
  4250.  END IF
  4251.  END
  4252.  
  4253.  
  4254.  81. READ/DATA Statement Slower in QB 4.00 & BC 6.00 Than QB 3.00
  4255.  
  4256.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  4257.  Operating System:   MS-DOS          | OS/2
  4258.  Flags: ENDUSER | SR# G881102-5637 B_QuickBas
  4259.  Last Modified:  1-FEB-1990    ArticleIdent: Q37768
  4260.  
  4261.  The following are two reasons why READ/DATA statements are slower in
  4262.  Microsoft BASIC Compiler Versions 6.00 and 6.00b, Microsoft BASIC
  4263.  Professional Development System (PDS) Version 7.00, and QuickBASIC
  4264.  Versions 4.00, 4.00b, and 4.50 than in the noncoprocessor version of
  4265.  QuickBASIC Version 3.00:
  4266.  
  4267.  1. Math Package
  4268.  
  4269.     The noncoprocessor version of QuickBASIC Version 3.00 (QB.EXE) uses
  4270.     Microsoft Binary Format (MBF) for floating-point numbers, while
  4271.     QuickBASIC Versions 4.x, Microsoft BASIC PDS, and the BASIC
  4272.     compiler Versions 6.00 and 6.00b use IEEE. If a math coprocessor is
  4273.     not present, the later compilers emulate one and, thus, are slower
  4274.     than the noncoprocessor version of QuickBASIC 3.00.
  4275.  
  4276.     To increase its speed without a coprocessor, the BASIC compiler
  4277.     Versions 6.00 and 6.00b and Microsoft BASIC PDS Version 7.00
  4278.     provide support for the alternate math library. Alternate math is a
  4279.     subset of IEEE and is 40 to 50 percent faster than emulating a math
  4280.     coprocessor (but is still slower than MBF). To use alternate math,
  4281.     compile with the BC /FPa switch. Note that the alternate math
  4282.     library is not supported in Microsoft QuickBASIC Compiler Versions
  4283.     1.00, 1.01, 1.02, 2.00, 2.01, 3.00, 4.00, 4.00b, or 4.50.
  4284.  
  4285.  2. Microsoft rewrote the code for READ and DATA statements to support
  4286.     both the QB.EXE 4.00, 4.00b, and 4.50 environment and separate
  4287.     compilation in the BC.EXE BASIC compiler. QuickBASIC 3.00 is highly
  4288.     dependent upon a particular format and location for DATA
  4289.     statements. In QuickBASIC 4.00 and later, and in the QuickBASIC
  4290.     extended environment included with Microsoft BASIC PDS Version
  4291.     7.00, the support is generalized to allow for DATA statements in
  4292.     Quick libraries.
  4293.  
  4294.  
  4295.  82. Using Run-Time Module, RUN Makes Program Lose 70K Memory
  4296.  
  4297.  Product Version(s): 6.00 6.00b 7.00 7.10
  4298.  Operating System:   MS-DOS
  4299.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 buglist7.10 B_QuickBas
  4300.  Last Modified: 20-SEP-1990    ArticleIdent: Q37769
  4301.  
  4302.  When a program compiled without the /O option executes the RUN
  4303.  statement to run a second program, the run-time module (BRUNxx.EXE or
  4304.  BRTMxx.EXE) is unloaded from memory. However, the 70K of space for the
  4305.  run-time module fragments memory, and approximately 70K of RAM is
  4306.  unavailable to the program run with the RUN statement. When the second
  4307.  program quits or transfers control, the 70K of memory is available
  4308.  again.
  4309.  
  4310.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  4311.  Compiler versions 6.00 and 6.00b for MS-DOS, Microsoft BASIC
  4312.  Professional Development System (PDS) versions 7.00 and 7.10 for
  4313.  MS-DOS, and Microsoft QuickBASIC Compiler versions 4.00, 4.00b, and
  4314.  4.50 (buglist4.00, buglist4.00b, buglist4.50) for MS-DOS. We are
  4315.  researching this problem and will post new information here as it
  4316.  becomes available. This problem doesn't occur in QuickBASIC version
  4317.  3.00.
  4318.  
  4319.  This temporary fragmentation of memory can contribute towards causing
  4320.  any one of the following errors when attempting to RUN another .EXE
  4321.  program: "Out of Memory," "Error R6005," or the MS-DOS message "Not
  4322.  enough memory to Exec."
  4323.  
  4324.  To work around this problem, you can make the program that uses the
  4325.  run-time module RUN another BASIC program compiled with the BC /O
  4326.  (stand-alone) option, which in turn can RUN the desired .EXE program.
  4327.  
  4328.  If the first BASIC program is compiled with the BC /O (stand-alone)
  4329.  option, all but 200 bytes are available after the RUN statement. In
  4330.  this case, the 200 missing bytes are the expected overhead associated
  4331.  with the RUN statement.
  4332.  
  4333.  The following are two different examples (1 and 2) that duplicate the
  4334.  problem:
  4335.  
  4336.  1. To duplicate the problem, do the following:
  4337.  
  4338.     a. Compile the following program WITHOUT the BC /O (stand-alone)
  4339.        option:
  4340.  
  4341.           ' TEST1.BAS
  4342.           PRINT FRE(-1)
  4343.           RUN "TEST2"
  4344.  
  4345.     b. Compile the following program WITH the BC /O (stand-alone)
  4346.        option:
  4347.  
  4348.           ' TEST2.BAS
  4349.           PRINT FRE(-1)
  4350.  
  4351.     c. Run TEST1.EXE. The following is sample output:
  4352.  
  4353.           439432  (from TEST1)
  4354.           429432  (from TEST2)
  4355.  
  4356.     d. Run TEST2.EXE alone. The following is sample output:
  4357.  
  4358.           500232  (from TEST2)
  4359.  
  4360.        There is about 70K more far heap available for TEST2 when it is
  4361.        run alone compared to when it is run from a BASIC program using
  4362.        the BRUNxx.EXE module.
  4363.  
  4364.  2. The problem was originally reported using the RUN statement to
  4365.     execute a Microsoft C .EXE program.
  4366.  
  4367.     To duplicate this problem, compile (without /O) and run the BASIC
  4368.     program below, which RUNs a Microsoft C program. The C routine
  4369.     prints the approximate amount of memory free. When the BASIC
  4370.     routine is compiled with the run-time module, about 70K is lost.
  4371.  
  4372.     If you RUN the C program from the BASIC routine compiled with /O
  4373.     and then compare with running the C program from MS-DOS, the memory
  4374.     numbers are within 200 bytes of one another.
  4375.  
  4376.     The following BASIC routine RUNS the C routine:
  4377.  
  4378.        RUN "memtest.exe"
  4379.  
  4380.     The following Microsoft C routine prints available memory:
  4381.  
  4382.  /*   memtest.c   */
  4383.  #include <dos.h>
  4384.  #include <malloc.h>
  4385.  #include <stdio.h>
  4386.  long l;
  4387.  unsigned int j,pp;
  4388.  main()
  4389.  {
  4390.  union REGS inregs, outregs;
  4391.  inregs.h.ah=0x48;
  4392.  inregs.x.bx=0xffff;
  4393.  intdos(&inregs,&outregs);
  4394.  l=(long)(outregs.x.bx * 16L); /*amount available from far heap*/
  4395.  j=_memavl();/*calculate approximate amount available from near heap*/
  4396.  printf("approximate # of bytes available for allocation %ld\n",l+j);
  4397.  }
  4398.  
  4399.  
  4400.  83. "Program Memory Overflow": Break into SUBprograms
  4401.  
  4402.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  4403.  Operating System:   MS-DOS               | OS/2
  4404.  Flags: ENDUSER | SR# G881028-5376 B_QuickBas
  4405.  Last Modified: 10-AUG-1990    ArticleIdent: Q37770
  4406.  
  4407.  The code generated by BC.EXE in Microsoft BASIC Compiler versions 6.00
  4408.  and 6.00b, Microsoft BASIC Professional Development System (PDS)
  4409.  versions 7.00 and 7.10, and QuickBASIC versions 4.00, 4.00b, and 4.50
  4410.  may be larger (on disk or in run-time memory) than that compiled with
  4411.  previous versions. With the increase in product features, the program
  4412.  size has grown. Therefore, it is possible that your program will no
  4413.  longer compile and will give a "Program Memory Overflow" error. This
  4414.  error can be avoided by breaking the program into smaller, separately
  4415.  compiled subprograms or FUNCTION procedures.
  4416.  
  4417.  At compile time, the BC.EXE compiler options can make a big difference
  4418.  in object file size. The /D (debug), /E (error handling with RESUME
  4419.  label), and /V (event handling between statements) compiler options
  4420.  generate the largest amount of code. The /X (error handling with
  4421.  RESUME NEXT, RESUME, and RESUME 0) and /W (event handling between
  4422.  lines) options generate less code than /E and /V; however, /X and /W
  4423.  still generate a fair amount of code.
  4424.  
  4425.  If you find that even with a careful choice of compiler options the
  4426.  program is still too big to compile, the program should be broken up
  4427.  into smaller modules that can be linked together.
  4428.  
  4429.  Each module can contain up to 64K in code and share a 64K data segment
  4430.  with the other modules. For code to be placed into its own module, it
  4431.  must be a subprogram or FUNCTION procedure. A subprogram procedure is
  4432.  surrounded by the SUB and END SUB statements. A FUNCTION procedure is
  4433.  surrounded by the FUNCTION and END FUNCTION statements. For more
  4434.  information about the memory the compiler uses and how to determine
  4435.  segment sizes for code and data, query in this Knowledge Base for the
  4436.  following words:
  4437.  
  4438.     determining and segment and sizes and LINK and /Map
  4439.  
  4440.  Also, if a program works in the QuickBASIC environment, BC.EXE usually
  4441.  compiles it to an executable program. However, there are two
  4442.  exceptions. If the program contains a large $INCLUDE file with RESUME
  4443.  and RESUME NEXT in it, the BC.EXE compiler may fail. The BC.EXE
  4444.  compiler builds a table of line numbers for RESUME/RESUME NEXT
  4445.  statements at 4 bytes each so it can tell where to resume back to.
  4446.  This adds additional code to the program and causes memory depletion.
  4447.  The QB.EXE interpreter does not have to keep the table, so less code
  4448.  is generated.
  4449.  
  4450.  To work around this situation, you can do the following two things:
  4451.  
  4452.  1. Use RESUME <label> instead of RESUME NEXT. Note that RESUME <label>
  4453.     should only be used to return to the same procedure level as where
  4454.     the error occurred, or else stack space will be consumed without
  4455.     being released, which can result in an "Out of stack space" error.
  4456.     For example, if an error occurs in a SUB procedure that is handled
  4457.     by an error handler in the main level code that performs RESUME
  4458.     <label> to a label in the main level code, then return addresses
  4459.     for the SUB remain unused on the stack and unavailable to the
  4460.     program.
  4461.  
  4462.  2. Break the program into smaller separate modules.
  4463.  
  4464.  If you have a large number of static numeric arrays, the BC.EXE
  4465.  compiler can run out of memory. In the QuickBASIC QB.EXE or QBX.EXE
  4466.  environment, static numeric arrays are not stored in the DGROUP data
  4467.  segment; they are stored in an additional segment. When the program is
  4468.  compiled with BC.EXE, these arrays are placed into the DGROUP data
  4469.  segment. This segment is limited to 64K. One way to work around this
  4470.  segment limitation is to make the static arrays dynamic to put them in
  4471.  the far heap.
  4472.  
  4473.  Dynamic non-variable-length-string arrays are stored on the far heap
  4474.  and not in the DGROUP data segment. There are three different ways to
  4475.  make an array dynamic, as follows:
  4476.  
  4477.  1. Use the REM $DYNAMIC metacommand to make all arrays dynamic.
  4478.  
  4479.  2. Use a variable as the number of elements in the DIM statement, as
  4480.     in the following example:
  4481.  
  4482.        x=20
  4483.        DIM array(x)
  4484.  
  4485.  3. Place the array in COMMON and dimension the array after the COMMON
  4486.     statement:
  4487.  
  4488.        COMMON SHARED array()
  4489.        DIM array(100)
  4490.  
  4491.  Once the program compiles, there are a few things that can be done to
  4492.  reduce the size of the linked executable file. The following is a list
  4493.  of ways to help reduce the size of .EXE files:
  4494.  
  4495.  1. Use the /E (/EXEPACK) linker option. This linker option removes
  4496.     sequences of repeated bytes and optimizes the load-time relocation
  4497.     table. The result is that executable files linked with this option
  4498.     may be smaller and may load faster than files linked without this
  4499.     option. Note: The /EXEPACK option cannot be used with the /Q
  4500.     option.
  4501.  
  4502.  2. For stand-alone .EXE files (that is, those compiled with the BC /O
  4503.     option) that use a string variable for the filename in the OPEN
  4504.     statement, linking in the file NOCOM.OBJ reduces the size of the
  4505.     programs by about 4K. (NOCOM.OBJ should be used only if your
  4506.     program contains no OPEN "COM" statements.) For example, the
  4507.     following is a program that NOCOM.OBJ will help make smaller:
  4508.  
  4509.        X$="test.dat"
  4510.        OPEN X$ FOR OUTPUT AS #1
  4511.  
  4512.  In addition to NOCOM.OBJ, BASIC compiler version 6.00 provides other
  4513.  NOxxx.OBJ files, including NOCGA.OBJ, NOEGA.OBJ, NOGRAPH.OBJ,
  4514.  NOHERC.OBJ, NOLPT.OBJ, NOVGA.OBJ, and SMALLERR.OBJ. These files are
  4515.  discussed in both the "Microsoft BASIC Compiler 6.0: User's Guide" and
  4516.  the README.DOC found on Disk 1. These NOxxx.OBJ files can also be used
  4517.  when a custom run-time module is built with the BUILDRTM.EXE utility.
  4518.  
  4519.  For more information about stub files and optimizing code for size and
  4520.  speed, see Chapter 15, "Optimizing Program Size and Speed," in the
  4521.  "Microsoft BASIC 7.0: Programmer's Guide" for versions 7.00 and 7.10.
  4522.  
  4523.  
  4524.  84. BASIC Example to Call OS/2 Function DosSetVerify, DosQVerify
  4525.  
  4526.  Product Version(s): 6.00 6.00b 7.00
  4527.  Operating System:   OS/2
  4528.  Flags: ENDUSER |
  4529.  Last Modified:  1-FEB-1990    ArticleIdent: Q37772
  4530.  
  4531.  The sample program below makes a call to the MS OS/2 functions
  4532.  DosSetVerify and DosQVerify. This program can be compiled in Microsoft
  4533.  BASIC Compiler Versions 6.00 and 6.00b for MS OS/2 and in Microsoft
  4534.  BASIC Professional Development System (PDS) Version 7.00 for MS OS/2.
  4535.  
  4536.  The program is as follows:
  4537.  
  4538.  DEFINT A-Z
  4539.  
  4540.  'The declarations can be found in BSEDOSFL.BI
  4541.  
  4542.  DECLARE FUNCTION DosSetVerify%(_
  4543.                   BYVAL P1 AS INTEGER)
  4544.  
  4545.  DECLARE FUNCTION DosQVerify%(_
  4546.                   SEG P1 AS INTEGER)
  4547.  
  4548.  x=DosQVerify(opt%)
  4549.  
  4550.  IF (x) THEN
  4551.    Print "An error occurred.  The number is : ";x
  4552.  ELSE
  4553.    SELECT CASE opt%
  4554.       CASE 0
  4555.          Print "Verify is off"
  4556.       CASE 1
  4557.          PRINT "Verify is on"
  4558.       CASE ELSE
  4559.          PRINT "An unexpected error occurred."
  4560.    END SELECT
  4561.  END IF
  4562.  
  4563.  Print  "(0) to deactivate verify "
  4564.  input  "(1) to activate for this Application : ";opt%
  4565.  
  4566.  x=DosSetVerify(opt%)
  4567.  
  4568.  IF (x) THEN
  4569.    Print "An error occurred.  The number is : ";x
  4570.  ELSE
  4571.    SELECT CASE opt%
  4572.       CASE 0
  4573.          Print "Verify is set off"
  4574.       CASE 1
  4575.          PRINT "Verify is set on"
  4576.       CASE ELSE
  4577.          PRINT "An unexpected error occurred."
  4578.    END SELECT
  4579.  END IF
  4580.  INPUT "Enter Any Key to Verify the Status of VERIFY";a$
  4581.  
  4582.  x=DosQVerify(opt%)
  4583.  
  4584.  IF (x) THEN
  4585.    Print "An error occurred.  The number is : ";x
  4586.  ELSE
  4587.    SELECT CASE opt%
  4588.       CASE 0
  4589.          Print "Verify is off"
  4590.       CASE 1
  4591.          PRINT "Verify is on"
  4592.       CASE ELSE
  4593.          PRINT "An unexpected error occurred."
  4594.    END SELECT
  4595.  END IF
  4596.  END
  4597.  
  4598.  
  4599.  85. Compiled BASIC Example to Call OS/2 Function DosKillProcess
  4600.  
  4601.  Product Version(s): 6.00 6.00b 7.00
  4602.  Operating System:   OS/2
  4603.  Flags: ENDUSER |
  4604.  Last Modified:  1-FEB-1990    ArticleIdent: Q37773
  4605.  
  4606.  The sample program below makes a call to the MS OS/2 function
  4607.  DosKillProcess. This program can be compiled in Microsoft BASIC
  4608.  Compiler Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC
  4609.  Professional Development System (PDS) Version 7.00 for MS OS/2.
  4610.  
  4611.  The program is as follows:
  4612.  
  4613.  DEFINT A-Z
  4614.  
  4615.  'This declaration can be found in BSEDOSPC.BI
  4616.  DECLARE FUNCTION DosKillProcess%(_
  4617.                   BYVAL p1 AS INTEGER,_
  4618.                   BYVAL p2 AS INTEGER)
  4619.  
  4620.  Input "Enter PID to KILL : ";pid%
  4621.  Input "Enter ACTION code : ";action%
  4622.  
  4623.  x% = DosKillProcess%(action%,pid%)
  4624.  
  4625.  if (x%) then
  4626.      Print "Error: ";x%
  4627.  else
  4628.      Print "PID : ";pid%;" - stopped"
  4629.  end if
  4630.  end
  4631.  
  4632.  
  4633.  86. "Duplicate Definition" LINKing C Graphics Library to BASIC, /O
  4634.  
  4635.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  4636.  Operating System:   MS-DOS          | OS/2
  4637.  Flags: ENDUSER | S_C S_QuickC B_QuickBas SR# G881109-6007
  4638.  Last Modified: 27-JUL-1990    ArticleIdent: Q37901
  4639.  
  4640.  The C graphics library, GRAPHICS.LIB, is incompatible with programs
  4641.  compiled with BC /O in QuickBASIC versions 4.00, 4.00b, and 4.50,
  4642.  Microsoft BASIC Compiler versions 6.00 or 6.00b, or Microsoft BASIC
  4643.  Professional Development System (PDS) version 7.00. The FONT and CHART
  4644.  graphics in QuickC version 2.00 are also incompatible with programs
  4645.  compiled with BC /O in these versions of QuickBASIC and BASIC
  4646.  compiler. Many of the C graphics routines conflict with the BASIC
  4647.  graphic routines in the BASIC stand-alone library. If you need to do
  4648.  graphics when you link BASIC stand-alone programs with C, the graphics
  4649.  should be done in BASIC. An alternative is to compile without the BC
  4650.  /O option in BASIC.
  4651.  
  4652.  Linking BASIC programs compiled BC /O with Microsoft C graphics
  4653.  routines gives many "Duplicate Definition" errors, even if you LINK
  4654.  with the /NOE option. Compile without /O to eliminate the errors.
  4655.  
  4656.  
  4657.  87. BASIC Sample Program for OS/2 Function Calls for DLL Modules
  4658.  
  4659.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  4660.  Operating System:   MS-DOS          | OS/2
  4661.  Flags: ENDUSER |
  4662.  Last Modified:  2-FEB-1990    ArticleIdent: Q37905
  4663.  
  4664.  Below is a sample program that makes a call to the following MS OS/2
  4665.  functions:
  4666.  
  4667.     DosLoadModule
  4668.     DosFreeModule
  4669.     DosGetProcAddr
  4670.     DosGetModHandle
  4671.     DosGetModName
  4672.  
  4673.  The program below can be compiled in Microsoft BASIC Compiler Versions
  4674.  6.00 and 6.00b for MS-DOS and MS OS/2 and Microsoft BASIC Professional
  4675.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  4676.  
  4677.  The program below should be compiled with BASIC compiler Version 6.00
  4678.  or 6.00b, or BASIC PDS 7.00 and should use the default run-time module
  4679.  (BRUN60EP.DLL for BASIC compiler 6.00, BRUN61EP.DLL for BASIC compiler
  4680.  6.00b, and BRT70ENP.DLL for BASIC PDS 7.00). The run-time module is
  4681.  required because the call to DosGetModHandle is searching for the
  4682.  handle of the run-time module. The program can be modified to search
  4683.  for any given DLL (dynamic link library).
  4684.  
  4685.  The following is a code example:
  4686.  
  4687.  'The function declarations can be found in BSEDOSPE.BI
  4688.  
  4689.  DECLARE FUNCTION DosLoadModule%(_
  4690.        BYVAL P1s AS INTEGER,_
  4691.        BYVAL P1o AS INTEGER,_
  4692.        BYVAL P2  AS INTEGER,_
  4693.        BYVAL P3s AS INTEGER,_
  4694.        BYVAL P3o AS INTEGER,_
  4695.        SEG   P4  AS INTEGER)
  4696.  
  4697.  DECLARE FUNCTION DosFreeModule%(_
  4698.        BYVAL P1  AS INTEGER)
  4699.  
  4700.  DECLARE FUNCTION DosGetProcAddr%(_
  4701.        BYVAL P1  AS INTEGER,_
  4702.        BYVAL P2s AS INTEGER,_
  4703.        BYVAL P2o AS INTEGER,_
  4704.        SEG   P3  AS LONG)
  4705.  
  4706.  DECLARE FUNCTION DosGetModHandle%(_
  4707.        BYVAL P1s AS INTEGER,_
  4708.        BYVAL P1o AS INTEGER,_
  4709.        SEG   P2  AS INTEGER)
  4710.  
  4711.  DECLARE FUNCTION DosGetModName%(_
  4712.        BYVAL P1  AS INTEGER,_
  4713.        BYVAL P2  AS INTEGER,_
  4714.        BYVAL P3s AS INTEGER,_
  4715.        BYVAL P3o AS INTEGER)
  4716.  
  4717.  DEFINT a-z
  4718.  
  4719.  dllname$="BRUN60EP"+chr$(0)  'Change this "BRUN61EP" for 6.00B
  4720.  
  4721.  x=DosGetModHandle%(varseg(dllname$),sadd(dllname$),handle)
  4722.  
  4723.  IF (x) THEN
  4724.     Print "An error occurred in DosGetModHandle.  The number is : ";x
  4725.  ELSE
  4726.     Print "The handle for ";dllname$;" is : ";handle
  4727.  
  4728.     'Using the handle returned, find the name
  4729.     DIM buffer AS STRING*40
  4730.     length=40
  4731.     x=DosGetModName%(handle,length,varseg(buffer),varptr(buffer))
  4732.     IF (x) THEN
  4733.        Print "An error occurred in DosGetModName.  The number is : ";x
  4734.     ELSE
  4735.        Print "The module name for handle ";handle;" is ";buffer
  4736.     END IF
  4737.  
  4738.     'Load another DLL
  4739.     DIM bad AS STRING*128
  4740.     dllname$="DOSCALLS1"+chr$(0)
  4741.     x=DosLoadModule%(varseg(bad),varptr(bad),128,varseg(dllname$),_
  4742.               sadd(dllname$),handle)
  4743.     IF (x) THEN
  4744.        Print "An error occurred in DosLoadModule.  The number is : ";x
  4745.     ELSE
  4746.        Print "The handle for ";dllname$;" is : ";handle
  4747.  
  4748.        '#150 is an routine that can be found in DOSCALLS1
  4749.        routine$="#150"+chr$(0)
  4750.        DIM address AS LONG
  4751.        x=DosGetProcAddr%(handle,varseg(routine$),sadd(routine$),address)
  4752.        IF (x) THEN
  4753.         Print "An error occurred in DosGetProcAddr.  The number is : ";x
  4754.        ELSE
  4755.         Print "The address of ";routine$;" is ";address
  4756.        END IF
  4757.  
  4758.        'Unload module
  4759.        x=DosFreeModule%(handle)
  4760.        IF (x) THEN
  4761.         print "An error occurred in DosFreeModule.  The number is : ";x
  4762.        ELSE
  4763.         Print "DLL was freed."
  4764.        END IF
  4765.     END IF
  4766.  END IF
  4767.  END
  4768.  
  4769.  
  4770.  88. BC /A or CodeView Finds Run-Time Error Segment:Offset Address
  4771.  
  4772.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  4773.  Operating System:   MS-DOS          | OS/2
  4774.  Flags: ENDUSER | B_QuickBas
  4775.  Last Modified: 26-FEB-1990    ArticleIdent: Q39190
  4776.  
  4777.  The following information applies to Microsoft BASIC Compiler Versions
  4778.  6.00 and 6.00b for MS-DOS and MS OS/2, to Microsoft BASIC Professional
  4779.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2, and to
  4780.  QuickBASIC Versions 4.00, 4.00b, and 4.50 for MS-DOS.
  4781.  
  4782.  When a run-time error message is displayed with a segment and offset
  4783.  address, the address is in hexadecimal notation. For example, "error
  4784.  in module [name] at 5517:0059" means a code segment address of 5517
  4785.  hexadecimal and a code offset address of 0059 hexadecimal.
  4786.  
  4787.  To find out where this address corresponds to a statement in your
  4788.  program, you can compile your program with the BC /A option and
  4789.  generate a .LST file. The .LST file lists the code offsets along with
  4790.  the BASIC statements and their translation into assembly-language
  4791.  code. You can use the module name and code offset from the run-time
  4792.  error message to find the error line in that module's .LST file. (The
  4793.  segment address from the error message is not needed to find the error
  4794.  line in the .LST file).
  4795.  
  4796.  You can also use the run-time error's segment:offset address in the
  4797.  Microsoft CodeView debugger to see which BASIC code caused the
  4798.  run-time error.
  4799.  
  4800.  The BC /A option requires the file to be saved in Text format. (If you
  4801.  save the source file in Fast Load and Save format, BC /A gives the
  4802.  compiler error "Cannot generate listing for BASIC binary source
  4803.  files.")
  4804.  
  4805.  Page 196 of the "Microsoft CodeView and Utilities: Software
  4806.  Development Tools for MS-DOS" manual states that you can use "V" to
  4807.  view an address in the segment:offset format. To view the source code
  4808.  executed at an address, type the following in CodeView:
  4809.  
  4810.     V &H5517:&H0059
  4811.  
  4812.  Note: QuickBASIC Versions 4.00, 4.00b, and 4.50 are not sold with the
  4813.  CodeView debugger. The CodeView debugger comes with Microsoft BASIC
  4814.  Compiler Version 6.00 or 6.00b, Microsoft BASIC PDS Version 7.00, or
  4815.  with Microsoft Macro Assembler Versions 5.00 and 5.10, but is not sold
  4816.  separately.
  4817.  
  4818.  The following is an example of finding the statement in error in a
  4819.  BASIC program based upon the code offset given in the run-time error
  4820.  message. The BASIC .EXE program below generates a "File Not Found"
  4821.  error at a specific address. Note that the error occurred at an offset
  4822.  (0057) right after a call to B$OPEN. This is a clue that the error
  4823.  occurred with the open routine.
  4824.  
  4825.  The following is a code example to be compiled with the BC /A option:
  4826.  
  4827.     CLS
  4828.     PRINT "This is a test of the /a option"
  4829.     OPEN "NONEXIST.DAT" FOR INPUT AS #1
  4830.  
  4831.  This program generates the following output:
  4832.  
  4833.     This is a test of the /a option
  4834.  
  4835.     File not found in module TEST     at address 5CCD:0057
  4836.  
  4837.  The .LST file generated with BC /A is as follows:
  4838.                                                             PAGE   1
  4839.                                                            28 Dec 88
  4840.                                                             09:35:26
  4841.  Offset  Data    Source Line      Microsoft (R) QuickBASIC
  4842.  
  4843.   0030   0006    CLS
  4844.   0030   0006    PRINT "This is a test of the /a option"
  4845.   0030   0006    OPEN "NONEXIST.DAT" FOR INPUT AS #1
  4846.   0030   0006
  4847.   0030   0006
  4848.   0030    **            I00002: mov   ax,0FFFFh
  4849.   0033    **                    push  ax
  4850.   0034    **                    call  B$SCLS
  4851.   0039    **                    mov   ax,offset <const>
  4852.   003C    **                    push  ax
  4853.   003D    **                    call  B$PESD
  4854.   0042    **                    mov   ax,offset <const>
  4855.   0045    **                    push  ax
  4856.   0046    **                    mov   ax,0001h
  4857.   0049    **                    push  ax
  4858.   004A    **                    mov   ax,0FFFFh
  4859.   004D    **                    push  ax
  4860.   004E    **                    mov   ax,0001h
  4861.   0051    **                    push  ax
  4862.   0052    **                    call  B$OPEN      <<-- offending line
  4863.   0057    **                    call  B$CENP
  4864.   005C   0006
  4865.  
  4866.  43613 Bytes Available
  4867.  43308 Bytes Free
  4868.  
  4869.      0 Warning Error(s)
  4870.      0 Severe  Error(s)
  4871.  
  4872.  
  4873.  89. Sample Program; BASIC Invoking C Function That Returns String
  4874.  
  4875.  Product Version(s): 4.00 4.00b 4.50
  4876.  Operating System:   MS-DOS
  4877.  Flags: ENDUSER | B_BasicCom SR# S881207-17
  4878.  Last Modified:  1-FEB-1990    ArticleIdent: Q39361
  4879.  
  4880.  The sample program below demonstrates a BASIC program calling a C
  4881.  routine that returns a BASIC string descriptor. This programming
  4882.  example is a variation of the sample program located on Page 310 of
  4883.  the "Microsoft QuickBASIC 4.0: Learning and Using" manual.
  4884.  
  4885.  This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
  4886.  and 4.50, to Microsoft BASIC Compiler Versions 6.00 and 6.00b for
  4887.  MS-DOS and MS OS/2, and to Microsoft BASIC Professional Development
  4888.  System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  4889.  
  4890.  Note: The Microsoft C medium-memory model should be used to ensure
  4891.  that the C string is in DGROUP.
  4892.  
  4893.  Note: This information does not apply if using far string support in
  4894.  BASIC PDS Version 7.00 or when running inside the QuickBASIC extended
  4895.  (QBX.EXE) environment with BASIC PDS Version 7.00. For information on
  4896.  programming with mixed-languages using far strings refer to Chapter
  4897.  13, "Mixed-Language Programming with Far Strings," in the "Microsoft
  4898.  BASIC 7.0: Programmer's Guide."
  4899.  
  4900.  The COMPILE and LINK instructions are as follows:
  4901.  
  4902.     BC test.bas;
  4903.     CL /AM /c tc.c
  4904.     LINK test tc /noe;
  4905.  
  4906.  The BASIC routine is as follows:
  4907.  
  4908.     DECLARE FUNCTION t1$()
  4909.     a$ = t1$
  4910.     PRINT a$
  4911.  
  4912.  The C function is as follows:
  4913.  
  4914.     struct bas_str{
  4915.             int sd_len;
  4916.             char *sd_addr;
  4917.             };
  4918.     char cstr[]="ABC";
  4919.     struct bas_str pascal t1()
  4920.     {
  4921.        struct bas_str str_des;
  4922.        str_des.sd_addr = cstr;
  4923.        str_des.sd_len = strlen(cstr);
  4924.        return (str_des);
  4925.     }
  4926.  
  4927.  
  4928.  90. Can't Define SUB/FUNCTION in INCLUDE File
  4929.  
  4930.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  4931.  Operating System:   MS-DOS          | OS/2
  4932.  Flags: ENDUSER | B_QuickBas SR# S881209-27
  4933.  Last Modified:  1-FEB-1990    ArticleIdent: Q39581
  4934.  
  4935.  The command line compiler BC.EXE fails to flag the error if you put a
  4936.  procedure definition (SUB...END SUB or FUNCTION...END FUNCTION) into
  4937.  an INCLUDE file. The program compiles, LINKs, and runs without error.
  4938.  
  4939.  QB.EXE, and QBX.EXE included with Microsoft BASIC Professional
  4940.  Development System (PDS) Version 7.00, correctly gives the error
  4941.  "Statement cannot occur within include file." Procedure definitions
  4942.  are not allowed in $INCLUDE files.
  4943.  
  4944.  This information applies to QuickBASIC Versions 4.00b and 4.50, to
  4945.  Microsoft BASIC Compiler Versions 6.00 and 6.00b, and Microsoft BASIC
  4946.  PDS Version 7.00 for MS-DOS and MS OS/2.
  4947.  
  4948.  The BC.EXE from QuickBASIC Version 4.00 correctly flags the error.
  4949.  
  4950.  The following is a example:
  4951.  
  4952.     DIM arr(50)
  4953.     REM $INCLUDE: 'getsub.inc'
  4954.     FOR i = 1 TO 50
  4955.        arr(i) = i
  4956.     NEXT i
  4957.     CALL prntarray(arr())
  4958.     END
  4959.  
  4960.     'This is GETSUB.INC, the separate include file:
  4961.     SUB prntarray (a())
  4962.        FOR j = 1 TO 50
  4963.           PRINT a(j)
  4964.        NEXT j
  4965.     END SUB
  4966.  
  4967.  
  4968.  91. BC 6.00 Example to Manipulate File with OS/2 API Calls
  4969.  
  4970.  Product Version(s): 6.00 6.00b 7.00
  4971.  Operating System:   OS/2
  4972.  Flags: ENDUSER | SR# S890125-57
  4973.  Last Modified:  1-FEB-1990    ArticleIdent: Q40865
  4974.  
  4975.  Below is a sample program that calls the following MS OS/2 API
  4976.  functions:
  4977.  
  4978.     DosBufReset
  4979.     DosChgFilePtr
  4980.     DosClose
  4981.     DosOpen
  4982.     DosQFHandState
  4983.     DosQHandType
  4984.     DosRead
  4985.     DosSetFHandState
  4986.     DosWrite
  4987.  
  4988.  This program can be compiled in Microsoft BASIC Compiler Version 6.00
  4989.  or 6.00b for MS OS/2 and Microsoft BASIC Professional Development
  4990.  System (PDS) Version 7.00 for MS OS/2.
  4991.  
  4992.  The following is the sample program:
  4993.  
  4994.  CONST TRUE=-1
  4995.  CONST FALSE=0
  4996.  
  4997.  REM $INCLUDE: 'BSEDOSFL.BI'
  4998.  DEFINT A-Z
  4999.  DIM sizel AS LONG
  5000.  DIM reserved AS LONG
  5001.  DIM buf AS STRING*512
  5002.  DIM distance AS LONG
  5003.  DIM NewPointer AS LONG
  5004.  
  5005.  CLS
  5006.  input "Enter the Filename : ";fl$
  5007.  fl$=fl$+chr$(0)
  5008.  openflag = 17
  5009.  openmode = &h6092
  5010.  PRINT
  5011.  PRINT "Enter a Key to OPEN the file"
  5012.  WHILE INKEY$="" : WEND
  5013.  PRINT
  5014.  x=DosOpen(varseg(fl$),sadd(fl$),handle,action,sizel,_
  5015.            filea,openflag,openmode,reserved)
  5016.  
  5017.  IF (x) THEN
  5018.     print "An error occurred.  The number is : ";x
  5019.     end
  5020.  ELSE
  5021.    print "The handle is : ";handle
  5022.    print "The action is : ";action
  5023.    print "The size is   : ";sizel
  5024.    print "The filea is  : ";filea
  5025.    print "The openflag  : ";openflag
  5026.    print "The openmode  : ";openmode
  5027.    size=512
  5028.    buffer$=string$(size/4,65)+string$(size/4,66)
  5029.    buffer$=buffer$+string$(size/4,67)+string$(size/4,68)+chr$(0)
  5030.    PRINT
  5031.    PRINT "Enter a Key to WRITE to the file"
  5032.    WHILE INKEY$="" : WEND
  5033.    PRINT
  5034.    x=DosWrite%(handle,varseg(buffer$),sadd(buffer$),size,nw)
  5035.    IF (x) THEN
  5036.      Print "An error occurred.  The number is : ";x
  5037.    ELSE
  5038.      print "The information was placed into the file."
  5039.      print "The number of bytes written was : ";nw
  5040.    END IF
  5041.  END IF
  5042.  PRINT
  5043.  PRINT "Enter a Key to CLOSE the file"
  5044.  WHILE INKEY$="" : WEND
  5045.  PRINT
  5046.  
  5047.  x=DosClose%(handle)
  5048.  IF (x) THEN
  5049.     Print "An error occurred.  The number is : ";x
  5050.  ELSE
  5051.     print "The file is closed." : print
  5052.  END IF
  5053.  PRINT
  5054.  PRINT "Enter a Key to RE-OPEN the file"
  5055.  WHILE INKEY$="" : WEND
  5056.  PRINT
  5057.  x=DosOpen(varseg(fl$),sadd(fl$),handle,action,sizel,_
  5058.            filea,openflag,openmode,reserved)
  5059.  
  5060.  IF x THEN
  5061.     print "error: ";x
  5062.     stop
  5063.  END IF
  5064.  DONE=FALSE
  5065.  WHILE NOT(done)
  5066.    size=256
  5067.    buf=string$(size,42)
  5068.    PRINT
  5069.    PRINT "Enter a Key to READ the file"
  5070.    WHILE INKEY$="" : WEND
  5071.    PRINT
  5072.  
  5073.    x=DosRead%(handle,varseg(buf),varptr(buf),size,nr)
  5074.    IF (x) THEN
  5075.      Print "An error occurred.  The number is : ";x
  5076.    ELSE
  5077.      IF nr=0 THEN
  5078.         PRINT "EOF Detected"
  5079.         DONE=TRUE
  5080.      ELSE
  5081.         PRINT "The number of bytes read is : ";nr
  5082.         PRINT "The bytes were : ";buf
  5083.      END IF
  5084.    END IF
  5085.  WEND
  5086.    PRINT
  5087.    PRINT "Enter a Key to RESET the file BUFFER"
  5088.    WHILE INKEY$="" : WEND
  5089.    PRINT
  5090.    x=DosBufReset%(handle)
  5091.    IF (x) THEN
  5092.      Print "An error occurred.  The number is : ";x
  5093.    ELSE
  5094.      PRINT "The BUFFER was flushed"
  5095.    END IF
  5096.  PRINT
  5097.  PRINT "Enter a Key to CHANGE the file POINTER"
  5098.  WHILE INKEY$="" : WEND
  5099.  PRINT
  5100.  distance=192
  5101.  MoveType=0
  5102.  
  5103.  x=DosChgFilePtr%(handle,distance,MoveType,NewPointer)
  5104.  IF (x) THEN
  5105.    Print "An error occurred.  The number is : ";x
  5106.  ELSE
  5107.    Print "The file pointer is moved.  The information will be read."
  5108.    size=256
  5109.    buf=string$(size,42)
  5110.    PRINT
  5111.    PRINT "Enter a Key to READ the file"
  5112.    WHILE INKEY$="" : WEND
  5113.    PRINT
  5114.  
  5115.    x=DosRead%(handle,varseg(buf),varptr(buf),size,nr)
  5116.    IF (x) THEN
  5117.      Print "An error occurred.  The number is : ";x
  5118.    ELSE
  5119.      IF nr=0 THEN
  5120.         PRINT "EOF Detected"
  5121.         DONE=TRUE
  5122.      ELSE
  5123.         PRINT "The number of bytes read is : ";nr
  5124.         PRINT "The bytes were : ";buf
  5125.      END IF
  5126.    END IF
  5127.  END IF
  5128.  PRINT
  5129.  PRINT "Enter a Key to get the GET/Modify File Handle State"
  5130.  WHILE INKEY$="" : WEND
  5131.  PRINT
  5132.  
  5133.  x=DosQFHandState%(handle,FileHandleState)
  5134.  IF (x) THEN
  5135.     Print "An error occurred.  The number is : ";x
  5136.  ELSE
  5137.     print "The filehandle state is : ";FileHandleState
  5138.  END IF
  5139.  
  5140.  NewHandState=&h0010
  5141.  x=DosSetFHandState%(handle,NewHandleState)
  5142.  IF (x) THEN
  5143.     Print "An error occurred.  The number is : ";x
  5144.  ELSE
  5145.     print "The filehandle state was changed."
  5146.  END IF
  5147.  
  5148.  x=DosQFHandState%(handle,FileHandleState)
  5149.  IF (x) THEN
  5150.     Print "An error occurred.  The number is : ";x
  5151.  ELSE
  5152.     print "The filehandle state is : ";FileHandleState
  5153.  END IF
  5154.  
  5155.  x=DosQHandType%(handle,HandType,FlagWord)
  5156.  IF (x) THEN
  5157.     Print "An error occurred.  The number is : ";x
  5158.  ELSE
  5159.     IF (HandleType) THEN
  5160.         print "The handle type is a Device handle"
  5161.         print "The Flag Word is : ";Flag Word
  5162.     ELSE
  5163.         print "The handle type is a File-System handle"
  5164.     END IF
  5165.  END IF
  5166.  PRINT
  5167.  PRINT "Enter a Key to CLOSE the file"
  5168.  WHILE INKEY$="" : WEND
  5169.  PRINT
  5170.  x=DosClose%(handle)
  5171.  IF (x) THEN
  5172.     Print "An error occurred.  The number is : ";x
  5173.  ELSE
  5174.     print "The file is closed."
  5175.  END IF
  5176.  END
  5177.  
  5178.  
  5179.  92. BC 6.00 Example of OS/2 API Calls DosGetPrty, DosSetPrty
  5180.  
  5181.  Product Version(s): 6.00 6.00b 7.00
  5182.  Operating System:   OS/2
  5183.  Flags: ENDUSER | SR# S890125-56
  5184.  Last Modified:  1-FEB-1990    ArticleIdent: Q40866
  5185.  
  5186.  Below is a sample program that calls the MS OS/2 API functions
  5187.  DosGetPrty and DosSetPrty. This program can be compiled in Microsoft
  5188.  BASIC Compiler Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC
  5189.  Professional Development System (PDS) Version 7.00 for MS OS/2.
  5190.  
  5191.  The following is the sample program:
  5192.  
  5193.  REM $INCLUDE: 'BSEDOSPC.BI'
  5194.  DEFINT a-z
  5195.  DIM pids AS PidInfo
  5196.  
  5197.  x%=DosGetPid(pids)
  5198.  IF (x%) THEN
  5199.     PRINT "An error occurred in DosGetPid: ";x%
  5200.     END
  5201.  ELSE
  5202.     pid=pids.pid
  5203.     scope = 0
  5204.     x% = DosGetPrty(scope,priority,pid)
  5205.     IF (x%) THEN
  5206.         PRINT "An error occurred in DosGetPrty: ";x%
  5207.         END
  5208.     ELSE
  5209.        PRINT
  5210.        PRINT "Priority: "; Priority
  5211.        PRINT
  5212.        CALL SetPrty(pid)
  5213.        PRINT
  5214.        PRINT "Enter a Key to Verify Change..."
  5215.        WHILE INKEY$="": WEND
  5216.        scope=0
  5217.        x%=DosGetPrty(scope,priority,pid)
  5218.        IF (x%) THEN
  5219.           PRINT "An error Occurred in DosGetPrty: ";x%
  5220.           END
  5221.        ELSE
  5222.           PRINT
  5223.           PRINT "Priority: "; Priority
  5224.        END IF
  5225.     END IF
  5226.  END IF
  5227.  END
  5228.  
  5229.  SUB SetPrty(pid) STATIC
  5230.      Print "Enter the SCOPE (0 - Process and all threads)"
  5231.      PRINT "                (1 - Process and all the descendants)"
  5232.      PRINT "                (2 - Thread calling the function)"
  5233.      INPUT "                                         OPTION: ";scope
  5234.      PRINT
  5235.      PRINT "Enter the CLASS (0 - No Change)"
  5236.      PRINT "                (1 - Idle-time)"
  5237.      PRINT "                (2 - Regular)"
  5238.      PRINT "                (3 - Time-Critical)"
  5239.      INPUT "                             OPTION: ";class
  5240.      PRINT
  5241.      INPUT "Enter CHANGE (-31 to + 31) : "; change
  5242.      x% = DosSetPrty%(scope,class,change,pid)
  5243.      if (x%) then
  5244.          PRINT "Error setting Priority - ";x%
  5245.      else
  5246.          PRINT "Priority Changed."
  5247.      end if
  5248.  END SUB
  5249.  
  5250.  
  5251.  93. BC 6.00 Example of OS/2 API Calls DosError, DosErrClass
  5252.  
  5253.  Product Version(s): 6.00 6.00b 7.00
  5254.  Operating System:   OS/2
  5255.  Flags: ENDUSER | SR# S890125-55
  5256.  Last Modified:  1-FEB-1990    ArticleIdent: Q40867
  5257.  
  5258.  Below is an example of using the MS OS/2 API function DosError and
  5259.  DosErrClass. This program must be compiled with Microsoft BASIC
  5260.  Compiler Version 6.00 and 6.00b for MS OS/2 and Microsoft BASIC
  5261.  Professional Development System (PDS) Version 7.00 for MS OS/2.
  5262.  
  5263.  The following is the sample program:
  5264.  
  5265.  DEFINT a-z
  5266.  REM $include: 'bsedosfl.bi'
  5267.  REM $include: 'bsedospc.bi'
  5268.  PRINT "Note: This only affects OS/2 API calls you call"
  5269.  PRINT "      BASIC handles its own errors"
  5270.  PRINT
  5271.  PRINT "Enter (0) to SUSPEND system hard-error processing"
  5272.  INPUT "or (1) to RESUME system hard-error processing : ";y%
  5273.  PRINT
  5274.  x=DOSERROR%(y%)
  5275.  
  5276.  IF (x) THEN
  5277.     Print "An error occurred.  The number is : ";x
  5278.  ELSE
  5279.     Print "Hard-Error Processing Suspended"
  5280.     Print "Open Drive Door A and Enter any Key..."
  5281.     PRINT
  5282.     WHILE INKEY$="" : WEND
  5283.  END IF
  5284.  fl$="A:\ABC.EXE"+chr$(0)
  5285.  
  5286.  code%=DosQFileMode(varseg(fl$),sadd(fl$),attribute%,0&)
  5287.  if (code%) then
  5288.     Print "Error Returned from DosQFileMode: " code%
  5289.     x% = DosErrClass(code%,class%,action%,locus%)
  5290.     IF (x%) THEN
  5291.        PRINT "An error was received determining class"
  5292.     ELSE
  5293.        CALL DetermineError(class%,action%,locus%)
  5294.     END IF
  5295.  END IF
  5296.  END
  5297.  
  5298.  SUB DetermineError(class%,action%,locus%) STATIC
  5299.  PRINT "Error Class: ";
  5300.  SELECT CASE class%
  5301.         CASE 1
  5302.           PRINT "ERRCLASS_OUTRES ==> Out of Resource"
  5303.         CASE 2
  5304.           PRINT "ERRCLASS_TEMPSIT ==> This is a Temporary Situation"
  5305.         CASE 3
  5306.           PRINT "ERRCLASS_AUTH ==> Authorization has failed"
  5307.         CASE 4
  5308.           PRINT "ERRCLASS_INTRN ==> An Internal Error has Occurred"
  5309.         CASE 5
  5310.           PRINT "ERRCLASS_HRDFAIL ==> A Device Hardware Failure"
  5311.         CASE 6
  5312.           PRINT "ERRCLASS_SYSFAIL ==> A System Failure has Occurred"
  5313.         CASE 7
  5314.  PRINT "ERRCLASS_APPERR ==> A Probable Application Error has Occurred"
  5315.         CASE 8
  5316.           PRINT "ERRCLASS_NOTFND ==> The Item was not Located"
  5317.         CASE 9
  5318.           PRINT "ERRCLASS_BADFMT ==> Bad Format"
  5319.         CASE 10
  5320.           PRINT "ERRCLASS_LOCKED ==> Locked"
  5321.         CASE 11
  5322.  PRINT "ERRCLASS_MEDIA ==> Incorrect Media; a CRC Error has Occurred"
  5323.         CASE 12
  5324.           PRINT "ERRCLASS_ALREADY ==> Everything is Ready"
  5325.         CASE 13
  5326.           PRINT "ERRCLASS_UNK ==> Error is Unclassified"
  5327.         CASE 14
  5328.           PRINT "ERRCLASS_CANT ==> Cannot perform Requested Action"
  5329.         CASE 15
  5330.           PRINT "ERRCLASS_TIME ==> Time-out has Occurred"
  5331.         CASE ELSE
  5332.           PRINT "UnKnown Class"
  5333.  END SELECT
  5334.  Print "Recommended Action: ";
  5335.  SELECT CASE action%
  5336.         CASE 1
  5337.           PRINT "ERRACT_RETRY ==> Retry Immediately"
  5338.         CASE 2
  5339.           PRINT "ERRACT_DLYRET ==> Delay and Retry"
  5340.         CASE 3
  5341.           PRINT "ERRACT_USER ==> Bad User Input; Get New values"
  5342.         CASE 4
  5343.           PRINT "ERRACT_ABORT ==> Terminate in an Orderly Manner"
  5344.         CASE 5
  5345.           PRINT "ERRACT_PANIC ==> Terminate Immediately"
  5346.         CASE 6
  5347.           PRINT "ERRACT_IGNORE ==> Ignore the Error"
  5348.         CASE 7
  5349.           PRINT "ERRACT_INTRET ==> Retry After User Intervention"
  5350.         CASE ELSE
  5351.           PRINT "UnKnown Class"
  5352.  END SELECT
  5353.  PRINT "Location: ";
  5354.  SELECT CASE locus%
  5355.         CASE 1
  5356.           PRINT "ERRLOC_UNK ==> The Origin of the Error is Unknown"
  5357.         CASE 2
  5358.           PRINT "ERRLOC_DISK ==> The Error Occurred in a Random-Access"
  5359.           PRINT "                Device, such as a Disk Drive"
  5360.         CASE 3
  5361.           PRINT "ERRLOC_NET ==> This is a Network Error"
  5362.         CASE 4
  5363.           PRINT "ERRLOC_SERDEV ==> This is a Serial-Device Error"
  5364.         CASE 5
  5365.           PRINT "ERRLOC_MEM ==> This is a Memory Parameter Error"
  5366.         CASE ELSE
  5367.           PRINT "Unknown Location Error"
  5368.  END SELECT
  5369.  END SUB
  5370.  
  5371.  
  5372.  94. BC 6.00 Example of OS/2 API Function Call DosExecPgm
  5373.  
  5374.  Product Version(s): 6.00 6.00b 7.00
  5375.  Operating System:   OS/2
  5376.  Flags: ENDUSER | SR# S890125-54
  5377.  Last Modified:  1-FEB-1990    ArticleIdent: Q40868
  5378.  
  5379.  Below is an example of using the MS OS/2 API function DosExecPgm. This
  5380.  program must be compiled with Microsoft BASIC Compiler Versions 6.00
  5381.  or 6.00b for MS OS/2 or Microsoft BASIC Professional Development
  5382.  System (PDS) Version 7.00 for MS OS/2.
  5383.  
  5384.  The following is the example code:
  5385.  
  5386.  'The definitions are taken from BSEDOSPC.BI
  5387.  TYPE ResultCodes
  5388.       codeterminate as integer
  5389.       coderesult as integer
  5390.  END TYPE
  5391.  DECLARE FUNCTION DosExecPgm%(_
  5392.          BYVAL p1S AS INTEGER,_
  5393.          BYVAL p1o AS INTEGER,_
  5394.          BYVAL p2  AS INTEGER,_
  5395.          BYVAL p3  AS INTEGER,_
  5396.          BYVAL p4s AS INTEGER,_
  5397.          BYVAL p4o AS INTEGER,_
  5398.          BYVAL p5s AS INTEGER,_
  5399.          BYVAL p5o AS INTEGER,_
  5400.          SEG   p6  AS ResultCodes,_
  5401.          BYVAL p7s AS INTEGER,_
  5402.          BYVAL p7o AS INTEGER)
  5403.  DEFINT A-Z
  5404.  DIM results as ResultCodes
  5405.  
  5406.  INPUT "Enter NAME of EXE file (with .EXE) to execute: "; fln$
  5407.  fln$ = fln$ + chr$(0)
  5408.  buffer$=space$(255)+chr$(0)
  5409.  bufferlen = len(buffer$)
  5410.  AsyncTraceFlags = 1  'Execute Asynchronously to the parent
  5411.  ArgPointer$=chr$(0)
  5412.  EnvPointer$=chr$(0)
  5413.  x% = DosExecPgm(varseg(buffer$),sadd(buffer$),_
  5414.                  bufferlen,AsyncTraceFlags,_
  5415.                  varseg(ArgPointer$),sadd(ArgPointer$),_
  5416.                  varseg(EnvPointer$),sadd(EnvPointer$),_
  5417.                  results, varseg(fln$),sadd(fln$))
  5418.  PRINT "ExecPgm Error CODE : ";x%
  5419.  SLEEP(5)
  5420.  PRINT "This Parent is Complete"
  5421.  END
  5422.  
  5423.  
  5424.  95. BC 6.00 Example of OS/2 API Function Call DosNewSize
  5425.  
  5426.  Product Version(s): 6.00 6.00b 7.00
  5427.  Operating System:   OS/2
  5428.  Flags: ENDUSER | SR# S890125-34
  5429.  Last Modified:  1-FEB-1990    ArticleIdent: Q40870
  5430.  
  5431.  Below is a sample program that makes a call to the MS OS/2 API
  5432.  function DosNewSize. This function can be used to truncate or expand a
  5433.  file. If the file is expanded, the new bytes are undefined. The
  5434.  program also makes calls to DosOpen and DosClose.
  5435.  
  5436.  The program can be compiled in Microsoft BASIC Compiler Versions 6.00
  5437.  and 6.00b for MS OS/2 and Microsoft BASIC Professional Development
  5438.  System (PDS) Version 7.00 for MS OS/2.
  5439.  
  5440.  The following is the sample program:
  5441.  
  5442.  REM $INCLUDE: 'bsedosfl.bi'
  5443.  DEFINT a-z
  5444.  CLS
  5445.  DIM filelist AS FileStatus
  5446.  DIM sizel AS LONG
  5447.  DIM reserved AS LONG
  5448.  DIM buf AS STRING*512
  5449.  DIM distance AS LONG
  5450.  DIM NewPointer AS LONG
  5451.  
  5452.  input "Enter the Filename : ";fl$
  5453.  fl$=fl$+chr$(0)
  5454.  openflag=17
  5455.  openmode=&h6092
  5456.  
  5457.  x=DosOpen(varseg(fl$),sadd(fl$),handle,action,sizel,_
  5458.            filea,openflag,openmode,reserved)
  5459.  
  5460.  IF (x) THEN
  5461.     print "An error occurred.  The number is : ";x
  5462.     end
  5463.  ELSE
  5464.    input "Enter the new size ",newsize&
  5465.    x=DosNewSize(handle,newsize&)
  5466.    IF (x) THEN
  5467.       Print "An error occurred.  The number is : ";x
  5468.    ELSE
  5469.       Print "File size was changed"
  5470.    END IF
  5471.    x=DosClose%(handle)
  5472.    IF (x) THEN
  5473.       color 7 :PRINT "An error occurred. The number is : ";x :color 15
  5474.    ELSE
  5475.       print "File Closed."
  5476.       print "Enter any key to exit..."
  5477.       while inkey$="" :wend
  5478.    END IF
  5479.  END IF
  5480.  END
  5481.  
  5482.  
  5483.  96. Some Coprocessor Assembler Instructions Are Not Emulated
  5484.  
  5485.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  5486.  Operating System:   MS-DOS          | OS/2
  5487.  Flags: ENDUSER | B_QuickBas S_C H_Fortran H_MASM SR# S890111-171
  5488.  Last Modified:  1-FEB-1990    ArticleIdent: Q40872
  5489.  
  5490.  Microsoft Macro Assembler Version 5.10 does not come with routines to
  5491.  emulate a math coprocessor.
  5492.  
  5493.  Page 382 of the "Microsoft Macro Assembler 5.1: Programmer's Guide"
  5494.  states that to emulate math-coprocessor instructions, you must link
  5495.  with a Microsoft high-level language that supports floating-point
  5496.  emulation of the coprocessor. You would write the assembler procedure
  5497.  using coprocessor instructions, then assemble with the /E option, and
  5498.  finally link it with the high-level language modules.
  5499.  
  5500.  However, only a subset of coprocessor instructions are emulated by the
  5501.  Microsoft high-level languages.
  5502.  
  5503.  If you link your Microsoft higher-level language to an assembler
  5504.  routine that invokes an instruction that is NOT emulated by the
  5505.  higher-level language, then the program gives a run-time error (or
  5506.  possibly hangs, or gives incorrect results) when run on a machine that
  5507.  has no coprocessor.
  5508.  
  5509.  This information applies to the following products:
  5510.  
  5511.  1.  Microsoft BASIC Compiler Versions 6.00 and 6.00b
  5512.  
  5513.  2.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  5514.  
  5515.  3.  Microsoft QuickBASIC Version 4.50
  5516.  
  5517.  4.  Microsoft C Compiler Version 5.10
  5518.  
  5519.  5.  Microsoft FORTRAN Compiler Version 4.10
  5520.  
  5521.  Below is a list of the coprocessor (8087 or 80287) instructions that
  5522.  are not emulated by Microsoft high-level languages:
  5523.  
  5524.     FBLD    - packed decimal load
  5525.     FBSTP   - packed decimal store and pop
  5526.     FCOS    - cosine function
  5527.     FDECSTP - decrement stack pointer
  5528.     FINCSTP - increment stack pointer
  5529.     FINIT   - initialize processor
  5530.     FLDENV  - load environment
  5531.     FNOP    - No operation
  5532.     FPREM1  - partial remainder
  5533.     FRSTOR  - restore saved state
  5534.     FSAVE   - save state
  5535.     FSETPM  - set protected mode
  5536.     FSIN    - only sine function
  5537.     FSINCOS - sine and cosine function
  5538.     FSTENV  - store environment
  5539.     FUCOM   - unordered comparison
  5540.     FUCOMP  - unordered comparison and pop
  5541.     FUCOMPP - unordered comparison and double pop
  5542.     FXTRACT - extract exponent and significant
  5543.  
  5544.  Also, some of the No-Wait forms of instructions are not emulated, such
  5545.  as FNSTENV and FNINIT.
  5546.  
  5547.  
  5548.  97. BC 6.00 Example of OS/2 API Function Call DosDupHandle
  5549.  
  5550.  Product Version(s): 6.00 6.00b 7.00
  5551.  Operating System:   OS/2
  5552.  Flags: ENDUSER | SR# S890125-58
  5553.  Last Modified:  1-FEB-1990    ArticleIdent: Q40873
  5554.  
  5555.  Below is a sample program that makes a call to the MS OS/2 API
  5556.  function DosDupHandle. It also uses the following MS OS/2 API
  5557.  functions:
  5558.  
  5559.     DosOpen
  5560.     DosRead
  5561.     DosWrite
  5562.     DosClose
  5563.  
  5564.  This program can be compiled in Microsoft BASIC Compiler Versions 6.00
  5565.  and 6.00b for MS OS/2 and Microsoft BASIC Professional Development
  5566.  System (PDS) Version 7.00 for MS OS/2.
  5567.  
  5568.  The following is the sample program:
  5569.  
  5570.  CONST TRUE=-1
  5571.  CONST FALSE=0
  5572.  REM $include: 'BSEDOSFL.BI'
  5573.  
  5574.  DEFINT A-Z
  5575.  DIM sizel AS LONG
  5576.  DIM reserved AS LONG
  5577.  DIM buf AS STRING*512
  5578.  DIM distance AS LONG
  5579.  DIM NewPointer AS LONG
  5580.  CLS
  5581.  
  5582.  input "Enter the Filename : ";fl$
  5583.  fl$=fl$+chr$(0)
  5584.  openflag=17
  5585.  openmode=&h6092
  5586.  
  5587.  x=DosOpen(varseg(fl$),sadd(fl$),handle,action,sizel,_
  5588.            filea,openflag,openmode,reserved)
  5589.  
  5590.  IF (x) THEN
  5591.     print "An error occurred.  The number is : ";x
  5592.     end
  5593.  ELSE
  5594.    print "The handle is : ";handle
  5595.    print "The action is : ";action
  5596.    print "The size is   : ";sizel
  5597.    print "The filea is  : ";filea
  5598.    print "The openflag  : ";openflag
  5599.    print "The openmode  : ";openmode
  5600.    size=512
  5601.    buffer$=string$(size/4,65)+string$(size/4,66)+string$(size/4,67)
  5602.    buffer$=buffer$+string$(size/4,68)+chr$(0)
  5603.  
  5604.    x=DosWrite%(handle,varseg(buffer$),sadd(buffer$),size,nw)
  5605.    IF (x) THEN
  5606.      Print "An error occurred.  The number is : ";x
  5607.    ELSE
  5608.      print "The information was placed into the file."
  5609.      print "The number of bytes written was : ";nw
  5610.    END IF
  5611.  END IF
  5612.  
  5613.  x=DosClose%(handle)
  5614.  IF (x) THEN
  5615.     Print "An error occurred.  The number is : ";x
  5616.  ELSE
  5617.     print "The file is closed." : print
  5618.  END IF
  5619.  print "Enter Any Key OPEN file and DUPLICATE Handle..."
  5620.  while inkey$="" :wend
  5621.  
  5622.  x=DosOpen(varseg(fl$),sadd(fl$),handle,action,sizel,_
  5623.            filea,openflag,openmode,reserved)
  5624.  x=DosDupHandle%(handle,newhandle)
  5625.    IF (x) THEN
  5626.      Print "An error occurred.  The number is : ";x
  5627.    ELSE
  5628.      Print "Handle was Duplicated."
  5629.    END IF
  5630.  PRINT
  5631.  PRINT "Enter any Key to READ with Both handles"
  5632.  PRINT
  5633.  WHILE INKEY$="" : WEND
  5634.  size=256
  5635.  buf=string$(size,42)
  5636.  x=DosRead%(handle,varseg(buf),varptr(buf),size,nr)
  5637.    IF (x) THEN
  5638.      Print "An error occurred.  The number is : ";x
  5639.    ELSE
  5640.      IF nr=0 THEN
  5641.         PRINT "EOF Detected"
  5642.      ELSE
  5643.         PRINT "ORIGINAL HANDLE"
  5644.         PRINT "The number of bytes read is : ";nr
  5645.         PRINT "The bytes were : ";buf
  5646.      END IF
  5647.    END IF
  5648.  size=256
  5649.  buf=string$(size,42)
  5650.  x=DosRead%(newhandle,varseg(buf),varptr(buf),size,nr)
  5651.    IF (x) THEN
  5652.      Print "An error occurred.  The number is : ";x
  5653.    ELSE
  5654.      IF nr=0 THEN
  5655.         PRINT "EOF Detected"
  5656.      ELSE
  5657.         PRINT "NEW HANDLE"
  5658.         PRINT "The number of bytes read is : ";nr
  5659.         PRINT "The bytes were : ";buf
  5660.      END IF
  5661.    END IF
  5662.  
  5663.  x=DosClose%(handle)
  5664.  IF (x) THEN
  5665.     Print "An error occurred.  The number is : ";x
  5666.  ELSE
  5667.     print "The file is closed."
  5668.  END IF
  5669.  END
  5670.  
  5671.  
  5672.  98. Mouse Not Supported on VGA in OS/2 Real Mode; OK in MS-DOS
  5673.  
  5674.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  5675.  Operating System:   MS-DOS          | OS/2
  5676.  Flags: ENDUSER | SR# S890222-67 B_QuickBas
  5677.  Last Modified:  2-FEB-1990    ArticleIdent: Q42589
  5678.  
  5679.  This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
  5680.  and 4.50 for MS-DOS, to Microsoft BASIC Compiler Versions 6.00 and
  5681.  6.00b for MS-DOS and MS OS/2, and to Microsoft BASIC Professional
  5682.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  5683.  
  5684.  In MS OS/2 real mode under MS OS/2 Versions 1.00 and 1.10, due to
  5685.  limitations of the MS OS/2 mouse controller, the mouse driver does not
  5686.  support operating with VGA graphics. The mouse works correctly in EGA,
  5687.  CGA, and text modes. This problem was corrected in MS OS/2 Version
  5688.  1.20.
  5689.  
  5690.  In MS OS/2 protected mode, the MS OS/2 mouse driver does not support
  5691.  the drawing of the mouse pointer in graphics modes. It is up to the
  5692.  application to draw its own pointer. The mouse driver provides
  5693.  notification of mouse movement to an MS OS/2 application, provided
  5694.  that the VioSetMode CALL (set graphics mode) is used AFTER the MouOpen
  5695.  (open the mouse) and the MouSetDevStatus (to disable pointer drawing)
  5696.  CALLs are performed.
  5697.  
  5698.  More information on the VioSetMode and MouSetDevStatus MS OS/2 API
  5699.  CALLs can be found in the "Microsoft Operating System/2: Programmer's
  5700.  Toolkit Programming Tools."
  5701.  
  5702.  
  5703.  99. "SYS2090" Error Using SETUP, LINK, or LIB with BASIC Compiler
  5704.  
  5705.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  5706.  Operating System:   MS-DOS          | OS/2
  5707.  Flags: ENDUSER |
  5708.  Last Modified:  1-FEB-1990    ArticleIdent: Q42591
  5709.  
  5710.  You can receive the error, "SYS2090: Unable to load User Program" when
  5711.  trying to run the SETUP.EXE, LINK.EXE, or LIB.EXE program (from
  5712.  Microsoft BASIC Compiler Versions 6.00 or 6.00b and Microsoft BASIC
  5713.  Professional Development System (PDS) Version 7.00 for MS-DOS and MS
  5714.  OS/2) in either the protected or real modes of Microsoft OS/2.
  5715.  
  5716.  This Microsoft OS/2 error typically occurs when trying to run a bound
  5717.  application that is not configured correctly in the real (MS-DOS)
  5718.  environment. Because bound applications can run under both real or
  5719.  protected mode, these applications are very sensitive to their
  5720.  environment.
  5721.  
  5722.  The following are some possible reasons for this error in real mode:
  5723.  
  5724.  1. A corrupted or zero-length .EXE file.
  5725.  
  5726.  2. When running under the standard MS-DOS environment, you may be
  5727.     using MS-DOS Versions 2.x. Running a bound application under MS-DOS
  5728.     2.x requires that the bound programs be placed in the current
  5729.     subdirectory. Using MS-DOS Versions 3.x will also correct the
  5730.     problem.
  5731.  
  5732.  3. Problems with the specific BIOS, possibly corrected by upgrading
  5733.     the ROM version.
  5734.  
  5735.  4. Interference by terminate-and-stay-resident (TSR) programs and some
  5736.     unpatched versions of Novell netware has been observed to cause
  5737.     SYS2090 errors. Novell users should contact their dealers to obtain
  5738.     patched versions of the netware that emulate MS-DOS 3.x correctly by
  5739.     preserving the SS and SP registers when spawning processes. Novell
  5740.     netware Version 2.0A++, and Versions 2.10 and later are patched
  5741.     properly, according to Novell.)
  5742.  
  5743.  
  5744.  100. BASIC User-Entry Points Cannot Be Called from Other Languages
  5745.  
  5746.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  5747.  Operating System:   MS-DOS               | OS/2
  5748.  Flags: ENDUSER | docerr B_QuickBas H_MASM S_C S_PasCal H_Fortran
  5749.  Last Modified:  8-JAN-1991    ArticleIdent: Q42700
  5750.  
  5751.  The "Microsoft Mixed-Language Programming Guide" is packaged with
  5752.  Microsoft C Versions 5.00 and later, Microsoft Pascal Versions 4.00
  5753.  and later, Microsoft FORTRAN Versions 4.10 and later, and Microsoft
  5754.  Macro Assembler (MASM) Versions 5.00 and later.
  5755.  
  5756.  On the bottom of Page 39, there is a note that incorrectly states that
  5757.  QuickBASIC Version 4.00 provides a number of "user-entry points,"
  5758.  which are BASIC system-level functions that may be called directly
  5759.  from C, and that the README file provides more information. However,
  5760.  there is no information on these "user-entry points" in the README.DOC
  5761.  file provided with QuickBASIC Versions 4.00, 4.00b, or 4.50, Microsoft
  5762.  BASIC Compiler Versions 6.00 and 6.00b, or Microsoft BASIC
  5763.  Professional Development System (PDS) Version 7.00 or 7.10 for MS-DOS
  5764.  and MS OS/2. This note should be removed, since there are no such
  5765.  user-entry points available.
  5766.  
  5767.  
  5768.  101. M.EXE Editor's CALLTREE Does Not Support BASIC Source Files
  5769.  
  5770.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  5771.  Operating System:   MS-DOS          | OS/2
  5772.  Flags: ENDUSER | B_QuickBas SR# S890212-9
  5773.  Last Modified:  1-FEB-1990    ArticleIdent: Q43788
  5774.  
  5775.  The CALLTREE program used by the Microsoft M.EXE editor does not
  5776.  produce meaningful results for BASIC source files. The CALLTREE
  5777.  utility is provided with the Microsoft Editor for use with Microsoft C
  5778.  and Microsoft Macro Assembler (MASM). It returns a listing of a C or
  5779.  MASM program's function-calling structure in a tree format. CALLTREE
  5780.  processes BASIC files with no error messages; however, the results are
  5781.  not correct.
  5782.  
  5783.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  5784.  6.00b for MS-DOS and MS OS/2, to Microsoft BASIC Professional
  5785.  Development System (PDS) Version 7.00, and to Microsoft QuickBASIC
  5786.  Versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50. (Note: The Microsoft
  5787.  M.EXE editor comes with the BASIC compiler 6.00 and 6.00b and
  5788.  Microsoft BASIC PDS Version 7.00 but not with any version of the
  5789.  QuickBASIC package.)
  5790.  
  5791.  Code Example
  5792.  ------------
  5793.  
  5794.  The following is the BASIC SOURCE FILE for testing CALLTREE:
  5795.  
  5796.  DECLARE SUB anysub1 ()
  5797.  DECLARE SUB anysub3 ()
  5798.  DECLARE SUB anysub2 ()
  5799.  
  5800.  CLS
  5801.  CALL anysub3
  5802.  END
  5803.  
  5804.  SUB anysub1
  5805.    PRINT "inside of subroutine 1"
  5806.  END SUB
  5807.  
  5808.  SUB anysub2
  5809.  PRINT "Inside of subroutine 2"
  5810.  CALL anysub1
  5811.  END SUB
  5812.  
  5813.  SUB anysub3
  5814.    PRINT "Inside of subroutine 3"
  5815.    CALL anysub2
  5816.  END SUB
  5817.  
  5818.  The following is the CALLTREE OUTPUT for the above BASIC file:
  5819.  
  5820.  anysub1
  5821.  anysub3
  5822.  anysub2
  5823.  
  5824.  The following is the C SOURCE FILE for testing CALLTREE:
  5825.  
  5826.  void func1(void)
  5827.  {
  5828.    printf("Inside of function 1\n");
  5829.  }
  5830.  
  5831.  void func2(void)
  5832.  {
  5833.    printf("inside of function 2\n");
  5834.    func1();
  5835.  }
  5836.  
  5837.  void func3(void)
  5838.  {
  5839.    printf("Inside of function 3\n");
  5840.    func2();
  5841.  }
  5842.  
  5843.  void main(void)
  5844.  {
  5845.    func3();
  5846.  }
  5847.  
  5848.  The following is the CALLTREE OUTPUT for the above C program:
  5849.  
  5850.  func1
  5851.  |   printf?
  5852.  func2
  5853.  |   printf?
  5854.  |   func1
  5855.  |   |   printf?
  5856.  func3
  5857.  |   printf?
  5858.  |   func2
  5859.  |   |   printf?
  5860.  |   |   func1
  5861.  |   |   |   printf?
  5862.  main
  5863.  |   func3
  5864.  |   |   printf?
  5865.  |   |   func2
  5866.  |   |   |   printf?
  5867.  |   |   |   func1
  5868.  |   |   |   |   printf?
  5869.  
  5870.  
  5871.  102. BC 6.00's BUILDRTM Has Not Been Tested with QB 4.50's Compiler
  5872.  
  5873.  Product Version(s): 6.00 6.00b 7.00
  5874.  Operating System:   MS-DOS
  5875.  Flags: ENDUSER | B_QuickBas
  5876.  Last Modified:  4-JAN-1990    ArticleIdent: Q43931
  5877.  
  5878.  QuickBASIC Version 4.50 has not been tested with the BUILDRTM.EXE
  5879.  found in Microsoft BASIC Compiler Versions 6.00 and 6.00b and
  5880.  Microsoft BASIC PDS Version 7.00. Microsoft does not claim that
  5881.  BUILDRTM.EXE will work correctly with object modules compiled using
  5882.  the BC.EXE compiler from QuickBASIC 4.50.
  5883.  
  5884.  "Unresolved Externals" during linkage is one of the reported errors
  5885.  that occurs when using the BUILDRTM.EXE on an object module compiled
  5886.  with the BC.EXE from QuickBASIC 4.50.
  5887.  
  5888.  BUILDRTM is designed for use only with Microsoft BASIC Compiler
  5889.  Versions 6.00 and 6.00b for MS-DOS and OS/2 and Microsoft BASIC PDS
  5890.  Version 7.00 for MS-DOS and OS/2. BUILDRTM adds routines to extend the
  5891.  BRUN6xx.EXE run-time libraries for Versions 6.00 and 6.00b and the
  5892.  BRT70xxx.EXE run-time libraries for BASIC PDS 7.00.
  5893.  
  5894.  
  5895.  103. MARKEXE.EXE in OS/2 May Cause .EXE Hang at Run Time
  5896.  
  5897.  Product Version(s): 6.00 6.00b 7.00
  5898.  Operating System:   OS/2
  5899.  Flags: ENDUSER | SR# S890424-101
  5900.  Last Modified:  4-JAN-1990    ArticleIdent: Q44230
  5901.  
  5902.  Microsoft BASIC Compiler programs running in OS/2 protected mode take
  5903.  over the full screen by default and will not run from an OS/2
  5904.  Presentation Manager (PM) windowed environment unless you first alter
  5905.  the .EXE program's header with the MARKEXE utility or with PM's Start
  5906.  Programs window (as shown further below).
  5907.  
  5908.  It has been reported that system crashes may intermittently occur
  5909.  while running graphics-mode programs from the PM windowed environment.
  5910.  Only nongraphics programs using SCREEN 0 in a PM windowed environment
  5911.  seem to work without problems, and this is not always the case either.
  5912.  It has also been reported that system crashes have occurred while
  5913.  running character-mode (SCREEN 0) programs from within a PM windowed
  5914.  environment.
  5915.  
  5916.  Microsoft has not tested programs running within a PM window that were
  5917.  compiled with Microsoft BASIC Compiler Versions 6.00, 6.00b, or
  5918.  Microsoft BASIC PDS Version 7.00. This feature is under review and
  5919.  will be considered for inclusion in a future release.
  5920.  
  5921.  While there are problems running BASIC programs from within a PM
  5922.  window, you can write OS/2 Presentation Manager (PM) applications
  5923.  using BASIC compiler Versions 6.00 and 6.00b and BASIC PDS Version
  5924.  7.00. This information is detailed in a separate article that can be
  5925.  found by querying on the following words:
  5926.  
  5927.    OS/2 and Presentation and Manager and BASIC
  5928.  
  5929.  The MARKEXE.EXE utility program is shipped on the Toolkit 1 disk
  5930.  with the Microsoft OS/2 Software Development Kit and is used for
  5931.  altering the header of a bound or protected-mode executable program
  5932.  (.EXE) to run from a PM windowed environment. The following is an
  5933.  example of running MARKEXE:
  5934.  
  5935.     MARKEXE progname windowcompat
  5936.  
  5937.  Another method to modify your compiled BASIC .EXE to run under a PM
  5938.  window (in protected mode) is to do the following:
  5939.  
  5940.  1. Choose the Add option from the Program menu of the Start Programs
  5941.     window in PM.
  5942.  
  5943.  2. Choose Change from the Program menu. The Change Program Information
  5944.     window now appears.
  5945.  
  5946.  3. Choose Other for the Program Type. Press the ENTER key. The How To
  5947.     Run The Program window now appears.
  5948.  
  5949.  4. Choose Run The Program In A Text Window to run your program in a
  5950.     PM window. Press the ENTER key.
  5951.  
  5952.  You can now run your program in a PM window from OS/2's Start Program
  5953.  window or from the OS/2 full-screen command prompt.
  5954.  
  5955.  If the program is deleted from the Start Program menu, the .EXE header
  5956.  is changed back to what it was prior to being entered into the Start
  5957.  Program menu.
  5958.  
  5959.  
  5960.  104. LPOS(0) and LPOS(1) Both Return Print Head Position for LPT1
  5961.  
  5962.  Product Version(s): 6.00 6.00b | 6.00 6.00b
  5963.  Operating System:   MS-DOS     | OS/2
  5964.  Flags: ENDUSER | docerr B_QuickBas
  5965.  Last Modified:  2-FEB-1990    ArticleIdent: Q45420
  5966.  
  5967.  The LPOS(0) and LPOS(1) functions both return the current position of
  5968.  the print head within the printer buffer for LPT1. LPOS(2) returns
  5969.  the current print position for LPT2.
  5970.  
  5971.  On Page 263 of the "Microsoft BASIC Compiler 6.0: BASIC Language
  5972.  Reference" manual for Versions 6.00 and 6.00b for MS OS/2 and MS-DOS,
  5973.  the program example uses LPOS(0) to return the current position of the
  5974.  line printer's print head within the print buffer, but no mention is
  5975.  made of LPOS(0) in the function description. LPOS(0) operates the same
  5976.  as LPOS(1), and there is no difference between the two functions.
  5977.  
  5978.  This information applies also to Page 263 of the "Microsoft QuickBASIC
  5979.  4.0: BASIC Language Reference" manual for QuickBASIC Versions 4.00 and
  5980.  4.00b, to Page 224 of the "Microsoft QuickBASIC 4.5: BASIC Language
  5981.  Reference" for Version 4.50, and to the QuickBASIC Version 4.50 QB
  5982.  Advisor online Help system.
  5983.  
  5984.  This documentation error was corrected on Page 204 of the "Microsoft
  5985.  BASIC 7.0: Language Reference" manual for Microsoft BASIC Professional
  5986.  Development System (PDS) Version 7.00.
  5987.  
  5988.  
  5989.  105. CodeView Can't Watch Array Passed to BASIC SUBprogram
  5990.  
  5991.  Product Version(s): 6.00 6.00b 7.00
  5992.  Operating System:   MS-DOS
  5993.  Flags: ENDUSER | B_QuickBas buglist6.00 buglist6.00b buglist7.00 fixlist7.10
  5994.  Last Modified: 20-SEP-1990    ArticleIdent: Q47060
  5995.  
  5996.  When debugging a BASIC program (compiled with BC.EXE versions 7.00 and
  5997.  earlier) with Microsoft CodeView (version 2.20, 2.30, 2.35, 3.00, or
  5998.  3.10), an attempt to watch an array passed to a SUBprogram produces
  5999.  the error "Not an array."
  6000.  
  6001.  Microsoft has confirmed this to be a problem in QuickBASIC versions
  6002.  4.00, 4.00b, and 4.50 (even though they do not provide CodeView on the
  6003.  release disks) (buglist4.00, buglist4.00b, buglist4.50); in Microsoft
  6004.  BASIC Compiler versions 6.00 and 6.00b (which provide CodeView version
  6005.  2.20 on the release disks); and in Microsoft BASIC Professional
  6006.  Development System (PDS) version 7.00 (which provides CodeView version
  6007.  2.35 on the release disks). This problem is corrected by compiling the
  6008.  program with BASIC PDS version 7.10 and using Microsoft CodeView
  6009.  version 3.10, which comes with BASIC PDS 7.10.
  6010.  
  6011.  As a workaround in earlier versions, you can make the array global by
  6012.  putting it in a COMMON statement and not passing it through a CALL
  6013.  statement's parameter list.
  6014.  
  6015.  Note that CodeView version 2.20 is shipped with Microsoft BASIC
  6016.  Compiler versions 6.00 and 6.00b; CodeView 2.30 is shipped with
  6017.  Microsoft FORTRAN version 5.00; CodeView version 2.35 is shipped with
  6018.  Microsoft BASIC Professional Development System (PDS) version 7.00;
  6019.  CodeView version 3.00 is shipped with Microsoft C Compiler version
  6020.  6.00; and CodeView 3.10 is shipped with Microsoft BASIC PDS version
  6021.  7.10.
  6022.  
  6023.  The following program is CVTEST.BAS, which demonstrates the above
  6024.  problem when compiled in BC.EXE 7.00 or earlier, and run under
  6025.  Microsoft CodeView:
  6026.  
  6027.     DECLARE SUB test (a() AS INTEGER)
  6028.     DIM a(5) AS INTEGER
  6029.     a(3) = 3
  6030.     PRINT a(3)
  6031.     CALL test(a())
  6032.     END
  6033.  
  6034.     SUB test (a() AS INTEGER)
  6035.       PRINT a(3)
  6036.     END SUB
  6037.  
  6038.  To demonstrate the problem, compile and link as follows:
  6039.  
  6040.     BC /Zi TEST.BAS;
  6041.     LINK /CO TEST;
  6042.  
  6043.  Load the program into CodeView (CV.EXE) and set a Watch (CTRL+W) on
  6044.  the variable a(3), then single-step the program (by pressing function
  6045.  key F8) until you execute the PRINT a(3) statement inside the
  6046.  SUB...END SUB procedure. At this point, the "Not an array" error
  6047.  message appears.
  6048.  
  6049.  Additional article reference words: S_CodeView
  6050.  
  6051.  
  6052.  106. Using BASIC to Perform Serial Communications in MS OS/2
  6053.  
  6054.  Product Version(s): 6.00 6.00b 7.00 7.10
  6055.  Operating System:   OS/2
  6056.  Flags: ENDUSER | SR# S890801-2
  6057.  Last Modified: 17-JAN-1991    ArticleIdent: Q48400
  6058.  
  6059.  This article contains a sample BASIC module that calls API routines in
  6060.  MS OS/2 protected mode to perform serial communications through
  6061.  communications port COM1, COM2, COM3, or COM4.
  6062.  
  6063.  You must link NOCOM.OBJ (which requires BC /O) with this module before
  6064.  attempting to use this module's routines.
  6065.  
  6066.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  6067.  6.00b for MS OS/2 (in protected mode only) and to Microsoft BASIC
  6068.  Professional Development System (PDS) versions 7.00 and 7.10 for MS
  6069.  OS/2 (in protected mode only).
  6070.  
  6071.  The following steps must be taken to use the COMPORT.BAS module
  6072.  (farther below):
  6073.  
  6074.  1. Create a program called COM.BAS that makes calls to the routines
  6075.     found in COMPORT.BAS and compile the program.
  6076.  
  6077.  2. Compile COMPORT.BAS. Ensure that COMPORT.BI (shown below) and
  6078.     BSEDOSFL.BI (included with BASIC compiler 6.00/6.00b and BASIC
  6079.     PDS 7.00/7.10) are in a directory that is in the $INCLUDE
  6080.     statement's explicit path.
  6081.  
  6082.  3. Link your program to COMPORT.OBJ in addition to NOCOM.OBJ.
  6083.  
  6084.  The following is a sample file that, when used as input for the MAKE
  6085.  utility, compiles and links a program called COM.BAS that uses the
  6086.  COMPORT module:
  6087.  
  6088.  #----------------------
  6089.  # MAKE file for COM.BAS
  6090.  #----------------------
  6091.  comport.obj : comport.bas comport.bi
  6092.       BC /LP /Z /O /D COMPORT.BAS;
  6093.  com.obj : com.bas comport.bi
  6094.       BC /LP /Z /O /D COM.BAS;
  6095.  com.exe : com.obj comport.obj
  6096.       link /EX com comport nocom;
  6097.  
  6098.  COMPORT.BI
  6099.  ----------
  6100.  
  6101.  ' parameter buffer for DosDevIOCtrl Function 41H
  6102.  TYPE F41Info
  6103.      BaudRate AS INTEGER
  6104.  END TYPE
  6105.  
  6106.  ' parameter buffer for DosDevIOCtrl Function 42H
  6107.  TYPE F42Info
  6108.      DataBits AS STRING * 1
  6109.      Parity AS STRING * 1
  6110.      StopBits AS STRING * 1
  6111.  END TYPE
  6112.  
  6113.  ' data buffer for DosDevIOCtrl Function 68H
  6114.  TYPE F68Info
  6115.      NumChars AS INTEGER   ' Number of characters waiting in
  6116.                            '   device queue
  6117.      QueueSize AS INTEGER  ' Size of queue
  6118.  END TYPE
  6119.  
  6120.  DECLARE FUNCTION InitComPort% (ComPort$, Baud%, Parity%,_
  6121.                                 DataBit%,StopBit%)
  6122.  DECLARE SUB WriteCom (Handle%, ToCom$, BytesWritten%)
  6123.  DECLARE SUB PrintCom (Handle%, ToCom$, BytesWritten%)
  6124.  DECLARE SUB ReadCom (Handle%, FromCom$, BytesToRead%,_
  6125.                       BytesRead%)
  6126.  DECLARE SUB ComSize (Handle%, Size%)
  6127.  DECLARE SUB CloseCom (Handle%)
  6128.  
  6129.  COMPORT.BAS
  6130.  -----------
  6131.  
  6132.  ' $INCLUDE: 'COMPORT.BI'
  6133.  ' $INCLUDE: 'BSEDOSFL.BI'
  6134.  ' Note:
  6135.  '       These routines call OS/2 system functions
  6136.  ' that always return a value indicating whether or not an
  6137.  ' error has occurred. In this module, ReturnErr% always
  6138.  ' contains this value. A return value of 0 means no error
  6139.  ' occurred. This module does no error checking. This would
  6140.  ' have to be added using the values in ReturnErr%.
  6141.  '       For added flexibility in configuring the port, use
  6142.  ' DosDevIOCtrl Function 53H.
  6143.  '       All of the routines in this module (except
  6144.  ' InitComPort%) need a Handle% as one of the parameters.
  6145.  ' This Handle% is obtained from InitComPort%
  6146.  
  6147.  '***********************************************************
  6148.  ' InitComPort% returns a handle to the comport specified in
  6149.  ' the parameter ComPort$ (must be in the form: "COMn" where
  6150.  ' n is a number between 1 and 4.) Before the handle to the
  6151.  ' port is returned, the port is configured to the correct
  6152.  ' baud rate (110 to 19200), parity, data bit, and stop bit.
  6153.  '***********************************************************
  6154.  FUNCTION InitComPort% (ComPort$, Baud%, Parity%, DataBit%,_
  6155.                         StopBit%)
  6156.      DIM F42 AS F42Info
  6157.      DIM F41 AS F41Info
  6158.      DIM Temp AS STRING * 5 'Temp holds string of form "COMn"+null byte
  6159.      Temp = ComPort$
  6160.      F41.BaudRate = Baud%
  6161.      F42.DataBits = CHR$(DataBit%)
  6162.      F42.Parity = CHR$(Parity%)
  6163.      F42.StopBits = CHR$(StopBit%)
  6164.  
  6165.      ReturnErr% = DosOpen% (VARSEG(Temp), VARPTR(Temp),_
  6166.                             Handle%,_
  6167.                             Action%,_
  6168.                             0,_
  6169.                             0,_
  6170.                             1,_
  6171.                             &H12,_
  6172.                             0)
  6173.      IF (ReturnErr% = 0) THEN
  6174.          ReturnErr% = DosDevIOCtl%(0, 0,_
  6175.                                    VARSEG(F41), VARPTR(F41),_
  6176.                                    &H41,_
  6177.                                     1,_
  6178.                                     Handle%)
  6179.          ReturnErr% =  DosDevIOCtl%(0, 0,_
  6180.                                     VARSEG(F42),VARPTR(F42),_
  6181.                                     &H42,_
  6182.                                     1,_
  6183.                                     Handle%)
  6184.      END IF
  6185.      InitComPort% = Handle%
  6186.  END FUNCTION
  6187.  
  6188.  '***********************************************************
  6189.  ' WriteCom writes a string (ToCom$) to the port associated
  6190.  ' with Handle%. BytesWritten% will contain the actual
  6191.  ' number of bytes written after the call to WriteCom.
  6192.  '***********************************************************
  6193.  SUB WriteCom (Handle%, ToCom$, BytesWritten%)
  6194.      DIM Temp AS STRING * 512
  6195.      Temp = ToCom$
  6196.      Length = LEN(ToCom$)
  6197.      ReturnErr% = DosWrite%(Handle%,_
  6198.                             VARSEG(Temp), VARPTR(Temp),_
  6199.                             Length,_
  6200.                             BytesWritten%)
  6201.  END SUB
  6202.  
  6203.  '***********************************************************
  6204.  ' PrintCom Prints a string (ToCom$) to the port associated
  6205.  ' with Handle%. The string is written and an additional CR
  6206.  ' and LF. BytesWritten% will contain the actual number of
  6207.  ' bytes written after the call to PrintCom.
  6208.  '***********************************************************
  6209.  SUB PrintCom (Handle%, ToCom$, BytesWritten%)
  6210.      ToCom$ = ToCom$ + CHR$(13) + CHR$(10)
  6211.      DIM Temp AS STRING * 512
  6212.      Temp = ToCom$
  6213.      Length = LEN(ToCom$)
  6214.      ReturnErr% = DosWrite%(Handle%,_
  6215.                             VARSEG(Temp), VARPTR(Temp),_
  6216.                             Length,_
  6217.                             BytesWritten%)
  6218.  END SUB
  6219.  
  6220.  '***********************************************************
  6221.  ' ReadCom reads BytesToRead% number of bytes from the port
  6222.  ' associated with Handle%. The bytes read are placed in
  6223.  ' FromCom$, and the number of bytes read will be placed in
  6224.  ' BytesRead%.
  6225.  '***********************************************************
  6226.  SUB ReadCom (Handle%, FromCom$, BytesToRead%, BytesRead%)
  6227.      DIM Temp AS STRING * 512
  6228.      ReturnErr% = DosRead%(Handle%,_
  6229.                            VARSEG(Temp), VARPTR(Temp),_
  6230.                            BytesToRead%,_
  6231.                            BytesRead%)
  6232.      FromCom$ = MID$(Temp,1,BytesRead%)
  6233.  END SUB
  6234.  
  6235.  '***********************************************************
  6236.  ' ComSize returns the number of bytes waiting to be read at
  6237.  ' the port associated with Handle%. The number of bytes
  6238.  ' waiting is placed in Size%.
  6239.  ************************************************************
  6240.  SUB ComSize (Handle%, Size%)
  6241.      DIM F68 AS F68Info
  6242.      DIM FileInfo AS FILESTATUS
  6243.      ReturnErr% = DosDevIOCtl%(VARSEG(F68), VARPTR(F68),_
  6244.                                0, 0,_
  6245.                                &H68,_
  6246.                                1,_
  6247.                                Handle%)
  6248.      Size% = F68.NumChars
  6249.  END SUB
  6250.  
  6251.  '***********************************************************
  6252.  ' CloseCom closes the port associated with Handle%. This
  6253.  ' should be called before the end of the program.
  6254.  '***********************************************************
  6255.  SUB CloseCom (Handle%)
  6256.      ReturnErr% = DosClose% (Handle%)
  6257.  END SUB
  6258.  
  6259.  
  6260.  107. OS/2 Program Selector Fails to Show DOS Box If Using SCREEN 3
  6261.  
  6262.  Product Version(s): 6.00 6.00b | 6.00 6.00b
  6263.  Operating System:   MS-DOS     | OS/2
  6264.  Flags: ENDUSER | SR# S891010-116 B_QuickBas
  6265.  Last Modified: 15-DEC-1989    ArticleIdent: Q50625
  6266.  
  6267.  The Program Selector of OS/2 Version 1.00 or 1.10 can't correctly
  6268.  switch to the screen of a running BASIC application that is currently
  6269.  using SCREEN 3 (Hercules graphics) in the DOS 3.x box (real mode). To
  6270.  work around this OS/2 limitation, you must stop the BASIC program with
  6271.  CTRL+BREAK or switch back to SCREEN 0 (or text mode) within the
  6272.  program.
  6273.  
  6274.  This behavior occurs in Microsoft QuickBASIC Versions 4.00, 4.00b, and
  6275.  4.50 for MS-DOS, in Microsoft BASIC Compiler Versions 6.00 and 6.00b
  6276.  for MS-DOS and MS OS/2, and in Microsoft BASIC PDS 7.00 for MS-DOS
  6277.  and MS OS/2.
  6278.  
  6279.  The Program Selector of OS/2 Version 1.00 or 1.10 is a simple
  6280.  interface that runs in character mode. When you invoke the OS/2 DOS
  6281.  box when it is running a program in Hercules graphics mode, OS/2
  6282.  maintains character mode and can't refresh the Hercules screen.
  6283.  QuickBASIC thinks it is still running under SCREEN 3 and the output is
  6284.  incorrect. Text mode must be reinvoked to restore visibility in the
  6285.  DOS box.
  6286.  
  6287.  Note that this problem does not occur for non-Hercules graphics screen
  6288.  modes (CGA, EGA, VGA) or for the Task Manager of OS/2 Presentation
  6289.  Manager (which can't run on Hercules graphics cards anyway).
  6290.  
  6291.  When you choose MS-DOS Command Prompt from the Switch To A Running
  6292.  Program menu in the OS/2 1.10 Program Selector screen and press ENTER,
  6293.  the highlighting on the menu selection disappears, the mouse pointer
  6294.  (if any) disappears, and the Program Selector appears to be hung
  6295.  (frozen) on the screen. If the BASIC program in the DOS box scrolls
  6296.  the screen during this time, the Program Selector will scroll upward
  6297.  showing some BASIC output, but the display will be incorrect
  6298.  (garbage).
  6299.  
  6300.  To stop the apparent hang or garbage on the screen, press CTRL+BREAK
  6301.  to abort the BASIC program and switch the screen over to text mode,
  6302.  thus making the DOS box visible. You can also press CTRL+ESC or
  6303.  ALT+ESC to go back to OS/2 at any time.
  6304.  
  6305.  Example
  6306.  -------
  6307.  
  6308.  To duplicate the problem, invoke the OS/2 Program Selector (CTRL+ESC),
  6309.  and then select MS-DOS Command Prompt from the Switch To A Running
  6310.  Program menu. Run the following code in the QuickBASIC QB.EXE editor
  6311.  or in a compiled .EXE program:
  6312.  
  6313.     SCREEN 3
  6314.     PRINT "This is a test"
  6315.     idle: GOTO idle
  6316.  
  6317.  [You must compile the .EXE program with /D (debug) so that CTRL+BREAK
  6318.  can stop the continuous loop in the program.] Invoke the OS/2 Program
  6319.  Selector (CTRL+ESC), and then select MS-DOS Command Prompt again. The
  6320.  menu highlight will disappear and the Program Selector screen will
  6321.  remain intact. The system will appear to be hung, but you are actually
  6322.  in the BASIC program. Pressing CTRL+BREAK will stop execution of the
  6323.  BASIC program and switch the DOS box back to text mode. When this is
  6324.  done, the Program Selector screen will be replaced with the DOS box
  6325.  screen.
  6326.  
  6327.  Note that if the BASIC application is not provided with a means to
  6328.  terminate or switch to the text mode screen, then the DOS box (for all
  6329.  practical purposes) will be hung. Technically, it can still be
  6330.  accessed by the keyboard, but the screen is never displayed correctly
  6331.  unless the program itself reinvokes SCREEN 0. The only way out of this
  6332.  condition is to reboot the computer.
  6333.  
  6334.  
  6335.  108. BASIC Program to Tell If Expanded Memory Driver Is Resident
  6336.  
  6337.  Product Version(s): 6.00 6.00b 7.00
  6338.  Operating System:   MS-DOS
  6339.  Flags: ENDUSER | B_QuickBas
  6340.  Last Modified: 26-FEB-1990    ArticleIdent: Q51293
  6341.  
  6342.  The following program shows how to determine if an expanded memory
  6343.  driver [or Expanded Memory Manager (EMM)] is loaded under MS-DOS. This
  6344.  program can be used either in the QuickBASIC editor or in an .EXE
  6345.  program created with the BC.EXE BASIC compiler under MS-DOS. This
  6346.  program also determines the amount of available expanded memory and
  6347.  the Lotus/Intel/Microsoft (LIM) specification version number of the
  6348.  EMS (Expanded Memory Specification) driver. For more information,
  6349.  refer to Pages 204-206 in "Advanced MS-DOS Programming, 2nd Edition"
  6350.  by Ray Duncan (Microsoft Press, 1988).
  6351.  
  6352.  This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
  6353.  and 4.50 for MS-DOS, to Microsoft BASIC Compiler Versions 6.00 and
  6354.  6.00b for MS-DOS, and to Microsoft BASIC Professional Development
  6355.  System (PDS) Version 7.00 for MS-DOS.
  6356.  
  6357.  Note that Microsoft BASIC PDS 7.00 introduces support for LIM 4.0 EMS
  6358.  (Expanded Memory Specification) for the following features: ISAM file
  6359.  buffers, the QBX.EXE editor environment, and LINK overlays at run
  6360.  time. Microsoft BASIC Compiler Versions 6.00b and earlier and
  6361.  QuickBASIC Versions 4.50 and earlier don't support expanded memory,
  6362.  ISAM, or LINK overlays.
  6363.  
  6364.  If an EMM driver is loaded, it is hooked to Interrupt 67 hex. This
  6365.  means that the address stored in the interrupt vector table for
  6366.  interrupt 67 hex points to the beginning of the driver. The device
  6367.  name for an Expanded Memory Manager driver must be "EMMXXXX0". This
  6368.  device name is located 0A hex bytes into the device header. This name
  6369.  can be checked to determine if a legitimate driver has been loaded. If
  6370.  this name is not found, you can assume that no expanded memory support
  6371.  is available.
  6372.  
  6373.  The strategy used in the program below is to use the DOS service
  6374.  (Interrupt 21 hex, function 35 hex) to get the address of the driver
  6375.  and then check the driver header found at that address for the correct
  6376.  name. Once the program determines that an expanded memory driver is
  6377.  available, it can access the driver through interrupt 67 hex, with
  6378.  functions 42 hex and 46 hex, to obtain the amount of expanded memory
  6379.  and LIM version numbers, respectively. The code example below
  6380.  illustrates one method for accomplishing this in Microsoft BASIC.
  6381.  
  6382.  For more information about how to use INTERRUPT or INTERRUPTX to
  6383.  access a DOS interrupt, ROM BIOS interrupt, or any other interrupt
  6384.  service, query for a separate article with the following word: QB4INT
  6385.  
  6386.  For more information about the interrupts necessary to access LIM EMS,
  6387.  see Pages 25-68 of "MS-DOS Extensions: Programmer's Quick Reference,"
  6388.  by Ray Duncan (Microsoft Press, 1989).
  6389.  
  6390.  Sample Program
  6391.  --------------
  6392.  
  6393.  '----------------------------- EXPCHK.BAS --------------------------
  6394.  '
  6395.  '   This program determines if an Expanded Memory Driver is loaded,
  6396.  '   displays the amount of available expanded memory, raw page
  6397.  '   size, EMM driver status, and the version number of the
  6398.  '   Lotus/Intel/Microsoft Expanded Memory Specification.
  6399.  
  6400.  '$INCLUDE: ''QBX.BI'              'Data Declarations for CALL INTERRUPT(X)
  6401.  DIM InRegsx AS RegTypeX, OutRegsx AS RegTypeX
  6402.  DIM InRegs AS RegType, OutRegs AS RegType
  6403.  DIM buffer(0 TO 4) AS INTEGER
  6404.  CLS
  6405.  LOCATE 10
  6406.  '-------------------------------------------------------------------
  6407.  'The Expanded Memory Manager is accessed through Interrupt &H67 if
  6408.  'present. Use the DOS Get Interrupt Vector (interrupt 21 hex, with
  6409.  'function 35 hex) service to retrieve the address of the device
  6410.  'driver and then get the device name from there. If the name is found
  6411.  'to be "EMMXXXX0", then the driver is loaded and calls can be made to
  6412.  'it.
  6413.  '-------------------------------------------------------------------
  6414.  
  6415.  InRegsx.ax = &H3500 + &H67         'DOS Get Interrupt Address Service
  6416.  InRegsx.ds = -1                    'Retain current DS and ES values
  6417.  InRegsx.es = -1
  6418.  CALL INTERRUPTX(&H21, InRegsx, OutRegsx)
  6419.  EMMDriverSEG = OutRegsx.es         'Segment of INT 67 EMM driver
  6420.  EMMDriverOFF = OutRegsx.bx         'Offset  of INT 67 EMM driver
  6421.  
  6422.  DEF SEG = EMMDriverSEG
  6423.  index = &HA   'Driver name located at offset &H0A into device header
  6424.  DO UNTIL LEN(EMMName$) > 7         'Retrieve Device Name (8 chars)
  6425.          EMMName$ = EMMName$ + CHR$(PEEK(index))
  6426.          index = index + 1
  6427.  LOOP
  6428.  
  6429.  IF EMMName$ = "EMMXXXX0" THEN
  6430.          PRINT TAB(10); "Expanded Memory Available"
  6431.  ELSE
  6432.          PRINT TAB(10); "No Expanded Memory Driver Loaded"
  6433.          END
  6434.  END IF
  6435.  
  6436.  InRegs.ax = &H4000                'EMM get status function
  6437.  CALL INTERRUPT(&H67, InRegs, OutRegs)
  6438.  
  6439.  IF OutRegs.ax < 0 THEN            'Isolate high byte of AX
  6440.          highbyte = (OutRegs.ax + 2 ^ 16) \ 256&   'High bit set case
  6441.  ELSE
  6442.          highbyte = OutRegs.ax \ 256&
  6443.  END IF
  6444.  
  6445.  IF highbyte = 0 THEN          'Check for error codes in AH
  6446.          PRINT TAB(10); "Extended Memory Driver Status: FUNCTIONAL"
  6447.  ELSE
  6448.          PRINT TAB(10); "Extended Memory Driver Status: NON-FUNCTIONAL"
  6449.          PRINT TAB(10); "Error Code: "; OutRegs.ax
  6450.  END IF
  6451.  
  6452.  InRegs.ax = &H4600                        'EMM get version function
  6453.  CALL INTERRUPT(&H67, InRegs, OutRegs)
  6454.  LimVersion$=LEFT$(HEX$(OutRegs.ax),1) + "." + RIGHT$(HEX$(OutRegs.ax),1)
  6455.  PRINT TAB(10); "LIM Version "; LimVersion$; " Driver Installed"
  6456.  
  6457.  InRegs.ax = &H4200                  'EMM get number of pages function
  6458.  CALL INTERRUPT(&H67, InRegs, OutRegs)
  6459.  
  6460.  IF OutRegs.ax < 0 THEN                      'Isolate high byte of AX
  6461.          highbyte = (OutRegs.ax + 2 ^ 16) \ 256&
  6462.  ELSE
  6463.          highbyte = OutRegs.ax \ 256&
  6464.  END IF
  6465.  
  6466.  IF highbyte = 0 THEN
  6467.          PRINT TAB(10); "Total Number of 16K Pages Available: "; OutRegs.dx
  6468.          total& = OutRegs.dx * 16 * 1024& \ 1048576  'Convert to Megabytes
  6469.          PRINT TAB(10); "Total Expanded Memory: "; total&; " Megabytes"
  6470.  ELSE
  6471.          PRINT TAB(10); "Error Determining Number of Expanded Memory Pages"
  6472.          PRINT TAB(10); "Error Code: "; OutRegs.ax
  6473.  END IF
  6474.  
  6475.  DEF SEG                                'Restore original state
  6476.  IF VAL(LimVersion$) >= 4! THEN  'This only supported LIM 4.0 and later
  6477.     InRegsx.ax = &H5900  'EMM Get hardware config (Page Size) function
  6478.     InRegsx.es = VARSEG(buffer(0))
  6479.     InRegsx.di = VARPTR(buffer(0))
  6480.     CALL INTERRUPTX(&H67, InRegsx, OutRegsx)
  6481.     IF OutRegsx.ax < 0 THEN
  6482.        highbyte = (OutRegsx.ax + 2 ^ 16) \ 256&
  6483.     ELSE
  6484.        highbyte = OutRegsx.ax \ 256&
  6485.     END IF
  6486.  
  6487.     IF highbyte = 0 THEN
  6488.        size = buffer(0) * 16& \ 1024  'Convert paragraphs to Kilobytes
  6489.        PRINT TAB(10); "Raw Expanded Memory Page Size: "; size; " Kilobytes"
  6490.     ELSE
  6491.        PRINT TAB(10); "Error in determining Raw Page Size."
  6492.        PRINT TAB(10); "Error Code: "; OutRegsx.ax
  6493.     END IF
  6494.  ELSE
  6495.     PRINT TAB(10); "Raw Expanded Memory Page Size: 16 Kilobytes"
  6496.  END IF
  6497.  
  6498.  END
  6499.  
  6500.  
  6501.  109. STACK STACK Correctly Gives "Out of Memory" in QBX.EXE
  6502.  
  6503.  Product Version(s): 7.00
  6504.  Operating System:   MS-DOS
  6505.  Flags: ENDUSER | SR# S891019-160
  6506.  Last Modified: 12-DEC-1989    ArticleIdent: Q51413
  6507.  
  6508.  If you run a program containing the statement STACK STACK in the
  6509.  QBX.EXE environment and then attempt to edit the program, the error
  6510.  message "Out of memory" will result. The error message can be
  6511.  prevented by going to the Immediate window in QBX and executing the
  6512.  STACK statement to reset the stack size to the default. The error
  6513.  occurs because the STACK STACK statement allocates all available
  6514.  memory in the data segment for the stack. However, QBX needs to use
  6515.  part of this segment for its own purposes.
  6516.  
  6517.  This information applies to Microsoft BASIC PDS Version 7.00 for
  6518.  MS-DOS.
  6519.  
  6520.  
  6521.  110. Internal Format of CURRENCY Data Type in BASIC PDS 7.00
  6522.  
  6523.  Product Version(s): 7.00 7.10 | 7.00 7.10
  6524.  Operating System:   MS-DOS    | OS/2
  6525.  Flags: ENDUSER |
  6526.  Last Modified: 21-FEB-1991    ArticleIdent: Q51414
  6527.  
  6528.  The CURRENCY data type available in Microsoft BASIC Compiler versions
  6529.  7.00 and 7.10 for MS-DOS and OS/2 is an 8-byte signed integer scaled
  6530.  by 10,000. This allows a variable of the CURRENCY type to have a range
  6531.  of
  6532.  
  6533.     (2 ^ 63 -1) / 10,000  =  +922337203685477.5807
  6534.  
  6535.  to
  6536.  
  6537.     (2 ^ 63) / 10,000   =  -922337203685477.5808
  6538.  
  6539.  Up to 19 digits are allowed, with no more than 4 digits to the right
  6540.  of the decimal point.
  6541.  
  6542.  Because the CURRENCY type is scaled by 10,000, its internal
  6543.  representation is the actual value multiplied by 10,000. For instance,
  6544.  a CURRENCY variable holding the value 0.0001 will be stored as
  6545.  follows:
  6546.  
  6547.     HIGH BYTE                                                     LOW BYTE
  6548.     00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
  6549.  
  6550.  As with ordinary INTEGERs, the higher byte is stored at the higher
  6551.  memory address so that once you find the address of the variable, you
  6552.  will find the low byte there, the second byte stored above, the third
  6553.  byte above that, etc. The example program below displays the
  6554.  hexadecimal machine representation for a CURRENCY data type variable
  6555.  whose value is INPUT from the keyboard.
  6556.  
  6557.  Sample Code:
  6558.  
  6559.  '******************************************************************
  6560.  '     Sample program to display machine representation of the     *
  6561.  '     CURRENCY data type (8-byte scaled INTEGER)                  *
  6562.  '******************************************************************
  6563.  CLS
  6564.  DO UNTIL INKEY$ = CHR$(27)
  6565.    PRINT "Enter a CURRENCY value.  The machine representation will be "
  6566.    PRINT "displayed in Hex"
  6567.    INPUT a@                   ' "@" is the CURRENCY data type suffix.
  6568.    address% = VARPTR(a@)      ' Get the address of the variable a@
  6569.  
  6570.    FOR i% = 7 TO 0 STEP -1
  6571.       PRINT HEX$(PEEK(address% + i%)); "  ";  ' Display representation
  6572.    NEXT i%                                    ' in normal Low-Byte to
  6573.                                               ' the right form.
  6574.    PRINT
  6575.    PRINT "press a key to continue, Esc to EXIT"
  6576.    SLEEP
  6577.  LOOP
  6578.  
  6579.  
  6580.  111. PDS 7.00 Alert FUNCTION Return Value Description Incorrect
  6581.  
  6582.  Product Version(s): 7.00 7.10
  6583.  Operating System:   MS-DOS
  6584.  Flags: ENDUSER | SR# S891101-66 docerr
  6585.  Last Modified:  8-JAN-1991    ArticleIdent: Q51415
  6586.  
  6587.  The Alert FUNCTION in the WINDOW.BAS file of the User Interface (UI)
  6588.  Toolbox is incorrectly described in the documentation. On Page 553 of
  6589.  the "Microsoft BASIC 7.0: Language Reference" manual (for 7.00 and
  6590.  7.10), the "Syntax" section incorrectly shows that the Alert FUNCTION
  6591.  will return a string. The "Remarks" section and the source code in
  6592.  WINDOW.BAS correctly show that the Alert FUNCTION actually returns an
  6593.  INTEGER from 1 to 3.
  6594.  
  6595.  This information applies to Microsoft BASIC Professional Development
  6596.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  6597.  
  6598.  The "Syntax" section of the Alert FUNCTION description reads as
  6599.  follows:
  6600.  
  6601.     Syntax   variablename$ = Alert(style%,text$,row1%,...etc.
  6602.  
  6603.  It should read as follows:
  6604.  
  6605.     Syntax   variablename% = Alert(style%,text$,row1%,...etc.
  6606.  
  6607.  The dollar sign ($) appended to "variablename" should be a percent
  6608.  sign (%) because the Alert FUNCTION returns an integer.
  6609.  
  6610.  
  6611.  112. How to Use Link Overlays in BASIC PDS 7.00 and 7.10
  6612.  
  6613.  Product Version(s): 7.00 7.10
  6614.  Operating System:   MS-DOS
  6615.  Flags: ENDUSER | SR# S891017-94 S_LINK
  6616.  Last Modified:  5-SEP-1990    ArticleIdent: Q51416
  6617.  
  6618.  When using the linker (LINK.EXE) to generate code overlays for
  6619.  Microsoft BASIC Professional Development System (PDS) version 7.00 or
  6620.  7.10 under MS-DOS, you must put the modules you want to overlay in
  6621.  parentheses on the LINK command line. The modules that make up one
  6622.  overlay must be compiled with the same switches. Code is the only part
  6623.  of the program that is overlaid. Data is not overlaid. Examples and
  6624.  further restrictions for using linker overlays are given below.
  6625.  
  6626.  This information applies to Microsoft BASIC PDS versions 7.00 and 7.10
  6627.  for MS-DOS (but does NOT apply to earlier BASIC compiler versions).
  6628.  
  6629.  Note that link overlays are not needed and not supported under OS/2
  6630.  protected mode, since OS/2 itself automatically provides a similar
  6631.  feature to support swapping of very large .EXE programs in OS/2's
  6632.  extended and virtual memory.
  6633.  
  6634.  The following is an example of how to produce code overlays
  6635.  
  6636.     LINK test1+(test2+test3)+test4+(test5)+(test6),TEST1.EXE,TEST1.MAP;
  6637.  
  6638.  where the following apply:
  6639.  
  6640.  1. test1 (TEST1.OBJ) is the main module.
  6641.  
  6642.  2. test2 and test3 (TEST2.OBJ and TEST3.OBJ) are separately compiled
  6643.     modules that make up one overlay.
  6644.  
  6645.  3. test4 (TEST4.OBJ) stays resident in memory along with the main
  6646.     module (test1) at run time and is not swapped out of memory to disk.
  6647.  
  6648.  4. test5 and test6 (TEST5.OBJ and TEST6.OBJ) are two separate overlays.
  6649.  
  6650.  5. TEST1.EXE is the executable overlaid program created by this LINK.
  6651.  
  6652.  6. TEST1.MAP is a text file (created by the above LINK) that tells
  6653.     you the code sizes of all overlays and procedures.
  6654.  
  6655.  To invoke an overlay, you call a SUB or FUNCTION in a module contained
  6656.  in that overlay, and the Overlay Manager automatically moves the
  6657.  overlay (if it is not already loaded) into DOS memory, overlaying any
  6658.  previous overlay in memory.
  6659.  
  6660.  You can call any module or overlay from any other module or overlay.
  6661.  
  6662.  Overlays provide an alternative to CHAINing when a program is too
  6663.  large to fit into memory all at once. An overlaid program is made up
  6664.  of a single .EXE file (which can be an advantage in some cases),
  6665.  unlike CHAINed programs, which are composed of several .EXE files.
  6666.  
  6667.  Restrictions on Using Overlays
  6668.  ------------------------------
  6669.  
  6670.  The restrictions on using overlays in Microsoft BASIC PDS versions
  6671.  7.00 and 7.10 for MS-DOS are as follows:
  6672.  
  6673.  1. Each Microsoft BASIC overlay cannot exceed 256K in code (see LINK
  6674.     .MAP for size of each overlay). You can have up to 64 overlays
  6675.     per .EXE program. This means you may be able to make .EXE programs
  6676.     up to 16 MB in code size under MS-DOS.
  6677.  
  6678.  2. The main module must be the first module in the LINK command line,
  6679.     and it must NOT be specified as an overlay. If you incorrectly make
  6680.     the first module in the LINK command line an overlay, the machine
  6681.     will hang when the program first loads.
  6682.  
  6683.  3. When you create an overlaid version of a program, make sure that
  6684.     each module contained in the program is compiled with the same
  6685.     options.
  6686.  
  6687.  4. You cannot use the LINK /PACKCODE or /EXEPACK option when linking a
  6688.     program that uses overlays.
  6689.  
  6690.  5. You cannot have a stub file as an overlay. Do not specify stub
  6691.     files (NOxxx.OBJ) in the parentheses for link overlays, or the
  6692.     program will hang. Stub files may only be specified outside
  6693.     parentheses in the LINK command line.
  6694.  
  6695.  Using Expanded Memory with Overlays
  6696.  -----------------------------------
  6697.  
  6698.  386Max (386MAX.SYS) from Qualitas, Inc. is an example of an expanded
  6699.  memory driver that can be used with BASIC PDS 7.00 and 7.10. BASIC PDS
  6700.  7.00 and 7.10 require an expanded memory driver that uses the
  6701.  Lotus-Intel-Microsoft (LIM) version 4.0 Expanded Memory Specification
  6702.  (EMS).
  6703.  
  6704.  If you have loaded an expanded memory driver, and if all the overlays
  6705.  can fit together at one time in expanded memory, and if each overlay
  6706.  has less than 64K of code, then overlays are loaded from expanded
  6707.  memory. Otherwise, overlays are swapped from disk, which is slower
  6708.  than loading from expanded memory.
  6709.  
  6710.  Assume that the overlaid program satisfies the above conditions for
  6711.  using expanded memory. Note that the overlaid modules are not loaded
  6712.  when the EXE file is first invoked. They remain on disk until the
  6713.  first overlay is called. When this occurs, all the overlaid modules
  6714.  are loaded at once from disk into expanded memory. From then on, the
  6715.  overlays are swapped from expanded memory into DOS memory, and the
  6716.  disk is no longer used for loading overlays.
  6717.  
  6718.  The overlay manager in BASIC 7.00 and 7.10 requests expanded memory in
  6719.  16K pages (blocks). The overlay manager only knows the size of the
  6720.  largest overlay, and must make a "best guess" at the size of the
  6721.  smaller overlays. When the overlay manager estimates how many 16K
  6722.  pages are necessary to hold all overlays at once in expanded memory,
  6723.  the estimate could be over or under the actual number of pages needed.
  6724.  If your overlays are all between 16K and 64K in size (according to the
  6725.  LINK .MAP file), and if the estimated or actual size of all overlays
  6726.  together exceeds the available expanded memory, the following
  6727.  initialization error occurs when the first overlay is called at
  6728.  run-time:
  6729.  
  6730.     Insufficient EMS to load overlays
  6731.  
  6732.  Note: This error is documented on Page 656 of the "Microsoft BASIC
  6733.  7.0: Language Reference" manual for versions 7.00 and 7.10. You will
  6734.  never see this error if all your overlays are smaller than 16K each.
  6735.  
  6736.  If you want to force loading overlays from disk, thus avoiding the
  6737.  possibility of this overlay initialization error in expanded memory,
  6738.  you must link with the stub file NOEMS.OBJ (with no parentheses around
  6739.  NOEMS.OBJ on the LINK command line). Alternatively, you can try
  6740.  reconfiguring expanded memory so more of it is available for BASIC
  6741.  overlays. Another alternative is to make overlays similar in size.
  6742.  
  6743.  DOS Memory Map When Using Overlaid .EXE Program
  6744.  ------------------------------------------------
  6745.  
  6746.  [Low Memory]
  6747.  
  6748.  * MS-DOS.
  6749.  * Main program and non-overlaid modules.
  6750.  * Contiguous overlay memory area, equal to the size of biggest overlay.
  6751.  * DGROUP (default data segment, which is shared by all routines).
  6752.  * Far heap (dynamic non-variable-length-string arrays).
  6753.  * BASIC's run-time support module if .EXE not compiled stand-alone (BC /O)
  6754.  
  6755.  [High Memory]
  6756.  
  6757.  For more information on using overlays, see the section "Linking with
  6758.  Overlays" on Pages 612-614 in the "Microsoft BASIC 7.0: Programmer's
  6759.  Guide."
  6760.  
  6761.  
  6762.  113. CURRENCY Data Type Not Available in Alternate Math (BC /FPa)
  6763.  
  6764.  Product Version(s): 7.00 7.10 | 7.00 7.10
  6765.  Operating System:   MS-DOS    | OS/2
  6766.  Flags: ENDUSER |
  6767.  Last Modified:  6-AUG-1990    ArticleIdent: Q51417
  6768.  
  6769.  The CURRENCY data type available in Microsoft BASIC Professional
  6770.  Development System (PDS) versions 7.00 and 7.10 can be used only with
  6771.  the coprocessor/emulation math package (BC /FPi, the default). The
  6772.  CURRENCY type is not supported in the alternate math package (BC /FPa
  6773.  option). Trying to compile a program that uses CURRENCY variables with
  6774.  the alternate math package results in "Currency type illegal in
  6775.  alternate math pack" errors.
  6776.  
  6777.  This information applies to Microsoft BASIC Professional Development
  6778.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  6779.  
  6780.  The implementation of a CURRENCY data type for alternate math would
  6781.  have delayed the release of BASIC PDS 7.00 and 7.10, keeping the
  6782.  product from developers who need the other new features. This feature
  6783.  is under review and will be considered for inclusion in a future
  6784.  release.
  6785.  
  6786.  The CURRENCY data type is not found in Microsoft BASIC Compiler
  6787.  versions earlier than Microsoft BASIC PDS version 7.00.
  6788.  
  6789.  You can declare a variable with the CURRENCY data type by appending
  6790.  the variable name with the suffix @ (the "at" sign), or you can use
  6791.  the DIM statement with the AS CURRENCY clause (DIM x AS CURRENCY).
  6792.  
  6793.  
  6794.  114. EXT.H, EXTHDR.H Files Don't Come with BASIC 6.00 or COBOL 3.00
  6795.  
  6796.  Product Version(s): 6.00 6.00b | 6.00 6.00b
  6797.  Operating System:   MS-DOS     | OS/2
  6798.  Flags: ENDUSER | B_COBOL S_QuickC S_C
  6799.  Last Modified: 15-DEC-1989    ArticleIdent: Q51603
  6800.  
  6801.  EXT.H and EXTHDR.H, the files necessary to write C extensions for the
  6802.  Microsoft Editor (M.EXE and MEP.EXE), are not included with the
  6803.  Microsoft Editor software for the following products:
  6804.  
  6805.     Microsoft BASIC Compiler Version 6.00 or 6.00b for MS-DOS and OS/2
  6806.     Microsoft BASIC PDS Version 7.00 for MS-DOS and OS/2
  6807.     Microsoft COBOL Compiler Version 3.00 or 3.00a for MS-DOS and OS/2
  6808.  
  6809.  As EXT.H and EXTHDR.H are included with the Microsoft C Compiler 5.10,
  6810.  the lack of EXT.H and EXTHDR.H will only affect those who are writing
  6811.  C extensions for the M.EXE or MEP.EXE editor and using Microsoft
  6812.  QuickC.
  6813.  
  6814.  
  6815.  115. Example of Gaussian Elimination; Matrix Math in BASIC 7.00
  6816.  
  6817.  Product Version(s): 7.00   | 7.00
  6818.  Operating System:   MS-DOS | OS/2
  6819.  Flags: ENDUSER |
  6820.  Last Modified: 13-DEC-1989    ArticleIdent: Q51605
  6821.  
  6822.  This article explains the purpose of Gaussian elimination and gives
  6823.  a code example.
  6824.  
  6825.  In Microsoft BASIC PDS (Professional Development System) Version 7.00
  6826.  for MS-DOS and MS OS/2, the following FUNCTION procedures perform
  6827.  Gaussian elimination:
  6828.  
  6829.     MatSEqnS% (for single-precision)
  6830.     MatSEqnD% (for double-precision)
  6831.     MatSEqnC% (for currency data type)
  6832.  
  6833.  The source code of all of these functions is provided in the MATB.BAS
  6834.  source file on one of the release disks. To use these functions in the
  6835.  QuickBASIC Extended editor, load the MATBEFR.QLB Quick library as
  6836.  follows:
  6837.  
  6838.     QBX /L MATBEFR.QLB
  6839.  
  6840.  MATFEFR.QLB and the related .LIB files are mentioned in the $INCLUDE
  6841.  file MATB.BI. MATB.BI contains DECLARE FUNCTION statements necessary
  6842.  for the matrix math routines.
  6843.  
  6844.  Definitions
  6845.  -----------
  6846.  
  6847.  1. A matrix is a two-dimensional array in BASIC.
  6848.  
  6849.  2. A vector is a one-dimensional array in BASIC.
  6850.  
  6851.  3. An identity matrix is a square array composed of 1's along the
  6852.     diagonal from upper left to lower right, with all else 0's (zeros).
  6853.  
  6854.  Gaussian Elimination
  6855.  --------------------
  6856.  
  6857.  A linear equation of n variables (unknowns) has the following form:
  6858.  
  6859.     a1*x1 + a2*x2 + an*xn = b
  6860.  
  6861.  where:
  6862.  
  6863.     a1 through an and b are known constants, and x1 through xn are
  6864.     variables with unknown values.
  6865.  
  6866.  Linear equations do not involve any products or roots of variables.
  6867.  All variables are to the first power, and don't appear as arguments
  6868.  of trigonometric, logarithmic, or exponential functions.
  6869.  
  6870.  A solution of a linear equation is a sequence of n numbers (s1 through
  6871.  sn) such that the equation is satisfied when we substitute x1=s1,
  6872.  x2=s2, ..., xn=sn.
  6873.  
  6874.  A set of multiple linear equations in the variables x1 through xn is
  6875.  called a system of linear equations. The set (vector) of constants s1
  6876.  through sn is called a solution of the system if it provides a
  6877.  solution for every equation in the system. Every system of linear
  6878.  equations has either no solutions, exactly one solution, or infinitely
  6879.  many solutions.
  6880.  
  6881.  A system of m linear equations in n unknowns can be written as follows
  6882.  in BASIC:
  6883.  
  6884.     a(1,1)*x1 + a(1,2)*x2 + ... + a(1,n)*xn = b(1)
  6885.  
  6886.     a(2,1)*x1 + a(2,2)*x2 + ... + a(2,n)*xn = b(2)
  6887.  
  6888.        ...                  ...
  6889.  
  6890.     a(m,1)*x1 + a(m,2)*x2 + ... + a(m,n)*xn = b(m)
  6891.  
  6892.  If you mentally keep track of the location of the +'s, the x's, and
  6893.  the ='s, the arrays a(m,n) and b(m) provide a shorthand notation for
  6894.  the system of linear equations. In elementary linear algebra texts,
  6895.  a(m,n) and b(m) together make what is called the "augmented matrix."
  6896.  
  6897.  Again, our goal is to discover the unknown values s1 through sn that,
  6898.  when assigned to variables x1 through xn, solve every equation.
  6899.  
  6900.  Gaussian elimination reduces the augmented matrix [the combination of
  6901.  a(m,n) and b(m)] to a matrix of reduced row-echelon form, which looks
  6902.  like a square identity matrix attached to a 1 by m vector [ b() ]. The
  6903.  vector b() contains the solution set (s1 through sn) of the system of
  6904.  linear equations.
  6905.  
  6906.  The Gaussian elimination functions MatSEqnS%, MatSEqnD%, and MatSEqnC%
  6907.  accept a square matrix a() and a vector b() as input arguments
  6908.  (together composing the input-augmented matrix), and give the solution
  6909.  in the one-dimensional array b(). After you invoke the function, a()
  6910.  is replaced with the identity matrix, and the solution values
  6911.  overwrite the input arguments that you had placed in b(). The n
  6912.  solution values in b(), when assigned to variables x1 through xn,
  6913.  satisfy every equation in the system.
  6914.  
  6915.  For more information about linear algebra, the following is an
  6916.  excellent text:
  6917.  
  6918.     "Elementary Linear Algebra, Second Edition", by Howard Anton,
  6919.      published by John Wiley & Sons, 1977
  6920.  
  6921.  Code Example
  6922.  ------------
  6923.  
  6924.  ' This program demonstrates Gaussian elimination to solve a set of
  6925.  ' linear equations using double-precision variables.
  6926.  ' The MATSEQND, MATSEQNS, and MATSEQNC matrix math routines are
  6927.  ' provided in the Matrix Math Toolbox in Microsoft BASIC 7.00 for
  6928.  ' MS-DOS and MS OS/2.
  6929.  '
  6930.  ' To run this program in the QuickBASIC Extended editor, load the
  6931.  ' MATBEFR.QLB Quick library as follows:
  6932.  '
  6933.  '     QBX /L MATBEFR.QLB
  6934.  '
  6935.  ' MATFEFR.QLB and the related .LIB files are documented in the INCLUDE
  6936.  ' file 'MATB.BI' but NOT in "Microsoft BASIC 7.0: Language Reference."
  6937.  
  6938.  DECLARE FUNCTION MatSEqnD% (A() AS DOUBLE, b() AS DOUBLE)
  6939.  
  6940.  ' The above DECLARE statement is all that is needed from the following
  6941.  ' include file:   REM $INCLUDE: 'matb.bi'
  6942.  DEFDBL A-Z
  6943.  OPTION BASE 1    ' Use OPTION BASE 1 for easier reference.
  6944.  DIM A(3, 3), b(3)
  6945.  
  6946.  ' The following system of linear equations:
  6947.  PRINT "       x +   y + 2*z = 9"
  6948.  PRINT "     2*x + 4*y - 3*z = 1"
  6949.  PRINT "     3*x + 6*y - 5*z = 0"
  6950.  ' ...can be represented in the following matrix:
  6951.  '     1  1  2  9
  6952.  '     2  4 -3  1
  6953.  '     3  6 -5  0
  6954.  ' ...which can be placed in arrays a() and b() respectively as follows:
  6955.  '     a(1,1)  a(1,2)  a(1,3)  b(1)
  6956.  '     a(2,1)  a(2,2)  a(2,3)  b(2)
  6957.  '     a(3,1)  a(3,2)  a(3,3)  b(3)
  6958.  A(1, 1) = 1
  6959.  A(1, 2) = 1
  6960.  A(1, 3) = 2
  6961.  A(2, 1) = 2
  6962.  A(2, 2) = 4
  6963.  A(2, 3) = -3
  6964.  A(3, 1) = 3
  6965.  A(3, 2) = 6
  6966.  A(3, 3) = -5
  6967.  b(1) = 9
  6968.  b(2) = 1
  6969.  b(3) = 0
  6970.  errcode% = MatSEqnD%(A(), b())
  6971.  PRINT "The following values for x, y, and z solve all three equations:"
  6972.  PRINT "x="; b(1)
  6973.  PRINT "y="; b(2)
  6974.  PRINT "z="; b(3)
  6975.  
  6976.  ' Here is the output, accurate to within double-precision limits:
  6977.  '    x= 1.00000000000001
  6978.  '    y= 2
  6979.  '    z= 3
  6980.  
  6981.  
  6982.  116. EXD Should Be EXP, BASIC 7.00 Page 541 "Programmer's Guide"
  6983.  
  6984.  Product Version(s): 7.00 7.10 | 7.00 7.10
  6985.  Operating System:   MS-DOS    | OS/2
  6986.  Flags: ENDUSER | docerr SR# S891109-123
  6987.  Last Modified:  8-JAN-1991    ArticleIdent: Q51861
  6988.  
  6989.  EXD should be changed to EXP in the list of transcendental operations
  6990.  affected by the NOTRNEMM.LIB stub file on Page 541 of "Microsoft BASIC
  6991.  7.0: Programmer's Guide" for 7.00 and 7.10.
  6992.  
  6993.  This information applies to Microsoft BASIC Professional Development
  6994.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  6995.  
  6996.  
  6997.  117. Example of Using NPV and IRR Financial Functions in BASIC 7.00
  6998.  
  6999.  Product Version(s): 7.00   | 7.00
  7000.  Operating System:   MS-DOS | OS/2
  7001.  Flags: ENDUSER |
  7002.  Last Modified: 14-JAN-1990    ArticleIdent: Q52068
  7003.  
  7004.  This article explains how to use the NPV and IRR financial functions
  7005.  in Microsoft BASIC PDS (Professional Development System) Version 7.00
  7006.  for MS-DOS and MS OS/2.
  7007.  
  7008.  Note that the NPV#, IRR#, and MIRR# functions are used for investments
  7009.  that are a series of nonconstant cash payments made at equal
  7010.  intervals. You pass the series of nonconstant payments in an array.
  7011.  [This contrasts with the financial functions for annuity investments
  7012.  (FV#, IPmt#, Rate#, NPer#, PV#, Pmt#, and PPmt#). In an annuity, each
  7013.  cash payment is the same constant amount, made at equal intervals.]
  7014.  
  7015.  The present value (PV) of a future cash receipt is the amount of money
  7016.  that, if received today, would be considered equivalent to the future
  7017.  receipt, at a given interest rate. The present value is less than the
  7018.  future receipt because you can earn interest on money received today.
  7019.  NPV (Net Present Value) compares (subtracts) the current value of a
  7020.  series of future cash flows with an amount invested today.
  7021.  
  7022.  NPV is useful to compare investment opportunities at a given discount
  7023.  (interest) rate. The discount rate (rate#) can be viewed as the rate
  7024.  of return you want out of your investment. If NPV is greater than or
  7025.  equal to 0, the investment equals or exceeds your interest (discount)
  7026.  rate requirement; if NPV is less than 0, the investment does not meet
  7027.  your interest rate requirement.
  7028.  
  7029.  The NPV#(rate#,valuearray#(),valuecount%,status%) function returns
  7030.  Net Present Value. You input the values rate#, valuearray#(), and
  7031.  valuecount% (which is the number of array elements), and get back
  7032.  status% equals 0 for success, 1 for failure.
  7033.  
  7034.  The IRR#(valuearray#(),valuecount%,guess#,status%) function returns
  7035.  Internal Rate of Return. IRR returns the discount rate at which NPV
  7036.  would return 0 (zero). For a given array of cash flow values, IRR can
  7037.  be thought of as an average interest rate (which compounds at each
  7038.  period). If IRR is lower than the interest rate you desire for this
  7039.  investment, then it is not a good investment.
  7040.  
  7041.  The first element of the input cash-flow array should usually be
  7042.  negative, indicating your initial investment. A high (positive) income
  7043.  early in the value array will make IRR higher than if the same high
  7044.  income instead occurred later in the array. This is an example of the
  7045.  time value of money.
  7046.  
  7047.  Please refer to an elementary accounting textbook for more information
  7048.  about these standard Accounting functions.
  7049.  
  7050.  Code Example
  7051.  ------------
  7052.  
  7053.  You can run this program in the QuickBASIC Extended environment with
  7054.  QBX /L FINANCER.QLB. To run outside this environment, you must link
  7055.  with the appropriate library (FINANCER.LIB, FINANCAR.LIB,
  7056.  FINANCEP.LIB, or FINANCAP.LIB).
  7057.  
  7058.  REM $INCLUDE: 'FINANC.BI
  7059.  DEFDBL A-Z
  7060.  OPTION BASE 1
  7061.  CLS
  7062.  valuecount% = 5   ' = number of cash-flow values in valuearray()
  7063.  ' Array holds cash flow values, one value per period (such as per
  7064.  ' year):
  7065.  DIM valuearray(valuecount%)
  7066.  guess = .1        ' Guess the IRR (use .1 if in doubt)
  7067.  
  7068.  valuearray(1) = -1000 ' 0. First value negative as initial investment.
  7069.  valuearray(2) = 100   ' 1. Return on investment after 1 period.
  7070.  valuearray(3) = 200   ' 2. (Positive value is return on investment.)
  7071.  valuearray(4) = -300  ' 3. (Negative value is additional investment.)
  7072.  valuearray(5) = 1200  ' 4. Return on investment after 4 periods.
  7073.  ' For the above values, IRR returns .0514. (5.14% return per period)
  7074.  status% = 0
  7075.  
  7076.  irreturn = IRR(valuearray(), valuecount%, guess, status%)
  7077.  IF status% THEN PRINT "IRR error occurred; try different guess";
  7078.  
  7079.  discountrate = irreturn
  7080.  netpresval = NPV#(discountrate, valuearray(), valuecount%, status%)
  7081.  
  7082.  'Notes for NPV#() function:
  7083.  ' If discountrate = value returned by IRR(), then NPV returns zero, as
  7084.  '    in the IRR example in the "Microsoft BASIC 7.0: Language
  7085.  '    Reference" manual, and also as in this code example.
  7086.  ' If discountrate = zero, NPV returns sum of values in valuearray().
  7087.  ' If discountrate > zero, NPV returns an amount smaller than sum of
  7088.  '    values in valuearray() due to the discount effect at each period.
  7089.  ' If discountrate < zero, NPV returns an amount larger than the sum of
  7090.  '    the values in valuearray().
  7091.  
  7092.  IF status% THEN PRINT "NPV error occurred"
  7093.  PRINT "IRR (fractional return on investment per period) = ";
  7094.  PRINT USING "##.####"; irreturn
  7095.  PRINT "NPV = ";
  7096.  PRINT USING "#######.##"; netpresval
  7097.  
  7098.  Output
  7099.  ------
  7100.  
  7101.  For the above values, IRR returns .0514 (5.14 percent return per
  7102.  period). NPV returns 0 (zero), since IRR returns the discount rate at
  7103.  which NPV returns 0.
  7104.  
  7105.  
  7106.  118. MatSEqn FUNCTION Correction Page 506, 7.00 Language Reference
  7107.  
  7108.  Product Version(s): 7.00 7.10 | 7.00 7.10
  7109.  Operating System:   MS-DOS    | OS/2
  7110.  Flags: ENDUSER | docerr SR# S891218-99
  7111.  Last Modified:  8-JAN-1991    ArticleIdent: Q52069
  7112.  
  7113.  The following two corrections apply to the MatSEqn FUNCTION
  7114.  (MatSEqnS%, MatSEqnD%, and MatSEqnC%) on Page 506 of the "Microsoft
  7115.  BASIC 7.0: Language Reference" manual (for 7.00 and 7.10):
  7116.  
  7117.  1. Insert the text marked in brackets ([]) into the first sentence in
  7118.     the Remarks on Page 506, as follows:
  7119.  
  7120.     The MatSEqntype% procedure solves a system of linear equations
  7121.     contained in [a one-dimensional vector and in] a square matrix...
  7122.  
  7123.  2. Insert the sentence marked in brackets ([]) after the fourth
  7124.     sentence in the Remarks on Page 506, as follows:
  7125.  
  7126.     The first matrix is the square input matrix that contains the
  7127.     coefficients for a system of simultaneous equations. [The second
  7128.     matrix is used to input the vector of constants for that system
  7129.     of simultaneous equations.]
  7130.  
  7131.  This information applies to Microsoft BASIC Professional Development
  7132.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  7133.  
  7134.  For an example of using MatSEqnx (Gaussian elimination), query on
  7135.  the following words:
  7136.  
  7137.     Gaussian and elimination
  7138.  
  7139.  
  7140.  119. Example of PPMT and PMT Financial Functions in BASIC 7.00
  7141.  
  7142.  Product Version(s): 7.00   | 7.00
  7143.  Operating System:   MS-DOS | OS/2
  7144.  Flags: ENDUSER |
  7145.  Last Modified: 14-JAN-1990    ArticleIdent: Q52070
  7146.  
  7147.  This program demonstrates the PPMT and PMT financial functions in
  7148.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  7149.  MS-DOS and MS OS/2.
  7150.  
  7151.  PMT returns the periodic payment for an investment. In the case of a
  7152.  loan, PMT returns the amount of the constant monthly payment (the sum
  7153.  of principal plus interest) for the loan, based upon a constant
  7154.  interest rate, the total number of payments, and the amount (present
  7155.  value) of the loan.
  7156.  
  7157.  PPMT is the payment on the principal for an investment at a specified
  7158.  period. (PMT minus PPMT is the payment on the interest at a specified
  7159.  period.) The sum of all PPMT values returned over the life of the loan
  7160.  equals the loan amount.
  7161.  
  7162.  Below is an analysis of the finances for buying and selling a house.
  7163.  The program returns average equity gain per month after the house has
  7164.  been bought and sold. You can change the initial parameters (such as
  7165.  houseval, down, rate1, sellper, apprec, etc.) to explore different
  7166.  scenarios, including a simplified inflation effect. Negative net
  7167.  equity gain per month is outgoing money; positive net equity gain per
  7168.  month is income.
  7169.  
  7170.  You can choose the period of time at which you sell the house and
  7171.  compare the net income or outgo per month to that of your current
  7172.  housing situation.
  7173.  
  7174.  Run this program with QBX /L FINANCER.QLB in Microsoft BASIC PDS
  7175.  Version 7.00 for MS-DOS. To run outside the QBX.EXE environment, you
  7176.  must link with the appropriate library (FINANCER.LIB, FINANCAR.LIB,
  7177.  FINANCEP.LIB, or FINANCAP.LIB).
  7178.  
  7179.  Code Example
  7180.  ------------
  7181.  
  7182.  REM $INCLUDE: 'financ.bi'
  7183.  DEFDBL A-Z
  7184.  
  7185.  ' Initialize variables:
  7186.  CLS
  7187.  houseval = 110000#     ' Purchase price of house (median for Seattle).
  7188.  apprec = 1.07#         ' Assumed yearly appreciation rate of house.
  7189.  sellper = 10# * 12#    ' Period (month) at which you choose to sell.
  7190.  down = .1#             ' Fraction of houseval paid as down payment.
  7191.  equity = down * houseval  ' Initial equity in house (10% down payment)
  7192.  pv1 = (1 - down) * houseval 'Present value of loan = 90% of houseval
  7193.  rate1 = .1025# / 12 ' Loan interest rate (10.25%) divided by 12 months
  7194.  pool = 0 ' Pool of money, if any, to earn interest & subtract payments
  7195.  poolint = 1.0057# ' Monthly interest earned on pool to get 7% yearly.
  7196.  pointsbuy = .02#  ' Assumed fees to buy loan, as fraction of houseval.
  7197.  pointsell = .07#  ' Selling fees (points) as fraction of selling price
  7198.  per = 0#           ' Month (period) counter.
  7199.  nper1 = 360#       ' # periods in loan. 30-year loan has 360 months.
  7200.  ptype% = 0#        ' 0 means payment due at end of each period.
  7201.  fv1 = 0#           ' Future value (the goal) of a loan is always zero.
  7202.  ptot1 = 0#         ' Current total of principal paid towards loan.
  7203.  in = .95#          ' 1 minus the inflation rate
  7204.  proptax = -130#    ' property taxes per month (tax deductible)
  7205.  fire = -25#        ' fire/house insurance per month
  7206.  roommate = 400#   ' Rent income from roommate (0 if none) after taxes.
  7207.  roominflate = 1.02 ' Yearly rate you increase your roommate's rent.
  7208.  tax = .8#       ' 1 minus your average yearly Tax rate (as a fraction)
  7209.  initial = pool + equity
  7210.  PRINT "Purchase price ="; houseval;
  7211.  PRINT " // Initial pool + equity = "; initial
  7212.  upfront = equity + (pointsbuy * houseval)
  7213.  PRINT "Up front cost (down payment + loan fees) ="; upfront
  7214.  
  7215.  ' Calculate monthly (principal+interest) payment:
  7216.  payment1 = Pmt(rate1, nper1, pv1, fv1, ptype%, status%)
  7217.  IF down < .2# THEN
  7218.     minsure = .03 * payment1 ' Monthly mortgage insurance rate (3% of
  7219.  ELSE               ' principal+interest payment). You usually must pay
  7220.     minsure = 0#    ' mortgage insurance if you paid < 20% down.
  7221.  END IF
  7222.  PRINT "monthly payment= "
  7223.  PRINT payment1; "+"; fire; "+"; proptax; "+"; minsure; "= ";
  7224.  PRINT payment1 + fire + proptax + minsure
  7225.  PRINT "not counting tax savings ("; 1 - tax; "factor ) ";
  7226.  PRINT "or roommate income ("; roommate; ")";
  7227.  PRINT "**************************************************"
  7228.  
  7229.  ' Add up numbers until the period (month) where you sell (sellper):
  7230.  FOR j = 1 TO sellper
  7231.     per = j
  7232.     ' Yearly rent increase:
  7233.     IF j MOD 12 = 0 THEN roommate = roominflate * roommate
  7234.  
  7235.     ' Calculate principal and interest amounts paid:
  7236.     principal1 = PPmt(rate1, per, nper1, pv1, fv1, ptype%, status%)
  7237.  
  7238.     ptot1 = ptot1 + principal1   ' total accumulated principal to date
  7239.     interest1 = payment1 - principal1
  7240.     itot1 = itot1 + interest1  'total accumulated interest paid to date
  7241.     ' Outaftertax1 and outgo values are negative:
  7242.     outaftertax1 = ((interest1+proptax)*tax) +principal1 +fire +minsure
  7243.     pool = pool + outaftertax1 + roommate  ' (outaftertax is negative)
  7244.     ' pool earns interest if positive (no interest charged if negative,
  7245.     ' assuming you make monthly house payments without borrowing):
  7246.     IF pool > 0 THEN pool = pool * poolint
  7247.     equity = equity + ABS(principal1) ' Monthly principal builds equity
  7248.  NEXT
  7249.  
  7250.  ' Calculate final appreciation and closing costs; and print out:
  7251.  years = sellper / 12#   ' Number of years after which you sold.
  7252.  aphouseval = houseval * (apprec ^ years) ' Appreciated house value.
  7253.  closecost = -(pointsbuy * houseval) - (pointsell * aphouseval)
  7254.  naphouseval = aphouseval - houseval  ' net appreciation on house value
  7255.  final = pool + equity + naphouseval + closecost
  7256.  in1989 = final * (in ^ years)  ' In 1989 dollars (inflation adjusted).
  7257.  PRINT
  7258.  PRINT "After"; years; " years, buy+sell closecost ="; closecost
  7259.  PRINT "total principal paid="; ptot1 + ptot2
  7260.  PRINT "total interest paid="; itot1 + itot2
  7261.  PRINT "Appreciated value of house = "; aphouseval
  7262.  PRINT "final pool+equity+apprec-close="; final
  7263.  PRINT "or"; in1989; " in 1989 dollars with"; 1 - in;"yearly inflation"
  7264.  PRINT "(which is a"; CSNG(in ^ years); " overall inflation factor)"
  7265.  PRINT
  7266.  PRINT "Net ave. equity increase per month="; (final-initial)/sellper
  7267.  PRINT"(or with inflation=";(in1989-initial)/sellper;"in 1989 dollars)"
  7268.  
  7269.  
  7270.  120. Library Naming Conventions for BASIC PDS 7.00
  7271.  
  7272.  Product Version(s): 7.00   | 7.00
  7273.  Operating System:   MS-DOS | OS/2
  7274.  Flags: ENDUSER | SR# S891206-120
  7275.  Last Modified: 14-JAN-1990    ArticleIdent: Q52091
  7276.  
  7277.  The following article explains the library naming conventions used by
  7278.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  7279.  MS-DOS and MS OS/2.
  7280.  
  7281.  In Microsoft BASIC PDS Version 7.00, library names are acronyms that
  7282.  follow a standard format:
  7283.  
  7284.     NAMEmso.LIB
  7285.         m = Alternate (A) or Emulation (E) math package.
  7286.         s = Far (F) or Near (N) variable-length string storage.
  7287.         o = Protected (P) or Real (R) mode operating system.
  7288.  
  7289.  The format starts with a base NAME of several characters used to
  7290.  identify the function of the library (such as BRT70, BCL70, FINANC,
  7291.  FONTB, MATB, etc.). Next is a two- or three-character extension
  7292.  specifying support for which math package (emulation or alternate
  7293.  math), variable-length string storage (near or far), or operating
  7294.  system (real or protected mode).
  7295.  
  7296.  Real mode refers to the DOS Version 3.x box in MS OS/2, or to straight
  7297.  MS-DOS. Protected mode refers to MS OS/2 only.
  7298.  
  7299.  BASIC Run-Time Libraries
  7300.  ------------------------
  7301.  
  7302.     BRT70EFR.LIB, BRT70ENR.LIB, BRT70EFP.LIB, BRT70ENP.LIB
  7303.     BRT70ANR.LIB, BRT70AFR.LIB, BRT70ANP.LIB, BRT70AFP.LIB
  7304.  
  7305.     Format: BRT70mso.LIB
  7306.                  m = Alternate (A) or Emulation (E) math package.
  7307.                  s = Far (F) or Near (N) strings.
  7308.                  o = Protected (P) or Real (R) mode operating system.
  7309.  
  7310.  BASIC Stand-Alone Libraries
  7311.  ---------------------------
  7312.  
  7313.     BCL70EFR.LIB, BCL70ENR.LIB, BCL70EFP.LIB, BCL70ENP.LIB
  7314.     BCL70ANR.LIB, BCL70AFR.LIB, BCL70ANP.LIB, BCL70AFP.LIB
  7315.  
  7316.     Format: BCL70mso.LIB    (where the mso letters are defined above)
  7317.  
  7318.  Financial Libraries
  7319.  -------------------
  7320.  
  7321.     FINANCER.LIB, FINANCAR.LIB, FINANCEP.LIB, FINANCAP.LIB
  7322.  
  7323.     Format: FINANCmo.LIB    (where the mo letters are defined above)
  7324.     (Name is not dependent upon Far or Near string storage.)
  7325.  
  7326.     FINANCER.QLB is the Quick library for use in the QBX.EXE
  7327.     environment.
  7328.  
  7329.  Date/Time Format Libraries
  7330.  --------------------------
  7331.  
  7332.     DTFMTER.LIB, DTFMTAR.LIB, DTFMTEP.LIB, DTFMTAP.LIB
  7333.  
  7334.     Format: DTFMTmo.LIB    (where the mo letters are defined above)
  7335.     (Name is not dependent upon Far or Near string storage.)
  7336.  
  7337.     DTFMTER.QLB is the Quick library for use in the QBX.EXE
  7338.     environment.
  7339.  
  7340.  Font Libraries
  7341.  --------------
  7342.  
  7343.     FONTBEFR.LIB, FONTBENR.LIB, FONTBANR.LIB, FONTBAFR.LIB
  7344.  
  7345.     Format: FONTBmsR.LIB    (where the ms letters are defined above)
  7346.     (There is no protected mode version.)
  7347.  
  7348.     FONTBEFR.QLB is the Quick library for use in the QBX.EXE
  7349.     environment.
  7350.  
  7351.  Matrix Operations Toolbox Libraries
  7352.  -----------------------------------
  7353.  
  7354.     MATBEFR.LIB, MATBENR.LIB, MATBEFP.LIB, MATBENP.LIB
  7355.     MATBANR.LIB, MATBAFR.LIB, MATBANP.LIB, MATBAFP.LIB
  7356.  
  7357.     Format: MATBmso.LIB    (where the mso letters are defined above)
  7358.  
  7359.     MATBEFR.QLB is the Quick library for use in the QBX.EXE
  7360.     environment.
  7361.  
  7362.  User Interface Toolbox Libraries
  7363.  --------------------------------
  7364.  
  7365.     UITBEFR.LIB, UITBENR.LIB, UITBEFP.LIB, UITBENP.LIB
  7366.     UITBANR.LIB, UITBAFR.LIB, UITBANP.LIB, UITBAFP.LIB
  7367.  
  7368.     Format: UITBmso.LIB    (where the mso letters are defined above)
  7369.  
  7370.     UITBEFR.QLB is the Quick library for use in the QBX.EXE
  7371.     environment.
  7372.  
  7373.  Presentation Graphics Toolbox Libraries
  7374.  ---------------------------------------
  7375.  
  7376.     CHRTBEFR.LIB, CHRTBENR.LIB, CHRTBEFP.LIB, CHRTBENP.LIB
  7377.     CHRTBANR.LIB, CHRTBAFR.LIB, CHRTBANP.LIB, CHRTBAFP.LIB
  7378.  
  7379.     Format: CHRTBmso.LIB    (where the mso letters are defined above)
  7380.  
  7381.     CHRTBEFR.QLB is the Quick library for use in the QBX.EXE
  7382.     environment.
  7383.  
  7384.  Stub Library
  7385.  ------------
  7386.  
  7387.     NOTRNEMR.LIB, NOTRNEMP.LIB
  7388.  
  7389.     Format: NOTRNEMo.LIB
  7390.                    o = Protected (P) or Real (R) mode operating system.
  7391.  
  7392.     Description: A stub library file that removes all intrinsic math
  7393.                  functions including LOG, SQR, SIN, COS, TAN, ATN, EXP,
  7394.                  ^, CIRCLE statements with a start and/or stop angle,
  7395.                  and DRAW statements with A or T commands.
  7396.  
  7397.     (NOTRNEMR.LIB and NOTRNEMP.LIB are the only .LIB stub files in
  7398.     BASIC 7.00. For a list of .OBJ stub files, refer to Pages 540 and
  7399.     541 of "Microsoft BASIC Version 7.0: Programmer's Guide.")
  7400.  
  7401.  OTHER LIBRARY NAMING CONVENTIONS
  7402.  --------------------------------
  7403.  
  7404.  ISAM Libraries
  7405.  --------------
  7406.  
  7407.     PROISAMD.LIB, PROISAM.LIB
  7408.  
  7409.     PROISAMD.LIB gives you full ISAM support, including the data
  7410.     dictionary routines for creating and deleting indexes, tables, and
  7411.     databases. PROISAM.LIB (with no D) supports ISAM programs without
  7412.     the ability to create or delete indexes, tables, or databases.
  7413.  
  7414.     PROISAM.EXE and PROISAMD.EXE are the TSR (Terminate-and-Stay-
  7415.     Resident) programs that provide ISAM support in the QBX.EXE
  7416.     environment, or in .EXE programs where you don't wish to link the
  7417.     ISAM support directly to your .EXE file.
  7418.  
  7419.  OS/2 Function Library
  7420.  ---------------------
  7421.  
  7422.     Name: OS2.LIB
  7423.     Description: Used for operating system calls into MS OS/2.
  7424.  
  7425.  
  7426.  121. "Subscript out of Range in Quick Library Module: MENU" in 7.00
  7427.  
  7428.  Product Version(s): 7.00
  7429.  Operating System:   MS-DOS
  7430.  Flags: ENDUSER | SR# S891207-103
  7431.  Last Modified:  2-MAY-1990    ArticleIdent: Q52092
  7432.  
  7433.  A program that uses procedures in the User Interface Toolbox's
  7434.  WINDOW.BAS source-code file may generate the message "Subscript out
  7435.  of range in module: MENU," if either the global-array declarations
  7436.  used with MENU.BAS are not included in the program or if they are
  7437.  included in the wrong order.
  7438.  
  7439.  This information applies to Microsoft BASIC Professional Development
  7440.  System (PDS) version 7.00 for MS-DOS.
  7441.  
  7442.  When using procedures in WINDOW.BAS, you must include the global-array
  7443.  declarations used with MENU.BAS in addition to the global-array
  7444.  declarations that are specific to WINDOW.BAS.
  7445.  
  7446.  The MENU.BAS COMMON SHARED statements must be listed before the
  7447.  WINDOW.BAS COMMON SHARED statements or a "Subscript out of range in
  7448.  module: MENU" error occurs.
  7449.  
  7450.  When using procedures in WINDOW.BAS, you make the following
  7451.  global-array declarations in your program. The COMMON SHARED
  7452.  statements must be listed in the exact order shown. The order of the
  7453.  DIM statements does NOT matter.
  7454.  
  7455.  'COMMON SHARED statements to be used with MENU.BAS:
  7456.  
  7457.          COMMON SHARED /uitools/ GloMenu       AS MenuMiscType
  7458.          COMMON SHARED /uitools/ GloTitle()    AS MenuTitleType
  7459.          COMMON SHARED /uitools/ GloItem()     AS MenuItemType
  7460.  
  7461.  'COMMON SHARED statements WINDOW.BAS:
  7462.  
  7463.          COMMON SHARED /uitools/ GloWindow()   AS WindowType
  7464.          COMMON SHARED /uitools/ GloButton()   AS ButtonType
  7465.          COMMON SHARED /uitools/ GloEdit()     AS EditFieldType
  7466.          COMMON SHARED /uitools/ GloStorage    AS WindowStorageType
  7467.          COMMON SHARED /uitools/ GloWindowStack() AS INTEGER
  7468.          COMMON SHARED /uitools/ GloBuffer$()
  7469.  
  7470.  'DIM statements to be used with MENU.BAS:
  7471.  
  7472.          DIM GloTitle(MAXMENU)                 AS MenuTitleType
  7473.          DIM GloItem(MAXMENU, MAXITEM)         AS MenuItemType
  7474.  
  7475.  'DIM statements to be used with WINDOW.BAS:
  7476.  
  7477.          DIM GloWindow(MAXWINDOW)              AS WindowType
  7478.          DIM GloButton(MAXBUTTON)              AS ButtonType
  7479.          DIM GloEdit(MAXEDITFIELD)             AS EditFieldType
  7480.          DIM GloWindowStack(MAXWINDOW)         AS INTEGER
  7481.          DIM GloBuffer$(MAXWINDOW + 1, 2)
  7482.  
  7483.  
  7484.  122. BASIC 7.00 Example to Find All Available Disk Drives
  7485.  
  7486.  Product Version(s): 7.00   | 7.00
  7487.  Operating System:   MS-DOS | OS/2
  7488.  Flags: ENDUSER | SR# S891214-80
  7489.  Last Modified: 14-JAN-1990    ArticleIdent: Q52093
  7490.  
  7491.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  7492.  MS-DOS and MS OS/2 can change the current drive from within a BASIC
  7493.  program with the command
  7494.  
  7495.     CHDRIVE <drive letter>
  7496.  
  7497.  where <drive letter> is a string expression that is a valid drive.
  7498.  This statement, coupled with error trapping, can be used to find all
  7499.  available disk drives.
  7500.  
  7501.  The example program below collects a list of all the available disk
  7502.  drives and puts it into the fixed-length STRING array "Drives". This
  7503.  is done by using the CHDRIVE statement to log onto each possible drive
  7504.  (A through Z) and adding to the list only those drives that were
  7505.  successfully logged onto.
  7506.  
  7507.  The INTEGER variable "IsDrive%" is used to flag whether or not the
  7508.  CHDRIVE statement was successful in trying to log onto the next drive.
  7509.  
  7510.  If CHDRIVE is unsuccessful, BASIC will generate a "Device unavailable"
  7511.  error. This error will be trapped by the local error-handling routine,
  7512.  "DriveError", which will set "IsDrive%" to FALSE.
  7513.  
  7514.  If CHDRIVE is successful, "IsDrive%" will remain TRUE and the drive
  7515.  will be added to the list. The total number of available drives is
  7516.  stored in the INTEGER variable "TotalDrives%".
  7517.  
  7518.  Note that on a PC a legal drive name can only be a single letter
  7519.  between  "A" and "Z". Also, DOS does not distinguish between uppercase
  7520.  and lowercase letters. Therefore, in the following program we can use
  7521.  the numbers 65 through 90 whose corresponding ASCII characters are "A"
  7522.  through "Z" to circulate through all the possible drives. The counter
  7523.  variable of a FOR...NEXT loop is just right for performing this task.
  7524.  Our counter is "DriveLetter%".
  7525.  
  7526.  Code Example
  7527.  ------------
  7528.  
  7529.  CONST TRUE = -1
  7530.  CONST FALSE = 0
  7531.  
  7532.  DIM Drives(26) AS STRING * 1       'The list of drives.
  7533.  
  7534.  ON LOCAL ERROR GOTO DriveError   'If CHDRIVE unsuccessful trap error.
  7535.  TotalDrives% = 0
  7536.  
  7537.  FOR DriveLetter% = 65 TO 90      'ASCII "A" through "Z"
  7538.     IsDrive% = TRUE
  7539.     CHDRIVE CHR$(DriveLetter%)   'Try to log onto drive.
  7540.     IF IsDrive% THEN
  7541.        TotalDrives% = TotalDrives% + 1   'CHDRIVE was successful.
  7542.        Drives(TotalDrives%) = CHR$(DriveLetter%)   'Add drive letter.
  7543.     END IF
  7544.  NEXT DriveLetter%
  7545.  
  7546.  END
  7547.  
  7548.  DriveError: IsDrive% = FALSE   'CHDRIVE was unsuccessful.
  7549.              RESUME NEXT        'Resume at the IF statement.
  7550.  
  7551.  
  7552.  123. You Can CHAIN Only to an .EXE or .COM in BASIC PDS 7.00
  7553.  
  7554.  Product Version(s): 7.00   | 7.00
  7555.  Operating System:   MS-DOS | OS/2
  7556.  Flags: ENDUSER | SR# S891220-87
  7557.  Last Modified: 14-JAN-1990    ArticleIdent: Q57341
  7558.  
  7559.  In Microsoft Basic Compiler Versions 6.00 and 6.00b and in QuickBASIC
  7560.  Versions 4.00, 4.00b, and 4.50 for MS-DOS, you can CHAIN to an
  7561.  executable file that does not have the extension .EXE, and it will not
  7562.  generate an error. In BASIC Professional Development System (PDS)
  7563.  Version 7.00 for MS-DOS and MS OS/2, the same executable file must
  7564.  have the extension .EXE or .COM to run without an error. If the
  7565.  CHAINed-to file does not have one of these two extensions, the error
  7566.  "Bad File Mode" is generated when the program is executed.
  7567.  
  7568.  This new extension checking is to help you CHAIN to files that are
  7569.  most likely meant to be CHAINed to.
  7570.  
  7571.  
  7572.  124. QBX May Incorrectly Parse Array Element in User-Defined TYPE
  7573.  
  7574.  Product Version(s): 7.00
  7575.  Operating System:   MS-DOS
  7576.  Flags: ENDUSER | buglist7.00 fixlist7.10
  7577.  Last Modified: 20-SEP-1990    ArticleIdent: Q57501
  7578.  
  7579.  The QuickBASIC Extended editor (QBX.EXE), which is shipped with
  7580.  Microsoft BASIC Professional Development System (PDS) version 7.00 for
  7581.  MS-DOS, incorrectly parses a line of code that uses incorrect syntax
  7582.  for an array element in a user-defined TYPE. The following is an
  7583.  example:
  7584.  
  7585.     TYPE abc
  7586.        a(1 to 10) AS STRING * 8
  7587.     END TYPE
  7588.     DIM y AS abc
  7589.     PRINT y.a$(3)
  7590.  
  7591.  When you enter the last line into QBX.EXE and press the ENTER key,
  7592.  the line is interpreted (parsed) incorrectly and is displayed
  7593.  incorrectly as follows:
  7594.  
  7595.     3yGOTO
  7596.  
  7597.  If the correct line of code "PRINT y.a(3)" is entered, the code is
  7598.  interpreted correctly.
  7599.  
  7600.  Microsoft has confirmed this to be problem in the QBX.EXE editor in
  7601.  Microsoft BASIC PDS version 7.00. This problem was corrected in
  7602.  QBX.EXE in BASIC PDS 7.10.
  7603.  
  7604.  This problem relates only to QBX.EXE and does not relate to the BC.EXE
  7605.  compiler in BASIC 7.00.
  7606.  
  7607.  
  7608.  125. SCREEN Statement Correction for SCREEN 3 and 4 in PDS 7.00
  7609.  
  7610.  Product Version(s): 7.00 7.10
  7611.  Operating System:   MS-DOS
  7612.  Flags: ENDUSER | SR# S891214-90 docerr
  7613.  Last Modified:  8-JAN-1991    ArticleIdent: Q57343
  7614.  
  7615.  The "Microsoft BASIC 7.0: Language Reference" manual for Microsoft
  7616.  BASIC PDS Versions 7.00 and 7.10 incorrectly documents SCREEN modes 3
  7617.  and 4. Page 311 incorrectly states that SCREEN mode 3 supports
  7618.  Olivetti or AT&T Adapter Boards and that SCREEN mode 4 supports
  7619.  Hercules graphics capabilities.
  7620.  
  7621.  This information applies to Microsoft BASIC Professional Development
  7622.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  7623.  
  7624.  The correct entries under the SCREEN statement for SCREEN modes 3 and
  7625.  4 are included in the QBX.EXE Microsoft Advisor online Help system and
  7626.  appear as follows:
  7627.  
  7628.  SCREEN 3: Hercules adapter required, monochrome monitor only
  7629.     - 720 x 348 graphics
  7630.     - 80 x 25 text format, 9 x 14 character box
  7631.     - 2 screen pages (1 only if a second display adapter is installed)
  7632.     - PALETTE statement not supported
  7633.  
  7634.  SCREEN 4:
  7635.     - Supports Olivetti (R) Personal Computers models M24, M240, M28,
  7636.       M280, M380, M380/C, M380/T and AT&T (R) Personal Computers 6300
  7637.       series
  7638.     - 640 x 400 graphics
  7639.     - 80 x 25 text format, 8 x 16 character box
  7640.     - 1 of 16 colors assigned as the foreground color (selected by
  7641.       the COLOR statement); background is fixed at black
  7642.  
  7643.  
  7644.  126. "Subscript out of Range in Quick Library Module: WINDOW" Error
  7645.  
  7646.  Product Version(s): 7.00 7.10 | 7.00 7.10
  7647.  Operating System:   MS-DOS    | OS/2
  7648.  Flags: ENDUSER | SR# S891207-24 docerr
  7649.  Last Modified:  8-JAN-1991    ArticleIdent: Q57344
  7650.  
  7651.  The following COMMON SHARED statement should be added to the global
  7652.  array declarations found on Page 550 of the "Microsoft BASIC 7.0:
  7653.  Language Reference" manual (for 7.00 and 7.10) to successfully use the
  7654.  User Interface (UI) Toolbox's WINDOW.BAS source code file:
  7655.  
  7656.     COMMON SHARED /uitools/GloWindowStack() AS INTEGER
  7657.  
  7658.  The order of COMMON SHARED statements is important. The above
  7659.  statement should be inserted as follows:
  7660.  
  7661.     COMMON SHARED /uitools/GloWindow()      AS WindowType
  7662.     COMMON SHARED /uitools/GloButton ()     AS ButtonType
  7663.     COMMON SHARED /uitools/GloEdit()        AS EditFieldType
  7664.     COMMON SHARED /uitools/GloStorage()     AS WindowStorageType
  7665.     COMMON SHARED /uitools/GloWindowStack() AS INTEGER
  7666.     COMMON SHARED /uitools/GloBuffer$()
  7667.  
  7668.  If this COMMON SHARED statement is missing from a program that uses
  7669.  the WINDOW.BAS source code file, the program generates the error
  7670.  message "Subscript out of range in Quick library module: WINDOW" on
  7671.  the first call to a WINDOW.BAS procedure. This error will probably
  7672.  occur on the call to WindowInit because it must be the first
  7673.  WINDOW.BAS procedure called.
  7674.  
  7675.  This information applies to Microsoft BASIC Professional Development
  7676.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  7677.  
  7678.  
  7679.  127. Colored Buttons/Scroll Bars in BASIC 7.00 UI Toolbox
  7680.  
  7681.  Product Version(s): 7.00   | 7.00
  7682.  Operating System:   MS-DOS | OS/2
  7683.  Flags: ENDUSER | SR# S891207-109
  7684.  Last Modified: 14-JAN-1990    ArticleIdent: Q57355
  7685.  
  7686.  The User Interface (UI) Toolbox supplied with Microsoft BASIC
  7687.  Professional Development System (PDS) Version 7.00 for MS-DOS and MS
  7688.  OS/2 allows you to display scroll bars in windows. However, it has no
  7689.  facility for specifying foreground and background colors for them and
  7690.  always uses white and black, respectively. This limitation can be
  7691.  removed by modifying two COLOR statements in the ButtonShow procedure
  7692.  of the WINDOW.BAS toolbox file and adding a COMMON SHARED statement to
  7693.  the module-level code of that same file.
  7694.  
  7695.  The ButtonShow procedure of the WINDOW.BAS toolbox file is called when
  7696.  a button (which includes scroll bars) is to be displayed in a window.
  7697.  As written, the ButtonShow procedure does not allow regular buttons to
  7698.  have a different color than the window text and scroll bars are
  7699.  limited to a white foreground and black background.
  7700.  
  7701.  The colors of regular buttons can be specified through the use of the
  7702.  WindowColor procedure, which changes the colors used for window text.
  7703.  The colors used for window text are the same as those used for
  7704.  buttons.
  7705.  
  7706.  The COLOR statement used to color scroll bars is as follows:
  7707.  
  7708.     COLOR 0,7
  7709.  
  7710.  There are two of these COLOR statements in the ButtonShow procedure,
  7711.  one for horizontal scroll bars and one for vertical scroll bars. Both
  7712.  of them need to be changed to the following statement:
  7713.  
  7714.     COLOR ScrollBarForeground%, ScrollBarBackground%
  7715.  
  7716.  Here ScrollBarForeground and ScrollBarBackground are sample names for
  7717.  integer variables and may be differently named. However, they must be
  7718.  unique throughout the entire program because they will be COMMON
  7719.  SHARED between the module opening a button and the WINDOW.BAS module.
  7720.  Therefore, at the module-level code of both of those modules, insert
  7721.  the following statements:
  7722.  
  7723.     COMMON SHARED /ScrollBarColors/ ScrollBarForeground%
  7724.     COMMON SHARED /ScrollBarColors/ ScrollBarBackground%
  7725.  
  7726.  Here ScrollBarColors is an sample name for a named COMMON block and
  7727.  may be different. However, the name of the COMMON block must be the
  7728.  same in both modules and the data types of the variables must be
  7729.  integer. To prevent confusion, the same names used in the COLOR
  7730.  statements should be used in the COMMON SHARED statements.
  7731.  
  7732.  After the above changes have been made, you can specify what the
  7733.  foreground and background colors of each scroll bar will be by
  7734.  assigning color numbers to the variables in the named COMMON block.
  7735.  The variables do not need to be passed to the ButtonShow procedure
  7736.  because they are COMMON SHARED with the WINDOW.BAS module. The COLOR
  7737.  statement will always have access to them.
  7738.  
  7739.  Code Example
  7740.  ------------
  7741.  
  7742.  The following code fragment is an example of specifying colors for a
  7743.  scroll bar:
  7744.  
  7745.  'The following COMMON SHARED statements would also appear in the
  7746.  'module-level code of the WINDOW.BAS module.
  7747.  
  7748.  COMMON SHARED /ScrollBarColors/ ScrollBarForeground%
  7749.  COMMON SHARED /ScrollBarColors/ ScrollBarBackground%
  7750.  
  7751.  ScrollBarForeground% = 14   'yellow foreground.
  7752.  ScrollBarBackground% = 1    'blue background.
  7753.  
  7754.  'The ButtonOpen procedure will call the ButtonShow procedure,
  7755.  'which will use the values in ScrollBarForeground% and
  7756.  'ScrollBarBackground% to COLOR the scroll bar.
  7757.  
  7758.  CALL ButtonOpen (1, 1, "", 10, 30, 20, 30, 6)
  7759.  
  7760.  
  7761.  128. "Overflow" Accessing > 32K Array Inside User-Defined TYPE
  7762.  
  7763.  Product Version(s): 7.00   | 7.00
  7764.  Operating System:   MS-DOS | OS/2
  7765.  Flags: ENDUSER | SR# S891113-17 buglist7.00
  7766.  Last Modified: 14-JAN-1990    ArticleIdent: Q57356
  7767.  
  7768.  When a program is compiled with the /D switch, the length of arrays
  7769.  inside user-defined TYPEs is limited to 32,768 bytes. The compiler
  7770.  will not generate an error if a larger array is declared inside a
  7771.  user-defined type, but accessing any element that is offset more than
  7772.  32,768 bytes into the array will cause an "Overflow" error.
  7773.  
  7774.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  7775.  Professional Development System (PDS) Version 7.00 for MS-DOS and MS
  7776.  OS/2. We are researching this problem and will report new information
  7777.  here as it becomes available.
  7778.  
  7779.  This limitation applies only to arrays inside user-defined TYPEs, a
  7780.  new feature that was introduced in BASIC PDS 7.00 for MS-DOS and MS
  7781.  OS/2.
  7782.  
  7783.  The following two examples illustrate when the "Overflow" error occurs
  7784.  and when it doesn't.
  7785.  
  7786.  Example 1
  7787.  ---------
  7788.  
  7789.  When compiled with the BC /D switch, this program generates an
  7790.  "Overflow" error. This is because element 16,385 of the INTEGER array
  7791.  inside of the user-defined TYPE is being accessed. 16,385 * 2 (2 bytes
  7792.  per INTEGER) is greater than 32,768, so that element is out of bounds.
  7793.  
  7794.  TYPE aType
  7795.     anArray (1 TO 16385) AS INTEGER  'The compiler will not
  7796.                                      'flag this as an error -
  7797.  END TYPE                            '(16385*2) > 32768
  7798.  DIM aVariable as aType
  7799.  
  7800.  FOR i = 1 TO 16385
  7801.     aVariable.anArray(i) = 1   'When i = 16385 the "Overflow"
  7802.  NEXT i                        'error will be generated.
  7803.  
  7804.  Example 2
  7805.  ---------
  7806.  
  7807.  The following program does not generate an "Overflow" error. This is
  7808.  because the highest element of the INTEGER array inside the
  7809.  user-defined type being accessed is 16,384. 16,384 * 2 (2 bytes per
  7810.  INTEGER) is not greater than 32,768, so the element is not out of
  7811.  bounds.
  7812.  
  7813.  TYPE aType
  7814.     anArray (1 TO 16385) AS INTEGER  'The compiler will not
  7815.                                      'flag this as an error -
  7816.  END TYPE                            '(16385 * 2) > 32768
  7817.  DIM aVariable as aType
  7818.  
  7819.  FOR i = 1 TO 16384
  7820.     aVariable.anArray(i) = 1   'No "Overflow" error -
  7821.  NEXT i                        '16384 * 2 <= 32768.
  7822.  
  7823.  
  7824.  129. Missing Dollar Sign on a Call to Assembly Routine
  7825.  
  7826.  Product Version(s): 7.00 7.10 | 7.00 7.10
  7827.  Operating System:   MS-DOS    | OS/2
  7828.  Flags: ENDUSER | SR# S891226-5 docerr
  7829.  Last Modified:  8-JAN-1991    ArticleIdent: Q57357
  7830.  
  7831.  On Page 372 of the "Microsoft BASIC 7.0: Language Reference" manual
  7832.  (for 7.00 and 7.10) the CALL to Makestring needs to have a dollar sign
  7833.  appended to the end of it as shown below.
  7834.  
  7835.  The following is incorrect:
  7836.  
  7837.     PRINT Makestring
  7838.  
  7839.  It should be the following:
  7840.  
  7841.     PRINT Makestring$
  7842.  
  7843.  This information applies to Microsoft BASIC Professional Development
  7844.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  7845.  
  7846.  
  7847.  130. Incorrect Declaration of Far Procedure in Assembly; BASIC 7.10
  7848.  
  7849.  Product Version(s): 7.00 7.10 | 7.00 7.10
  7850.  Operating System:   MS-DOS    | OS/2
  7851.  Flags: ENDUSER | SR# S891226-6 docerr
  7852.  Last Modified:  8-JAN-1991    ArticleIdent: Q57358
  7853.  
  7854.  On Page 495 of the "Microsoft BASIC 7.0: Programmer's Guide" (for 7.00
  7855.  and 7.10), the "proc far" declaring the assembly procedures as far
  7856.  should actually be just "far", not "proc far" as shown below.
  7857.  
  7858.  The following is incorrect:
  7859.  
  7860.     extrn stringassign:proc far
  7861.  
  7862.  It should be the following:
  7863.  
  7864.     extrn stringassign:far
  7865.  
  7866.  This information applies to Microsoft BASIC Professional Development
  7867.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  7868.  
  7869.  
  7870.  131. Use "proc uses", Not "procuses" in MASM Example; BASIC 7.10
  7871.  
  7872.  Product Version(s): 7.00 7.10 | 7.00 7.10
  7873.  Operating System:   MS-DOS    | OS/2
  7874.  Flags: ENDUSER | SR# S891226-4 docerr
  7875.  Last Modified:  8-JAN-1991    ArticleIdent: Q57359
  7876.  
  7877.  On Page 495 of the "Microsoft BASIC 7.0: Programmer's Guide" (for 7.00
  7878.  and 7.10), a space should appear between the assembly code "proc" and
  7879.  "uses", but the manual shows no space between them.
  7880.  
  7881.  The following is incorrect:
  7882.  
  7883.     addstring  procuses si di ds,s1:far ptr,s1len,s2:far ptr,s2len
  7884.  
  7885.  The following is correct:
  7886.  
  7887.     addstring  proc uses si di sd,s1:far ptr,s1len,s2:far ptr,s2len
  7888.  
  7889.  This information applies to Microsoft BASIC Professional Development
  7890.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  7891.  
  7892.  
  7893.  132. Variable Length String Passed from BASIC PDS 7.00 to C
  7894.  
  7895.  Product Version(s): 7.00   | 7.00
  7896.  Operating System:   MS-DOS | OS/2
  7897.  Flags: ENDUSER | SR# S891017-100
  7898.  Last Modified: 17-JAN-1990    ArticleIdent: Q57362
  7899.  
  7900.  The example below demonstrates how to pass a variable-length string
  7901.  from a compiled BASIC program to a C program. This information applies
  7902.  to Microsoft BASIC Professional Development System (PDS) 7.00 for
  7903.  MS-DOS and MS OS/2.
  7904.  
  7905.  BASIC to C Example
  7906.  ------------------
  7907.  
  7908.  Compile and link as follows:
  7909.  
  7910.  Compile:  BC /Fs/d Bastest.bas;
  7911.            QCL /AM Ctest.c /c
  7912.  
  7913.  Link:     LINK /noe/nod Bastest+Ctest,,,BRT70EFR+MLIBCE;
  7914.  
  7915.  REM ===== BASIC PROGRAM =====
  7916.  DECLARE SUB StringFar CDECL (BYVAL p1o AS INTEGER, BYVAL p1s AS
  7917.  INTEGER, SEG p3 AS INTEGER)
  7918.  CLS
  7919.  a$ = "This is a test" + CHR$(0)
  7920.  CALL StringFar(SADD(a$), SSEG(a$), LEN(a$))
  7921.  PRINT "Back from C"
  7922.  END
  7923.  /* C sub-program */
  7924.  #include <e:\qc2\include\stdio.h>
  7925.  void StringFar(a,len)
  7926.     char far *a;
  7927.      int *len;
  7928.   {
  7929.      int i;
  7930.      printf("The string is : %s \n\n",a);
  7931.      printf(" Index       Value       Character\n");
  7932.      for (i=0;i < *len; i++)
  7933.         {
  7934.           printf("  %2d          %3d
  7935.  %c\n",i,a[i],a[i]);
  7936.         };
  7937.   }
  7938.  
  7939.  
  7940.  133. How to Pass a Variable Length String from BASIC to MASM
  7941.  
  7942.  Product Version(s): 7.00   | 7.00
  7943.  Operating System:   MS-DOS | OS/2
  7944.  Flags: ENDUSER | SR# S891017-100
  7945.  Last Modified: 17-JAN-1990    ArticleIdent: Q57363
  7946.  
  7947.  The example below demonstrates how to pass a variable-length string
  7948.  from a compiled BASIC program to a MASM procedure. This information
  7949.  applies to Microsoft BASIC Professional Development System (PDS)
  7950.  Version 7.00 for MS-DOS and MS OS/2.
  7951.  
  7952.  BASIC to MASM Example
  7953.  ---------------------
  7954.  
  7955.  Compile and link as follows:
  7956.  
  7957.  Compile: BC /Fs/d basmasm.bas;
  7958.           MASM masmtest;
  7959.  Link:    LINK basmasm+masmtest,,,BRT70EFR;
  7960.  
  7961.  REM ==BASIC to MASM code===
  7962.  DEFINT A-Z
  7963.  DECLARE SUB printmessage (BYVAL segm, BYVAL offs)
  7964.  CLS
  7965.  a$ = "Assembly test successful" + "$"
  7966.  CALL printmessage(SSEG(a$), SADD(a$))
  7967.  LOCATE 10, 10
  7968.  PRINT "Back from assembly"
  7969.  END
  7970.  
  7971.  ;MASM code here
  7972.                      .Model    Medium,basic
  7973.                      .stack
  7974.                      .code
  7975.                      public    printmessage
  7976.  printmessage        proc      uses ds,segm,offs
  7977.                      mov       ax,segm
  7978.                      mov       ds,ax
  7979.                      mov       dx,offs
  7980.                      mov       ah,9
  7981.                      int       21h
  7982.                      ret
  7983.  printmessage        endp
  7984.                      end
  7985.  
  7986.  
  7987.  134. Missing FUNCTION Name in BASIC PDS 7.00 Example
  7988.  
  7989.  Product Version(s): 7.00 7.10 | 7.00 7.10
  7990.  Operating System:   MS-DOS    | OS/2
  7991.  Flags: ENDUSER | SR# S891219-95 docerr
  7992.  Last Modified:  8-JAN-1991    ArticleIdent: Q57364
  7993.  
  7994.  There is an error on Page 494 of the "Microsoft BASIC 7.0:
  7995.  Programmer's Guide" (for 7.00 and 7.10), as shown below.
  7996.  
  7997.  The following is incorrect:
  7998.  
  7999.     C$ = (A$, LEN(A$), B$, LEN(B$))
  8000.  
  8001.  The following is correct:
  8002.  
  8003.     C$ = AddString$(A$, LEN(A$), B$, LEN(B$))
  8004.  
  8005.  This information applies to Microsoft BASIC Professional Development
  8006.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  8007.  
  8008.  
  8009.  135. "Subprogram Not Defined" GetCopyBox, AttrBox Using GENERAL.BAS
  8010.  
  8011.  Product Version(s): 7.00 7.10
  8012.  Operating System:   MS-DOS
  8013.  Flags: ENDUSER | SR# S891219-77 docerr
  8014.  Last Modified:  1-AUG-1990    ArticleIdent: Q57365
  8015.  
  8016.  GetCopyBox, PutCopyBox, and AttrBox (which are all invoked in
  8017.  GENERAL.BAS) are assembly language procedures located in the UIASM.ASM
  8018.  assembler source file, in the UIASM.OBJ object file, and in the
  8019.  UITBEFR.QLB Quick library. This fact needs to be added on Pages 499,
  8020.  585-586, 589, and 591 of the "Microsoft BASIC 7.0: Language Reference"
  8021.  manual for Microsoft BASIC Professional Development System (PDS)
  8022.  versions 7.00 and 7.10. You will need to know this when using
  8023.  GENERAL.BAS from the User Interface (UI) Toolbox as described below.
  8024.  
  8025.  If you are using GENERAL.BAS in QBX.EXE and get a "Subprogram not
  8026.  defined" error on a call to GetCopyBox, PutCopyBox, or AttrBox, then
  8027.  you must invoke QBX with a Quick library containing these routines,
  8028.  for example:
  8029.  
  8030.     QBX /L UITBEFR.QLB.
  8031.  
  8032.  [Also, if you are using GENERAL.BAS in QBX.EXE and get a "Subprogram
  8033.  not defined" error on a call to MouseHide (in the Box subprogram),
  8034.  then you must Load (choose Load from the File menu) the MOUSE.BAS
  8035.  source file, which contains MouseHide and the other mouse UI Toolbox
  8036.  routines.]
  8037.  
  8038.  This information applies to the UI Toolbox in Microsoft BASIC PDS
  8039.  versions 7.00 and 7.10 for MS-DOS.
  8040.  
  8041.  If you chose to have Quick libraries created when you ran SETUP.EXE
  8042.  for BASIC 7.00 or 7.10, you already have the UITBEFR.QLB Quick library
  8043.  that contains all the UI Toolbox routines. SETUP.EXE places
  8044.  UITBEFR.QLB by default in the directory where you chose to place
  8045.  .LIB files.
  8046.  
  8047.  Pages 534 and 535 "Microsoft BASIC 7.0: Language Reference" for
  8048.  versions 7.00 and 7.10 describe how to build UITBEFR.QLB (or subsets)
  8049.  yourself. (You can use LINK /Q to build UIASM.OBJ into a Quick library
  8050.  and use LIB.EXE to build the parallel .LIB library.)
  8051.  
  8052.  The three routines in UIASM.OBJ (PutCopyBox, GetCopyBox, and AttrBox)
  8053.  must always be present when using the UI Toolbox.
  8054.  
  8055.  Page 586 correctly describes how to make calls to AttrBox SUB. Since
  8056.  the code for AttrBox is not in the GENERAL.BAS source-code file, if
  8057.  you want to alter the code for AttrBox, you must edit the UIASM.ASM
  8058.  source file and reassemble it with Microsoft Macro Assembler (MASM).
  8059.  
  8060.  Documentation Correction
  8061.  ------------------------
  8062.  
  8063.  Pages 499 and 585-586 of the "Microsoft BASIC 7.0: Language Reference"
  8064.  manual incorrectly imply that AttrBox SUB is a procedure found in the
  8065.  GENERAL.BAS source-code file for the User Interface (UI) Toolbox.
  8066.  
  8067.  The AttrBox is actually an assembly language procedure located in the
  8068.  UI Toolbox object file, UIASM.OBJ (and in the UIASM.ASM source file).
  8069.  The UI Toolbox procedures require that UIASM.OBJ be included either in
  8070.  a Quick library when running inside the QBX.EXE editor or in a library
  8071.  (.LIB) that is linked to your program when running outside the
  8072.  environment (in a compiled executable .EXE form).
  8073.  
  8074.  
  8075.  136. DateSerial# Accepts Values Outside Range for Arguments
  8076.  
  8077.  Product Version(s): 7.00 7.10 | 7.00 7.10
  8078.  Operating System:   MS-DOS    | OS/2
  8079.  Flags: ENDUSER | docerr SR# S891227-47
  8080.  Last Modified:  8-JAN-1991    ArticleIdent: Q57366
  8081.  
  8082.  Page 425 of the "Microsoft BASIC 7.0: Language Reference" manual (for
  8083.  7.00 and 7.10) states that the DateSerial# function will generate an
  8084.  "Illegal function call" if values are specified outside the given
  8085.  ranges of the following:
  8086.  
  8087.     year%  - A year from 1753 to 2078
  8088.     month% - A month from 1 to 12
  8089.     day%   - A day from 1 to 31
  8090.  
  8091.  An "Illegal function call" is only generated if the year, month, and
  8092.  day arguments generate a serial number outside the valid range of
  8093.  -53,688 to 65,380. The corresponding dates for this range are January
  8094.  1, 1753, to December 31, 2078.
  8095.  
  8096.  The README.DOC file provided with Microsoft BASIC Professional
  8097.  Development System (PDS) Versions 7.00 and 7.10 notes this
  8098.  documentation error.
  8099.  
  8100.  This information applies to Microsoft BASIC Professional Development
  8101.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  8102.  
  8103.  The DateSerial# function can return serial numbers for dates in the
  8104.  following range, inclusive:
  8105.  
  8106.     DATE:     January 1, 1753, to December 31, 2078
  8107.     SERIAL#:           -53688 to 65380
  8108.  
  8109.  The DateSerial# function generates an "Illegal function call" only if
  8110.  the arguments passed to it generate a serial number outside the range
  8111.  of -53,688 to 65,380. The following example uses a value outside the
  8112.  given range for the "month%" argument, but does not generate an
  8113.  "Illegal function call":
  8114.  
  8115.     theDate# = DateSerial#(89, 13, 1)
  8116.  
  8117.  The serial number returned in the above call actually corresponds to
  8118.  the date January 1, 1990. A value of 13 logically corresponds to the
  8119.  month following December. Since December is the last month of a year,
  8120.  the year value is incremented by 1, and the month value is reset to 1,
  8121.  which corresponds to January; therefore, the following two calls to
  8122.  DateSerial# return the same serial number:
  8123.  
  8124.     theDate# = DateSerial#(89, 13, 1)
  8125.     theDate# = DateSerial#(90,  1, 1)
  8126.  
  8127.  Negative numbers work in the same way. A value of "-1" for the month
  8128.  argument refers to the month of November in the previous year. The
  8129.  following to calls to DateSerial# return the same serial number:
  8130.  
  8131.     theDate# = DateSerial#(90, -1, 1)
  8132.     theDate# = DateSerial#(89, 11, 1)
  8133.  
  8134.  The following are example calls to DateSerial# that generate the
  8135.  "Illegal function call" error message since the resulting serial
  8136.  number falls outside the valid range:
  8137.  
  8138.     theDate# = DateSerial#(2078, 12, 32)  ->  January   1, 2079
  8139.     theDate# = DateSerial#(2078, 13,  1)  ->  January   1, 2079
  8140.     theDate# = DateSerial#(1753,  0, 31)  ->  December 31, 1752
  8141.  
  8142.  
  8143.  137. COMMON SHARED Must Be in Order in User Interface Toolbox
  8144.  
  8145.  Product Version(s): 7.00
  8146.  Operating System:   MS-DOS
  8147.  Flags: ENDUSER | SR# S891211-54
  8148.  Last Modified: 23-FEB-1990    ArticleIdent: Q57367
  8149.  
  8150.  When using procedures from the User Interface (UI) Toolbox's MENU.BAS
  8151.  or WINDOW.BAS, you must provide global-array declarations in your
  8152.  program. If these declarations are in the wrong order, various errors
  8153.  may occur. The proper order for COMMON SHARED declarations can be
  8154.  found at the beginning of each User Interface Toolbox .BAS file.
  8155.  Possible errors include "Subscript out of range in module...," "Far
  8156.  Heap Corrupt," or the system may hang.
  8157.  
  8158.  This information applies to Microsoft BASIC Professional Development
  8159.  System (PDS) Version 7.00 for MS-DOS.
  8160.  
  8161.  In most cases, switching the order of the COMMON SHARED statements for
  8162.  the global-array declarations generates the error "Subscript out of
  8163.  range in module..." on the first call to a procedure in MENU.BAS or
  8164.  WINDOW.BAS.
  8165.  
  8166.  Changing the order of certain COMMON SHARED statements results in a
  8167.  "Far Heap Corrupt" message when the program is run from the QBX.EXE
  8168.  editor. This can put the computer in an unstable memory state, which
  8169.  may cause it to hang. When the same program is run from the DOS
  8170.  command line, the program fails and gives a "Subscript out of range in
  8171.  module..." error message.
  8172.  
  8173.  Here is some good advice from Page 65 of the "Microsoft BASIC 7.0:
  8174.  Language Reference" manual:
  8175.  
  8176.     Errors caused by mismatched COMMON statements are subtle and
  8177.     difficult to find. An easy way to avoid mismatched COMMON
  8178.     statements is to place COMMON declarations in a single include
  8179.     file and use the $INCLUDE metacommand in each module.
  8180.  
  8181.  Code Example
  8182.  ------------
  8183.  
  8184.  The following code exhibits the behavior of a program that has a
  8185.  statement (COMMON SHARED /uitools/GloWindowStack() AS INTEGER) in the
  8186.  wrong order. This program generates a "Far Heap Corrupt" message and
  8187.  can hang when run from the QBX.EXE editor in either MS-DOS or in OS/2
  8188.  real mode. If this program is compiled, linked, and then run from the
  8189.  DOS command line, it generates a "Subscript out of range in module..."
  8190.  error.
  8191.  
  8192.     REM $INCLUDE: 'MENU.BI'
  8193.     REM $INCLUDE: 'WINDOW.BI'
  8194.     REM $INCLUDE: 'MOUSE.BI'
  8195.     REM $INCLUDE: 'GENERAL.BI'
  8196.  
  8197.     COMMON SHARED /uitools/GloMenu     AS MenuMiscType
  8198.     COMMON SHARED /uitools/GloTitle()  AS MenuTitleType
  8199.     COMMON SHARED /uitools/GloItem()   AS MenuItemType
  8200.  
  8201.     'The next statement is out of order
  8202.  
  8203.     COMMON SHARED /uitools/GloWindowStack() AS INTEGER
  8204.     COMMON SHARED /uitools/GloWindow() AS WindowType
  8205.     COMMON SHARED /uitools/GloButton() AS ButtonType
  8206.     COMMON SHARED /uitools/GloEdit()   AS EditFieldType
  8207.     COMMON SHARED /uitools/Storage     AS WindowStorageType
  8208.     'This is where the statement should be
  8209.     COMMON SHARED /uitools/GloBuffer$()
  8210.  
  8211.     DIM GloTitle(MAXMENU)              AS MenuTitleType
  8212.     DIM GloItem(MAXMENU, MAXITEM)      AS MenuItemType
  8213.     DIM GloWindow(MAXWINDOW)           AS WindowType
  8214.     DIM GloButton(MAXBUTTON)           AS ButtonType
  8215.     DIM GloEdit(MAXEDITFIELD)          AS EditFieldType
  8216.     DIM GloWindowStack(MAXWINDOW)      AS INTEGER
  8217.     DIM GloBuffer$(MAXWINDOW +1, 2)
  8218.  
  8219.     MenuInit
  8220.     WindowInit
  8221.  
  8222.  
  8223.  138. QBX Make Library Uses OS/2 Mode Last Used by Make EXE File
  8224.  
  8225.  Product Version(s): 7.00
  8226.  Operating System:   MS-DOS
  8227.  Flags: ENDUSER | SR# S891211-105
  8228.  Last Modified:  8-JAN-1990    ArticleIdent: Q57382
  8229.  
  8230.  The Make Library menu command of the QuickBASIC Extended (QBX.EXE)
  8231.  environment that comes with Microsoft BASIC PDS Version 7.00 for
  8232.  MS-DOS and MS OS/2 will compile currently loaded source modules for
  8233.  whichever OS/2 mode (real or protected) that the last Make EXE File
  8234.  menu command compiled for.
  8235.  
  8236.  (Note that the QBX.EXE environment runs only under OS/2 real mode or
  8237.  MS-DOS and does not itself run under OS/2 protected mode, although
  8238.  QBX.EXE can make .EXE programs that run under OS/2 protected mode.)
  8239.  
  8240.  The Make Library command on the Run menu of the QBX.EXE environment
  8241.  can be used to make stand-alone libraries for either real or protected
  8242.  mode operation. However, there is no option in the Make Library dialog
  8243.  box that allows you to choose which mode the modules of the library
  8244.  will be compiled for.
  8245.  
  8246.  The Make Library command will compile the source-code modules for
  8247.  whichever mode the last Make EXE File command compiled for. That is,
  8248.  if the OS/2 Protected Mode option in the Make EXE File dialog box was
  8249.  selected the last time you made an EXE file, then the Make Library
  8250.  command will compile the library modules for protected mode. If a real
  8251.  mode (using the DOS or OS/2 Real Mode option) EXE file was made last,
  8252.  a real mode library will be made the next time Make Library is
  8253.  invoked.
  8254.  
  8255.  Note that selecting a mode (protected or real) in the Make EXE File
  8256.  dialog box and then choosing the Cancel button will not cause the Make
  8257.  Library command to compile for that mode. BC.EXE must be invoked for
  8258.  the change to take effect.
  8259.  
  8260.  Do the following to demonstrate the problem:
  8261.  
  8262.  1. Invoke QBX and type the following line:
  8263.  
  8264.     PRINT "This will be a protected-mode program"
  8265.  
  8266.     Now save the program.
  8267.  
  8268.  2. Make the program into an executable file using the Make EXE File
  8269.     menu command. For the target environment (operation mode), select
  8270.     the OS/2 Protected Mode option. Choose the Make EXE button to make
  8271.     the executable file.
  8272.  
  8273.     The "/Lp" option should be one of the parameters on the BC.EXE
  8274.     command line that is displayed. This switch is used to compile for
  8275.     protected mode.
  8276.  
  8277.  3. When the executable has been made, the QBX environment should
  8278.     reappear on the screen. Choose the Make Library command and select
  8279.     the Make Library button to make the library.
  8280.  
  8281.     The "/Lp" switch should be one of the parameters on the BC.EXE
  8282.     command line that is displayed. This switch is used to compile for
  8283.     protected mode.
  8284.  
  8285.  4. When the QBX environment comes back on the screen, repeat Steps 2
  8286.     and 3. However, in Step 2, select the DOS Or OS/2 Real Mode option
  8287.     for the target environment. Instead of the "/Lp" switch, the "/Lr"
  8288.     switch should be one of the parameters on the BC.EXE command line
  8289.     generated by the Make EXE File and the Make Library commands.
  8290.  
  8291.  
  8292.  139. LoadFont Function Example Documentation Error in BASIC 7.00
  8293.  
  8294.  Product Version(s): 7.00 7.10
  8295.  Operating System:   MS-DOS
  8296.  Flags: ENDUSER | SR# S891211-4 docerr
  8297.  Last Modified:  8-JAN-1991    ArticleIdent: Q57502
  8298.  
  8299.  Page 524 of the "Microsoft BASIC 7.0: Language Reference" for
  8300.  Microsoft BASIC Professional Development System (PDS) Versions 7.00
  8301.  and 7.10 shows an incorrect example of how to load a font by its order
  8302.  in the font file. This documentation incorrectly states the following:
  8303.  
  8304.     Note that to load fonts according to their order in the font
  8305.     file, l% would take the form:
  8306.  
  8307.        l% = LoadFont%("n1,n3,n6")
  8308.  
  8309.  The code above should read as follows (where l% means L%, not to be
  8310.  confused with 1%):
  8311.  
  8312.     l% = LoadFont%("n1/n3/n6")
  8313.  
  8314.  When loading multiple fonts, each font given in the fontspec$ argument
  8315.  of LoadFont%(fontspec$) should be separated by forward slashes (the
  8316.  "/" character), not by commas.
  8317.  
  8318.  If the code in this documentation error is used, only the first font
  8319.  is loaded (l% contains the number "1", indicating that only one font
  8320.  is loaded).
  8321.  
  8322.  Code Example
  8323.  ------------
  8324.  
  8325.  The following code example demonstrates the documentation problem. To
  8326.  use this code example, you must start QBX.EXE with /L FONTBEFR.QLB to
  8327.  access the font routines.
  8328.  
  8329.  REM $INCLUDE: 'fontb.bi'
  8330.  '* Load a the Times Roman font.
  8331.  SCREEN 9
  8332.  PRINT "Registering Times Roman font."
  8333.  FontNum% = RegisterFonts("D:\BC7\FONTS\TMSRB.FON")
  8334.  PRINT "Number of fonts in the file: "; FontNum%
  8335.  PRINT "Loading fonts 4,5,6 from the Times Roman file."
  8336.  var1% = LoadFont%("N4,N5,N6")
  8337.  PRINT "Number of fonts successfully loaded"; var1%
  8338.  PRINT "value of FontErr", FontErr
  8339.  a$ = "Hello world"
  8340.  var1% = OutGText%(100, 100, a$)
  8341.  END
  8342.  
  8343.  
  8344.  140. Documentation Errors in BASIC 7.00 Presentation Graphics
  8345.  
  8346.  Product Version(s): 7.00 7.10
  8347.  Operating System:   MS-DOS
  8348.  Flags: ENDUSER | SR# S891211-2 docerr
  8349.  Last Modified:  8-JAN-1991    ArticleIdent: Q57504
  8350.  
  8351.  This article documents several documentation errors in Chapter 6,
  8352.  "Presentation Graphics," of the "Microsoft BASIC 7.0: Programmer's
  8353.  Guide" for Microsoft BASIC Professional Development System (PDS)
  8354.  Versions 7.00 and 7.10. The errors are as follows:
  8355.  
  8356.  1. Page 250 details the fields in the AxisType user-defined TYPE. The
  8357.     field "Labelled" is misspelled. It should be spelled "Labeled".
  8358.     This field is spelled correctly in the definition of the AxisType
  8359.     in the CHRTB.BI $INCLUDE file.
  8360.  
  8361.  2. Page 251 incorrectly says to assign TicFormat to the CONSTant
  8362.     cDecFormat for decimal. There is no CONSTant named cDecFormat.
  8363.     This constant is defined as cNormFormat in the CHRTB.BI $INCLUDE
  8364.     file.
  8365.  
  8366.  3. Page 266 describes how to load fonts for use in Presentation
  8367.     Graphics. The following line in the example at the bottom of the
  8368.     page is incorrect:
  8369.  
  8370.        Env.MainTitle.Font = 3
  8371.  
  8372.     This line should be changed to the following:
  8373.  
  8374.        Env.MainTitle.TitleFont = 3
  8375.  
  8376.  
  8377.  141. "No Symbolic Information" Using Older CodeView with BASIC PDS
  8378.  
  8379.  Product Version(s): 7.00
  8380.  Operating System:   MS-DOS
  8381.  Flags: ENDUSER | SR# S891228-44
  8382.  Last Modified: 14-JAN-1990    ArticleIdent: Q57515
  8383.  
  8384.  If a version of Microsoft CodeView earlier than Version 2.35 is used
  8385.  on a program compiled with Microsoft BASIC Professional Development
  8386.  System (PDS) Version 7.00, the message "No symbolic information" is
  8387.  displayed within CodeView and no BASIC source code is displayed.
  8388.  
  8389.  BASIC PDS 7.00 is designed to use CodeView Version 2.35, which is
  8390.  included with the product.
  8391.  
  8392.  This information applies to the Microsoft BASIC PDS Version 7.00 for
  8393.  MS-DOS and MS OS/2.
  8394.  
  8395.  
  8396.  142. Why BASIC 7.00 and 7.10 Don't Support Multiuser ISAM
  8397.  
  8398.  Product Version(s): 7.00 7.10 | 7.00 7.10
  8399.  Operating System:   MS-DOS    | OS/2
  8400.  Flags: ENDUSER |
  8401.  Last Modified: 27-JUL-1990    ArticleIdent: Q57579
  8402.  
  8403.  Question:
  8404.  
  8405.  Why is ISAM support in Microsoft BASIC Professional Development System
  8406.  (PDS) versions 7.00 and 7.10 only single-user and not multiuser? Also,
  8407.  why was ISAM support for OS/2 protected mode not available in 7.00 but
  8408.  was released in version 7.10?
  8409.  
  8410.  (Multiuser ISAM support refers to the ability for multiple processes,
  8411.  or users on a network, to access different records within one ISAM
  8412.  file at the same time, with locking of individual records. BASIC 7.00
  8413.  and 7.10 don't support multiuser ISAM; they only support single-user
  8414.  ISAM, where the whole ISAM file is locked during use by one program.)
  8415.  
  8416.  Response:
  8417.  
  8418.  The Microsoft BASIC Professional Development System (PDS) is a
  8419.  feature-packed product designed to satisfy the majority of needs
  8420.  expressed to us by our professional BASIC programmers. It includes the
  8421.  following:
  8422.  
  8423.   - Significant enhancements in performance (smaller and faster EXEs)
  8424.  
  8425.   - Significant enhancements in capacity (a 10- to 50-times increase in
  8426.     code and/or data space)
  8427.  
  8428.   - Significant enhancements in language (CURRENCY data type, static
  8429.     arrays in user-defined-TYPE records, local error handling, stack
  8430.     control, DOS file control)
  8431.  
  8432.   - Extras (three Excel-based libraries, three BASIC toolboxes for user
  8433.     interfaces, presentation graphics, and matrix math)
  8434.  
  8435.   - A new dimension added to file handling in the form of the
  8436.     high-performance ISAM database engine with a powerful, integrated
  8437.     BASIC programming interface
  8438.  
  8439.  As much as Microsoft wanted to include multiuser ISAM in BASIC PDS
  8440.  version 7.00 or 7.10, doing so meant holding back other features (such
  8441.  as those above) from the programmers who have expressed such a great
  8442.  need for them. Clearly, PC connectivity is growing and so will the
  8443.  need for a multiuser ISAM in BASIC. Just as Microsoft listened to
  8444.  customers in creating BASIC PDS 7.00 and 7.10, we will continue to
  8445.  listen and will make every attempt to have our future products address
  8446.  the most serious needs made known to us.
  8447.  
  8448.  The longer we allow the feature list for a given product release to
  8449.  grow, the longer everyone has to wait to get the feature(s) that may
  8450.  solve their immediate problem(s). If we had held BASIC 7.00 or 7.10
  8451.  off the market until multiuser ISAM was ready, no one would have had
  8452.  any of the above capacity, performance, or language features in a
  8453.  satisfactory time frame.
  8454.  
  8455.  Only after thorough testing did we introduce protected-mode (but still
  8456.  single-user) ISAM support in BASIC 7.10.
  8457.  
  8458.  Our perpetual challenge in the product release planning process is to
  8459.  find the combination of features and schedule that will best satisfy
  8460.  the needs of most of our customers.
  8461.  
  8462.  
  8463.  143. What Features Would You Want for a 1-Byte Data Type in BASIC?
  8464.  
  8465.  Product Version(s): 7.00   | 7.00
  8466.  Operating System:   MS-DOS | OS/2
  8467.  Flags: ENDUSER | B_QuickBas
  8468.  Last Modified: 17-JAN-1990    ArticleIdent: Q57580
  8469.  
  8470.  Some developers using Microsoft BASIC or QuickBASIC may suggest that a
  8471.  single-byte, unsigned data type should be added to BASIC. As of
  8472.  Microsoft BASIC PDS Version 7.00 or QuickBASIC Version 4.50 or
  8473.  earlier, a single-byte data type hasn't yet been implemented. If you
  8474.  support this suggestion, please send Microsoft your (customer)
  8475.  comments about what you would use this data type for and what kinds
  8476.  of operations you would like to see it support.
  8477.  
  8478.  For example, would you like the single-byte data type to be a fully
  8479.  implemented short integer complete with overflow checking and coercion
  8480.  to floating point or longer integers for the appropriate operations,
  8481.  or would you like to see it implemented as a simple, small, and fast
  8482.  data type with a subset of these operations? What are the ranges of
  8483.  uses that you can see for such a data type in your programs?
  8484.  
  8485.  We'd like to know what kinds of uses people envision for a single-byte
  8486.  data type before we consider adding the overhead to the product.
  8487.  
  8488.  Please send in your comments to Microsoft Product Support
  8489.  (206-454-2030) so we may forward them to the Microsoft BASIC Program
  8490.  Manager. Your input will be greatly appreciated.
  8491.  
  8492.  
  8493.  144. Microsoft Doesn't Offer Educational Edition of BASIC PDS 7.00
  8494.  
  8495.  Product Version(s): 7.00   | 7.00
  8496.  Operating System:   MS-DOS | OS/2
  8497.  Flags: ENDUSER |
  8498.  Last Modified: 14-JAN-1990    ArticleIdent: Q57581
  8499.  
  8500.  Question:
  8501.  
  8502.  Why doesn't Microsoft offer an educational edition of BASIC PDS
  8503.  (Professional Development System) Version 7.00?
  8504.  
  8505.  Response:
  8506.  
  8507.  Microsoft instead recommends one of the following products for
  8508.  educational institutions and people who want to teach modern BASIC on
  8509.  IBM Personal Computers or compatibles:
  8510.  
  8511.  1. "Learn BASIC Now" by Halvorson and Rygmyr, published by Microsoft
  8512.     Press, 1989.
  8513.  
  8514.     This is the fastest, easiest way to learn modern QuickBASIC
  8515.     programming. The book includes a disk with the Microsoft QuickBASIC
  8516.     Interpreter (QBI.EXE), the QBI Advisor complete electronic
  8517.     reference, the QuickBASIC Express online tutorial and introduction
  8518.     to the interpreter, and dozens of sample programs. The book teaches
  8519.     BASIC programming step by step.
  8520.  
  8521.  2. Microsoft QuickBASIC Interpreter, Academic Edition Version 1.00,
  8522.     for IBM Personal Computers and Compatibles
  8523.  
  8524.     This product is entirely disk based, without a printed manual. The
  8525.     disk contains the Microsoft QuickBASIC Interpreter (QBI.EXE), the
  8526.     QBI Advisor complete electronic reference, the QuickBASIC Express
  8527.     online tutorial and introduction to the interpreter, and dozens of
  8528.     sample programs.
  8529.  
  8530.  The above two QuickBASIC Interpreter (QBI.EXE) products have the same
  8531.  language features found in Microsoft QuickBASIC Version 4.50 for IBM
  8532.  PCs and compatibles. (Note that the QBI.EXE interpreter environment
  8533.  has some limitations compared to QB.EXE 4.50).
  8534.  
  8535.  We found no compelling reason to make a special academic edition for
  8536.  BASIC PDS 7.00 since the only features in 7.00 not found in the
  8537.  existing QuickBASIC academic editions are all targeted for people
  8538.  making professional, commercial applications and are not crucial for
  8539.  teaching BASIC.
  8540.  
  8541.  
  8542.  145. BC 6.00/6.00b ERROUT.EXE Utility, "Command Failed" Error
  8543.  
  8544.  Product Version(s): 6.00 6.00b
  8545.  Operating System:   MS-DOS
  8546.  Flags: ENDUSER | SR# S891019-106 docerr
  8547.  Last Modified: 14-JAN-1990    ArticleIdent: Q57644
  8548.  
  8549.  Contrary to Pages 328 and 329 of the "Microsoft CodeView and
  8550.  Utilities: Software Development Tools for MS-DOS" manual, the
  8551.  ERROUT.EXE utility supplied with Microsoft BASIC Compiler Versions
  8552.  6.00 and 6.00b works only with .EXE or .COM files.
  8553.  
  8554.  When running any DOS command line other than an .EXE or .COM file,
  8555.  ERROUT fails to execute the supplied command and either hangs the
  8556.  machine or returns the following error:
  8557.  
  8558.     execution error U2253 : command failed
  8559.  
  8560.  When executing batch files or DOS commands such as TYPE and DIR, the
  8561.  above error message displays. In the case of batch files, if the .BAT
  8562.  extension is included at the end of the batch-file name, ERROUT.EXE
  8563.  may hang the machine. If the .BAT extension is not included, the above
  8564.  error message displays. (When an error output filename is supplied
  8565.  with the /f option, this same error is written to the file.)
  8566.  
  8567.  The first example on Page 329 of the "Microsoft CodeView and
  8568.  Utilities: Software Development Tools for MS-DOS" manual (for
  8569.  Microsoft BASIC Compiler 6.00 and 6.00b) fails since it uses the DOS
  8570.  TYPE statement. This first example should be removed. The examples
  8571.  using CL and MASM work properly since CL.EXE and MASM.EXE are .EXE
  8572.  programs.
  8573.  
  8574.  (The ERROUT.EXE utility is not shipped in Microsoft BASIC Professional
  8575.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.)
  8576.  
  8577.  Syntax for ERROUT
  8578.  -----------------
  8579.  
  8580.  The ERROUT.EXE utility redirects standard error output generated from
  8581.  an .EXE or .COM program, using the following syntax:
  8582.  
  8583.     ERROUT [/f standarderrorfile] doscommandline
  8584.  
  8585.  Here, "standarderrorfile" is a filename to which all errors generated
  8586.  by "doscommandline" will be written when you use the /f option
  8587.  (lowercase "f"). Without the /f option, all error messages are sent to
  8588.  the console.
  8589.  
  8590.  No form of ERROUT works except when doscommandline is the name of an
  8591.  .EXE or .COM file.
  8592.  
  8593.  
  8594.  146. Setting COMSPEC & SHELL in OS/2; SHELL "Illegal Function Call"
  8595.  
  8596.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  8597.  Operating System:   MS-DOS          | OS/2
  8598.  Flags: ENDUSER | SR# S891218-2  B_QuickBas
  8599.  Last Modified: 14-JAN-1990    ArticleIdent: Q57645
  8600.  
  8601.  The following two situations might cause an "Illegal function call"
  8602.  error when attempting to SHELL under OS/2:
  8603.  
  8604.  1. In the OS/2 DOS 3.x compatibility box, a program can generate an
  8605.     "Illegal function call" if the COMSPEC environment variable is
  8606.     placed in the AUTOEXEC.BAT. Under OS/2, COMSPEC should be defined
  8607.     only in the CONFIG.SYS file.
  8608.  
  8609.  2. In an OS/2 protected mode session, "Illegal function call" on a
  8610.     SHELL can be generated if the parameter /E:xxxx is used to attempt
  8611.     to set the environment size on the CMD.EXE command interpreter. The
  8612.     CMD.EXE command interpreter will accept this parameter, but it will
  8613.     then prevent you from SHELLing another copy of CMD.EXE. To correct
  8614.     this problem, remove the COMSPEC from the AUTOEXEC.BAT file and make
  8615.     sure it is in the CONFIG.SYS. Also delete the parameter /E:xxxx
  8616.     after CMD.EXE in the CONFIG.SYS.
  8617.  
  8618.  This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
  8619.  and 4.50 under MS OS/2 real mode, to Microsoft BASIC Compiler Versions
  8620.  6.00 and 6.00b under MS OS/2 real and protected modes, and to
  8621.  Microsoft BASIC Professional Development System (PDS) 7.00 under MS
  8622.  OS/2 real and protected modes.
  8623.  
  8624.  To reproduce the problem, do the following:
  8625.  
  8626.  1. Place the following lines in the CONFIG.SYS file for OS/2:
  8627.  
  8628.        SET COMSPEC=C:\OS2\CMD.EXE /P /E:1024
  8629.        SET SHELL=C:\OS2\COMMAND.COM /P /E:1024
  8630.  
  8631.  2. Place the following statement in the OS/2 AUTOEXEC.BAT file:
  8632.  
  8633.        SET COMSPEC=C:\OS2\COMMAND.COM /P /E:1024
  8634.  
  8635.     Note: The path names to CMD.EXE and COMMAND.COM may be different on
  8636.     your system, depending on how you installed OS/2.
  8637.  
  8638.  3. Reboot your computer with the new settings.
  8639.  
  8640.  4. Do one of the following, depending on whether you are in real
  8641.     (MS-DOS) or protected mode:
  8642.  
  8643.     a. Load QB.EXE or QBX.EXE in real mode (DOS 3.x box) and either
  8644.        choose DOS Shell from the File menu, execute the word "SHELL"
  8645.        in the immediate window, or execute a program that contains only
  8646.        the word "SHELL." Each of these will produce the "illegal
  8647.        function  call" error in QB and QBX.EXE.
  8648.  
  8649.     b. Under OS/2 protected mode, execute a BASIC 6.00, 6.00b,or 7.00
  8650.        compiled program whose only statement is SHELL to show the
  8651.        problem.
  8652.  
  8653.  To eliminate the problem, remove the COMSPEC statement from the
  8654.  AUTOEXEC.BAT file, delete the /P /E:1024 after CMD.EXE, and reboot.
  8655.  
  8656.  The Command Interpreter (COMMAND.COM) Under DOS
  8657.  -----------------------------------------------
  8658.  
  8659.  Under DOS 3.x, 4.00, and 4.01, the COMSPEC environment variable is
  8660.  defined in the AUTOEXEC.BAT file. The SET COMSPEC= statement gives DOS
  8661.  a path for where the DOS command interpreter COMMAND.COM is located on
  8662.  the disk.
  8663.  
  8664.  Under DOS, a SHELL= command defined in the CONFIG.SYS file tells DOS
  8665.  the name of your command interpreter. This at first may not seem
  8666.  useful, but this feature was provided so that you can write your own
  8667.  command interpreter. You can place the name of your command
  8668.  interpreter in the SHELL= statement for DOS to load that command
  8669.  interpreter at boot time. However, most people use COMMAND.COM as
  8670.  their command interpreter in both the SET COMSPEC= and SHELL= commands
  8671.  under DOS.
  8672.  
  8673.  If you want to set the environment size, you can use the /E:xxx
  8674.  parameter on COMMAND.COM to increase or decrease the size available
  8675.  for environment variables and the PATH.
  8676.  
  8677.  The Command Interpreters (CMD.EXE and COMMAND.COM) Under OS/2
  8678.  -------------------------------------------------------------
  8679.  
  8680.  Under OS/2, there are two command interpreters (CMD.EXE and
  8681.  COMMAND.COM) and two parameters to SET in the CONFIG.SYS file:
  8682.  
  8683.  1. First, the SET COMSPEC= statement tells OS/2 where to find the OS/2
  8684.     protected mode command interpreter, which is called CMD.EXE. Unlike
  8685.     COMMAND.COM, CMD.EXE does not take the parameter /E:xxxx to set the
  8686.     environment size. OS/2 does not limit the environment size as DOS
  8687.     does with COMMAND.COM. If you use /E: on CMD.EXE, it will not cause
  8688.     an error message at boot time, but it will prevent you from
  8689.     SHELLing when in an OS/2 session.
  8690.  
  8691.  2. Second, the SHELL= statement tells OS/2 where to find the DOS
  8692.     compatibility box command interpreter, which is called COMMAND.COM.
  8693.     Just as in DOS, COMMAND.COM will take the parameter /E:xxxx, which
  8694.     allows you to set the environment size for the DOS box command
  8695.     interpreter. Note, however, that when you go into the DOS box, OS/2
  8696.     takes the value of the SHELL in the CONFIG.SYS and SETs the DOS box
  8697.     COMSPEC equal to that value so that normal DOS programs that need
  8698.     that information will function normally. This can be shown by
  8699.     typing the word SET at the DOS box command line. This will show
  8700.     that the COMSPEC is actually set, even though it is not in the
  8701.     AUTOEXEC.BAT file.
  8702.  
  8703.  Note again that both COMSPEC and SHELL are set in the CONFIG.SYS file
  8704.  under OS/2. Nothing is done in the AUTOEXEC.BAT file to specify
  8705.  information about command interpreters under OS/2.
  8706.  
  8707.  
  8708.  147. Use STACK, Not FRE("), with QBX.EXE or /Fs in BASIC 7.00
  8709.  
  8710.  Product Version(s): 7.00   | 7.00
  8711.  Operating System:   MS-DOS | OS/2
  8712.  Flags: ENDUSER |
  8713.  Last Modified: 14-JAN-1990    ArticleIdent: Q57646
  8714.  
  8715.  With the advent of far string support in Microsoft BASIC Professional
  8716.  Development System (PDS) Version 7.00 for MS-DOS and OS/2, the FRE()
  8717.  function has some different properties. The following statement
  8718.  
  8719.     PRINT  FRE("")
  8720.  
  8721.  does not return the remaining default data segment (DGROUP) space when
  8722.  run in the QBX.EXE environment or when run as a program compiled with
  8723.  the /Fs (Far String) option. To obtain the remaining DGROUP space in
  8724.  these cases, you must now use the STACK function (introduced in BASIC
  8725.  7.00). For example, the following statement
  8726.  
  8727.     PRINT STACK
  8728.  
  8729.  returns the current space available in DGROUP for the STACK to be
  8730.  resized. The stack is always in DGROUP, so the new STACK function
  8731.  conveniently informs you of the total remaining space that can be used
  8732.  in DGROUP.
  8733.  
  8734.  This information applies to Microsoft BASIC PDS 7.00 for MS-DOS and
  8735.  MS OS/2.
  8736.  
  8737.  For more information on the many changes in the FRE() function in
  8738.  regard to far strings, refer to Pages 140-142 of the "Microsoft BASIC
  8739.  7.0: Language Reference" manual.
  8740.  
  8741.  
  8742.  148. Using DIR$ to Load Directory Listing into Array in BASIC 7.00
  8743.  
  8744.  Product Version(s): 7.00   | 7.00
  8745.  Operating System:   MS-DOS | OS/2
  8746.  Flags: ENDUSER |
  8747.  Last Modified: 15-JAN-1990    ArticleIdent: Q57671
  8748.  
  8749.  This article illustrates how to use the DIR$ function and load an
  8750.  MS-DOS or MS OS/2 directory listing into a BASIC string array. This
  8751.  information applies only to the Microsoft BASIC Professional
  8752.  Development System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  8753.  
  8754.  The following sample program demonstrates use of the DIR$ function
  8755.  available in BASIC PDS 7.00 to return all the files matching a given
  8756.  filespec and store them in a BASIC string array. For more information
  8757.  on the DIR$ function, see Page 107 of the "Microsoft BASIC 7.0:
  8758.  Language Reference" manual.
  8759.  
  8760.  Code Example
  8761.  ------------
  8762.  
  8763.  DEFINT A-Z
  8764.  CONST TRUE = -1
  8765.  CONST FALSE = NOT TRUE
  8766.  
  8767.  NumFiles = 255             'Maximum number of filenames to hold
  8768.  Counter = 0
  8769.  Finished = FALSE
  8770.  DIM FileName$(NumFiles)
  8771.  
  8772.  CLS     'Enter DIR type filespec, for example "C:\*.BAS":
  8773.  INPUT "Enter filespec:"; Path$
  8774.  
  8775.  TempName$ = DIR$(Path$)             'Get the first filename.
  8776.  IF TempName$ = "" THEN
  8777.    PRINT "No file(s) found"
  8778.  ELSE
  8779.    FileName$(Counter) = TempName$ ' Keep getting filenames until we
  8780.    Counter = Counter + 1      ' have NumFiles worth or we get them all.
  8781.    DO
  8782.      TempName$ = DIR$
  8783.      IF TempName$ <> "" THEN FileName$(Counter) = TempName$
  8784.      Counter = Counter + 1
  8785.    LOOP WHILE TempName$ <> "" AND Counter <= NumFiles
  8786.  END IF
  8787.  
  8788.  IF FileName$(0) <> "" THEN    'Display filenames if we received any.
  8789.    Counter = 0
  8790.    DO
  8791.      PRINT FileName$(Counter)
  8792.      IF FileName$(Counter) = "" THEN Finished = TRUE
  8793.      Counter = Counter + 1
  8794.    LOOP WHILE Counter <= NumFiles AND NOT Finished
  8795.  END IF
  8796.  
  8797.  
  8798.  149. Menus Cannot Have Zero Items in BASIC PDS 7.00 UI Toolbox
  8799.  
  8800.  Product Version(s): 7.00
  8801.  Operating System:   MS-DOS
  8802.  Flags: ENDUSER | SR# S900108-113
  8803.  Last Modified: 14-JAN-1990    ArticleIdent: Q57672
  8804.  
  8805.  The User Interface (UI) Toolbox routines provided with Microsoft BASIC
  8806.  Professional Development System (PDS) Version 7.00 do not allow menus
  8807.  without menu items.
  8808.  
  8809.  Because of this design, it is necessary to always have menu items to
  8810.  choose from. It may be possible to alter the source for the menu
  8811.  routines (MENU.BAS) and change the functionality to add the ability
  8812.  for menus without items.
  8813.  
  8814.  This feature is under review and will be considered for inclusion in a
  8815.  future release.
  8816.  
  8817.  
  8818.  150. "Typed Variable Not Allowed in Expression" Using Nested Arrays
  8819.  
  8820.  Product Version(s): 7.00   | 7.00
  8821.  Operating System:   MS-DOS | OS/2
  8822.  Flags: ENDUSER | SR# S891220-141 buglist7.00 fixlist7.10
  8823.  Last Modified: 20-SEP-1990    ArticleIdent: Q57709
  8824.  
  8825.  Microsoft BASIC Professional Development System (PDS) version 7.00
  8826.  allows static arrays as fields of user-defined TYPEs. This feature
  8827.  allows programs to have complex data structures such as nested arrays
  8828.  (a nested array is an array of user-defined-TYPE records that contain
  8829.  an array).
  8830.  
  8831.  However, compile-time errors occur using the ERASE statement and the
  8832.  LBOUND and UBOUND functions on an array of arrays (nested in a
  8833.  user-defined TYPE) when subscripted by means of a user-defined TYPE.
  8834.  The BC.EXE compiler gives the messages "Syntax error" and "Typed
  8835.  variable not allowed in expression." This problem occurs only when the
  8836.  code is compiled with BC.EXE, not when it is compiled with QBX.EXE.
  8837.  
  8838.  The array reference needed to produce the problem looks like the
  8839.  following:
  8840.  
  8841.     PRINT UBOUND(array2(typedvariable.field).nestedarray1)
  8842.  
  8843.  Microsoft has confirmed this to be a problem in BC.EXE in Microsoft
  8844.  BASIC Professional Development System (PDS) version 7.00 for MS-DOS
  8845.  and MS OS/2. This problem was corrected in BASIC PDS version 7.10.
  8846.  
  8847.  You can work around this problem by using a non-TYPEd variable as the
  8848.  subscript for the nested array (see the workaround example below).
  8849.  
  8850.  Code Example
  8851.  ------------
  8852.  
  8853.  The following code example illustrates the problem:
  8854.  
  8855.     TYPE Type1
  8856.        Array1(1 TO 1) AS INTEGER
  8857.     END TYPE
  8858.     TYPE Type2
  8859.        Number AS INTEGER
  8860.     END TYPE
  8861.     DIM Array2(1 TO 1) AS Type1
  8862.     DIM Var AS Type2
  8863.     Var.Number = 1
  8864.     PRINT LBOUND(Array2(Var.Number).Array1)
  8865.     '                   ^^^^^^^^^^ This TYPEd variable causes the error.
  8866.  
  8867.  The following code example shows a workaround for the problem:
  8868.  
  8869.     TYPE Type1
  8870.        Array1(1 TO 1) AS INTEGER
  8871.     END TYPE
  8872.     TYPE Type2
  8873.        Number AS INTEGER
  8874.     END TYPE
  8875.     DIM Array2(1 TO 1) AS Type1
  8876.     DIM Var AS Type2
  8877.     Var.Number = 1
  8878.     Var2% = Var.Number
  8879.     PRINT LBOUND(Array2(Var2%).Array1)
  8880.     '                   ^^^^^ Non-TYPEd variable will work.
  8881.  
  8882.  
  8883.  151. QB/QBX "Out of Stack Space" Using Large TYPE as SUB Parameter
  8884.  
  8885.  Product Version(s): 4.00 4.00b 4.50
  8886.  Operating System:   MS-DOS
  8887.  Flags: ENDUSER | buglist4.00 buglist4.00b buglist4.50 B_BasicCom
  8888.  Last Modified: 20-SEP-1990    ArticleIdent: Q57711
  8889.  
  8890.  The program below demonstrates a problem with the QuickBASIC (QB.EXE)
  8891.  and QuickBASIC Extended (QBX.EXE) editors in which the environment
  8892.  runs out of stack space when passing a large user-defined TYPE
  8893.  variable to a SUBprogram.
  8894.  
  8895.  Microsoft has confirmed this to be a problem in QB.EXE in Microsoft
  8896.  QuickBASIC versions 4.00, 4.00b, and 4.50 for MS-DOS; in QB.EXE
  8897.  shipped with Microsoft BASIC Compiler 6.00 and 6.00b (buglist6.00,
  8898.  buglist6.00b) for MS-DOS; and in the QBX.EXE editor that comes with
  8899.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  8900.  and 7.10 for MS-DOS (buglist7.00, buglist7.10). We are researching
  8901.  this problem and will post new information here as it becomes
  8902.  available.
  8903.  
  8904.  This problem does not occur in .EXE programs compiled with BC.EXE.
  8905.  
  8906.  The minimum code to duplicate this "Out of stack space" error is as
  8907.  follows:
  8908.  
  8909.  1. Create a TYPE that is near the size of, or larger than, the
  8910.     available stack space. (A TYPE with 2400 bytes is adequate to show
  8911.     the problem in both QB.EXE and QBX.EXE. QB.EXE has a default
  8912.     program stack size of 2K, and QBX.EXE has a default program stack
  8913.     size of 3K).
  8914.  
  8915.  2. DIMension an array of that TYPE. An array of one element is all
  8916.     that is necessary to reproduce the problem. The array can be
  8917.     either $DYNAMIC or $STATIC.
  8918.  
  8919.  3. Create a SUBprogram that takes a single element of this TYPE as a
  8920.     parameter. The SUB does not have to contain any code at all.
  8921.  
  8922.  4. CALL the SUB and pass one element of this array.
  8923.  
  8924.  5. Run the program by pressing SHIFT+F5 in the environment.
  8925.  
  8926.  Attempting to run this program in the editor produces an "Out of stack
  8927.  space" error followed by an "Out of memory" error before the program
  8928.  even begins to execute. The errors do NOT occur at the time of the
  8929.  CALL because the program is pushing information onto the stack. This
  8930.  can be shown by putting a breakpoint on the CALL and then attempting
  8931.  to execute the program. The CALL is never reached; the problem occurs
  8932.  during the binding and final memory allocation steps.
  8933.  
  8934.  This problem does not occur when the program is compiled with the
  8935.  BC.EXE compiler.
  8936.  
  8937.  To work around this problem, dimension the TYPEd array with DIM SHARED
  8938.  or put it in a COMMON SHARED statement.
  8939.  
  8940.  The following is the minimum amount of code needed to reproduce the
  8941.  problem:
  8942.  
  8943.     DECLARE SUB sub1 (boot AS ANY)
  8944.     TYPE rec1
  8945.       jump1 AS STRING * 2400
  8946.     END TYPE
  8947.     DIM var1(1) AS rec1
  8948.     CALL sub1(var1(1))
  8949.     END
  8950.     SUB sub1 (boot AS rec1)
  8951.     END SUB
  8952.  
  8953.  The following code example shows one workaround:
  8954.  
  8955.     DECLARE SUB sub1 ()
  8956.     TYPE rec1
  8957.       jump1 AS STRING * 2400
  8958.     END TYPE
  8959.     DIM SHARED var1(1) AS rec1
  8960.     CALL sub1
  8961.     END
  8962.     SUB sub1
  8963.     END SUB
  8964.  
  8965.  
  8966.  152. Repeated Word on Page 611 BASIC 7.0 Programmer's Guide
  8967.  
  8968.  Product Version(s): 7.00   | 7.00
  8969.  Operating System:   MS-DOS | OS/2
  8970.  Flags: ENDUSER | docerr SR# S900112-170
  8971.  Last Modified: 20-JAN-1990    ArticleIdent: Q57777
  8972.  
  8973.  On Page 611 of the "Microsoft BASIC Version 7.0: Programmer's Guide,"
  8974.  there is a repeated word in the explanation of the stub file
  8975.  NOFLTIN.OBJ. The error is shown below.
  8976.  
  8977.  Page 611 states the following:
  8978.  
  8979.     If you link with NOFLTIN.OBJ, all numbers numbers used by INPUT,
  8980.     READ, and VAL must be legal long integers.
  8981.  
  8982.  It should be corrected to read as follows:
  8983.  
  8984.     If you link with NOFLTIN.OBJ, all numbers used by INPUT, READ,
  8985.     and VAL must be legal long integers.
  8986.  
  8987.  
  8988.  153. FORTRAN READ Statement Hangs in OS/2 If Called from BASIC
  8989.  
  8990.  Product Version(s): 6.00 6.00b 7.00
  8991.  Operating System:   OS/2
  8992.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 SR# S900103-146
  8993.  Last Modified: 17-JAN-1990    ArticleIdent: Q57795
  8994.  
  8995.  When running under MS OS/2, a Microsoft BASIC program LINKed with a
  8996.  FORTRAN routine that contains a READ statement will hang during
  8997.  execution. The same program compiled and linked under MS-DOS will run
  8998.  correctly.
  8999.  
  9000.  This problem occurs in Microsoft BASIC Compiler Versions 6.00 and
  9001.  6.00b for OS/2 and in Microsoft BASIC Professional Development System
  9002.  (PDS) Version 7.00 for OS/2. Microsoft is researching this problem and
  9003.  will post new information here as it becomes available.
  9004.  
  9005.  The following two programs will hang when run. To demonstrate these
  9006.  programs from an .EXE program, compile and link as follows with the
  9007.  BASIC compiler and Microsoft FORTRAN Optimizing Compiler Version 5.00:
  9008.  
  9009.     BC /O /Lp BAS;
  9010.     FL /c /FPi /Lp FOR.FOR ;
  9011.     LINK /NOE /NOD BAS FOR,,,BCOM60.LIB LLIBFE.LIB;
  9012.  
  9013.  Please note that the above FORTRAN library LLIBFE.LIB may be called
  9014.  LLIBFEP.LIB, depending on how you installed FORTRAN.
  9015.  
  9016.  Code Example
  9017.  ------------
  9018.  
  9019.  The following BASIC program is BAS.BAS, which calls a FORTRAN
  9020.  procedure:
  9021.  
  9022.     DECLARE SUB FPROG()
  9023.     DIM A%(500)
  9024.     COMMON SHARED /NMALLOC/ A%()
  9025.     PRINT "Calling FORTRAN"
  9026.     CALL FPROG
  9027.     END
  9028.  
  9029.  The following program is FOR.FOR, which prompts you for input and then
  9030.  should display the entered value:
  9031.  
  9032.        SUBROUTINE FPROG()
  9033.           INTEGER i
  9034.           WRITE (*,*) 'Please enter i'
  9035.           READ (*, *) i
  9036.           WRITE (*, *) 'This is i:', i
  9037.        END
  9038.  
  9039.  BAS.EXE produces the following output, and then hangs:
  9040.  
  9041.     Calling FORTRAN
  9042.     Please enter i
  9043.  
  9044.  
  9045.  154. QBX.EXE 7.00 Editor Black & White Only on PS/2 Model 60 & 80
  9046.  
  9047.  Product Version(s): 7.00
  9048.  Operating System:   MS-DOS
  9049.  Flags: ENDUSER | SR# S900111-148
  9050.  Last Modified: 20-JUN-1990    ArticleIdent: Q57796
  9051.  
  9052.  The QuickBASIC Extended (QBX.EXE) environment may have problems
  9053.  displaying colors on certain IBM PS/2 models with an out-of-date 8514
  9054.  adaptor card. QBX.EXE loads and correctly runs programs that execute
  9055.  graphics in VGA SCREEN modes 12 and 13. However, the editor itself
  9056.  comes up in gray, black, and white. The only colors available under
  9057.  Display on the Options menu are gray, black, and white.
  9058.  
  9059.  This problem may be corrected by contacting IBM and updating the 8514
  9060.  adaptor card (or the BIOS chip on the card).
  9061.  
  9062.  This information applies to the QuickBASIC Extended editor (QBX.EXE)
  9063.  in Microsoft BASIC Professional Development System (PDS) version 7.00
  9064.  for MS-DOS.
  9065.  
  9066.  Microsoft Product Support Services has verified this problem on a PS/2
  9067.  model 60 that has a built-in VGA with an 8514 VGA color monitor. This
  9068.  problem was reproduced under MS-DOS version 3.30, under PC-DOS version
  9069.  3.30, and under the DOS 3.x box in IBM OS/2 version 1.20.
  9070.  
  9071.  One customer also reported this problem on a PS/2 model 80 with an
  9072.  8514A monitor. Microsoft has not confirmed this problem on a PS/2
  9073.  model 80.
  9074.  
  9075.  Another customer reported that on an IBM PS/2 Model 80 (under IBM DOS
  9076.  4.00) with an 8514 video card and an 80387 coprocessor installed, the
  9077.  QBX.EXE editor displays in monochrome. However, if the coprocessor is
  9078.  disabled (SET NO87="Coprocessor Disabled"), the QBX.EXE editor
  9079.  displays the proper colors. (No TSR or device drivers were in the
  9080.  system during this test.) Microsoft has not confirmed this report.
  9081.  
  9082.  A customer has also reported this problem on an IBM PS/2 Model 70
  9083.  using an 8515 monitor. Microsoft has not confirmed this report.
  9084.  
  9085.  To demonstrate that these color problems are due to the card, do the
  9086.  following:
  9087.  
  9088.  1. Start QBX.EXE.
  9089.  
  9090.  2. Unplug the monitor from the 8514 card.
  9091.  
  9092.  3. Plug the monitor into the VGA on the motherboard.
  9093.  
  9094.  4. Unplug the monitor and plug it back into the 8514 card, and correct
  9095.     color now returns.
  9096.  
  9097.  
  9098.  155. Problems Using BASIC 7.00 with Novell Advanced NetWare 2.15
  9099.  
  9100.  Product Version(s): 7.00
  9101.  Operating System:   MS-DOS
  9102.  Flags: ENDUSER | SR# S900112-81
  9103.  Last Modified:  1-AUG-1990    ArticleIdent: Q57797
  9104.  
  9105.  Microsoft BASIC Professional Development System (PDS) version 7.00 has
  9106.  not been fully tested under nor is it guaranteed to run under any
  9107.  version of Novell NetWare. Below are some confirmed and unconfirmed
  9108.  cases of problems using BASIC PDS 7.00 programs with Novell NetWare.
  9109.  
  9110.  Confirmed QBX.EXE Hanging Report
  9111.  --------------------------------
  9112.  
  9113.  1. Microsoft Product Support Services performed one test that showed
  9114.     that QBX.EXE may hang under Novell Advanced NetWare version 2.15
  9115.     revision C. This test was performed on an IBM AT with a 16-bit
  9116.     Ungermann Bass network card. The test was run on a nondedicated
  9117.     Novell server. The QBX.EXE editor screen comes up, but at this
  9118.     point, the machine hangs and requires a cold reboot.
  9119.  
  9120.     This information applies to the QBX.EXE editor that comes with
  9121.     Microsoft BASIC Professional Development System (PDS) version 7.00
  9122.     for MS-DOS.
  9123.  
  9124.  Unconfirmed QBX.EXE Hanging Reports
  9125.  -----------------------------------
  9126.  
  9127.  1. A customer reported that QBX.EXE can hang under the following
  9128.     configuration:
  9129.  
  9130.        COMPAQ 386/20 or ALR 386/33 computer
  9131.        Version 2.15 Novell Advanced NetWare
  9132.        Micom Interland board NI52100TP-8
  9133.        Microsoft Mouse 7.00
  9134.  
  9135.     When the customer booted without the Novell drivers, or with the
  9136.     Novell drivers and without the Microsoft Mouse 7.00 driver, QBX.EXE
  9137.     worked correctly without hanging. Microsoft has not confirmed this
  9138.     information.
  9139.  
  9140.  2. A customer reported that QBX.EXE can hang under the following
  9141.     configuration:
  9142.  
  9143.        IBM PS/2 Model 50z computer
  9144.        Version 2.15 revision C Novell SFT network
  9145.  
  9146.  3. A customer reported that a BASIC PDS 7.00 program using the
  9147.     OPEN COM statement may hang on a workstation connected to Novell
  9148.     Advanced NetWare version 2.15 revision A. When a Quarterdeck QEMM
  9149.     version 5.00 expanded memory driver was installed, the machine
  9150.     would not hang, but instead, QEMM would return an "Exception 12"
  9151.     error. When the software for the Novell Network was removed, the
  9152.     computer would not hang, nor would it generate an Exception 12
  9153.     error with the QEMM driver loaded. Microsoft has not confirmed this
  9154.     problem. The customer reported the problem on the following
  9155.     configuration:
  9156.  
  9157.        Dell System 310
  9158.        Novell Advanced NetWare version 2.15 revision A
  9159.        DOS version 3.30
  9160.        80387 math coprocessor
  9161.        4 MB extended memory
  9162.        Video Seven VGA video card
  9163.        Phoenix 80386 ROM BIOS Plus version 1.10 A05
  9164.        Western Digital EtherCard Plus 16, or 3Com EtherLink card
  9165.  
  9166.  4. A customer reported that QBX.EXE hangs on the following
  9167.     configuration (customer did not test same program run from .EXE):
  9168.  
  9169.        Novell NetWare 2.15 SFT revision C
  9170.        Everex Step 386
  9171.        Version 3 AMI BIOS
  9172.        MS-DOS version 4.01
  9173.  
  9174.  5. A customer reported that QBX.EXE hangs on the following
  9175.     configuration (customer did not test same program run from .EXE):
  9176.  
  9177.      Novell SFT NetWare 286 version 2.15 revision B
  9178.      Uknown name AT 286
  9179.      1 MB RAM
  9180.      MDI Graphics Card (Hercules-compatible)
  9181.      MF-II keyboard
  9182.      MS-DOS 3.30
  9183.  
  9184.  
  9185.  156. LINK /PAC Switch in 6.00/6.00b Is Now /PACKC in BASIC PDS 7.00
  9186.  
  9187.  Product Version(s): 7.00 7.10 | 7.00 7.10
  9188.  Operating System:   MS-DOS    | OS/2
  9189.  Flags: ENDUSER | docerr SR# S900116-46
  9190.  Last Modified:  8-JAN-1991    ArticleIdent: Q57852
  9191.  
  9192.  The LINK.EXE /PACKCODE switch of the Microsoft Segmented-Executable
  9193.  Linker version 5.01.20, shipped with Microsoft BASIC Compiler versions
  9194.  6.00 and 6.00b for MS-DOS and MS OS/2, can be abbreviated with /PAC on
  9195.  the LINK command line. The same is true for the Microsoft Overlay
  9196.  Linker shipped with Microsoft QuickBASIC versions 4.00, 4.00b, and
  9197.  4.50.
  9198.  
  9199.  This abbreviation has changed to /PACKC in the Segmented-Executable
  9200.  Linker version 5.05 shipped with Microsoft BASIC Professional
  9201.  Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS
  9202.  OS/2.
  9203.  
  9204.  On Page 589 of the "Microsoft BASIC 7.0: Programmer's Guide" (for
  9205.  versions 7.00 and 7.10) the abbreviation for /PACKCODE is incorrectly
  9206.  documented as being /PAC. It should be changed to /PACKC.
  9207.  
  9208.  In addition, eleven occurences of /PAC should be changed to /PACKC on
  9209.  Pages 596-597 of the "Microsoft BASIC 7.0: Programmer's Guide" (for
  9210.  versions 7.00 and 7.10).
  9211.  
  9212.  The /PACKCODE switch abbreviation was changed from /PAC to /PACKC
  9213.  because a new switch was added to the linker to take advantage of
  9214.  Microsoft BASIC PDS's ability to manage multiple data segments (far
  9215.  strings). The name of the new switch is /PACKDATA and is used to pack
  9216.  small data segments together. Its abbreviation is /PACKD.
  9217.  
  9218.  Although it is not ambiguous to have one switch abbreviated /PAC and
  9219.  another /PACKD, because the switches have similar functions, it is
  9220.  more logical for their abbreviations to have the same first 4 letters
  9221.  ("PACK") followed by a distinguishing letter ("C" or "D").
  9222.  
  9223.  
  9224.  157. BASIC 7.00 WindowDo Doesn't Trap Click in Current Window
  9225.  
  9226.  Product Version(s): 7.00
  9227.  Operating System:   MS-DOS
  9228.  Flags: ENDUSER | SR# S891113-16
  9229.  Last Modified: 20-JAN-1990    ArticleIdent: Q57853
  9230.  
  9231.  The WindowDo procedure of the WINDOW.BAS toolbox file that is included
  9232.  with Microsoft BASIC Professional Development System (PDS) Version
  9233.  7.00 for MS-DOS will not trap a click in the current window unless
  9234.  that click is in a button or edit field.
  9235.  
  9236.  To work around this limitation, open an "area" button (button type 4)
  9237.  in the current window that is exactly the same size as the current
  9238.  window. This does not make the WindowDo procedure trap clicks in the
  9239.  current window (it is only trapping a click in a button), but it
  9240.  appears so because an area button is invisible.
  9241.  
  9242.  The WindowDo procedure allows you to trap window events such as
  9243.  selecting buttons and edit fields, resizing, moving, or closing a
  9244.  window, and selecting a window other than the current window. However,
  9245.  WindowDo cannot trap a click in the current window itself unless the
  9246.  click occurs on a button or edit field in that window.
  9247.  
  9248.  For example, suppose a program opens up two windows. For simplicity,
  9249.  we will assume that there are no buttons or edit fields opened in
  9250.  either window. By default, the last window opened (window2) is the
  9251.  current window. The WindowDo procedure will trap a click in the other
  9252.  window (window1) but not in window2. This is a design limitation of
  9253.  the WindowDo procedure and is not considered a problem.
  9254.  
  9255.  To easily work around this situation, in the current window, open an
  9256.  area button (button type 4) that is exactly the same size as the
  9257.  current window. The WindowDo procedure is still trapping a click in a
  9258.  button, but it appears as if a click is being trapped anywhere in the
  9259.  window because the button is hidden. Type 4 buttons are invisible.
  9260.  
  9261.  For a detailed explanation of the WindowDo procedure, see Page 572 of
  9262.  the "Microsoft BASIC Version 7.0: Language Reference" manual. For more
  9263.  information on area buttons (button type 4), see the ButtonOpen
  9264.  procedure on Page 557 of the same manual.
  9265.  
  9266.  The following example program illustrates the limitation and its
  9267.  workaround:
  9268.  
  9269.  '$INCLUDE: 'general.bi'   'These INCLUDE, COMMON SHARED, and DIM
  9270.  '$INCLUDE: 'mouse.bi'     'statements are generally those needed
  9271.  '$INCLUDE: 'menu.bi'      'for using the User Interface Toolbox.
  9272.  '$INCLUDE: 'window.bi'
  9273.  
  9274.  COMMON SHARED /uitools/ GloMenu           AS MenuMiscType
  9275.  COMMON SHARED /uitools/ GloTitle()        AS MenuTitleType
  9276.  COMMON SHARED /uitools/ GloItem()         AS MenuItemType
  9277.  COMMON SHARED /uitools/ GloWindow()       AS WindowType
  9278.  COMMON SHARED /uitools/ GloButton()       AS ButtonType
  9279.  COMMON SHARED /uitools/ GloEdit()         AS EditFieldType
  9280.  COMMON SHARED /uitools/ GloStorage        AS WindowStorageType
  9281.  COMMON SHARED /uitools/ GloWindowStack()  AS INTEGER
  9282.  COMMON SHARED /uitools/ GloBuffer$()
  9283.  
  9284.  DIM GloTitle(MAXMENU)           AS MenuTitleType
  9285.  DIM GloItem(MAXMENU, MAXITEM)   AS MenuItemType
  9286.  DIM GloWindow(MAXWINDOW)        AS WindowType
  9287.  DIM GloButton(MAXBUTTON)        AS ButtonType
  9288.  DIM GloEdit(MAXEDITFIELD)       AS EditFieldType
  9289.  DIM GloWindowStack(MAXWINDOW)   AS INTEGER
  9290.  DIM GloBuffer$(MAXWINDOW + 1, 2)
  9291.  
  9292.  CLS
  9293.  CALL WindowInit   'Initialize window and mouse routines.
  9294.  CALL MouseInit
  9295.  
  9296.  'Open window1. It is the current window..
  9297.  CALL WindowOpen(1, 4, 20, 20, 36, 14, 1, 14, 1, 15, FALSE, FALSE,_
  9298.                  FALSE, FALSE, 1, "Window 1")
  9299.  
  9300.  'Open window2, it is now the current window.
  9301.  CALL WindowOpen(2, 4, 45, 20, 61, 14, 1, 14, 1, 15, FALSE, FALSE,_
  9302.                  FALSE, FALSE, 1, "Window 2")
  9303.  
  9304.  CALL MouseShow        'Show the mouse cursor.
  9305.  
  9306.  CALL WindowDo(0, 0)   'Wait for a window event to happen.
  9307.                        'The program will not continue until window1 is
  9308.                        'clicked. This is because clicking in window2
  9309.                        '(the current window) is not trapped by the
  9310.                        'WindowDo procedure.
  9311.  
  9312.  'Assume window1 is the current window now.
  9313.  
  9314.  'Open an area button in the current window that is the same size as
  9315.  'the current window.
  9316.  CALL ButtonOpen(1, 0, "", 1, 1, 17, 17, 4)
  9317.  
  9318.  CALL WindowDo(0, 0)   'Wait for a window event to happen.
  9319.                        'The program will continue if either window is
  9320.                        'clicked. Clicking window2 will be trapped
  9321.                        'because it is not the current window. Clicking
  9322.                        'window1 will be trapped because there is a
  9323.                        'button (although invisible) in window1 that
  9324.                        'is the same size as window1.
  9325.  
  9326.  
  9327.  158. BASIC PDS 7.00 Supports Short-Circuit Boolean Expressions
  9328.  
  9329.  Product Version(s): 7.00   | 7.00
  9330.  Operating System:   MS-DOS | OS/2
  9331.  Flags: ENDUSER | B_QuickBas SR# S890703-44
  9332.  Last Modified: 20-JAN-1990    ArticleIdent: Q57866
  9333.  
  9334.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  9335.  supports "short-circuit" optimization of Boolean expressions, as
  9336.  described below. To take advantage of this speed optimization in
  9337.  complex IF, WHILE, DO LOOP WHILE, or DO LOOP UNTIL statements, the
  9338.  quickest Boolean conditions should appear first.
  9339.  
  9340.  Microsoft QuickBASIC Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00,
  9341.  4.00, 4.00b, and 4.50 and Microsoft BASIC Compiler Versions 6.00 and
  9342.  6.00b DON'T support short-circuit Boolean expressions.
  9343.  
  9344.  Boolean expressions are those expressions in BASIC that evaluate to
  9345.  true or false. In BASIC, the IF, WHILE, and DO LOOP {WHILE | UNTIL}
  9346.  statements all require Boolean expressions as part of their syntax.
  9347.  
  9348.  A "short-circuit" Boolean expression is a unique kind of Boolean
  9349.  expression. If a Boolean expression consists of more than one part,
  9350.  not all the parts may be evaluated. The evaluation of the expression
  9351.  may stop, or "short circuit," partway through. Consider the following
  9352.  two-part Boolean expression:
  9353.  
  9354.     IF <condition1> AND <condition2> THEN
  9355.  
  9356.  If <condition1> evaluates to false, it isn't necessary to evaluate
  9357.  <condition2>, because "false" AND "anything else" is still false.
  9358.  Therefore, we can short circuit the expression and not evaluate
  9359.  <condition2>.
  9360.  
  9361.  The same rule applies to the following expression:
  9362.  
  9363.     IF <condition1> OR <condition2> THEN
  9364.  
  9365.  If <condition1> is true, we do not need to evaluate <condition2>
  9366.  because "true" OR "anything else" always evaluates to true.
  9367.  
  9368.  Short-circuit Boolean expressions are desirable for two reasons.
  9369.  First, they allow you to optimize code by evaluating only as much of
  9370.  the Boolean expression as necessary. This can generate faster, more
  9371.  efficient code. In the examples above, if <condition2> were very
  9372.  complex, a short-circuit Boolean might speed up program execution by
  9373.  evaluating the whole expression only when absolutely necessary.
  9374.  Second, short-circuit Booleans can be used to prevent error
  9375.  conditions. In the code example below, BASIC PDS 7.00 prevents the
  9376.  "Division by zero" error in .EXE programs since it supports
  9377.  short-circuit Booleans. QBX.EXE programs in BASIC 7.00, and QB.EXE and
  9378.  .EXE programs in QuickBASIC 4.00, 4.00b, and 4.50, give the "Division by
  9379.  zero" error.
  9380.  
  9381.  BASIC 7.00 will short circuit IF expressions as long as doing so does
  9382.  not change the semantics of the statement. The following is an
  9383.  example:
  9384.  
  9385.     IF (a% < b%) OR (c! < d!) THEN PRINT
  9386.  
  9387.  The compiler compares a% and b%. If a% is less than b%, the compiler
  9388.  skips the floating-point comparison. On the other hand, consider the
  9389.  following statements:
  9390.  
  9391.     DECLARE FUNCTION Foo! (p!)
  9392.     IF (a% < b%) OR (c! < Foo!(d!)) THEN PRINT
  9393.  
  9394.  The compiler avoids the floating-point comparison when a% is less
  9395.  than b%, but it still calls the function Foo. This is because existing
  9396.  programs may rely on the side effects of the function Foo.
  9397.  
  9398.  This feature affects the best way to write code in BASIC PDS 7.00.
  9399.  Specifically, in complex IF, WHILE, DO LOOP WHILE, or DO LOOP UNTIL
  9400.  conditions, the quickest conditions should appear first.
  9401.  
  9402.  Code Example
  9403.  ------------
  9404.  
  9405.  The following program determines if a compiler supports short-circuit
  9406.  Boolean optimization for an IF statement. Since it supports
  9407.  short-circuit Booleans, BASIC PDS Version 7.00 prevents the "Division
  9408.  by zero" error in the .EXE program. QBX.EXE programs in BASIC 7.00,
  9409.  and QB.EXE and .EXE programs in QuickBASIC 4.00, 4.00b, and 4.50, give
  9410.  the "Division by zero" error.
  9411.  
  9412.  DEFINT A-Z
  9413.  ON ERROR GOTO errorhandle
  9414.  a = 1
  9415.  b = 1
  9416.  c = 0
  9417.  CLS
  9418.  LOCATE 10, 10
  9419.  
  9420.  ' In the following IF statement, b / c is not executed if
  9421.  ' short-circuit Booleans are supported because a = 1 evaluates to
  9422.  ' true, and therefore, the whole expression is true. This is
  9423.  ' because (true OR <anything>) evaluates to true.
  9424.  
  9425.  IF (a = 1 OR ((b / c) = 1)) THEN
  9426.     ' If this PRINTs, then short-circuit Booleans are supported.
  9427.     PRINT "This compiler supports short-circuit Booleans"
  9428.  END IF
  9429.  terminate:
  9430.  PRINT "End of program reached"
  9431.  END
  9432.  errorhandle:
  9433.     IF ERR = 11 THEN PRINT "Division by zero, Error="; ERR
  9434.     LOCATE 11, 10
  9435.     PRINT "This compiler does not support short-circuit Booleans"
  9436.     RESUME terminate     ' End the program.
  9437.  
  9438.  
  9439.  159. BUILDRTM.EXE Requires BASIC 7.00 Component Libraries; SETUP
  9440.  
  9441.  Product Version(s): 7.00   | 7.00
  9442.  Operating System:   MS-DOS | OS/2
  9443.  Flags: ENDUSER |
  9444.  Last Modified:  2-FEB-1990    ArticleIdent: Q57882
  9445.  
  9446.  The BUILDRTM.EXE utility program for Microsoft BASIC Professional
  9447.  Development System (PDS) Version 7.00 can be used to create custom
  9448.  run-time modules. For BUILDRTM to function, you must have the
  9449.  component libraries available.
  9450.  
  9451.  The component libraries are installed by the BASIC PDS 7.00 SETUP.EXE
  9452.  program, but are deleted unless you specify that they be maintained.
  9453.  (You are prompted to delete or keep the component libraries during the
  9454.  setup procedure).
  9455.  
  9456.  The following lists show the component libraries needed to use
  9457.  BUILDRTM under real mode (MS-DOS) and OS/2 protected mode (note that
  9458.  all component library files have a .LIB extension):
  9459.  
  9460.  Real Mode (MS-DOS) Component Libraries
  9461.  --------------------------------------
  9462.  
  9463.     B70OBJ.LIB    B70OBN.LIB    B70ORN.LIB    B70ROBJ.LIB   B70RORJ.LIB
  9464.     B70ROBN.LIB   B70RORN.LIB   B70ROEJ.LIB   B70ROEN.LIB   B70S.LIB
  9465.     BLIBFP.LIB    EMR.LIB       B70RLN.LIB    B70RCN.LIB
  9466.  
  9467.  MS OS/2 Protected Mode Component Libraries
  9468.  ------------------------------------------
  9469.  
  9470.     B70OBJ.LIB    B70OBN.LIB    B70ORN.LIB    B70POBJR.LIB  B70PORJ.LIB
  9471.     B70POBN.LIB   B70PORN.LIB   B70POEJ.LIB   B70POEN.LIB   B70S.LIB
  9472.     BLIBFP.LIB    EMP.LIB       B70PLN.LIB    B70PCN.LIB    OS2.LIB
  9473.  
  9474.  To install these libraries, run the BASIC PDS 7.00 SETUP.EXE program,
  9475.  select the libraries you want to install (real or protected mode), and
  9476.  then specify that you want to maintain the component libraries.
  9477.  
  9478.  
  9479.  160. UI Toolbox Menu Bar with Menu Past 64th Column Shows Garbage
  9480.  
  9481.  Product Version(s): 7.00 7.10
  9482.  Operating System:   MS-DOS
  9483.  Flags: ENDUSER | SR# S900112-171 buglist7.00 buglist7.10
  9484.  Last Modified: 20-SEP-1990    ArticleIdent: Q57883
  9485.  
  9486.  The User Interface (UI) Toolbox shipped with Microsoft BASIC
  9487.  Professional Development System (PDS) versions 7.00 and 7.10
  9488.  incorrectly processes menu bars when the last menu item starts in the
  9489.  64th or higher column. The symptom of this errant behavior is that
  9490.  garbage characters are displayed on the screen after that menu is
  9491.  deselected.
  9492.  
  9493.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  9494.  versions 7.00 and 7.10 for MS-DOS. We are researching this problem and
  9495.  will post new information here as it becomes available. A correction
  9496.  for this problem in MENU.BAS is shown below.
  9497.  
  9498.  To correct the source code, MENU.BAS, so that it will handle longer
  9499.  menu bars correctly, change the following IF statement (found after
  9500.  the "menuDoShowPullDown" label near the end of the MenuDo SUB)
  9501.  
  9502.     LEN(GloTitle(currMenu).text)
  9503.  
  9504.  to
  9505.  
  9506.     LEN(RTRIM$(GloTitle(currMenu).text))
  9507.  
  9508.  in both of the following places:
  9509.  
  9510.    IF GloTitle(currMenu).rColItem - GloTitle(currMenu).lColItem _
  9511.         < LEN(GloTitle(currMenu).text) THEN
  9512.      GloTitle(currMenu).rColItem = _
  9513.         GloTitle(currMenu).lColItem + LEN(GloTitle(currMenu).text)
  9514.    END IF
  9515.  
  9516.  Note: The underscore (_) characters above indicate line continuation
  9517.  to fit in this article. This block IF is actually on three long lines
  9518.  in the original source.
  9519.  
  9520.  The changed code is as follows:
  9521.  
  9522.    IF GloTitle(currMenu).rColItem - GloTitle(currMenu).lColItem _
  9523.         < LEN(RTRIM$(GloTitle(currMenu).text)) THEN
  9524.      GloTitle(currMenu).rColItem = _
  9525.         GloTitle(currMenu).lColItem + LEN(RTRIM$(GloTitle(currMenu).text))
  9526.    END IF
  9527.  
  9528.  This correction should be made and the libraries rebuilt to enable
  9529.  correct handling of menus beginning past the 64th column.
  9530.  
  9531.  The above correction is the same as for a separate article describing
  9532.  a different symptom, where the mouse-selectable area for narrow menus
  9533.  is too wide. To find this and other problems with the User Interface
  9534.  Toolbox, query in this Knowledge Base on the following keywords:
  9535.  
  9536.     user and interface and toolbox and buglist7.00
  9537.  
  9538.  
  9539.  161. Listbox Initialized Incorrectly in BASIC 7.00 UI Toolbox
  9540.  
  9541.  Product Version(s): 7.00 7.10
  9542.  Operating System:   MS-DOS
  9543.  Flags: ENDUSER | SR# S900109-123 buglist7.00 buglist7.10
  9544.  Last Modified: 20-SEP-1990    ArticleIdent: Q57884
  9545.  
  9546.  The ListBox FUNCTION in the User Interface (UI) Toolbox WINDOW.BAS
  9547.  file provided with Microsoft BASIC Professional Development System
  9548.  (PDS) versions 7.00 and 7.10 does not behave correctly when a list box
  9549.  is first activated. On initialization, the keyboard cursor is set on
  9550.  the OK button instead of in the list box.
  9551.  
  9552.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  9553.  versions 7.00 and 7.10 for MS-DOS. We are researching this problem and
  9554.  will post new information here as it becomes available.
  9555.  
  9556.  Without the modification listed below, you must press the TAB key
  9557.  twice before using the cursor keys to move into the list box.
  9558.  
  9559.  To correct this behavior, the initial value of currButton (set early
  9560.  in the ListBox FUNCTION) must be changed from 2 to 0. The following
  9561.  are the statements from the ListBox FUNCTION of WINDOW.BAS adjacent to
  9562.  (and including) the incorrect statement:
  9563.  
  9564.     currTop = 1
  9565.     currPos = 1
  9566.     currButton = 2       '****** Need to change this to currButton = 0
  9567.  
  9568.     GOSUB ListBoxDrawText
  9569.  
  9570.  This correction should be made and the libraries rebuilt to have the
  9571.  cursor positioned properly in the list box.
  9572.  
  9573.  To find other problems with the User Interface Toolbox, query in this
  9574.  Knowledge Base on the following words:
  9575.  
  9576.     User and Interface and Toolbox and buglist7.00
  9577.  
  9578.  
  9579.  162. Disabled First Menu Malfunctions in BASIC 7.00 UI Toolbox
  9580.  
  9581.  Product Version(s): 7.00 7.10
  9582.  Operating System:   MS-DOS
  9583.  Flags: ENDUSER | SR# S900108-102 buglist7.00 buglist7.10
  9584.  Last Modified: 20-SEP-1990    ArticleIdent: Q57885
  9585.  
  9586.  The User Interface (UI) Toolbox menu routines, provided with Microsoft
  9587.  BASIC Professional Development System (PDS) versions 7.00 and 7.10 for
  9588.  MS-DOS, do not behave correctly when the first menu on the line is
  9589.  disabled. In this case, the menu can still be chosen with the ALT+X
  9590.  key combination.
  9591.  
  9592.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  9593.  versions 7.00 and 7.10 for MS-DOS. We are researching this problem and
  9594.  will post new information here as it becomes available.
  9595.  
  9596.  This article provides an example demonstrating the problem and the
  9597.  correction to MENU.BAS.
  9598.  
  9599.  Use the following command line to set up QBX for demonstrating the
  9600.  problem:
  9601.  
  9602.     QBX /L UITBEFR
  9603.  
  9604.  The following code example disables the first (only) menu, but it can
  9605.  still be selected with the ALT+X keys. To demonstrate the problem,
  9606.  press ALT, which incorrectly highlights the first menu, then press the
  9607.  DOWN ARROW, which incorrectly brings down the menu item (without a
  9608.  proper menu box).
  9609.  
  9610.  REM $INCLUDE: 'General.bi'
  9611.  REM $INCLUDE: 'Mouse.bi'
  9612.  REM $INCLUDE: 'Menu.bi'
  9613.  COMMON SHARED /uitools/ GloMenu AS MenuMiscType
  9614.  COMMON SHARED /uitools/ GloTitle() AS MenuTitleType
  9615.  COMMON SHARED /uitools/ GloItem() AS MenuItemType
  9616.  DIM GloTitle(MAXMENU) AS MenuTitleType
  9617.  DIM GloItem(MAXMENU, MAXITEM) AS MenuItemType
  9618.  
  9619.  CLS
  9620.  MenuInit
  9621.  MenuSet 1, 0, 0, "Menu Title", 1   '*** Disable main level menu
  9622.  MenuSet 1, 1, 1, "Exit", 1
  9623.  MenuPreProcess
  9624.  MenuShow
  9625.  MouseShow
  9626.  
  9627.  '*** It should not be possible to select the menu. Pressing
  9628.  '*** ALT highlights the first menu and the arrow brings down
  9629.  '*** other options (with incorrect highlighting).
  9630.  
  9631.  WHILE NOT ((menu = 1) AND (item = 1))
  9632.     IF MenuInkey$ = "menu" THEN
  9633.        menu = MenuCheck(0)
  9634.        item = MenuCheck(1)
  9635.     END IF
  9636.  WEND
  9637.  
  9638.  The following IF statement is taken from the end of the MenuDoInit
  9639.  GOSUB routine near the beginning of the MenuDo SUB:
  9640.  
  9641.      IF lButton THEN
  9642.          mouseMode = TRUE
  9643.          currMenu = 0
  9644.          currItem = 0
  9645.      ELSE
  9646.          mouseMode = FALSE
  9647.          currMenu = 1               '****** These lines need
  9648.          currItem = 0               '****** to be changed.
  9649.          GOSUB MenuDoShowTitleAccessKeys
  9650.      END IF
  9651.  
  9652.  The above IF statement should be replaced with the following IF
  9653.  statement:
  9654.  
  9655.      IF lButton THEN
  9656.          mouseMode = TRUE
  9657.          currMenu = 0
  9658.          currItem = 0
  9659.      ELSE
  9660.          mouseMode = FALSE
  9661.          currMenu = 0               '****** Set defaults to 0
  9662.          currItem = 0               '******
  9663.          FOR m=1 TO MAXMENU         '****** Search each menu
  9664.             IF GloTitle(m).state = 1 THEN ' check state
  9665.                currMenu=m           '****** set menu for 1st state
  9666.                EXIT FOR             '****** and exit
  9667.             END IF                  '******
  9668.          NEXT                       '****** last line of changes
  9669.          GOSUB MenuDoShowTitleAccessKeys
  9670.      END IF
  9671.  
  9672.  This correction should be made and the libraries rebuilt to properly
  9673.  disable a menu item.
  9674.  
  9675.  To find any other problems with the User Interface Toolbox, query on
  9676.  the following words:
  9677.  
  9678.     User and Interface and Toolbox and buglist7.00
  9679.  
  9680.  
  9681.  163. Overhead for /V and /W Event Trapping Is Reduced in BASIC 7.00
  9682.  
  9683.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  9684.  Operating System:   MS-DOS          | OS/2
  9685.  Flags: ENDUSER |
  9686.  Last Modified: 31-JAN-1990    ArticleIdent: Q57890
  9687.  
  9688.  The code overhead for BC /V is only 3 bytes per statement, and the
  9689.  code overhead for BC /W is only 3 bytes per labeled or numbered line,
  9690.  in Microsoft BASIC Professional Development System (PDS) Version 7.00
  9691.  for MS-DOS and MS OS/2.
  9692.  
  9693.  The overhead for these event trapping options is 5 bytes in Microsoft
  9694.  QuickBASIC Versions 4.00, 4.00b, and 4.50 for MS-DOS, and in Microsoft
  9695.  BASIC Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2.
  9696.  
  9697.  Event trapping for the ON <event> GOSUB statements is handled by
  9698.  polling. The <event> can be COM(n), KEY(n), PEN, PLAY(), STRIG, and
  9699.  TIMER. In BASIC 6.00, 6.00b, and 7.00, you can also use ON SIGNAL and
  9700.  ON UEVENT.
  9701.  
  9702.  At various points in your code, as controlled by the /V and /W options
  9703.  and the <event> ON and <event> OFF statements, the compiler places a
  9704.  call instruction to a routine that checks for events. /V places the
  9705.  call on every statement in the module. /W only places the call on
  9706.  every numbered or labeled line in the module. In QuickBASIC Versions
  9707.  4.00, 4.00b, and 4.50 and in Microsoft BASIC Compiler 6.00 and 6.00b,
  9708.  this call occupies 5 bytes. In BASIC 7.00, this has been reduced to 3
  9709.  bytes per call.
  9710.  
  9711.  
  9712.  164. How BC /G2 Option Makes Smaller .EXE Code in BASIC 7.00
  9713.  
  9714.  Product Version(s): 7.00   | 7.00
  9715.  Operating System:   MS-DOS | OS/2
  9716.  Flags: ENDUSER |
  9717.  Last Modified:  2-FEB-1990    ArticleIdent: Q57891
  9718.  
  9719.  In Microsoft BASIC Professional Development System (PDS) Version 7.00
  9720.  for MS-DOS and MS OS/2, the BC /G2 option generates code that is
  9721.  specific to computers containing an 80286 processor chip. Code
  9722.  generated with /G2 will run on computers with 80286 and 80386 chips,
  9723.  but will not run on computers with 8086 or 8088 chips.
  9724.  
  9725.  When compiled with the /G2 option, a program may be zero to ten
  9726.  percent smaller. The percentage by which the size decreases is usually
  9727.  more significant than the percentage by which the speed improves.
  9728.  
  9729.  Note: The 80286 chip is also known as the 286, for short. The 80386 is
  9730.  also known as the 386.
  9731.  
  9732.  The biggest gain from the use of 286 instructions is the PUSH
  9733.  immediate instruction. This is an operation frequently used by the
  9734.  compiler. To get an idea of how many bytes you would save, compile an
  9735.  existing program with the /A option and look for sequences of the
  9736.  following:
  9737.  
  9738.     MOV     reg,constant
  9739.     PUSH    reg
  9740.  
  9741.  These will be replaced with a single PUSH instruction, saving 1 or 2
  9742.  bytes per instance.
  9743.  
  9744.  We provided the BC /G2 option for developers who market their
  9745.  compiled-BASIC products to customers with 286 or 386 machines.
  9746.  
  9747.  
  9748.  165. Buttons Not Allowed in Resizeable Windows in 7.00 UI Toolbox
  9749.  
  9750.  Product Version(s): 7.00
  9751.  Operating System:   MS-DOS
  9752.  Flags: ENDUSER | SR# S891108-73
  9753.  Last Modified:  2-FEB-1990    ArticleIdent: Q57924
  9754.  
  9755.  Resizable windows created by the WindowOpen procedure of the
  9756.  WINDOW.BAS User Interface (UI) Toolbox file are not allowed to contain
  9757.  buttons. This design of the UI Toolbox is not documented. This
  9758.  information applies to Microsoft BASIC Professional Development System
  9759.  (PDS) Version 7.00 for MS-DOS and MS OS/2.
  9760.  
  9761.  Microsoft BASIC PDS 7.00 comes with toolbox files that allow you to
  9762.  program windows, menus, scroll bars, edit fields, and buttons. One of
  9763.  the files, WINDOW.BAS, contains a procedure called ButtonOpen, which
  9764.  opens a button in the current window. Windows themselves can be opened
  9765.  with another procedure in WINDOW.BAS called WindowOpen.
  9766.  
  9767.  Among the many attributes you can specify when opening a window is
  9768.  whether or not the window can be resized. If this attribute is
  9769.  specified, making the window resizable, the ButtonOpen procedure will
  9770.  not open a button in that window. ButtonOpen doesn't report this as an
  9771.  error; it simply doesn't open the button.
  9772.  
  9773.  Although this design is not documented, it is obvious when examining
  9774.  the source code of the ButtonOpen procedure and is considered a
  9775.  limitation, not a problem.
  9776.  
  9777.  The source code of the User Interface Toolbox files (WINDOW.BAS,
  9778.  MENU.BAS, MOUSE.BAS, and GENERAL.BAS) is provided so that you can
  9779.  modify them if you want to overcome any of their inherent limitations,
  9780.  such as the one described above. This modification can be safely done
  9781.  only if you have a full understanding of every module of the User
  9782.  Interface Toolbox, which may require much time and effort.
  9783.  
  9784.  However, a less safe but much quicker workaround for the above
  9785.  limitation has been used successfully. (Note: This procedure has not
  9786.  been extensively tested and is not guaranteed by Microsoft to work
  9787.  properly under any circumstances.)
  9788.  
  9789.  To use this workaround, comment out the line "resize = TRUE" in the
  9790.  ButtonOpen procedure of the WINDOW.BAS file. It is the first and only
  9791.  line inside the first IF/END structure of the procedure. The following
  9792.  code fragment identifies the IF/END structure and the statement that
  9793.  must be commented out:
  9794.  
  9795.     IF MID$(WindowBorder$(GloWindow(WindowCurrent).windowType), 9, 1) =
  9796.     "+" THEN
  9797.         resize = TRUE   'Comment out this statement.
  9798.     END IF
  9799.  
  9800.  After commenting out the line, the ButtonOpen procedure will open
  9801.  buttons in a resizable window. However, it is your responsibility to
  9802.  make sure that any buttons opened stay within the window boundaries
  9803.  after any resizing has been done.
  9804.  
  9805.  
  9806.  166. BASIC Does Not Support 8514 VGA Text Modes in OS/2
  9807.  
  9808.  Product Version(s): 6.00 6.00b 7.00
  9809.  Operating System:   OS/2
  9810.  Flags: ENDUSER | SR# S891229-63
  9811.  Last Modified: 31-JAN-1990    ArticleIdent: Q57927
  9812.  
  9813.  Microsoft BASIC does not support the VGA-specific screen modes, such
  9814.  as 50-line mode, in MS OS/2 protected mode set up for 8514 video
  9815.  cards. If the 8514 card is set up as a VGA card only, then BASIC can
  9816.  recognize the VGA TEXT modes. BASIC offers no support for the 8514
  9817.  extended modes.
  9818.  
  9819.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  9820.  6.00b for MS OS/2, and to Microsoft BASIC Professional Development
  9821.  System (PDS) Version 7.00 for MS OS/2.
  9822.  
  9823.  When trying to utilize VGA-specific line modes, BASIC returns an
  9824.  "Illegal Function Call" error when using an 8514 card in MS OS/2.
  9825.  
  9826.  The following program demonstrates the problem:
  9827.  
  9828.     PRINT "This line will print"
  9829.     WIDTH 80,50         ' this line gives "Illegal Function Call"
  9830.     SYSTEM
  9831.  
  9832.  Compile and link as follows:
  9833.  
  9834.     BC /LP /O TEST.BAS;
  9835.     LINK TEST;
  9836.  
  9837.  
  9838.  167. EXE Does Nothing If BC.EXE Compiled from GW-BASIC Binary Code
  9839.  
  9840.  Product Version(s): 6.00 6.00b 7.00 7.10
  9841.  Operating System:   MS-DOS
  9842.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 buglist7.10
  9843.  Last Modified: 20-SEP-1990    ArticleIdent: Q57931
  9844.  
  9845.  Programs saved in the Binary (the default tokenized) format in the
  9846.  GW-BASIC or BASICA Interpreter will appear to compile in BC.EXE and
  9847.  LINK into an .EXE program without error in the BASIC compilers listed
  9848.  further below. However, the resulting .EXE file created from a Binary
  9849.  GW-BASIC or BASICA source program does nothing when run -- it just
  9850.  drops back to DOS.
  9851.  
  9852.  The BC.EXE compiler fails to abort and give an error message when you
  9853.  mistakenly give it GW-BASIC or BASICA Binary files. Microsoft has
  9854.  confirmed this to be a problem in Microsoft BASIC Compiler versions
  9855.  6.00 and 6.00b; in Microsoft BASIC Professional Development System
  9856.  (PDS) versions 7.00 and 7.10; and in Microsoft QuickBASIC versions
  9857.  4.00, 4.00b, and 4.50 (buglist4.00, buglist4.00b, buglist4.50). We are
  9858.  researching this problem and will post new information here as it
  9859.  becomes available.
  9860.  
  9861.  To correctly create an EXE file from a GW-BASIC or BASICA program, it
  9862.  must first be saved in ASCII (text) format in the GWBASIC.EXE or
  9863.  BASICA.EXE editor. The following GW-BASIC or BASICA statement will
  9864.  save TEST.BAS in ASCII format:
  9865.  
  9866.     SAVE "TEST",A
  9867.  
  9868.  Binary format is the default SAVE format in BASICA and GW-BASIC; thus,
  9869.  you must explicitly save with the A (ASCII) option before BC.EXE can
  9870.  handle the source file.
  9871.  
  9872.  BASICA is an interpreter shipped in the ROM of some IBM and COMPAQ
  9873.  computers. Microsoft GW-BASIC Interpreter is shipped with some
  9874.  versions of DOS, depending upon the hardware vendor or the version of
  9875.  MS-DOS.
  9876.  
  9877.  Additional reference words: B_QuickBas B_GWBasicI
  9878.  
  9879.  
  9880.  168. BC 6.00 User's Guide, NOVGA.OBJ Affects SCREENs 11-13, Not 3
  9881.  
  9882.  Product Version(s): 6.00 6.00b | 6.00 6.00b
  9883.  Operating System:   MS-DOS     | OS/2
  9884.  Flags: ENDUSER | docerr SR# S900121-5
  9885.  Last Modified:  2-FEB-1990    ArticleIdent: Q58019
  9886.  
  9887.  On Page 10 of the "Microsoft BASIC Compiler 6.0: User's Guide," Table
  9888.  3.1 incorrectly states that NOVGA.OBJ removes support for screen mode
  9889.  3 features. The chart should actually show the following:
  9890.  
  9891.     NOVGA.OBJ    Video Graphics Array (VGA) features (screen modes
  9892.                  11, 12, and 13) absent.
  9893.  
  9894.  This correction applies to the user's guide for Microsoft BASIC
  9895.  Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2.
  9896.  
  9897.  This documentation error was corrected in the documentation for
  9898.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  9899.  MS-DOS and MS OS/2.
  9900.  
  9901.  
  9902.  169. Can't Search on Blank String Field in BASIC 7.00 ISAM
  9903.  
  9904.  Product Version(s): 7.00
  9905.  Operating System:   MS-DOS
  9906.  Flags: ENDUSER | SR# S900119-140
  9907.  Last Modified:  2-FEB-1990    ArticleIdent: Q58020
  9908.  
  9909.  Blank string fields cannot be searched on with the ISAM file handler
  9910.  that comes with Microsoft BASIC Professional Development System (PDS)
  9911.  Version 7.00 for MS-DOS.
  9912.  
  9913.  If a search is performed on a string field (whether the field is the
  9914.  entire index or part of a combined one) and the entire field is filled
  9915.  with spaces, the record will not be found and an end-of-file condition
  9916.  will be returned.
  9917.  
  9918.  To work around this problem, represent blank fields by inserting some
  9919.  other character into them and searching on the presence of that
  9920.  character in the field.
  9921.  
  9922.  Due to the way the ISAM engine stores string fields in a database
  9923.  table, completely blank string fields cannot be found when you use the
  9924.  SEEKGT, SEEKGE, or SEEKEQ statements. This is the case whether the
  9925.  string field represents the entire index or whether it is a field
  9926.  (primary or not) included in a combined index. Also, the same behavior
  9927.  is exhibited with fields that are unique and with those that have
  9928.  duplicates.
  9929.  
  9930.  This characteristic of the ISAM file handler is due to the way it
  9931.  strips off leading and trailing spaces from a string field to conserve
  9932.  disk space. For example, if the string " abc " (length of 5, with one
  9933.  leading and one trailing space) is inserted into a string field with a
  9934.  length of 10, "abc" (a length of 3) is actually written to the table.
  9935.  Therefore, inserting a string consisting entirely of spaces results in
  9936.  nothing being written to the table because every character is stripped
  9937.  off.
  9938.  
  9939.  The best workaround for this situation is to associate a special
  9940.  character with string fields that are to be completely blank and set
  9941.  the field equal to that character. Then, in all subsequent searches on
  9942.  this field, use that character as the key.
  9943.  
  9944.  
  9945.  170. BASIC 7.00 MousePoll Gives Screen, Not Window Coordinates
  9946.  
  9947.  Product Version(s): 7.00
  9948.  Operating System:   MS-DOS
  9949.  Flags: ENDUSER | SR# S891108-92
  9950.  Last Modified:  2-FEB-1990    ArticleIdent: Q58024
  9951.  
  9952.  The MousePoll routine of the MOUSE.BAS file that comes with the User
  9953.  Interface (UI) Toolbox in Microsoft BASIC Professional Development
  9954.  System (PDS) Version 7.00 for MS-DOS returns the absolute screen
  9955.  coordinates of the mouse text cursor as well as the status of the left
  9956.  and right mouse buttons.
  9957.  
  9958.  Using the window routines of the WINDOW.BAS toolbox file (also
  9959.  included) does not make the MousePoll routine return coordinates that
  9960.  are relative to the top-left corner of the current window. They are
  9961.  always relative to the top-left corner of the screen. This may not be
  9962.  apparent because the documentation presents all the toolbox files as
  9963.  being part of a user-interface unit; therefore, it may appear that the
  9964.  MousePoll routine returns coordinates that are relative to the current
  9965.  window.
  9966.  
  9967.  Included with Microsoft BASIC PDS is a toolbox source file called
  9968.  MOUSE.BAS. There is a routine in this module called MousePoll, which
  9969.  when called returns the vertical and horizontal coordinates of the
  9970.  mouse text cursor plus the status of the left and right mouse buttons.
  9971.  
  9972.  The coordinates returned are absolute screen coordinates. That is, if
  9973.  the mouse cursor is at the top-left corner of the screen, the
  9974.  coordinate pair (vertical, horizontal) returned is (1,1).
  9975.  
  9976.  This may lead to some confusion for those who are using another of the
  9977.  toolbox source files, WINDOW.BAS. This module contains (among many
  9978.  other things) routines used to open, resize, move, and print to
  9979.  windows. When addressing locations in these windows, relative (not
  9980.  absolute) coordinates are used. That is, the top-left corner of the
  9981.  window has coordinates (1,1) even if it is not in the same position as
  9982.  the screen's top-left corner (1,1).
  9983.  
  9984.  Therefore, it is important to note that the MousePoll subprogram does
  9985.  not return coordinates relative to any window's top-left corner, but
  9986.  always returns coordinates relative to the screen's top-left corner.
  9987.  
  9988.  
  9989.  171. BASIC PDS 7.10 Allows Line Numbers 40 Digits Long; Correction
  9990.  
  9991.  Product Version(s): 7.00 7.10 | 7.00 7.10
  9992.  Operating System:   MS-DOS    | OS/2
  9993.  Flags: ENDUSER | SR# S900120-1 docerr
  9994.  Last Modified:  8-JAN-1991    ArticleIdent: Q58027
  9995.  
  9996.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  9997.  and 7.10 for MS-DOS and MS OS/2 are enhanced to allow line numbers as
  9998.  long as 40 numbers (characters) long. However, Page 697 of Appendix A
  9999.  in the "Microsoft BASIC 7.0: Programmer's Guide" (for 7.00 and 7.10)
  10000.  incorrectly states that the largest line number possible is 65,529.
  10001.  
  10002.  The following code example demonstrates using large line numbers in
  10003.  BASIC PDS 7.00 and 7.10
  10004.  
  10005.     ON KEY(1) GOSUB 1234567890123456789012345678901234567891
  10006.     KEY(1) ON
  10007.     CLS
  10008.     PRINT "starting"
  10009.     WHILE a$ <> "q" AND a$ <> "Q"
  10010.     a$ = INKEY$
  10011.     WEND
  10012.     END
  10013.  
  10014.     1234567890123456789012345678901234567891
  10015.               PRINT "That is the F1 key"
  10016.               PRINT "Hit 'q' or 'Q' to quit"
  10017.               RETURN
  10018.  
  10019.  
  10020.  172. Alternate Math (BC /FPa) Won't Always Produce Smaller .EXE's
  10021.  
  10022.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  10023.  Operating System:   MS-DOS               | OS/2
  10024.  Flags: ENDUSER | docerr SR# S900122-49
  10025.  Last Modified:  8-JAN-1991    ArticleIdent: Q58035
  10026.  
  10027.  Using alternate math (BC /FPa) does not always produce smaller
  10028.  executable files than using the emulator math library (BC /FPi) when
  10029.  compiling with Microsoft BASIC Compiler Versions 6.00 and 6.00b for
  10030.  MS-DOS and MS OS/2 and Microsoft BASIC Professional Development System
  10031.  (PDS) Versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  10032.  
  10033.  Page 8 of the "Microsoft BASIC Compiler 6.0: User's Guide" and Page
  10034.  562 of the "Microsoft BASIC 7.0: Programmer's Guide" (for 7.00 and
  10035.  7.10) misleadingly state that "it [the alternate math library] also
  10036.  creates a smaller executable file." Page 545 of the "Microsoft BASIC
  10037.  7.0: Programmer's Guide" misleadingly states that "alternate math is
  10038.  an IEEE-compatible math package optimized for speed and size."
  10039.  
  10040.  Although there is an initial space savings from using the alternate
  10041.  math libraries, each individual floating-point calculation can take
  10042.  more room using the alternate math library than the equivalent code
  10043.  for the emulator math library. This means that as the code grows in
  10044.  size, the initial space savings can be lost and the program can
  10045.  actually be larger using the alternate math package.
  10046.  
  10047.  Note: You will only notice a savings in the size of an executable
  10048.  compiled /FPa versus /FPi if the program is also compiled with the /O
  10049.  (stand-alone) option. If you compile as non stand alone with the
  10050.  alternate math library (/FPa) option, the program will actually
  10051.  contain both math libraries -- the compiled program will contain the
  10052.  alternate math routines, while the BASIC run-time module
  10053.  (BRUN60Ax.EXE, BRUN61Ax.EXE, or BRT70Axx.EXE) will contain the
  10054.  emulator math routines.
  10055.  
  10056.  The small program below demonstrates the size difference when
  10057.  compiling with and without the alternate math package.
  10058.  
  10059.  Compile the following program in these two ways:
  10060.  
  10061.    BC /FPa test, test1.obj;
  10062.    BC /FPi test, test2.obj;
  10063.    LINK test1;
  10064.    LINK test2;
  10065.  
  10066.  Code Example
  10067.  ------------
  10068.  
  10069.     REM  This is TEST.BAS
  10070.     a = 6.1
  10071.     b = 5.7
  10072.     c = a * b
  10073.  
  10074.  The program compiled with the alternate math package (/FPa) produces
  10075.  larger code for the floating-point operation than the equivalent
  10076.  instructions using the emulator math library (/FPi). There is,
  10077.  however, an initial savings of about 4K when compiling with the
  10078.  alternate math library. In most programs, this initial savings offsets
  10079.  any extra code generated by floating-point calculation. In larger
  10080.  programs with lots of floating-point calculations, the extra code for
  10081.  each floating-point operation can actually create a larger executable
  10082.  file.
  10083.  
  10084.  
  10085.  173. "Internal Error" Using Two-Dimensional Single-Precision Array
  10086.  
  10087.  Product Version(s): 7.00   | 7.00
  10088.  Operating System:   MS-DOS | OS/2
  10089.  Flags: ENDUSER | buglist7.00 fixlist7.10
  10090.  Last Modified: 21-SEP-1990    ArticleIdent: Q58039
  10091.  
  10092.  The code example below generates the error message "Internal Error
  10093.  near 8C54" when compiled using the BC.EXE shipped with Microsoft BASIC
  10094.  Professional Development System (PDS) version 7.00 for MS-DOS and MS
  10095.  OS/2. This problem does not occur in the QBX.EXE environment or in
  10096.  earlier compiler versions.
  10097.  
  10098.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  10099.  version 7.00. This problem was corrected in BASIC PDS version 7.10.
  10100.  
  10101.  Code Example
  10102.  ------------
  10103.  
  10104.    DIM a (4, 4), b(4, 4)
  10105.    k% = i% + 1
  10106.    a(0, j%) = a(0, k%)
  10107.    b(0, j%) = b(0, k%)
  10108.  
  10109.  To work around this problem in 7.00, compile using the BC /D (Debug)
  10110.  option, or change the arrays to integer arrays or double-precision
  10111.  arrays. To cause the error, the array must be single precision,
  10112.  two-dimensional, and referenced with integer variables as shown.
  10113.  
  10114.  
  10115.  174. "Insufficient EMS to Load Overlays" at Run Time in 7.00, 7.10
  10116.  
  10117.  Product Version(s): 7.00 7.10
  10118.  Operating System:   MS-DOS
  10119.  Flags: ENDUSER | SR# S900808-19
  10120.  Last Modified:  5-SEP-1990    ArticleIdent: Q64876
  10121.  
  10122.  The run-time error message "Insufficient EMS to load overlays" occurs
  10123.  (if it is going to occur at all) when the first overlaid module is
  10124.  called. This error is documented on Page 656 of the "Microsoft BASIC
  10125.  7.0: Language Reference" manual for Microsoft BASIC Professional
  10126.  Development System (PDS) versions 7.00 and 7.10. The article below
  10127.  explains in more detail why you might get this error condition.
  10128.  
  10129.  This information applies to Microsoft BASIC Professional Development
  10130.  System (PDS) versions 7.00 and 7.10 for MS-DOS when using linked
  10131.  overlays.
  10132.  
  10133.  The "Insufficient EMS to load overlays" error message is not random.
  10134.  If you run a program on a particular machine and the error does not
  10135.  occur, the error will never occur for that program unless that
  10136.  machine's expanded memory configuration is changed. Common ways of
  10137.  changing the expanded memory configuration include the following:
  10138.  setting up a larger RAM drive in expanded memory; or moving the
  10139.  program to another machine with a different amount of free expanded
  10140.  memory.
  10141.  
  10142.  If a given program produces an "Insufficient EMS to load overlays"
  10143.  error on a given machine, the error will always occur for that program
  10144.  as long as the machine's expanded memory configuration and usage stay
  10145.  the same.
  10146.  
  10147.  When a BASIC program calls the first overlaid module, the program
  10148.  must estimate the space in expanded memory necessary to load all
  10149.  overlays at once. This estimate is based only on the following:
  10150.  
  10151.  1. The number of overlays
  10152.  2. The size of the largest overlay
  10153.  3. The fact that each overlay has less than 64K of code (otherwise, it
  10154.     would not be able to use expanded memory)
  10155.  
  10156.  The overlay manager in BASIC 7.00 and 7.10 requests expanded memory in
  10157.  16K pages (blocks). The overlay manager knows the size of only the
  10158.  largest overlay and must make a "best guess" at the size of the
  10159.  smaller overlays. When the overlay manager estimates how many 16K
  10160.  pages are necessary to hold all overlays at once in expanded memory,
  10161.  the estimate could be over or under the actual number of pages needed.
  10162.  If your overlays are all between 16K and 64K in size (according to the
  10163.  LINK .MAP file), and if the estimated or actual size of all overlays
  10164.  together exceeds the available expanded memory, the following
  10165.  initialization error occurs when the first overlay is called at
  10166.  run-time:
  10167.  
  10168.     Insufficient EMS to load overlays
  10169.  
  10170.  Note: You will never see this error if all your overlays are smaller
  10171.  than 16K each.
  10172.  
  10173.  If you want to force loading overlays from disk, thus avoiding the
  10174.  possibility of this overlay-initialization error in expanded memory,
  10175.  you must link with the stub file NOEMS.OBJ (with no parentheses around
  10176.  NOEMS.OBJ on the LINK command line). Alternatively, you can try
  10177.  reconfiguring expanded memory so more of it is available for BASIC
  10178.  overlays. Another alternative is to make overlays similar in size.
  10179.  
  10180.  To find out the size of each overlay, you must look at the .MAP file
  10181.  generated by the linker (LINK.EXE).
  10182.  
  10183.  References:
  10184.  
  10185.  For more information about how to use link overlays in BASIC 7.00 and
  10186.  7.10, search in this Knowledge Base for a separate article with the
  10187.  following words:
  10188.  
  10189.     How and link and overlays and expanded and memory and BASIC
  10190.  
  10191.  See also the section "Linking with Overlays" on Pages 612-614 in the
  10192.  "Microsoft BASIC 7.0: Programmer's Guide" for versions 7.00 and 7.10.
  10193.  
  10194.  
  10195.  175. INTERRUPTs Using Strings Need SSEG for Segment in QBX & BC /Fs
  10196.  
  10197.  Product Version(s): 7.00
  10198.  Operating System:   MS-DOS
  10199.  Flags: ENDUSER | S_C H_MASM SR# S900112-133
  10200.  Last Modified:  2-FEB-1990    ArticleIdent: Q58041
  10201.  
  10202.  Because the QuickBASIC Extended (QBX.EXE) editor that comes with
  10203.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  10204.  uses far addresses for all strings, some CALL INTERRUPT statements
  10205.  that worked in earlier versions of Microsoft's BASIC products require
  10206.  modification for correct results.
  10207.  
  10208.  To correct for this behavior, change the segment passed to the
  10209.  INTERRUPT to be SSEG(stringvariable).
  10210.  
  10211.  This information applies to Microsoft QuickBASIC Extended (QBX.EXE)
  10212.  and to programs compiled with BC /Fs in Microsoft BASIC PDS Version
  10213.  7.00 for MS-DOS and MS OS/2.
  10214.  
  10215.  In earlier versions of Microsoft BASIC's, near strings were used.
  10216.  Because of this, the VARSEG of the string variable, or -1 in some
  10217.  cases, could be used for the segment. In BASIC PDS 7.00, you must use
  10218.  the SSEG function to return the segment of a string variable.
  10219.  
  10220.  The following table shows the difference in the method of assigning
  10221.  the registers for string variables:
  10222.  
  10223.     BASIC Versions 6.00/6.00b    BASIC PDS Version 7.00
  10224.     -------------------------    ----------------------
  10225.  
  10226.     inregs.DS = VARSEG(a$)       inregs.DS = SSEG(a$)   '**** SSEG
  10227.     inregs.DX = SADD(a$)         inregs.DX = SADD(a$)
  10228.     inregs.ES = -1               inregs.ES = SSEG(b$)   '**** SSEG
  10229.  
  10230.  In addition to INTERRUPTs, the change to far strings could also have
  10231.  the same effect on mixed-language programming with Microsoft C and
  10232.  Microsoft Macro Assembler (MASM).
  10233.  
  10234.  
  10235.  176. No Beep When Clicking Outside Modal Window of WINDOW.BAS
  10236.  
  10237.  Product Version(s): 7.00 7.10
  10238.  Operating System:   MS-DOS
  10239.  Flags: ENDUSER | SR# S900116-127 docerr
  10240.  Last Modified:  8-JAN-1991    ArticleIdent: Q58102
  10241.  
  10242.  Using a mouse to select outside a modal window created with the
  10243.  WindowOpen procedure of WINDOW.BAS does not produce a beep. This is
  10244.  contrary to Page 575 of the "Microsoft BASIC 7.0: Language Reference"
  10245.  manual (for 7.00 and 7.10), which incorrectly says:
  10246.  
  10247.     When a window is modal, any attempt to select outside the window
  10248.     is unsuccessful and results in a beep.
  10249.  
  10250.  WINDOW.BAS is a file provided with the User Interface (UI) Toolbox in
  10251.  Microsoft BASIC Professional Development System (PDS) Versions 7.00
  10252.  and 7.10 for MS-DOS.
  10253.  
  10254.  While a modal window is current, pressing certain keys generates a
  10255.  beep, but no beep is generated when you click outside the window with
  10256.  the mouse. The keys that generate a beep are as follows [Note: This
  10257.  list assumes a 101-key (enhanced) keyboard]:
  10258.  
  10259.     ESC
  10260.     UP ARROW
  10261.     DOWN ARROW
  10262.     LEFT ARROW
  10263.     RIGHT ARROW
  10264.     HOME
  10265.     END
  10266.     PGUP
  10267.     PGDN
  10268.     ENTER (on main keyboard)
  10269.     TAB
  10270.     ENTER (on numeric keypad)
  10271.     1, 2, 3, 4, 5, 6, 7, 8, 9 (on numeric keypad)
  10272.  
  10273.  
  10274.  177. Compiler Options Explained for QBX.EXE's Make EXE File Command
  10275.  
  10276.  Product Version(s): 7.00 7.10 | 7.00 7.10
  10277.  Operating System:   MS-DOS    | OS/2
  10278.  Flags: ENDUSER |
  10279.  Last Modified: 29-JAN-1991    ArticleIdent: Q58106
  10280.  
  10281.  The following is a complete description of the compiler options
  10282.  available when you choose the Make EXE File command from the Run menu
  10283.  in the QuickBASIC extended (QBX.EXE) environment. This information is
  10284.  also available in the "Microsoft BASIC 7.0: Language Reference" manual
  10285.  (for 7.00 and 7.10) under "appendixes," Page 608.
  10286.  
  10287.  This information applies to Microsoft BASIC Professional Development
  10288.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  10289.  
  10290.  Although the QBX.EXE editor can run only under MS-DOS or the DOS real
  10291.  mode of MS OS/2, the Make EXE File command in QBX.EXE can use the /Lp
  10292.  option to create programs that require MS OS/2 protected mode.
  10293.  
  10294.  ------------------------ Make EXE File -------------------
  10295.                  ____________________________________
  10296.  EXE File Name: |____________________________________|
  10297.  
  10298.  This box lets you specify the name of the output .EXE file.
  10299.  
  10300.  ----- EXE Type -----------------------------------------
  10301.  [] Stand-Alone EXE           /O
  10302.  [] EXE Requiring BRT Module
  10303.  --------------------------------------------------------
  10304.  
  10305.  /O -- Substitutes the default stand-alone library for the default
  10306.  run-time library (creates a stand-alone executable file that can run
  10307.  without a BASIC run-time module). Stand-alone programs can be
  10308.  significantly larger than programs compiled to use the run-time
  10309.  module. /O is selected by default in this Make EXE File window.
  10310.  
  10311.  EXE Requiring BRT Module -- Makes an EXE program that requires the
  10312.  presence of BRT70XXX.EXE at run time. The XXX depends upon the /Fpi or
  10313.  /Fpa math package, near or far strings, and real or protected mode.
  10314.  
  10315.  ----- Speed -------------------------------------------
  10316.  [] 80x87 or Emulator Math   /Fpi
  10317.  [] Alternate Math           /Fpa
  10318.  [] Code Generation for 286   /G2
  10319.  [] Quick Call Optimization   /Ot
  10320.  -------------------------------------------------------
  10321.  
  10322.  /Fpi -- Causes the compiler to generate "in-line instructions" for use
  10323.  in floating-point operations. This option is the default.
  10324.  
  10325.  /Fpa -- Causes your program to use the alternate-math library for
  10326.  floating point operations.
  10327.  
  10328.  /G2 -- This option generates 80286-specific instructions (which
  10329.  actually affects size more than speed)
  10330.  
  10331.  /Ot -- Optimizes execution speed for SUB and FUNCTION procedures and
  10332.  DEF FN statements. To use this type of optimizing, certain conditions
  10333.  must be met. The frame size generated for SUB and FUNCTION procedures,
  10334.  and statements defined by DEF FN, depends on which of the following
  10335.  conditions exist in your code:
  10336.  
  10337.     For SUB and FUNCTION procedures:
  10338.  
  10339.     A reduced frame is generated with /Ot if no module-level handler
  10340.     exists in the code, and the /D or /Fs isn't used. A full frame is
  10341.     generated if your code uses local error handlers, calls a DEF FN or
  10342.     GOSUB statement, has returned (because of a GOSUB or other reason),
  10343.     or contains an ON event GOSUB.
  10344.  
  10345.     For statements defined by DEF FN:
  10346.  
  10347.     A full frame is generated if the /D, /Fs, /E, or /X option is used.
  10348.     In all other cases, no frame is generated if the /W or /V option is
  10349.     used. In all other cases, no frame is generated.
  10350.  
  10351.  ---- Target Environment --------------------------------
  10352.  [] DOS or OS/2 Real Mode     /Lr
  10353.  [] OS/2 Protected Mode       /Lp
  10354.  --------------------------------------------------------
  10355.  
  10356.  /Lr -- Creates a real-mode object file (the default). This makes
  10357.  .EXE programs that run in MS-DOS or the real mode (the DOS 3.x box)
  10358.  of MS OS/2.
  10359.  
  10360.  /Lp -- Creates a protected-mode object file (to make .EXE programs
  10361.  that run in OS/2 protected mode).
  10362.  
  10363.  ---- Size/Capacity -------------------------------------
  10364.  [] Far Strings                /Fs
  10365.  [] Near Strings
  10366.  [] Disable String Compression /S
  10367.  --------------------------------------------------------
  10368.  
  10369.  /Fs -- This option enables far-heap strings in user programs.
  10370.  
  10371.  Near Strings -- This option enables near (DGROUP) strings in user
  10372.  programs.
  10373.  
  10374.  /S -- Writes quoted strings directly to the object file instead of the
  10375.  symbol table in memory. Use this option when an "Out of memory" error
  10376.  message is generated while BC.EXE is compiling a program that has many
  10377.  string constants.
  10378.  
  10379.  ---- Debug ----------------------------------------------
  10380.  [] Run-Time Error Checking    /D
  10381.  [] CodeView Information       /Zi
  10382.  ---------------------------------------------------------
  10383.  
  10384.  /D -- Generates debugging code for run-time error checking; enables
  10385.  CTRL+BREAK. For ISAM programs, causes BASIC to write open database
  10386.  buffers to disk after every DELETE, INSERT, UPDATE, and CLOSE
  10387.  statement. You must use either /Ah or /D when you are compiling Quick
  10388.  library routines that will be loaded into QBX with the /Ea option
  10389.  (which moves arrays into expanded memory).
  10390.  
  10391.  /Zi -- This option adds debugging information to the object file that
  10392.  can be used by the Microsoft CodeView (CV.EXE, or CVP.EXE) debugger.
  10393.  
  10394.  QBX.EXE 7.10 adds an "Additional Options" field (not found in 7.00),
  10395.  which lets you specify any additional compiler options for invoking
  10396.  BC.EXE.
  10397.  
  10398.  There are four buttons at the bottom of the window:
  10399.  
  10400.  Make EXE -- This button shells out to DOS, runs BC.EXE with the
  10401.  specified options, runs LINK.EXE, creates an executable BASIC .EXE
  10402.  program, and returns to QBX.EXE.
  10403.  
  10404.  Make EXE and Exit -- This button transfers control to BC.EXE with the
  10405.  specified options, runs LINK.EXE, creates an executable BASIC
  10406.  .EXE program, and ends control in DOS, where you can run the .EXE.
  10407.  
  10408.  Cancel -- The Cancel button removes the Make EXE File window and
  10409.  returns you to the main QBX.EXE screen.
  10410.  
  10411.  Help -- The Help button briefly describes a few features of the Make
  10412.  EXE File window.
  10413.  
  10414.  
  10415.  178. BASIC 7.00 Wrong Integer FOR-NEXT Index Results in .EXE
  10416.  
  10417.  Product Version(s): 7.00   | 7.00
  10418.  Operating System:   MS-DOS | OS/2
  10419.  Flags: ENDUSER | SR# S900123-121 buglist7.00 fixlist7.10
  10420.  Last Modified:  1-AUG-1990    ArticleIdent: Q58108
  10421.  
  10422.  In a compiled .EXE program, a FOR ... NEXT loop with an ending loop
  10423.  counter value that is a variable and with a body that contains an
  10424.  integer or long integer array assigned to a single- or
  10425.  double-precision value can PRINT an incorrect value for the loop
  10426.  counter. This problem occurs in a compiled .EXE program only, not in
  10427.  the QuickBASIC Extended environment (QBX.EXE). An example of this
  10428.  problem is shown in the program below.
  10429.  
  10430.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  10431.  Professional Development System (PDS) version 7.00 for MS-DOS and MS
  10432.  OS/2. This problem was corrected in Microsoft BASIC PDS version 7.10.
  10433.  
  10434.  The program below illustrates two conditions that, when occurring
  10435.  together, can produce an undesirable effect. The root of this error is
  10436.  embedded in the BASIC compiler (BC.EXE) optimization techniques. The
  10437.  two conditions necessary to show this problem are as follows:
  10438.  
  10439.  1. A variable (not a constant) is used as the stop (ending) loop
  10440.     counter value on a FOR ... NEXT statement.
  10441.  
  10442.  2. An integer or long integer array (which is subscripted with the
  10443.     loop counter) is assigned to a single- or double-precision number.
  10444.     (This is known as "typecasting" -- a single- or double-precision
  10445.     number is typecasted to an integer or long integer.)
  10446.  
  10447.  The problem occurs only on the first PRINT statement in the source
  10448.  file that prints the loop counter (i%). For all loop iterations, that
  10449.  PRINT i% statement incorrectly displays the fixed value of t#, the
  10450.  ending loop value. PRINT i% statements farther down in the source code
  10451.  work correctly.
  10452.  
  10453.  To eliminate the problem, use one of the following workarounds:
  10454.  
  10455.  1. Compile with the BC /X option.
  10456.  
  10457.       Note: In the example below, the debug compiler option (/D) does
  10458.       not correct the problem.
  10459.  
  10460.  2. Use the CINT() function to convert the real number to an integer
  10461.     before assigning it to the integer or long integer array.
  10462.  
  10463.  3. Use a numeric constant (instead of a variable) for the ending
  10464.     value of the FOR loop counter.
  10465.  
  10466.  4. Compile with the BC /FPa option (instead of the default /FPi).
  10467.  
  10468.  Code Example
  10469.  ------------
  10470.  
  10471.     Dim ia%(10)            'An integer or long array shows problem.
  10472.     t# = 5                 't# can be any numeric type (!, @, #, %, or &)
  10473.     FOR i% = 1 to t#       't# is the ending value of the loop counter, i%
  10474.     PRINT i%;              'This value incorrectly prints equal to t# in .EXE
  10475.     ia%(i%) = 46.7         'A real number is typecast to an integer or
  10476.                            'long-integer value and assigned to the array
  10477.  REM ia%(i%) = CINT(46.7)  'Workaround: use CINT(46.7) in the above line.
  10478.     PRINT i%;              'This value prints correctly.
  10479.     PRINT ia%(i%)          'This value prints correctly.
  10480.     NEXT i%
  10481.     END
  10482.  
  10483.  Below is the (incorrect) output from this .EXE (compiled without
  10484.  BC /X):
  10485.  
  10486.     5   1   46.7
  10487.     5   2   46.7
  10488.     5   3   46.7
  10489.     5   4   46.7
  10490.     5   5   46.7
  10491.  
  10492.  The output should be as follows:
  10493.  
  10494.     1   1   46.7
  10495.     2   2   46.7
  10496.     3   3   46.7
  10497.     4   4   46.7
  10498.     5   5   46.7
  10499.  
  10500.  
  10501.  179. BASIC 7.00/7.10: Incorrect Results with Alternate Math Library
  10502.  
  10503.  Product Version(s): 7.00   | 7.00
  10504.  Operating System:   MS-DOS | OS/2
  10505.  Flags: ENDUSER | buglist7.00 fixlist7.10
  10506.  Last Modified: 20-SEP-1990    ArticleIdent: Q58124
  10507.  
  10508.  Using Microsoft BASIC Professional Development System (PDS) version
  10509.  7.00 for MS-DOS and MS OS/2, the code example below produces incorrect
  10510.  results when compiled with the alternate math library (/FPa).
  10511.  
  10512.  This code works correctly in the QBX.EXE environment or when compiled
  10513.  with BC /D (debug) or /X. It also works correctly when compiled with
  10514.  BC /FPa in Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS
  10515.  and MS OS/2. Dimensioning the array as double-precision also works
  10516.  around the problem.
  10517.  
  10518.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  10519.  version 7.00. This problem was corrected in BASIC PDS 7.10.
  10520.  
  10521.  Code Example
  10522.  ------------
  10523.  
  10524.     DIM A(3)
  10525.     A(i%) = 5
  10526.     sx = A(i%)
  10527.     pr = .1 * A(i%)
  10528.     PRINT pr, sx, A(i%)
  10529.  
  10530.  Compile as follows:
  10531.  
  10532.     BC prog /o /fpa;
  10533.  
  10534.  Link as follows:
  10535.  
  10536.     LINK prog;
  10537.  
  10538.  The correct output from BASIC 7.10 is as follows:
  10539.  
  10540.     .5     5     5
  10541.  
  10542.  
  10543.  180. "Error Loading File (x.QLB)" After QBX /L x; Must Compile /Fs
  10544.  
  10545.  Product Version(s): 7.00
  10546.  Operating System:   MS-DOS
  10547.  Flags: ENDUSER | SR# S900126-5
  10548.  Last Modified: 26-FEB-1990    ArticleIdent: Q58125
  10549.  
  10550.  The error "Error in loading file (xxx.QLB )" occurs when loading a
  10551.  Quick library into QBX.EXE if the Quick library contains BASIC modules
  10552.  compiled without the BC /Fs (far strings) option. The BC /Fs option is
  10553.  needed because far strings are always used in the QuickBASIC Extended
  10554.  (QBX) environment.
  10555.  
  10556.  To create a Quick library that is usable in QBX, recompile with the BC
  10557.  /Fs option and relink (LINK /QU) to make a new Quick library.
  10558.  
  10559.  This information applies to Microsoft BASIC Professional Development
  10560.  System (PDS) Version 7.00 for MS-DOS.
  10561.  
  10562.  The necessity of using the /Fs option to make Quick libraries is
  10563.  documented on Page 617 of the "Microsoft BASIC 7.0: Programmer's
  10564.  Guide." For more information on Quick libraries, see Chapter 19,
  10565.  "Creating and Using Quick Libraries."
  10566.  
  10567.  
  10568.  181. BASIC PDS 7.00 List of Stub Files for Linking Smaller .EXE's
  10569.  
  10570.  Product Version(s): 7.00   | 7.00
  10571.  Operating System:   MS-DOS | OS/2
  10572.  Flags: ENDUSER | SR# S900112-169
  10573.  Last Modified: 26-FEB-1990    ArticleIdent: Q58175
  10574.  
  10575.  Below is the list of linker stub files that come with Microsoft BASIC
  10576.  Professional Development System (PDS) Version 7.00 for MS-DOS and MS
  10577.  OS/2. Stub files are special object files that block the inclusion of
  10578.  certain pieces of the BASIC run-time routines in the final .EXE file
  10579.  at link time. Most stub files can reduce .EXE program size and memory
  10580.  usage.
  10581.  
  10582.  This list can also be found on Pages 540-541 and 610-611 of the
  10583.  "Microsoft BASIC 7.0: Programmer's Guide," and on Pages 10-12 of the
  10584.  "Microsoft BASIC 7.0: Getting Started" manual.
  10585.  
  10586.  BASIC 7.00 Stub Files
  10587.  ---------------------
  10588.  
  10589.  Filename              Description
  10590.  --------              -----------
  10591.  
  10592.  OVLDOS21.OBJ          DOS 2.10 support to an overlaid program. Does
  10593.                        not reduce .EXE size.
  10594.  
  10595.  NOCGA.OBJ             Removes support for CGA graphics (SCREEN modes 1
  10596.                        and 2).
  10597.  
  10598.  NOCOM.OBJ             Removes communications ("COM1:", "COM2:") device
  10599.                        support in two cases. LINK includes
  10600.                        communications support overhead only if you use a
  10601.                        string variable in place of the file or device
  10602.                        name, as in OPEN A$ FOR OUTPUT AS #1, or if you
  10603.                        use a string constant starting with COMn in an
  10604.                        OPEN statement.
  10605.  
  10606.  NOEDIT.OBJ            Reduces functionality of the editor provided
  10607.                        with the INPUT and LINE INPUT statements to
  10608.                        support only ENTER and BACKSPACE keys (no HOME,
  10609.                        END, etc.).
  10610.  
  10611.  NOEGA.OBJ             Removes support for EGA graphics (SCREEN modes
  10612.                        7, 8, 9, 10, 11).
  10613.  
  10614.  NOEMS.OBJ             Prevents the overlay manager from using Expanded
  10615.                        Memory Specification (EMS); instead, the BASIC
  10616.                        .EXE program is forced to swap to disk.
  10617.  
  10618.  NOEVENT.OBJ           Removes support for EVENT trapping. This stub
  10619.                        file is effective only if linked with the BASIC
  10620.                        run-time module (BRT70xxx.EXE); it has no effect
  10621.                        when linked into stand-alone executables.
  10622.  
  10623.  NOFLTIN.OBJ           Replaces the numeric parsing code with an
  10624.                        integer-only version. If you link with
  10625.                        NOFLTIN.OBJ, all numbers used by INPUT, READ,
  10626.                        and VAL must be legal long integers.
  10627.  
  10628.  NOGRAPH.OBJ           Removes all support for graphics statements and
  10629.                        nonzero SCREEN modes. NOGRAPH.OBJ is a superset
  10630.                        of the following stub files: NOHERC.OBJ,
  10631.                        NOOGA.OBJ, NOCGA.OBJ, NOEGA.OBJ, and NOVGA.OBJ.
  10632.  
  10633.  NOHERC.OBJ            Removes support for Hercules graphics SCREEN 3.
  10634.  
  10635.  NOISAM.OBJ            Removes ISAM support from the BASIC run-time
  10636.                        module (BRT70xxx.EXE) and is not useful for
  10637.                        stand-alone programs (compiled with BC /O).
  10638.  
  10639.  NOLPT.OBJ             Removes line printer support.
  10640.  
  10641.  NOOGA.OBJ             Removes support for Olivetti graphics (SCREEN
  10642.                        mode 4).
  10643.  
  10644.  NOTRNEMR.LIB          Removes support for transcendental operations,
  10645.  and NOTRNEMP.LIB      including: SIN, COS, TAN, ATN, LOG, SQR, EXP,
  10646.                        ^ (the exponential operator), a CIRCLE statement
  10647.                        with a start or stop value, and the DRAW
  10648.                        statement with the A or T commands.
  10649.  
  10650.  NOVGA.OBJ             Removes support for VGA (Video Graphics Array)
  10651.                        graphics (SCREEN modes 11, 12, 13).
  10652.  
  10653.  SMALLERR.OBJ          Reduces size of error messages displayed.
  10654.  
  10655.  TSCNIOxx.OBJ          Removes certain features from BASIC programs to
  10656.                        produce text-only screen I/O. There are four
  10657.                        files, depending on string type and operating
  10658.                        system mode, as follows:
  10659.  
  10660.                           TSCNIONR.OBJ   Near string, real mode (DOS)
  10661.  
  10662.                           TSCNIOFR.OBJ   Far string, real mode (DOS)
  10663.  
  10664.                           TSCNIONP.OBJ   Near string, OS/2 protected mode
  10665.  
  10666.                           TSCNIOFP.OBJ   Far string, OS/2 protected mode
  10667.  
  10668.                        The TSCNIOxx stub files remove all support for
  10669.                        BASIC graphics modes and graphics statements,
  10670.                        except SCREEN 0. They also remove support for
  10671.                        special treatment of control characters. The
  10672.                        TSCNIOxx stub files cannot be used with any of
  10673.                        the other graphics stub files.
  10674.  
  10675.  
  10676.  182. BUILDRTM "Unresolved External" Using OVLDOS21.OBJ; Not Allowed
  10677.  
  10678.  Product Version(s): 7.00 7.10
  10679.  Operating System:   MS-DOS
  10680.  Flags: ENDUSER | docerr
  10681.  Last Modified:  8-JAN-1991    ArticleIdent: Q58410
  10682.  
  10683.  The stub file OVLDOS21.OBJ, which is shipped with Microsoft BASIC
  10684.  Professional Development System (PDS) Versions 7.00 and 7.10 for
  10685.  MS-DOS, can be linked into an .EXE program that uses an extended
  10686.  run-time module, but is not allowed to be built into an extended
  10687.  run-time module.
  10688.  
  10689.  The link error "L2029: Unresolved external" displays a few times if
  10690.  you attempt to use the BUILDRTM.EXE utility to place the OVLDOS21.OBJ
  10691.  file into an extended run-time module.
  10692.  
  10693.  The following sentences need to be added to Pages 539, 611, and 663 of
  10694.  the "Microsoft BASIC 7.0: Programmer's Reference" manual (for versions
  10695.  7.00 and 7.10):
  10696.  
  10697.     Note that you cannot use BUILDRTM to build the OVLDOS21.OBJ stub
  10698.     file into an extended run-time module. You can link OVLDOS21.OBJ
  10699.     into an .EXE program that uses a normal or extended run-time
  10700.     module.
  10701.  
  10702.  The following is a correct example to link the OVLDOS21.OBJ stub file
  10703.  for use with an extended run-time module:
  10704.  
  10705.  LINK import.obj+main.obj+OVLDOS21.obj+(sub1)+(sub2),main.exe,,extrtm.lib;
  10706.  
  10707.  The OVLDOS21.OBJ stub file shipped with BASIC PDS Version 7.00 is
  10708.  provided to support code overlays under MS-DOS Version 2.10. This stub
  10709.  file is not required if overlays are to be used on MS-DOS Versions 3.00
  10710.  and later. For more information about overlays, search for a separate
  10711.  article by querying on the following words:
  10712.  
  10713.     how and use and LINK and overlays and BASIC and PDS and 7.00
  10714.  
  10715.  
  10716.  183. LIM 4.0 Expanded Memory Boards/Drivers for BASIC 7.00
  10717.  
  10718.  Product Version(s): 7.00
  10719.  Operating System:   MS-DOS
  10720.  Flags: ENDUSER |
  10721.  Last Modified: 21-FEB-1990    ArticleIdent: Q58547
  10722.  
  10723.  Listed below are some memory boards/drivers that are within the
  10724.  specifications of the LIM 4.0 EMS (Lotus-Intel-Microsoft Version 4.0
  10725.  Expanded Memory Specification) standard for MS-DOS. One list below is
  10726.  for 80386 computers, and another list is for 80286 computers.
  10727.  
  10728.  This information is useful for owners of Microsoft BASIC Professional
  10729.  Development System (PDS) Version 7.00 under MS-DOS. The following
  10730.  features in BASIC PDS 7.00 can take advantage of LIM 4.0 EMS expanded
  10731.  memory: ISAM file-handling, the QBX.EXE environment, and certain
  10732.  overlaid .EXE programs.
  10733.  
  10734.  Below is a list of expanded memory boards and drivers for machines
  10735.  with an 80386 processor chip. (The 80386 is also known as the 386):
  10736.  
  10737.  Company        Address / Phone              Memory board / Driver
  10738.  -------        ---------------              ---------------------
  10739.  
  10740.  Above
  10741.  Software       (714) 545-1181               Above Disk
  10742.  
  10743.  Everex         48431 Milmont Dr.            RAM8000 / EMM.SYS
  10744.                 Fremont, CA 94538
  10745.                 (800) 821-0806
  10746.                 (415) 498-1115
  10747.  
  10748.  Intel          185 Berry                    InBoard 386 AT / Driver
  10749.                 Suite 306
  10750.                 San Francisco, CA 94107
  10751.                 (800) 538-3373
  10752.                 (408) 765-4512
  10753.  
  10754.  Microsoft      One Microsoft Way            HIMEM.SYS
  10755.                 Redmond, WA 98052
  10756.                 (800) 426-9400
  10757.                 (206) 882-8088
  10758.  
  10759.  Orchid         45365 Northport              RamQuest XT / AT
  10760.                 Loop West
  10761.                 Fremont, CA 94538
  10762.                 (415) 683-0300
  10763.  
  10764.  Qualitas       7101 Wisconsin Ave.          n/a / 386MAX
  10765.                 Suite 1386
  10766.                 Bethesda, MD 20814
  10767.                 (301) 907-6700
  10768.  
  10769.  Quarterdeck    150 Pico Blvd                n/a / QEMM
  10770.                 Santa Monica, CA 90405
  10771.                 (213) 392-9851
  10772.  
  10773.  Tall Trees     2585 East Bayshore Rd.       JRAM / JEMS
  10774.                 Palo Alto, CA 94303
  10775.                 (415) 493-1980
  10776.  
  10777.  Techmar        6225 Cochran Rd.             MICRORAM 386
  10778.                 Solan, OH 44139              MICRORAM (PS/2)
  10779.                 (216) 349-1009
  10780.  
  10781.  Toshiba        2441 Michelle Dr.            n/a / EMM386.SYS
  10782.                 Tustin, CA 92680
  10783.                 (800) 999-4273
  10784.                 (714) 583-3000
  10785.  
  10786.  Below is a list of expanded memory boards and drivers for machines
  10787.  with an 80286 processor chip. (The 80286 also known as the 286):
  10788.  
  10789.  Company        Address / Phone              Memory board / Driver
  10790.  -------        ---------------              ---------------------
  10791.  
  10792.  Above
  10793.  Software       (714) 545-1181               Above Disk
  10794.  
  10795.  AST            16215 Alton Parkway          Rampage Plus XT / AT
  10796.                 Irvine, CA 92718             SixPak 286 XT / AT
  10797.                 (714) 863-1333
  10798.  
  10799.  Intel          185 Berry                    Above Board Plus / EMM
  10800.                 Suite 306                    Above Board Plus 8 / EMM
  10801.                 San Francisco, CA 94107
  10802.                 (800) 538-3373
  10803.                 (408) 765-4512
  10804.  
  10805.  Microsoft      One Microsoft Way            HIMEM.SYS
  10806.                 Redmond, WA 98052
  10807.                 (800) 426-9400
  10808.                 (206) 882-8088
  10809.  
  10810.  Orchid         45365 Northport              RamQuest XT / AT
  10811.                 Loop West
  10812.                 Fremont, CA 94538
  10813.                 (415) 683-0300
  10814.  
  10815.  Qualitas       7101 Wisconsin Ave.          n/a / MOVE'EM
  10816.                 Suite 1386
  10817.                 Bethesda, MA 20814
  10818.                 (301) 907-6700
  10819.  
  10820.  Quarterdeck    150 Pico Blvd                n/a / QEMM(IBM ONLY)
  10821.                 Santa Monica, CA 90405       n/a / QEMM 50/60
  10822.                 (213) 392-9851
  10823.  
  10824.  Tall Trees     2585 East Bayshore Rd.       JRAM / JEMS
  10825.                 Palo Alto, CA 94303
  10826.                 (415) 493-1980
  10827.  
  10828.  Techmar        6225 Cochran Rd.             MICRORAM
  10829.                 Solan, OH 44139              CAPTAIN 286
  10830.                 (216) 349-1009
  10831.  
  10832.  Toshiba        2441 Michelle Dr.            n/a / EMM.SYS
  10833.                 Tustin, CA 92680
  10834.                 (800) 999-4273
  10835.                 (714) 583-3000
  10836.  
  10837.  Note: The MS-DOS interrupts necessary to access LIM 4.0 expanded
  10838.  memory are documented in the following book:
  10839.  
  10840.     Pages 25-68 of "MS-DOS Extensions: Programmer's Quick Reference,"
  10841.     by Ray Duncan (Microsoft Press, 1989).
  10842.  
  10843.  
  10844.  184. 7.10 Correction Passing Far Variable-String Array to MASM
  10845.  
  10846.  Product Version(s): 7.00 7.10 | 7.00 7.10
  10847.  Operating System:   MS-DOS    | OS/2
  10848.  Flags: ENDUSER | SR# S900207-62 docerr
  10849.  Last Modified:  8-JAN-1991    ArticleIdent: Q58563
  10850.  
  10851.  Page 515 of the "Microsoft BASIC 7.0: Programmer's Guide" (for 7.00
  10852.  and 7.10) incorrectly shows how to pass a far variable-length-string
  10853.  array to assembly. Page 515 states the following:
  10854.  
  10855.     To accomplish this, BASIC could call a MASM procedure, passing it
  10856.     the address of the first string descriptor in the array:
  10857.  
  10858.     DECLARE SUB ChangeArray(S$)
  10859.     CALL ChangeArray(A$(1))
  10860.  
  10861.  This does not, in fact, pass the address of the string descriptor of
  10862.  the first array element, but rather passes the near address of the
  10863.  descriptor of a copy of the string. To pass the address of the first
  10864.  descriptor, use BYVAL and VARPTR as follows:
  10865.  
  10866.     DECLARE SUB ChangeArray(BYVAL offset%)
  10867.     CALL ChangeArray(VARPTR(a$(1)))
  10868.  
  10869.  This information applies to Microsoft BASIC Professional Development
  10870.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  10871.  
  10872.  Note that all strings in the QBX.EXE environment are always far. When
  10873.  making .EXE programs with BC.EXE, you can enable far strings with the
  10874.  BC /Fs option.
  10875.  
  10876.  The following code example shows the correct way to pass an array of
  10877.  BASIC variable-length far strings to assembly language:
  10878.  
  10879.     DECLARE SUB ChangeArray(BYVAL offset%)
  10880.     DIM a$(1 TO 10)
  10881.     FOR i% = 1 TO 10
  10882.       a$(i%) = STRING$(i%, ASC("A") + i% - 1)
  10883.       PRINT a$(i%)
  10884.     NEXT
  10885.     CALL ChangeArray(VARPTR(a$(1)))
  10886.     FOR i% = 1 TO 10
  10887.        PRINT a$(i%)
  10888.     NEXT
  10889.     END
  10890.  
  10891.  To use the above program, the following assembly code (taken from
  10892.  Pages 516-517 of "Microsoft BASIC 7.0: Programmer's Guide") should be
  10893.  assembled and linked with the above program, or linked into a Quick
  10894.  library (.QLB) for use in the QBX.EXE environment:
  10895.  
  10896.        .model medium,basic
  10897.        .data
  10898.  array       dw 100 dup(0)
  10899.        .code
  10900.  ; arraydescriptor below is the pointer to the array:
  10901.  changearray proc uses si di, arraydescriptor: near ptr
  10902.        extrn stringassign:proc
  10903.        mov   cx, 10
  10904.        mov   si, arraydescriptor
  10905.        lea   di, array
  10906.  transferin: push cx
  10907.  
  10908.        push  ds
  10909.        push  si
  10910.        xor   ax,ax
  10911.        push  ax
  10912.        push  ds
  10913.        push  di
  10914.        mov   ax, 10
  10915.        push  ax
  10916.        call  stringassign
  10917.        pop   cx
  10918.        add   si, 4
  10919.        add   di,10
  10920.        loop  transferin
  10921.  
  10922.        mov   cx,100
  10923.        lea   bx, array
  10924.  more: cmp byte ptr[bx], 0
  10925.        jz    skip
  10926.        add byte ptr[bx], 32
  10927.  skip: inc   bx
  10928.        loop  more
  10929.  
  10930.        mov   cx, 10
  10931.        lea   si, array + 90
  10932.  transferout:push   cx
  10933.  
  10934.        push  ds
  10935.        push  si
  10936.        push  cx
  10937.        push  ds
  10938.        push  di
  10939.        xor   ax,ax
  10940.        push  ax
  10941.        call  stringassign
  10942.        pop   cx
  10943.        sub   si, 10
  10944.        add   di, 4
  10945.        loop  transferout
  10946.  
  10947.        ret
  10948.  
  10949.  changearray endp
  10950.        end
  10951.  
  10952.  Use the following Microsoft Macro Assembler command line to assemble
  10953.  the above code:
  10954.  
  10955.     MASM CHGARRAY.ASM ;
  10956.  
  10957.  To create a Quick library from CHGARRAY.OBJ, use the following LINK
  10958.  line:
  10959.  
  10960.     LINK /Q CHGARRAY,,,QBXQLB;
  10961.  
  10962.  To use this Quick library, enter QBX.EXE with the following statement:
  10963.  
  10964.     QBX /L CHGARRAY
  10965.  
  10966.  The output for the above code example is as follows:
  10967.  
  10968.     A
  10969.     BB
  10970.     CCC
  10971.     DDDD
  10972.     EEEEE
  10973.     FFFFFF
  10974.     GGGGGGG
  10975.     HHHHHHHH
  10976.     IIIIIIIII
  10977.     JJJJJJJJJJ
  10978.     jjjjjjjjjj
  10979.     iiiiiiiii
  10980.     hhhhhhhh
  10981.     ggggggg
  10982.     ffffff
  10983.     eeeee
  10984.     dddd
  10985.     ccc
  10986.     bb
  10987.     a
  10988.  
  10989.  
  10990.  185. How to Use Customize Menu Command of Utility Menu in QBX.EXE
  10991.  
  10992.  Product Version(s): 7.00
  10993.  Operating System:   MS-DOS
  10994.  Flags: ENDUSER | SR# S900118-14
  10995.  Last Modified: 26-FEB-1990    ArticleIdent: Q58568
  10996.  
  10997.  This article explains how to use the Customize Menu command in the
  10998.  Utility menu in the QBX.EXE (QuickBASIC Extended) environment. The
  10999.  Customize Menu command allows you to add your own DOS commands
  11000.  (internal, external, or batch files) to the Utility menu. This
  11001.  provides easy access to these commands rather than having to shell out
  11002.  to DOS and type them in at the command line prompt.
  11003.  
  11004.  This information applies to Microsoft BASIC Professional Development
  11005.  System (PDS) Version 7.00 for MS-DOS.
  11006.  
  11007.  The following is a brief summary of the features of the Customize Menu
  11008.  dialog box:
  11009.  
  11010.  Applications List - A list of the DOS commands already included in the
  11011.                      Utility menu.
  11012.  
  11013.  Add button        - Adds a new command to the Applications List. For
  11014.                      details, see farther below.
  11015.  
  11016.  Edit button       - Edits the information associated with a command
  11017.                      already in the Applications List.
  11018.  
  11019.  Delete button     - Deletes a command from the Applications List.
  11020.  
  11021.  To Begin button   - Puts the currently selected command at the top of
  11022.                      the Applications List.
  11023.  
  11024.  To End button     - Puts the currently selected command at the bottom
  11025.                      of the Applications List.
  11026.  
  11027.  Save button       - Saves all the changes made to the Applications
  11028.                      List and closes the Customize Menu dialog box.
  11029.  
  11030.  Cancel button     - Cancels all the changes made to the Applications
  11031.                      List and closes the Customize Menu dialog box.
  11032.  
  11033.  Help button       - Provides online help for using the Customize
  11034.                      Menu command.
  11035.  
  11036.  The Customize Menu command in the Utility menu is a handy way to
  11037.  execute DOS-level commands from inside the QBX.EXE environment. It
  11038.  allows you to execute internal commands, external commands, and batch
  11039.  files by selecting a menu item with the keyboard or mouse. There is no
  11040.  need to shell out to DOS. When the command or batch file is finished,
  11041.  you can be prompted to "press any key to continue" or you can specify
  11042.  for QBX to reappear automatically.
  11043.  
  11044.  Adding, deleting, editing, and ordering commands in the Utility menu
  11045.  is very simple, and the discussion above should be adequate enough for
  11046.  every feature except the Add button, which is discussed below in
  11047.  detail.
  11048.  
  11049.  Add Button
  11050.  ----------
  11051.  
  11052.  When selected, the Add button brings up another dialog box containing
  11053.  edit fields that are used to enter information about the command to be
  11054.  added. The following is a list of the edit fields and buttons of this
  11055.  dialog box and information about each one:
  11056.  
  11057.  Menu Text (20 chars) - Enter the name you want displayed in the
  11058.                         Utility menu. This name will also appear in the
  11059.                         Applications List. This may or may not be the
  11060.                         name of the actual command.
  11061.  
  11062.  Pathname             - Enter the name of the command if it is internal
  11063.                         or the full path to the file if it is external
  11064.                         or a batch file. For example, "DIR" or
  11065.                         "C:\CHKDSK".
  11066.  
  11067.  Arguments            - Enter the arguments passed to the command. For
  11068.                         example, this may be "a:" if the command is
  11069.                         "FORMAT" or "/w" if the command is "DIR", etc.
  11070.  
  11071.  Initial Directory    - Enter the name of the directory you want the
  11072.                         command to operate in.
  11073.  
  11074.  Prompt Before        - Select this option if you want to be prompted
  11075.  Returning              with "press any key to continue" before control
  11076.                         is returned to QBX.
  11077.  
  11078.  Accelerator Key      - Select the None button if you do not want to
  11079.                         use an accelerator key or select the ALT+F
  11080.                         button if you do. The values that may be
  11081.                         entered into the box following ALT+F range from
  11082.                         2 to 10, specifying the function keys F2
  11083.                         through F10.
  11084.  
  11085.  OK button            - Select this button when you are satisfied with
  11086.                         the information in the dialog box. The Add
  11087.                         dialog box closes and the name of the new
  11088.                         command is added to the Applications List.
  11089.                         However, none of the changes to the Utility
  11090.                         menu are saved unless the Save button is
  11091.                         selected.
  11092.  
  11093.  Cancel button        - This button cancels the information entered in
  11094.                         the edit fields and closes the Add dialog box.
  11095.  
  11096.  Help button          - This button displays more online help.
  11097.  
  11098.  Below is a step-by-step example illustrating how to use the Customize
  11099.  Menu command. This example shows how to add the DOS command "DIR" to
  11100.  the Utility menu. This DIR command operates on the current directory
  11101.  and uses the "/w" parameter to display the listing in many columns
  11102.  rather than one. Also, an accelerator key (ALT+F5) is linked to the
  11103.  command for easy keyboard access and the user is prompted to "press
  11104.  any key to continue" after the DIR command is finished.
  11105.  
  11106.   1. Choose Customize Menu from the Utility menu. This can be done by
  11107.      holding down the ALT and U keys together, followed by the C key
  11108.      alone.
  11109.  
  11110.   2. The Customize Menu dialog box appears. Press the TAB key once to
  11111.      highlight the Add button and then press ENTER.
  11112.  
  11113.   3. Another dialog box appears, containing edit fields used to enter
  11114.      information about the command. The cursor is placed in the top
  11115.      edit field, "Menu Text (20 chars)." Type in "DIR" for this field
  11116.      and press TAB.
  11117.  
  11118.   4. The cursor advances to the next edit field, "Pathname". Since DIR
  11119.      is an internal command, it has no path, so you only need to enter
  11120.      the name of the command by itself, "DIR". Do this and press TAB
  11121.      again.
  11122.  
  11123.   5. The next edit field is "Arguments". A common argument to pass to
  11124.      the DIR command is "/w".  The "/w" argument (called a switch)
  11125.      breaks the directory listing into columns rather than listing them
  11126.      in one long column, which frequently scrolls off the screen. Type
  11127.      "/w" and press TAB.
  11128.  
  11129.   6. For the "Initial Directory" edit field, you can enter any valid
  11130.      pathname. Leaving this field blank causes the command to use the
  11131.      current pathname. Press TAB to leave it blank.
  11132.  
  11133.   7. The cursor is now placed inside the button titled "Prompt Before
  11134.      Returning." You can press SPACEBAR to toggle this button on or
  11135.      off. Toggle it on and press TAB.
  11136.  
  11137.   8. The cursor advances to the button titled "None". By default it is
  11138.      also selected, specifying that no accelerator key is to be defined
  11139.      for accessing the DOS command from the Utility menu. To enter an
  11140.      accelerator key, press the RIGHT ARROW. This toggles the None
  11141.      button off and the ALT+F button on. Press TAB to advance the
  11142.      cursor to the edit field following the ALT+F button and enter a 5
  11143.      (specifying F5). Press ENTER to continue.
  11144.  
  11145.   9. The current dialog box closes and the main Customize Menu dialog
  11146.      box reappears. You will see that "DIR" has been added to the
  11147.      Applications List. Press TAB until the Save button is highlighted,
  11148.      then press ENTER.
  11149.  
  11150.  10. The Customize Menu dialog box closes. You can now choose the DIR
  11151.      command from the Utility menu either by pulling down the menu and
  11152.      then choosing DIR or you can use the accelerator key sequence,
  11153.      ALT+F5. After displaying the contents of the current directory, you
  11154.      will be prompted with "press any key to continue" before control is
  11155.      returned to QBX.
  11156.  
  11157.  
  11158.  186. Token Ring Network Driver May Conflict with BASIC 7.00 Setup
  11159.  
  11160.  Product Version(s): 7.00
  11161.  Operating System:   MS-DOS
  11162.  Flags: ENDUSER | SR# S900207-50 B_BasicCom
  11163.  Last Modified: 26-FEB-1990    ArticleIdent: Q58639
  11164.  
  11165.  A customer reported that when running the SETUP.EXE installation
  11166.  program for Microsoft BASIC Professional Development System (PDS)
  11167.  Version 7.00 for MS-DOS and OS/2, problems may occur if a Token Ring
  11168.  network device driver Version 1.10 has been loaded from the CONFIG.SYS
  11169.  file during a system boot. Upon removing the device driver and
  11170.  rebooting the system, everything seems to install and build correctly.
  11171.  
  11172.  The customer reported that the source files on the distribution disks
  11173.  were overwritten with the current system date and weren't properly
  11174.  unpacked onto the hard disk, and subsequent library and toolbox builds
  11175.  crashed because of the corrupt files used. Microsoft has not confirmed
  11176.  this information.
  11177.  
  11178.  
  11179.  187. LOCAL (Procedure) ERROR Handling Introduced in BASIC PDS 7.00
  11180.  
  11181.  Product Version(s): 7.00   | 7.00
  11182.  Operating System:   MS-DOS | OS/2
  11183.  Flags: ENDUSER |
  11184.  Last Modified: 26-FEB-1990    ArticleIdent: Q58606
  11185.  
  11186.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  11187.  MS-DOS and MS OS/2 offers structured error trapping and handling that
  11188.  make error handling much more flexible than in earlier versions of
  11189.  BASIC.
  11190.  
  11191.  In previous versions of BASIC, error handling routines existed at the
  11192.  module level. When a handler was turned on with the ON ERROR GOTO
  11193.  statement, it was active for all procedures within that module.
  11194.  
  11195.  With Microsoft BASIC PDS 7.00, you can now create both module-level
  11196.  and procedure-level error handlers. BASIC PDS 7.00 introduces the ON
  11197.  LOCAL ERROR GOTO statement to trap procedure-level errors. A given
  11198.  type of error can invoke different local error-handling routines,
  11199.  depending on which procedure is running. For example, you may want to
  11200.  invoke different error-handling routines for ERR code 54, "Bad File
  11201.  Mode," because the error has different meaning for different file
  11202.  operations.
  11203.  
  11204.  For more information, please refer to Chapter 8, "Error Handling," in
  11205.  the "Microsoft BASIC 7.0: Programmer's Guide," or see the ON ERROR
  11206.  statement "Details" in the Microsoft Advisor online Help system in the
  11207.  QBX.EXE environment.
  11208.  
  11209.  Error handling is the process of intercepting and dealing with errors
  11210.  that would otherwise stop your program at run time. BASIC PDS 7.00
  11211.  provides an ON [LOCAL] ERROR GOTO statement to enable the trapping of
  11212.  errors and takes the appropriate action so the program can continue
  11213.  executing. The ON ERROR GOTO statement jumps to a labeled
  11214.  error-handling  routine. The ON [LOCAL] ERROR GOTO 0 statement can be
  11215.  used to disable an error-handling routine.
  11216.  
  11217.  Procedure-Level Versus Module-Level Error-Handling
  11218.  --------------------------------------------------
  11219.  
  11220.  For many applications, procedure-level error handling is preferred
  11221.  because procedures tend to be organized by task (display, printing,
  11222.  general I/O, etc.), and errors are also task-related. Therefore,
  11223.  program organization can be simpler and more straightforward when
  11224.  related tasks and their error handlers are grouped together.
  11225.  
  11226.  The following is the syntax for ERROR handling:
  11227.  
  11228.     ON [LOCAL] ERROR { GOTO line | RESUME NEXT | GOTO 0 }
  11229.  
  11230.     LOCAL: The LOCAL keyword indicates an error-handling routine that
  11231.     is "local" to the procedure within which the error-handling routine
  11232.     is located. A local error-handling routine:
  11233.  
  11234.     -- Overrides any enabled module-level error-handling routines.
  11235.  
  11236.     -- Is enabled only while the procedure within which it is
  11237.        located is executing.
  11238.  
  11239.     GOTO <line>: Enables the error-handling routine that starts at
  11240.     <line>. Thereafter, if a run-time error occurs, program control
  11241.     branches to <line> (label or line number). The specified <line> is
  11242.     in either module-level code or in the same procedure (if the LOCAL
  11243.     keyword is used). If <line> is not found in either place, BASIC
  11244.     generates a "Label not defined" compile-time error.
  11245.  
  11246.     Exiting an Error-Handling Routine
  11247.     ---------------------------------
  11248.  
  11249.     RESUME NEXT: Specifies that when a run-time error occurs control
  11250.     goes to the statement after the statement where the error occurred;
  11251.     the ERR function can then be used to obtain the run-time error
  11252.     code.
  11253.  
  11254.     RESUME[0]: Returns to the statement that caused the error or the
  11255.     last call out of the error-handling procedure or module.
  11256.  
  11257.     RESUME <line>: Returns to the label or line number specified by
  11258.     <line>.
  11259.  
  11260.     ERROR ERR: Initiates a search of the invocation path for the next
  11261.     higher-level error-handling routine, if any. If no higher-level
  11262.     error handler exists, the program stops with the error reported by
  11263.     the ERR function.
  11264.  
  11265.     GOTO 0: Disables any enabled module-level error-handling routine
  11266.     within the current module, or disables any enabled error handler
  11267.     within the current procedure (if used together with the LOCAL
  11268.     keyword).
  11269.  
  11270.  Below is an example of how to use procedure-level (local) error
  11271.  handling and module-level error handling within the same module.
  11272.  
  11273.  This program consists of one module that contains a main program and a
  11274.  subprogram within the same module. At the module-level code, the ON
  11275.  ERROR GOTO is placed at the top of the program so that that there is a
  11276.  way to handle errors that occur in the module-level code. The
  11277.  subprogram "test" has its own local error handler. Two errors occur in
  11278.  this program; one in the module-level code (ERROR 2 "Syntax error"),
  11279.  and another in the subprogram (Error 51 "Division by zero"). Each
  11280.  error is handled independently by each error-handler routine.
  11281.  
  11282.  Code Example
  11283.  ------------
  11284.  
  11285.  'MODULE LEVEL CODE:
  11286.  DECLARE SUB test ()
  11287.  CLS
  11288.  'Enable module-level error handler:
  11289.  ON ERROR GOTO ModuleHandler
  11290.  PRINT "We are at the module-level code"
  11291.  
  11292.  'Call a SUBprogram procedure within the same module:
  11293.  CALL test
  11294.  PRINT "We are back at the module level"
  11295.  'Simulate an error ("Syntax Error") in the module-level code:
  11296.  ERROR 2
  11297.  PRINT "this is the end"
  11298.  END
  11299.  
  11300.  'Module-Level Error Handler:
  11301.  ModuleHandler:
  11302.  
  11303.  PRINT "You have encountered an error at the module-level code,"
  11304.  PRINT "and the program has trapped error number:"; ERR
  11305.  PRINT "Now resuming to next line..."
  11306.  'RESUME NEXT from a module-level error handler returns to the next
  11307.  'statement immediately following the one that caused the error
  11308.  '(or to the statement following the CALL to a procedure in which
  11309.  'an untrapped error occurred):
  11310.  RESUME NEXT
  11311.  
  11312.  'This SUB is called by the module-level code:
  11313.  SUB test
  11314.  PRINT "We are now at the procedure (local) level code."
  11315.  'Enable the local-error handler:
  11316.  ON LOCAL ERROR GOTO LocalHandler
  11317.  a! = 10
  11318.  b! = 0
  11319.  'A "Division by zero" error occurs when the following line executes:
  11320.  c! = a! / b!
  11321.  PRINT "We resumed past the statement with the division by zero error."
  11322.  PRINT "c! ="; c!
  11323.  
  11324.  'Place the EXIT SUB statement before the error-handling routine to
  11325.  'avoid incorrectly passing control to the local error handler:
  11326.  EXIT SUB
  11327.  
  11328.  LocalHandler:
  11329.  PRINT "You have encountered an error at the procedure-level code,"
  11330.  PRINT "and the program has trapped error number:"; ERR
  11331.  SELECT CASE ERR
  11332.     CASE 11
  11333.     PRINT "Error Message: Attempted to divide by zero"
  11334.  END SELECT
  11335.  PRINT "Now resuming to next line..."
  11336.  RESUME NEXT
  11337.  
  11338.  END SUB
  11339.  
  11340.  
  11341.  188. Bad EXE Result Assigning n Between 2 Statements Using Same n
  11342.  
  11343.  Product Version(s): 7.00   | 7.00
  11344.  Operating System:   MS-DOS | OS/2
  11345.  Flags: ENDUSER | SR# S900207-44 buglist7.00 fixlist7.10
  11346.  Last Modified:  6-SEP-1990    ArticleIdent: Q58608
  11347.  
  11348.  Assigning a SINGLE-precision variable in a statement between two other
  11349.  statements that use that same variable can produce incorrect results
  11350.  in an .EXE compiled with BC.EXE in Microsoft BASIC Professional
  11351.  Development System (PDS) version 7.00 for MS-DOS and OS/2. This
  11352.  problem does not occur in the QBX.EXE (QuickBASIC Extended)
  11353.  environment. This error does not occur with the INTEGER, LONG, DOUBLE,
  11354.  or CURRENCY data types.
  11355.  
  11356.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  11357.  version 7.00. This problem was corrected in version 7.10.
  11358.  
  11359.  To work around this problem in 7.00, do ONE of the following:
  11360.  
  11361.  1. Use the BC /X compiler option.
  11362.  
  11363.  2. Make an assignment to a temporary variable before the second or
  11364.     third statement.
  11365.  
  11366.  3. Place a line number or label on the second or third statement.
  11367.  
  11368.  4. Place a DEFxxx statement in the program (such as DEFDBL A-Z), or
  11369.     explicitly DIMension the variable to be some data type other than
  11370.     SINGLE precision.
  11371.  
  11372.  This problem does NOT occur in Microsoft BASIC Compiler version 6.00
  11373.  or 6.00b for MS-DOS and OS/2, or in Microsoft QuickBASIC version 4.00,
  11374.  4.00b, or 4.50 for MS-DOS.
  11375.  
  11376.  The following code example illustrates the problem and contains
  11377.  workarounds #2 and #3 in comments:
  11378.  
  11379.     init = p
  11380.     'temp = init      'Uncomment this line for workaround #2
  11381.     'label:           'Uncomment this line for workaround #3
  11382.     p = 200
  11383.     wrong = p
  11384.     PRINT wrong, p    'In EXE compiled without /X, this prints 0 and 200
  11385.  
  11386.  
  11387.  189. "7.0: Programmer's Guide" Error Handling Example Correction
  11388.  
  11389.  Product Version(s): 7.00 7.10 | 7.00 7.10
  11390.  Operating System:   MS-DOS    | OS/2
  11391.  Flags: ENDUSER | SR# S900207-56 docerr
  11392.  Last Modified:  8-JAN-1991    ArticleIdent: Q58640
  11393.  
  11394.  The following are two corrections to the error handling example
  11395.  program on Page 291 of the "Microsoft BASIC 7.0: Programmer's Guide"
  11396.  (for 7.00 and 7.10):
  11397.  
  11398.  1. In Module #1, the line "ON ERROR GOTO Handler" should be removed
  11399.     because there is no line label "Handler" in the first module.
  11400.  
  11401.  2. In Module #2, the line "DEFINT A-Z" should be added before the line
  11402.     "Handler:". Since the default type for variables is SINGLE,
  11403.     variables A and B would be incorrectly typed as SINGLE instead of
  11404.     as INTEGER if the DEFINT A-Z line is not inserted.
  11405.  
  11406.  This information applies to Microsoft BASIC Professional Development
  11407.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  11408.  
  11409.  
  11410.  190. BASIC 7.00 Can Assign an Array to an Array If in a TYPE
  11411.  
  11412.  Product Version(s): 7.00 7.10 | 7.00 7.10
  11413.  Operating System:   MS-DOS    | OS/2
  11414.  Flags: ENDUSER | SR# S900131-59 B_QuickBas
  11415.  Last Modified: 12-NOV-1990    ArticleIdent: Q58733
  11416.  
  11417.  Some languages, such as Pascal, allow you to assign one array directly
  11418.  to another, which copies all the elements from one array to another.
  11419.  Microsoft BASIC cannot do this, except in Microsoft BASIC Professional
  11420.  Development System (PDS) versions 7.00 and 7.10 where you can now
  11421.  directly assign one static array to another by defining the array in a
  11422.  user-defined-TYPE variable and then assigning one variable of this
  11423.  TYPE to another.
  11424.  
  11425.  Using a variable of a TYPE that contains an array, you can also write
  11426.  an entire array to a file using a single PUT# statement.
  11427.  
  11428.  Note that in Microsoft QuickBASIC versions 4.00, 4.00b, and 4.50 for
  11429.  MS-DOS, in Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS
  11430.  and MS OS/2, and in Microsoft BASIC PDS versions 7.00 and 7.10 for
  11431.  MS-DOS and MS OS/2, you can directly assign variables of a
  11432.  user-defined TYPE directly to one another if they are of the same
  11433.  TYPE. (LSET can be used for assignment if the record variables differ
  11434.  in TYPE.) The TYPEd variables are assigned in one simple statement,
  11435.  and each and every element of the user-defined TYPE is automatically
  11436.  copied.
  11437.  
  11438.  Microsoft BASIC PDS version 7.00 for MS-DOS and MS OS/2 introduces
  11439.  support for static arrays in user-defined TYPEs. In BASIC PDS 7.00 and
  11440.  7.10, you can directly assign one static array to another by defining
  11441.  the array in a user-defined-TYPE variable and then assigning one
  11442.  variable of this TYPE to another, as shown in Example 1.
  11443.  
  11444.  You can also write a whole array at once into a disk file, as shown in
  11445.  Example 2.
  11446.  
  11447.  Code Example 1
  11448.  --------------
  11449.  
  11450.  The following program can be used in BASIC PDS 7.00 and 7.10 to
  11451.  demonstrate the assignment of the contents of one static array to
  11452.  another. (Note that dynamic arrays cannot be placed in user-defined
  11453.  TYPEs.)
  11454.  
  11455.     TYPE rec1
  11456.       array1(20) AS INTEGER
  11457.     END TYPE
  11458.     DIM var1 AS rec1, var2 AS rec1
  11459.     CLS
  11460.     FOR i = 1 TO 20      ' Fill the array in var1:
  11461.       var1.array1(i) = i
  11462.     NEXT
  11463.       var2 = var1          ' Make the assignment.
  11464.     FOR i = 1 TO 20      ' Confirm that the array was copied to var2:
  11465.       PRINT var2.array1(i)
  11466.     NEXT
  11467.     END
  11468.  
  11469.  Code Example 2
  11470.  --------------
  11471.  
  11472.  The following example, compiled in BASIC PDS 7.00 or 7.10, shows how
  11473.  to write a whole array to disk at once, using just one PUT# statement:
  11474.  
  11475.     TYPE rec1
  11476.       array1(20) AS INTEGER
  11477.     END TYPE
  11478.     DIM var1 AS rec1, var2 AS rec1
  11479.     CLS
  11480.     FOR i = 1 TO 20      ' Fill the array in var1:
  11481.       var1.array1(i) = i
  11482.     NEXT
  11483.  
  11484.     OPEN "test.dat" FOR RANDOM AS #1
  11485.     PUT #1, , var1         ' write whole array to disk all at once.
  11486.     CLOSE
  11487.  
  11488.     OPEN "test.dat" FOR RANDOM AS #1
  11489.     GET #1, , var2      ' Reads array all at once into var2.
  11490.     FOR i = 1 TO 20     ' Print the contents of array var2:
  11491.       PRINT var2.array1(i);
  11492.     NEXT
  11493.     CLOSE
  11494.  
  11495.  
  11496.  191. Quick Libraries in BASIC 7.00 Don't Use Expanded Memory
  11497.  
  11498.  Product Version(s): 7.00 7.10
  11499.  Operating System:   MS-DOS
  11500.  Flags: ENDUSER | SR# S900207-70
  11501.  Last Modified: 27-JUL-1990    ArticleIdent: Q58658
  11502.  
  11503.  When using a Quick library in QBX.EXE, the programming environment
  11504.  included with Microsoft BASIC Professional Development System (PDS)
  11505.  version 7.00 or 7.10, the Quick library is always placed in
  11506.  conventional memory. If you have expanded memory (as defined in the
  11507.  LIM 4.0 EMS), QBX.EXE utilizes this expanded memory for loaded source
  11508.  code segments that are smaller than 16K; however, Quick libraries are
  11509.  always placed in conventional memory.
  11510.  
  11511.  Microsoft BASIC PDS 7.00 or 7.10 is the only Microsoft BASIC product
  11512.  that supports expanded memory, so this is not a consideration in
  11513.  earlier versions of Microsoft BASIC Compiler or QuickBASIC.
  11514.  
  11515.  Note: (LIM 4.0 EMS is an acronym for the Lotus/Intel/Microsoft version
  11516.  4.0 Expanded Memory Specification for MS-DOS.)
  11517.  
  11518.  
  11519.  192. TIMEVALUE# Function Documentation Correction in BASIC 7.00
  11520.  
  11521.  Product Version(s): 7.00 7.10 | 7.00 7.10
  11522.  Operating System:   MS-DOS    | OS/2
  11523.  Flags: ENDUSER | SR# S900208-180 docerr
  11524.  Last Modified:  8-JAN-1991    ArticleIdent: Q58660
  11525.  
  11526.  The following reference to the TIMEVALUE# function on Page 486 of the
  11527.  "Microsoft BASIC 7.0: Language Reference" manual (for 7.00 and 7.10)
  11528.  is incorrect. The second sentence in the remarks section states the
  11529.  following:
  11530.  
  11531.     Time can be entered as "2:24PM" or "14:24".
  11532.  
  11533.  This sentence should indicate a space between "2:24" and "PM" and read
  11534.  as follows:
  11535.  
  11536.     Time can be entered as "2:24 PM" or "14:24".
  11537.  
  11538.  The TIMEVALUE function is a routine in the "add-on library" included
  11539.  with Microsoft BASIC Professional Development System versions 7.00 and
  11540.  7.10 for MS-DOS and MS OS/2.
  11541.  
  11542.  
  11543.  193. ButtonOpen Incorrectly Handles Button in Resizable Window
  11544.  
  11545.  Product Version(s): 7.00 7.10
  11546.  Operating System:   MS-DOS
  11547.  Flags: ENDUSER | SR# S900202-66 buglist7.00 buglist7.10
  11548.  Last Modified: 20-SEP-1990    ArticleIdent: Q58673
  11549.  
  11550.  The ButtonOpen SUBprogram in the User Interface (UI) Toolbox (in
  11551.  WINDOW.BAS) incorrectly handles buttons in resizable windows and
  11552.  buttons with invalid states. When trying to create a button with an
  11553.  invalid state (such as state 3 for window type 2), the following
  11554.  message displays and the program stops:
  11555.  
  11556.     Cannot open button on window that can be re-sized.
  11557.  
  11558.  When you attempt to place a button in a resizable window, the above
  11559.  message is not displayed, but no button is created. In this case, the
  11560.  ButtonOpen SUB falls through without doing anything.
  11561.  
  11562.  This information applies to Microsoft BASIC Professional Development
  11563.  System (PDS) versions 7.00 and 7.10 for MS-DOS. The necessary
  11564.  corrections to the WINDOW.BAS source code are listed below.
  11565.  
  11566.  For additional corrections to source code in the User Interface
  11567.  Toolbox, search in this Knowledge Base for the following words:
  11568.  
  11569.     User and Interface and Toolbox and buglist7.00
  11570.  
  11571.  The section of code that must be modified is at the end of the
  11572.  ButtonOpen SUB from WINDOW.BAS (Note: The underscores are used for
  11573.  display purposes only):
  11574.  
  11575.    IF (resize AND buttonType >= 6) OR NOT resize THEN
  11576.  ...*** not all code displayed
  11577.      IF (buttonType = 1 AND state >= 1 AND state <= 3)_
  11578.      OR (buttonType >= 2 AND buttonType <= 3 AND state >= 1 AND state <= 2)_
  11579.      OR (buttonType >= 4 AND buttonType <= 7) THEN
  11580.  ...*** not all code displayed
  11581.      ELSE
  11582.          PRINT "Cannot open button on window that can be re-sized!"
  11583.          END
  11584.      END IF
  11585.    END IF
  11586.  END SUB
  11587.  
  11588.  The problem with the existing code is that the ELSE clause matches the
  11589.  wrong level of the IF nesting. To modify the code to display correct
  11590.  messages, change the above code to the following:
  11591.  
  11592.    IF (resize AND buttonType >= 6) OR NOT resize THEN
  11593.    ...*** not all code displayed
  11594.      IF (buttonType = 1 AND state >= 1 AND state <= 3)_
  11595.      OR (buttonType >= 2 AND buttonType <= 3 AND state >= 1 AND state <= 2)_
  11596.      OR (buttonType >= 4 AND buttonType <= 7) THEN
  11597.      ...*** not all code displayed
  11598.  
  11599.  'The following lines have changed.
  11600.      ELSE
  11601.        PRINT "Illegal state ("; state; ") or button type ("; buttonType; ")"
  11602.        END
  11603.      END IF
  11604.    ELSE
  11605.      PRINT "Cannot open button on window that can be re-sized!"
  11606.      END
  11607.    END IF
  11608.  END SUB
  11609.  
  11610.  The following code examples demonstrate the two problems with the
  11611.  unmodified ButtonOpen SUB:
  11612.  
  11613.  Example 1
  11614.  ---------
  11615.  
  11616.  This first example attempts to open a button, type 2 (check box), with
  11617.  an invalid state, 3. This program displays the following incorrect
  11618.  message using the unmodified code shipped with BASIC PDS 7.00 or 7.10:
  11619.  
  11620.     Cannot open button on window that can be re-sized.
  11621.  
  11622.  After making the specified modifications to WINDOW.BAS, Example 1
  11623.  displays the following correct message:
  11624.  
  11625.     Illegal state ( 3 ) or button type ( 2 )
  11626.  
  11627.  REM $INCLUDE: 'General.bi'
  11628.  REM $INCLUDE: 'Mouse.bi'
  11629.  REM $INCLUDE: 'Menu.bi'
  11630.  REM $INCLUDE: 'Window.bi'
  11631.  COMMON SHARED /uitools/ GloMenu           AS MenuMiscType
  11632.  COMMON SHARED /uitools/ GloTitle()        AS MenuTitleType
  11633.  COMMON SHARED /uitools/ GloItem()         AS MenuItemType
  11634.  COMMON SHARED /uitools/ GloWindow()       AS windowType
  11635.  COMMON SHARED /uitools/ GloButton()       AS buttonType
  11636.  COMMON SHARED /uitools/ GloEdit()         AS EditFieldType
  11637.  COMMON SHARED /uitools/ GloStorage        AS WindowStorageType
  11638.  COMMON SHARED /uitools/ GloWindowStack()  AS INTEGER
  11639.  COMMON SHARED /uitools/ GloBuffer$()
  11640.  '$DYNAMIC
  11641.  DIM GloWindow(MAXWINDOW) AS windowType
  11642.  DIM GloWindowStack(MAXWINDOW) AS INTEGER
  11643.  DIM GloButton(MAXBUTTON) AS buttonType
  11644.  DIM GloEdit(MAXBUTTON) AS EditFieldType
  11645.  DIM GloBuffer$(MAXWINDOW + 1, 2)
  11646.  CLS
  11647.  WindowInit
  11648.  Resize% = 0               'Not resizable
  11649.  WindowOpen 1, 3, 3, 24, 24, 7, 0, 7, 0, 7, 7, 7, Resize%, 0, 1, "test"
  11650.  buttonType% = 2              'Check box (valid states=1 and 2)
  11651.  state% = 3                   '3 is invalid state for check box
  11652.  CALL ButtonOpen(1, state%, "Foo", 10, 10, 20, 20, buttonType%)
  11653.  
  11654.  Example 2
  11655.  ---------
  11656.  
  11657.  The following example attempts to open a button in a resizable window.
  11658.  This program executes without messages using the unmodified code
  11659.  shipped with BASIC PDS 7.00 or 7.10, but no button is created.
  11660.  
  11661.  After making the specified modifications to WINDOW.BAS, Example 2
  11662.  displays the following correct message:
  11663.  
  11664.     Cannot open button on window that can be re-sized.
  11665.  
  11666.  REM $INCLUDE: 'General.bi'
  11667.  REM $INCLUDE: 'Mouse.bi'
  11668.  REM $INCLUDE: 'Menu.bi'
  11669.  REM $INCLUDE: 'Window.bi'
  11670.  COMMON SHARED /uitools/ GloMenu           AS MenuMiscType
  11671.  COMMON SHARED /uitools/ GloTitle()        AS MenuTitleType
  11672.  COMMON SHARED /uitools/ GloItem()         AS MenuItemType
  11673.  COMMON SHARED /uitools/ GloWindow()       AS windowType
  11674.  COMMON SHARED /uitools/ GloButton()       AS buttonType
  11675.  COMMON SHARED /uitools/ GloEdit()         AS EditFieldType
  11676.  COMMON SHARED /uitools/ GloStorage        AS WindowStorageType
  11677.  COMMON SHARED /uitools/ GloWindowStack()  AS INTEGER
  11678.  COMMON SHARED /uitools/ GloBuffer$()
  11679.  '$DYNAMIC
  11680.  DIM GloWindow(MAXWINDOW) AS windowType
  11681.  DIM GloWindowStack(MAXWINDOW) AS INTEGER
  11682.  DIM GloButton(MAXBUTTON) AS buttonType
  11683.  DIM GloEdit(MAXBUTTON) AS EditFieldType
  11684.  DIM GloBuffer$(MAXWINDOW + 1, 2)
  11685.  CLS
  11686.  WindowInit
  11687.  Resize% = TRUE                 'Resizable
  11688.  WindowOpen 1, 3, 3, 24, 24, 7, 0, 7, 0, 7, 7, 7, Resize%, 0, 1, "test"
  11689.  buttonType% = 2
  11690.  state% = 1                     'Valid state.
  11691.  CALL ButtonOpen(1, state%, "Foo", 10, 10, 20, 20, buttonType%)
  11692.  
  11693.  
  11694.  194. MenuEvent$ Should Be MenuEvent, Page 495 BASIC 7.0 Reference
  11695.  
  11696.  Product Version(s): 7.00 7.10
  11697.  Operating System:   MS-DOS
  11698.  Flags: ENDUSER | SR# S900212-51 docerr
  11699.  Last Modified:  8-JAN-1991    ArticleIdent: Q58676
  11700.  
  11701.  On Page 495 of the "Microsoft BASIC Version 7.0: Language Reference"
  11702.  manual (for 7.00 and 7.10), the User Interface (UI) Toolbox routine
  11703.  "MenuEvent" is incorrectly referred to as "MenuEvent$". This is a
  11704.  documentation error, since the correct name is "MenuEvent".
  11705.  
  11706.  This information applies to Microsoft BASIC Professional Development
  11707.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  11708.  
  11709.  MenuEvent is a SUB in the toolbox file MENU.BAS and is used to poll
  11710.  for any menu events activated by the mouse or keyboard.
  11711.  
  11712.  
  11713.  195. Limits for Nesting Arrays in TYPE Statements in BASIC 7.00
  11714.  
  11715.  Product Version(s): 7.00   | 7.00
  11716.  Operating System:   MS-DOS | OS/2
  11717.  Flags: ENDUSER |
  11718.  Last Modified: 28-FEB-1990    ArticleIdent: Q58790
  11719.  
  11720.  In the QBX.EXE (QuickBASIC Extended) environment for MS-DOS, you can
  11721.  have up to 16 nested-array TYPE definitions (see Code Example 1,
  11722.  below). If you exceed 16 nestings, you get a "Subscript out of range"
  11723.  error.
  11724.  
  11725.  In the QBX.EXE environment, nonarray nested TYPEs (see Code Example 2,
  11726.  below) can be nested until you run out of memory.
  11727.  
  11728.  As for the BC.EXE compiler, the limit on the number of TYPE statements
  11729.  for one module is 240 whether they are nested or nonnested TYPE
  11730.  definitions. If the number of TYPEs of all kinds exceeds 240, the
  11731.  BC.EXE compiler gives an error of "Too Many Type statements".
  11732.  
  11733.  This information applies to Microsoft BASIC Professional Development
  11734.  System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  11735.  
  11736.  (This information does not apply to versions of Microsoft BASIC
  11737.  earlier than 7.00 because they do not support arrays in user-defined
  11738.  TYPEs.)
  11739.  
  11740.  Note that only static (nondynamic) arrays can be placed in TYPE
  11741.  statements in BASIC PDS 7.00.
  11742.  
  11743.  Code Example 1 (Arrays of Nested TYPEs)
  11744.  ---------------------------------------
  11745.  
  11746.  OPTION BASE 1
  11747.  
  11748.  TYPE test1
  11749.     a AS STRING * 1
  11750.  END TYPE
  11751.  
  11752.  TYPE test2
  11753.     b2(1) AS test1        'Nest it as the first TYPE
  11754.  END TYPE
  11755.  .
  11756.  .
  11757.  .
  11758.  TYPE test15
  11759.     b15(1) AS test14
  11760.  END TYPE
  11761.  
  11762.  TYPE test16
  11763.     b16(1) AS test15
  11764.  END TYPE
  11765.  
  11766.  DIM temp(1000) AS test16
  11767.  
  11768.  Code Example 2 (Nonarray Variables of Nested TYPEs)
  11769.  ---------------------------------------------------
  11770.  
  11771.  TYPE test1
  11772.     a AS INTEGER
  11773.  END TYPE
  11774.  
  11775.  TYPE test2
  11776.     b2 AS test1
  11777.  END TYPE
  11778.  
  11779.  TYPE test3
  11780.     b3 AS test2
  11781.  END TYPE
  11782.  .
  11783.  .
  11784.  .
  11785.  TYPE test237
  11786.     b237 AS test236
  11787.  END TYPE
  11788.  
  11789.  TYPE test238
  11790.     b238 AS test237
  11791.  END TYPE
  11792.  
  11793.  TYPE new
  11794.     none AS INTEGER    'Put in to see if the TYPEs had to be nested
  11795.  END TYPE
  11796.  
  11797.  TYPE new2
  11798.     none2 AS INTEGER
  11799.  END TYPE
  11800.  
  11801.  DIM temp(100) as test238
  11802.  
  11803.  
  11804.  196. DATEVALUE# Function in BASIC 7.00 Uses MM-DD-YY, Not DD-MM-YY
  11805.  
  11806.  Product Version(s): 7.00 7.10 | 7.00 7.10
  11807.  Operating System:   MS-DOS    | OS/2
  11808.  Flags: ENDUSER | docerr
  11809.  Last Modified:  8-JAN-1991    ArticleIdent: Q58791
  11810.  
  11811.  The DATEVALUE# function that comes in the Date/Time Library of
  11812.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  11813.  does not interpret dates in the form of "dd/mm/yy" or "dd-mm-yy,"
  11814.  where the day number precedes the month number (dd stands for day, mm
  11815.  stands for month, and yy stands for year). Instead, the DATEVALUE#
  11816.  function interprets dates in the form of "mm/dd/yy" or "mm-dd-yy,"
  11817.  where the month number precedes the day number. For example, you get
  11818.  "Illegal Function Call" (error 5) when passing "30/12/88" or
  11819.  "30-12-88" to the DATEVALUE# function.
  11820.  
  11821.  Both Page 427 of the "Microsoft BASIC 7.0: Language Reference" manual
  11822.  (for 7.00 and 7.10) and also the "HELP: DateValue# Function Details"
  11823.  screen in the Microsoft Advisor online Help system in QBX.EXE
  11824.  incorrectly state that "30/12/88" is one of the acceptable formats.
  11825.  This should be changed to say that "12/30/88" ("mm/dd/yy") format is
  11826.  accepted by the DATEVALUE# function.
  11827.  
  11828.  Also, the "HELP: DateValue# Function Details" screen in the Microsoft
  11829.  Advisor online Help system in QBX.EXE incorrectly states: "To use
  11830.  DateValue# in the QBX environment, use the FINANCER.QLB Quick
  11831.  library." This should be changed to say the DTFMTER.QLB Quick library.
  11832.  (Page 427 of the reference manual correctly says to use DTFMTER.QLB in
  11833.  QBX.)
  11834.  
  11835.  This information applies to Microsoft BASIC Professional Development
  11836.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  11837.  
  11838.  If you want to give the date before the month, you can use the name of
  11839.  the month instead of the numeric representation of the month.
  11840.  
  11841.  The following are not accepted ("Illegal Function Call"):
  11842.  
  11843.     B# = DateValue# ("30-12-88")
  11844.     B# = DateValue# ("30/12/88")
  11845.  
  11846.  The following are accepted (the workaround is to use the spelled
  11847.  instead of the numeric month):
  11848.  
  11849.     B# = DateValue# ("30-Dec-88")
  11850.     B# = DateValue# ("30/Dec/88")
  11851.  
  11852.  The following are accepted (but month, day, and year must be in
  11853.  order):
  11854.  
  11855.     B# = DateValue# ("12-30-88")
  11856.     B# = DateValue# ("12/30/88")
  11857.     B# = DateValue# ("December 30, 1988")
  11858.  
  11859.  DateValue# accepts dates between January 1, 1753, and December 31,
  11860.  2078.
  11861.  
  11862.  Complete Code Example
  11863.  ---------------------
  11864.  
  11865.  You can run this program with QBX /L DTFMTER.QLB, or link with the
  11866.  appropriate DTFMTxx.LIB file if making an .EXE program:
  11867.  
  11868.     REM $INCLUDE: 'DATIM.BI'
  11869.     d$ = "30-Dec-88"
  11870.     PRINT DateValue#(d$)   ' Prints 32507
  11871.     d$ = "12/30/88"
  11872.     PRINT DateValue#(d$)   ' Prints 32507
  11873.  
  11874.  
  11875.  197. PCOPY Can Fail from Page 0 in 43-Line Mode in SCREEN 0
  11876.  
  11877.  Product Version(s): 7.00
  11878.  Operating System:   MS-DOS
  11879.  Flags: ENDUSER | SR# S900214-56 buglist7.00 fixlist7.10
  11880.  Last Modified:  6-AUG-1990    ArticleIdent: Q58792
  11881.  
  11882.  In Microsoft BASIC Professional Development System (PDS) version 7.00,
  11883.  when in 43-line mode in SCREEN mode 0, using a PCOPY statement to copy
  11884.  screen page 0 to some other screen page may fail. If screen page 0 is
  11885.  both the visual and active page during the PCOPY statement, it copies
  11886.  corrupt information to the other screen page. This problem occurs only
  11887.  in SCREEN mode 0 when in 43-line mode and only when PCOPYing from page
  11888.  0. It does not occur when PCOPYing from another page to page 0.
  11889.  Temporarily setting the active and/or visual page to a screen page
  11890.  other than 0 during the PCOPY corrects the problem.
  11891.  
  11892.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  11893.  version 7.00 for MS-DOS. This problem was corrected in BASIC PDS
  11894.  version 7.10.
  11895.  
  11896.  The following program demonstrates the problem. A string of 3440 X's
  11897.  that fills the screen is displayed, then copied from page 0 to page 1.
  11898.  The visual page is then set to page 1 to view the information copied
  11899.  from page 0. What appears in page 1 is only a few lines of text,
  11900.  either at the top or middle of the screen. Setting either the visual
  11901.  and/or active screen page to any page other than page 0 corrects the
  11902.  problem.
  11903.  
  11904.     WIDTH 80, 43
  11905.     PRINT STRING$(3440, "X");
  11906.     'SCREEN , ,0, 1    'Uncommenting this line corrects the problem
  11907.     PCOPY 0, 1
  11908.     LOCATE 10, 10: PRINT " HIT ANY KEY TO SWITCH PAGES "
  11909.     SLEEP
  11910.     SCREEN , ,0, 1
  11911.     END
  11912.  
  11913.  
  11914.  198. "Unresolved External" Using Wrong Linker with BASIC 7.00, 7.10
  11915.  
  11916.  Product Version(s): 7.00 7.10 | 7.00 7.10
  11917.  Operating System:   MS-DOS    | OS/2
  11918.  Flags: ENDUSER | SR# S900130-159 S_LINK
  11919.  Last Modified:  4-SEP-1990    ArticleIdent: Q58815
  11920.  
  11921.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  11922.  and 7.10 for MS-DOS and MS OS/2 are shipped with Microsoft
  11923.  Segmented-Executable Linker versions 5.05 and 5.10 respectively.
  11924.  Because of the newer technology used in these linkers, it is more
  11925.  important than ever to use only the linker that comes with the product
  11926.  (or a later version of the Segmented-Executable Linker) to link BASIC
  11927.  PDS programs.
  11928.  
  11929.  Linking BASIC PDS modules with a version of LINK.EXE earlier than
  11930.  5.05, such as the Microsoft 8086-Object Linker, can result in "L2029:
  11931.  Unresolved external" errors, such as the following:
  11932.  
  11933.       B$IsamSetmemDown in file(s):
  11934.     C:\BC7\LIB\BCL70ENR.LIB(..\rt\isam.asm)
  11935.  
  11936.       B$IsamSetmemBack in file(s):
  11937.     C:\BC7\LIB\BCL70ENR.LIB(..\rt\isam.asm)
  11938.  
  11939.       B$RestoreEmsState in file(s):
  11940.     C:\BC7\LIB\BCL70ENR.LIB(..\rt\isam.asm)
  11941.  
  11942.       B$DoIsamTerm in file(s):
  11943.     C:\BC7\LIB\BCL70ENR.LIB(..\rt\isam.asm)
  11944.  
  11945.       B$FIsamInited in file(s):
  11946.     C:\BC7\LIB\BCL70ENR.LIB(..\rt\isam.asm)
  11947.  
  11948.  These errors should not occur when linking BASIC PDS modules with
  11949.  Microsoft Segmented-Executable Linker versions 5.05 or later.
  11950.  
  11951.  A very common mistake is running the Linker from a directory that does
  11952.  not contain LINK.EXE and thus invoking an older linker version found
  11953.  first in your DOS PATH. You must be sure to have the correct linker
  11954.  found in your DOS PATH or in the current directory.
  11955.  
  11956.  
  11957.  199. BASIC PDS 7.10 Does Not Support ILINK.EXE Incremental Linker
  11958.  
  11959.  Product Version(s): 7.00 7.10 | 7.00 7.10
  11960.  Operating System:   MS-DOS    | OS/2
  11961.  Flags: ENDUSER | SR# S900212-106 B_BasicCom docerr
  11962.  Last Modified:  8-JAN-1991    ArticleIdent: Q58816
  11963.  
  11964.  Page 593 of the "Microsoft BASIC 7.0: Programmer's Guide" (for 7.00
  11965.  and 7.10) incorrectly states that you can use the LINKer switch /INC,
  11966.  which sets up your .EXE file for later use with the Microsoft
  11967.  Incremental Linker (ILINK.EXE). Microsoft BASIC Professional
  11968.  Development System (PDS) Version 7.00 or 7.10 does not support the
  11969.  Incremental Linker. This is a documentation error, and the section
  11970.  "Preparing for Incremental Linking (/INC)" should be removed from Page
  11971.  593.
  11972.  
  11973.  ILINK.EXE is also documented on Pages 261-269 (Chapter 14) of the
  11974.  "Microsoft CodeView 2.3 and Utilities User's Guide" provided with
  11975.  Microsoft BASIC PDS 7.00 and 7.10, but ILINK.EXE is NOT shipped with
  11976.  or supported by BASIC PDS 7.00 or 7.10. The reference to BASIC on Page
  11977.  263 should be removed.
  11978.  
  11979.  Also, the /INC option needs to be added to the table of "Invalid LINK
  11980.  Options" on Page 590 of the "Microsoft BASIC 7.0: Programmer's Guide"
  11981.  for 7.00 and 7.10.
  11982.  
  11983.  This information applies to Microsoft BASIC Professional Development
  11984.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  11985.  
  11986.  ILINK.EXE is shipped with and supported by Microsoft C Version 5.10,
  11987.  QuickC Versions 2.00 and 2.01, and Microsoft Macro Assembler Version
  11988.  5.10.
  11989.  
  11990.  
  11991.  200. BASIC 7.00 "Error Loading Run-Time Module: Incompatible"
  11992.  
  11993.  Product Version(s): 7.00 7.10
  11994.  Operating System:   MS-DOS
  11995.  Flags: ENDUSER | SR# S900201-67
  11996.  Last Modified: 20-SEP-1990    ArticleIdent: Q58817
  11997.  
  11998.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  11999.  and 7.10 maintain a date and time stamp for each of their run-time
  12000.  modules (BRT70xxx.EXE and BRT71xxx.EXE). This time stamp is inherited
  12001.  by the compiled BASIC PDS program linked with a given BASIC PDS
  12002.  run-time module. (This information does NOT apply if you compile with
  12003.  the BC /O stand-alone option.)
  12004.  
  12005.  The result of this inheritance is that the BASIC executable .EXE
  12006.  program does not run with a run-time module other than the one it was
  12007.  linked with. Attempting to use a BASIC PDS 7.00 or 7.10 run-time
  12008.  module other than the one that the .EXE program was linked with
  12009.  results in the following error message:
  12010.  
  12011.     Error loading run-time module <runtime name>.EXE: Incompatible
  12012.     run-time module.
  12013.  
  12014.  The time stamp association between BASIC PDS 7.00/7.10 run-time
  12015.  modules and executable programs helps ensure that the run-time module
  12016.  used by the program actually contains the routines the BASIC
  12017.  executable program expects to be able to call.
  12018.  
  12019.  For example, assume that you have created the BASIC run-time module
  12020.  BRT70ENR.EXE and the run-time library BRT70ENR.LIB during setup, and
  12021.  you specify that you do not want to include VGA graphics support
  12022.  (which removes the VGA graphics routines by linking the NOVGA.OBJ stub
  12023.  file into your run-time module). If you were allowed to execute a
  12024.  program that was compiled by another person using a different
  12025.  BRT70ENR.LIB run-time library, and that program used VGA graphics
  12026.  routines, that program would try to call the graphics routines it
  12027.  expected to find at certain locations in the BASIC run-time
  12028.  BRT70ENR.EXE. Because the VGA graphics routines will not be present in
  12029.  your BRT70ENR.EXE run-time, the code at that location is not going to
  12030.  be the expected VGA routine, and the results of such a call are
  12031.  unpredictable.
  12032.  
  12033.  
  12034.  201. Microsoft Editor Cannot Use QuickBASIC Extended Help Files
  12035.  
  12036.  Product Version(s): 7.00
  12037.  Operating System:   MS-DOS
  12038.  Flags: ENDUSER | SR# S900209-75 s_editor S_PWB
  12039.  Last Modified:  6-SEP-1990    ArticleIdent: Q58819
  12040.  
  12041.  Microsoft Editor (M.EXE and MEP.EXE) version 1.20, which is included
  12042.  with Microsoft BASIC Professional Development System (PDS) version
  12043.  7.00 for MS-DOS and MS OS/2, cannot use the QuickBASIC Extended
  12044.  (QBX.EXE) Microsoft Advisor online Help system files. (The QBX.EXE
  12045.  editor environment is also included with BASIC PDS 7.00.)
  12046.  
  12047.  The online Help files used by QBX.EXE are of the wrong size and format
  12048.  to be used by the M.EXE or MEP.EXE editor.
  12049.  
  12050.  No version of the M.EXE or MEP.EXE editor can use the Microsoft
  12051.  Advisor online Help files used by QBX.EXE.
  12052.  
  12053.  This problem is eliminated by using PWB (Programmer's WorkBench),
  12054.  which comes with Microsoft BASIC PDS 7.10. PWB.EXE replaces the
  12055.  M.EXE/MEP.EXE editor, and improves functionality.
  12056.  
  12057.  The help files of QBX.EXE and PWB.EXE can be created and modified
  12058.  using HELPMAKE.EXE, the Microsoft Help File Creation Utility.
  12059.  
  12060.  
  12061.  202. Cannot Link PROISAM.LIB or PROISAMD.LIB into Quick Library
  12062.  
  12063.  Product Version(s): 7.00
  12064.  Operating System:   MS-DOS
  12065.  Flags: ENDUSER | SR# S900205-118
  12066.  Last Modified: 27-FEB-1990    ArticleIdent: Q58922
  12067.  
  12068.  The libraries PROISAM.LIB and PROISAMD.LIB included with Microsoft
  12069.  BASIC Professional Development System (PDS) Version 7.00 for MS-DOS
  12070.  cannot be linked into Quick libraries to be used by the QuickBASIC
  12071.  Extended Environment (QBX.EXE).
  12072.  
  12073.  Trying to link PROISAM.LIB or PROISAMD.LIB into a Quick library
  12074.  generates the following error message:
  12075.  
  12076.     LINK : fatal error L4050: too many public symbols for sorting
  12077.  
  12078.  The terminate-and-stay-resident (TSR) programs PROISAM.EXE and
  12079.  PROISAMD.EXE are the programs that make the ISAM engine available to
  12080.  QBX. PROISAM.EXE or PROISAMD.EXE must be run prior to invoking QBX.EXE
  12081.  if you want to use ISAM statements in your BASIC program.
  12082.  
  12083.  PROISAMD.EXE supports all the ISAM routines. PROISAM.EXE does not
  12084.  support all of the features of ISAM because for many database
  12085.  applications certain features are not needed. It does not contain the
  12086.  "data dictionary" statements -- CREATEINDEX, DELETEINDEX, and
  12087.  DELETETABLE. It contains a restricted version of the OPEN...FOR ISAM
  12088.  statement that opens a database or table but does not create it if it
  12089.  does not already exist.
  12090.  
  12091.  
  12092.  203. CONFIG.SYS IOPL=YES to Run CodeView CVP.EXE in Protected Mode
  12093.  
  12094.  Product Version(s): 7.00
  12095.  Operating System:   MS-DOS
  12096.  Flags: ENDUSER | S_CodeView
  12097.  Last Modified: 27-FEB-1990    ArticleIdent: Q58923
  12098.  
  12099.  To run the Microsoft CodeView debugger (CVP.EXE) in OS/2 protected
  12100.  mode, you must have the following line in your CONFIG.SYS file in MS
  12101.  OS/2:
  12102.  
  12103.     IOPL=YES
  12104.  
  12105.  This information applies to the Microsoft CodeView debugger (CVP.EXE)
  12106.  shipped with Microsoft BASIC Professional Development System (PDS)
  12107.  Version 7.00 for MS-DOS and MS OS/2.
  12108.  
  12109.  
  12110.  204. Must LINK 87.LIB Stub File in .OBJ List, NOT in the .LIB List
  12111.  
  12112.  Product Version(s): 7.00   | 7.00
  12113.  Operating System:   MS-DOS | OS/2
  12114.  Flags: ENDUSER | SR# S900215-30
  12115.  Last Modified:  1-MAR-1990    ArticleIdent: Q58953
  12116.  
  12117.  Page 612 of the "Microsoft BASIC 7.0: Programmer's Guide" correctly
  12118.  states the following concerning the .LIB stub files (87.LIB,
  12119.  NOTRNEMR.LIB, and NOTRNEMP.LIB):
  12120.  
  12121.     Stub files (including the .LIB files listed) are specified in the
  12122.     <objfiles> field of LINK. You must supply the /NOE
  12123.     (/NOEXTDICTIONARY) option when linking any of the stub files.
  12124.  
  12125.  If you mistakenly link the 87.LIB, NOTRNEMR.LIB, or NOTRNEMP.LIB stub
  12126.  file in the .LIB area instead of the .OBJ area of the LINK.EXE command
  12127.  line, the stub file will be ignored, and no code is excluded from your
  12128.  .EXE file.
  12129.  
  12130.  This information applies to Microsoft BASIC Professional Development
  12131.  System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  12132.  
  12133.  Example of Using 87.LIB Stub File
  12134.  ---------------------------------
  12135.  
  12136.  To remove floating-point-coprocessor emulation code from a stand-alone
  12137.  BASIC PDS 7.00 .EXE program, the 87.LIB file must be placed in the
  12138.  .OBJ area in the LINK.EXE command line, as follows:
  12139.  
  12140.     BC test/O;
  12141.     LINK test+87.LIB /NOE;
  12142.  
  12143.  The resulting .EXE program requires the presence of an 8087, 80287, or
  12144.  80387 (80x87) numeric coprocessor.
  12145.  
  12146.  87.LIB should be placed in the linker's objects (.OBJ) list, NOT in
  12147.  the libraries (.LIB) list. If you mistakenly link the 87.LIB file in
  12148.  the .LIB area of the LINK.EXE command line, 87.LIB is ignored, and no
  12149.  code is excluded from your .EXE file. (The resulting .EXE program will
  12150.  run on machines with or without a coprocessor.) Below is an example of
  12151.  the WRONG way to link the 87.LIB stub file:
  12152.  
  12153.     LINK test,,,87.LIB /NOE;
  12154.  
  12155.  This is wrong because the linker first searches the default BASIC
  12156.  libraries for the references it needs and only then searches your
  12157.  listed .LIB files for unresolved references (if any). For stub files
  12158.  to work, they must appear in the .OBJ area of the LINK command line to
  12159.  resolve routine references before the default library reference
  12160.  search.
  12161.  
  12162.  
  12163.  205. "R6002 - Floating Point Not Loaded" Without Math Coprocessor
  12164.  
  12165.  Product Version(s): 7.00   | 7.00
  12166.  Operating System:   MS-DOS | OS/2
  12167.  Flags: ENDUSER | SR# S900215-15
  12168.  Last Modified: 27-FEB-1990    ArticleIdent: Q58954
  12169.  
  12170.  A BASIC PDS 7.00 program gives "run-time error R6002 - Floating point
  12171.  not loaded" on a machine WITHOUT a coprocessor when the BASIC run-time
  12172.  library or .EXE program is created with coprocessor-only support.
  12173.  Coprocessor-only support means that the BASIC run-time routines
  12174.  require an 80x87 (8087, 80287, or 80387) math coprocessor to run.
  12175.  
  12176.  The R6002 error is an initialization error that cannot be trapped in a
  12177.  BASIC program.
  12178.  
  12179.  Implementing coprocessor-only support in an .EXE program depends upon
  12180.  whether you compile with or without the BC /O (stand-alone .EXE)
  12181.  option, as follows:
  12182.  
  12183.  1. If you compile WITHOUT BC /O, BASIC programs require a run-time
  12184.     module (BRT70xxx.EXE) to be present at run time. If you want to
  12185.     build a BASIC run-time module and BRT70xxx.LIB file with
  12186.     coprocessor-only support, you must invoke the BUILDRTM.EXE utility
  12187.     with the /FPi87 switch. For example:
  12188.  
  12189.        BUILDRTM /LR /FPi87 /DEFAULT
  12190.  
  12191.     (See Page 611 of "Microsoft BASIC 7.0: Language Reference" for an
  12192.     explanation of the options of the BUILDRTM.EXE utility.) You can
  12193.     then link with your new coprocessor-only run-time module, as
  12194.     follows:
  12195.  
  12196.        BC test;
  12197.        LINK IMPORT+test,test,,{newlibname} /NOE;
  12198.  
  12199.  2. If you compile WITH the BC /O (stand-alone .EXE) option, you can
  12200.     directly link your BASIC .OBJ file with the 87.LIB stub file. For
  12201.     example:
  12202.  
  12203.        BC test /O;
  12204.        LINK test+87.LIB /NOE;
  12205.  
  12206.  
  12207.  206. Twice-Called String FUNCTION May Fail in QB/QBX Quick Library
  12208.  
  12209.  Product Version(s): 6.00 6.00b 7.00 7.10
  12210.  Operating System:   MS-DOS
  12211.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 buglist7.10 B_QuickBas
  12212.  Last Modified:  6-AUG-1990    ArticleIdent: Q58955
  12213.  
  12214.  In the QBX.EXE or QB.EXE environment, a STATIC string FUNCTION located
  12215.  in a Quick library (.QLB) that is invoked twice within the same PRINT
  12216.  or assignment statement may give incorrect results. This problem only
  12217.  exists with a STATIC string FUNCTION in a Quick library that is
  12218.  invoked twice in one statement with a plus sign (+, for string
  12219.  concatenation) connecting the two invocations. This problem can be
  12220.  worked around easily by using temporary variables and splitting the
  12221.  statement into two statements. The problem does not occur in compiled
  12222.  and linked .EXE programs.
  12223.  
  12224.  Microsoft has confirmed this to be a problem in the QBX.EXE
  12225.  environment shipped with Microsoft BASIC Professional Development
  12226.  System (PDS) versions 7.00 and 7.10 for MS-DOS, in the QB.EXE
  12227.  environment shipped with Microsoft BASIC Compiler versions 6.00 and
  12228.  6.00b for MS-DOS, and in the QB.EXE environment shipped with Microsoft
  12229.  QuickBASIC versions 4.00, 4.00b, and 4.50 (buglist4.00, buglist4.00b,
  12230.  buglist4.50) for MS-DOS. We are researching this problem and will post
  12231.  new information here as it becomes available.
  12232.  
  12233.  Code Example
  12234.  ------------
  12235.  
  12236.  The following code example demonstrates the problem:
  12237.  
  12238.     FUNCTION Foop$(x$) STATIC
  12239.       Foop$ = x$ + "Z"
  12240.     END FUNCTION
  12241.  
  12242.  The module above should be compiled and built into a Quick library,
  12243.  then QBX should be started with that Quick library. Calling this
  12244.  FUNCTION twice in a row gives the incorrect results, as follows:
  12245.  
  12246.     DECLARE FUNCTION Foop$(x$)
  12247.     PRINT Foop$("abc")+Foop$("def")
  12248.  
  12249.  This example prints "defZdefZ" instead of correctly printing
  12250.  "abcZdefZ".
  12251.  
  12252.  
  12253.  207. ListBox Redefines Window 1 and Closes All Windows When Done
  12254.  
  12255.  Product Version(s): 7.00
  12256.  Operating System:   MS-DOS
  12257.  Flags: ENDUSER | SR# S900209-66
  12258.  Last Modified: 26-FEB-1990    ArticleIdent: Q58957
  12259.  
  12260.  The ListBox function of the WINDOW.BAS toolbox file is not designed to
  12261.  be used when other windows are already open. This is because ListBox
  12262.  redefines Window 1 and closes all windows when it is finished
  12263.  executing. This is not a problem, but a limitation of the ListBox
  12264.  function.
  12265.  
  12266.  This information applies to Microsoft BASIC Professional Development
  12267.  System (PDS) Version 7.00 for MS-DOS.
  12268.  
  12269.  This behavior of the ListBox function can be changed by modifying two
  12270.  statements, the one that opens and redefines Window 1 and the one that
  12271.  closes all the windows at the end of the function.
  12272.  
  12273.  The statement that opens and redefines Window 1 is as follows:
  12274.  
  12275.     WindowOpen 1, 4, StartRowPos, 20, StopRowPos, 0, 7, 0, 7, _
  12276.         15, 0, 0, 0, 1, 1, ""
  12277.  
  12278.  The number mentioned immediately after "WindowOpen" (1 in this case)
  12279.  is the handle to the window that will be opened. If Window 1 already
  12280.  exists, it will be redefined and become the modal window that is used
  12281.  by the ListBox function. This statement must be changed so that the
  12282.  next available window handle is used, not always Handle 1. The
  12283.  function for getting this handle is WindowNext. Therefore, the
  12284.  modified WindowOpen statement would be as follows:
  12285.  
  12286.     WindowOpen WindowNext, 4, StartRowPos, 20, StopRowPos, 0, 7, 0, 7, _
  12287.        15, 0, 0, 0, 1, 1, ""
  12288.  
  12289.  Now when the statement is executed, the next available window handle
  12290.  is used instead of always using Handle 1. This ensures that a window
  12291.  that is already open will not be redefined.
  12292.  
  12293.  The statement that closes all of the windows at the end of the
  12294.  function is as follows:
  12295.  
  12296.     WindowClose 0
  12297.  
  12298.  Passing a 0 to the WindowClose statement closes all open windows.
  12299.  Passing any other handle closes just the window with that handle. This
  12300.  statement must be changed so that only the current window (the one
  12301.  being used by ListBox) is closed. The function that returns the handle
  12302.  of the current window is WindowCurrent. Therefore, the above statement
  12303.  should be changed to the following:
  12304.  
  12305.     WindowClose WindowCurrent
  12306.  
  12307.  When the above two changes have been made to the ListBox function, it
  12308.  can safely be used with other open windows.
  12309.  
  12310.  The following sample program illustrates how to use the ListBox
  12311.  function. It opens a window and then a button in that window. Then it
  12312.  invokes ListBox, passing it an array of strings to display. After the
  12313.  user has finished with the list, the WindowDo procedure is invoked,
  12314.  which polls the mouse, waiting for the user to click on the button
  12315.  opened in Window 1. When it is clicked, the program ends. However, if
  12316.  the above changes have not been made to the ListBox function, Window 1
  12317.  is redefined by the window opened by ListBox. Thus, the first window
  12318.  opened disappears, along with its button. After ListBox is finished
  12319.  executing, it closes the window that it created, leaving no windows
  12320.  for the WindowDo procedure to operate on. This causes the program to
  12321.  end immediately.
  12322.  
  12323.  Code Example
  12324.  ------------
  12325.  
  12326.  'The following INCLUDE, COMMON SHARED, and DIM statements are
  12327.  'generally needed for working with the toolbox library routines.
  12328.  
  12329.  '$INCLUDE: 'general.bi'
  12330.  '$INCLUDE: 'mouse.bi'
  12331.  '$INCLUDE: 'menu.bi'
  12332.  '$INCLUDE: 'window.bi'
  12333.  
  12334.  COMMON SHARED /uitools/ GloMenu           AS MenuMiscType
  12335.  COMMON SHARED /uitools/ GloTitle()        AS MenuTitleType
  12336.  COMMON SHARED /uitools/ GloItem()         AS MenuItemType
  12337.  COMMON SHARED /uitools/ GloWindow()       AS WindowType
  12338.  COMMON SHARED /uitools/ GloButton()       AS ButtonType
  12339.  COMMON SHARED /uitools/ GloEdit()         AS EditFieldType
  12340.  COMMON SHARED /uitools/ GloStorage        AS WindowStorageType
  12341.  COMMON SHARED /uitools/ GloWindowStack()  AS INTEGER
  12342.  COMMON SHARED /uitools/ GloBuffer$()
  12343.  
  12344.  DIM GloTitle(MAXMENU)           AS MenuTitleType
  12345.  DIM GloItem(MAXMENU, MAXITEM)   AS MenuItemType
  12346.  DIM GloWindow(MAXWINDOW)        AS WindowType
  12347.  DIM GloButton(MAXBUTTON)        AS ButtonType
  12348.  DIM GloEdit(MAXEDITFIELD)       AS EditFieldType
  12349.  DIM GloWindowStack(MAXWINDOW)   AS INTEGER
  12350.  DIM GloBuffer$(MAXWINDOW + 1, 2)
  12351.  
  12352.  DIM text$(1 TO 15)
  12353.  
  12354.  FOR i = 1 TO 15                  'Load string array with some
  12355.  text$(i) = STRING$(15, i + 64)   'strings. This will be the list
  12356.  NEXT i                           'passed to the ListBox function.
  12357.  
  12358.  CLS
  12359.  CALL WindowInit   'Initialize window routines
  12360.  CALL MouseInit    'Initialize mouse routines
  12361.  
  12362.  'Open window #1.
  12363.  CALL WindowOpen(1, 3, 10, 20, 70, 14, 1, 14, 1, 15, false, false,
  12364.  false, false, 1, "Window")
  12365.  
  12366.  'Open button #1 in window #1.
  12367.  CALL ButtonOpen(1, 1, "OK", 10, 29, 0, 0, 1)
  12368.  
  12369.  'Make the mouse cursor visible.
  12370.  CALL MouseShow
  12371.  
  12372.  'Put up the list box.
  12373.  a% = ListBox(text$(), 15)
  12374.  
  12375.  'Trap the clicking of the button.
  12376.  CALL WindowDo(0, 0)
  12377.  END
  12378.  
  12379.  
  12380.  208. Size and Memory Limits in QBX.EXE in BASIC PDS 7.00
  12381.  
  12382.  Product Version(s): 7.00
  12383.  Operating System:   MS-DOS
  12384.  Flags: ENDUSER | SR# S900215-76
  12385.  Last Modified: 26-FEB-1990    ArticleIdent: Q58960
  12386.  
  12387.  The QBX.EXE environment offers programming versatility, but has
  12388.  limitations to keep file size and complexity manageable. As a result,
  12389.  you may reach these limits in some situations.
  12390.  
  12391.  This information applies to Microsoft BASIC Professional Development
  12392.  System (PDS) Version 7.00 for MS-DOS and MS OS/2.
  12393.  
  12394.  The information below lists the boundaries that you may encounter in
  12395.  the QBX.EXE environment. Most of these limits also apply to the BC.EXE
  12396.  compiler. This information was taken from the Microsoft Advisor online
  12397.  Help system in QBX.EXE, under "Contents - QBX Memory and Capacity."
  12398.  
  12399.  ---------------------------------------------------------------
  12400.  QBX Environment Limits - Names, Strings, and Numbers
  12401.  ---------------------------------------------------------------
  12402.                                Maximum               Minimum
  12403.  
  12404.  Variable name length          40 characters             1
  12405.  String length                 32,767 characters         0
  12406.  Integers                      32,767               -32,768
  12407.  Long Integers                 2,147,483,647       -2,147,483,648
  12408.  Single precision numbers
  12409.                   (positive)   3.402823E+38         2.802597E-45
  12410.  Single precision numbers
  12411.                   (negative)   -2.802597E-45       -3.402823E+38
  12412.  Double precision numbers
  12413.                    (positive)
  12414.                      Maximum:
  12415.                           1.797693134862315D+308
  12416.                      Minimum:
  12417.                           4.940656458412465D-324
  12418.  Double precision numbers
  12419.                   (negative)
  12420.                      Maximum:
  12421.                          -4.940656458412465D-324
  12422.                      Minimum:
  12423.                          -1.797693134862315D+308
  12424.  Currency
  12425.                      Maximum:
  12426.                           922337203685477.5807
  12427.                      Minimum:
  12428.                          -922337203685477.5808
  12429.  
  12430.  ----------------------------------------------------------------
  12431.  QBX Environment Limits - Arrays
  12432.  ----------------------------------------------------------------
  12433.                                    Maximum              Minimum
  12434.  Array size (all elements)
  12435.    Static                          65,535 bytes (64 K)     1
  12436.    Dynamic                         Available memory
  12437.  Number of dimensions allowed      60                      1
  12438.  Dimensions allowed if unspecified 8                       1
  12439.  Array subscript value             32,767            -32,768
  12440.  
  12441.  Note: The maximum range between array subscript values is 32,767.
  12442.  
  12443.  -----------------------------------------------------------------
  12444.  QBX Environment Limits - Procedures and Files
  12445.  -----------------------------------------------------------------
  12446.                                    Maximum              Minimum
  12447.  
  12448.  Procedure size (interpreted)      65,535 bytes (64 K)     0
  12449.  Number of arguments passed        60 interpreted          0
  12450.  Nesting of include files          5 levels                0
  12451.  Module size (compiled)            65,535 bytes (64 K)     0
  12452.  DATA file numbers                 255                     1
  12453.  DATA file record number           2,147,483,647           1
  12454.  DATA file record size (bytes)     32,767 bytes (32 K)     1
  12455.  DATA file size                    Available disk space    0
  12456.  Path names                        127 characters          1
  12457.  Error message numbers             255                     1
  12458.  
  12459.  -----------------------------------------------------------------
  12460.  QBX Environment Limits - Editing
  12461.  -----------------------------------------------------------------
  12462.                                        Maximum         Minimum
  12463.  
  12464.  Text box entry                        127 chars          0
  12465.  Search for string                     127 chars          1
  12466.  Change to string                      127 chars          0
  12467.  Place markers                           4                0
  12468.  Watchpoints and/or watch expressions   16                0
  12469.  Number of lines in Immediate window    10                0
  12470.  Characters in View window on one line  255               0
  12471.  Length of COMMAND$ string              124 characters    0
  12472.  
  12473.  
  12474.  209. UI Toolbox Shortcut Keys Documentation Error in BASIC 7.00
  12475.  
  12476.  Product Version(s): 7.00 7.10
  12477.  Operating System:   MS-DOS
  12478.  Flags: ENDUSER | SR# S900220-48 docerr
  12479.  Last Modified:  8-JAN-1991    ArticleIdent: Q58963
  12480.  
  12481.  On Page 496 of the "Microsoft BASIC 7.0: Language Reference" (for 7.00
  12482.  and 7.10) two of the procedure names under "Shortcut Keys" (for
  12483.  MENU.BAS) are incorrectly stated. ShortCutKeyDelete$ should be
  12484.  ShortCutKeyDelete and ShortCutKeyEvent$ should be ShortCutKeyEvent.
  12485.  Also on the same page, the WindowBorder function (detailed on Page 568
  12486.  of the same manual) should be added to the "Define Windows" summary
  12487.  (for WINDOW.BAS) in Table 3.5.
  12488.  
  12489.  This information applies to the User Interface (UI) Toolbox in
  12490.  Microsoft BASIC Professional Development System (PDS) Versions 7.00
  12491.  and 7.10 for MS-DOS.
  12492.  
  12493.  
  12494.  210. Bad Integer Output Using DEF FN, VAL, FOR-NEXT in BASIC 7.00
  12495.  
  12496.  Product Version(s): 7.00   | 7.00
  12497.  Operating System:   MS-DOS | OS/2
  12498.  Flags: ENDUSER | SR# S900217-5 buglist7.00 fixlist7.10
  12499.  Last Modified:  1-AUG-1990    ArticleIdent: Q59008
  12500.  
  12501.  When run as an .EXE program (compiled with BC.EXE), the program below
  12502.  gives incorrect output in Microsoft BASIC Professional Development
  12503.  System (PDS) version 7.00 for MS-DOS and MS OS/2. The same program
  12504.  gives correct output when run in the QBX.EXE environment or compiled
  12505.  with the BC /D option.
  12506.  
  12507.  The program fails when it assigns an integer array (which is
  12508.  subscripted by a FOR...NEXT loop counter) to the VAL of a DEF FN
  12509.  string function operating on a temporary string that was assigned to
  12510.  an array element that is subscripted by the FOR...NEXT loop counter.
  12511.  
  12512.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  12513.  Professional Development System (PDS) version 7.00. This problem was
  12514.  corrected in BASIC PDS version 7.10.
  12515.  
  12516.  This problem does not occur with an .EXE compiled in QuickBASIC
  12517.  version 4.50 or earlier.
  12518.  
  12519.  The program below outputs "2 2" instead of "1 2" from an .EXE program.
  12520.  (The problem occurs whether compiled as a stand-alone .EXE or as an
  12521.  .EXE requiring the BRT module). This problem is corrected by doing any
  12522.  one of the following:
  12523.  
  12524.  1. Compiling with the BC /D option.
  12525.  
  12526.  2. Removing the DEFINT A-Z line.
  12527.  
  12528.  3. Replacing n (the ending value of the FOR...NEXT loop counter) with
  12529.     the constant 2 in the FOR...NEXT statement.
  12530.  
  12531.  4. Eliminating the use of the temporary (placeholder) variable t$ by
  12532.     putting s$(i) in place of it in the VAL function.
  12533.  
  12534.  5. Replacing d(i) with a nonarray (scalar) variable.
  12535.  
  12536.  Code Example
  12537.  ------------
  12538.  
  12539.     DEFINT A-Z
  12540.     DIM s$(1 TO 2), d(1 TO 2)
  12541.     DEF FNa$ (x$)
  12542.     FNa$ = x$
  12543.     END DEF
  12544.     CLS
  12545.     n = 2
  12546.     s$(1) = "1"
  12547.     s$(2) = "2"
  12548.     PRINT
  12549.     FOR i = 1 TO n
  12550.        t$ = s$(i)
  12551.        d(i) = VAL(FNa$(t$))
  12552.     ' One workaround is to use:   d(i) = VAL(FNa$(s$(i)))
  12553.        PRINT d(i);
  12554.     NEXT
  12555.     END
  12556.  
  12557.  
  12558.  211. "BASIC 7.0: Reference" Correction for CALL Statement Example
  12559.  
  12560.  Product Version(s): 7.00 7.10 | 7.00 7.10
  12561.  Operating System:   MS-DOS    | OS/2
  12562.  Flags: ENDUSER | SR# S900217-3 docerr
  12563.  Last Modified:  8-JAN-1991    ArticleIdent: Q59073
  12564.  
  12565.  The corrections below apply to the Example program for the CALL
  12566.  statement (for calling BASIC procedures) on Page 32 of the "Microsoft
  12567.  BASIC 7.0: Language Reference" manual for 7.00 and 7.10:
  12568.  
  12569.  1. The following incorrect sentence should be changed to say "the
  12570.     24th line" instead of "the 25th line":
  12571.  
  12572.        The following example uses the CALL statement to call a SUB
  12573.        procedure that prints a message on the 25th line of the
  12574.        display....
  12575.  
  12576.  2. The following remark after the LOCATE 24,1 statement should be
  12577.     changed to say "the 24th line" instead of "the 25th line":
  12578.  
  12579.        LOCATE 24, 1 ' Move cursor to 25th line of display.
  12580.  
  12581.  This information applies to Microsoft BASIC Professional Development
  12582.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  12583.  
  12584.  
  12585.  212. BASIC 7.00 ISAM Cannot Store Single-Precision Numbers
  12586.  
  12587.  Product Version(s): 7.00
  12588.  Operating System:   MS-DOS
  12589.  Flags: ENDUSER |
  12590.  Last Modified:  2-MAR-1990    ArticleIdent: Q59289
  12591.  
  12592.  When using the ISAM file-handling feature of Microsoft BASIC
  12593.  Professional Development System (PDS) Version 7.00 for MS-DOS, you
  12594.  cannot use a single-precision variable in the TYPE ... END TYPE record
  12595.  structure. To store real numbers (numbers with a decimal point), you
  12596.  must use a CURRENCY or a double-precision variable. (You may also use
  12597.  an INTEGER and a LONG integer if you do not need a number with a
  12598.  decimal point.)
  12599.  
  12600.  This is not a software problem, but is a design limitation of BASIC
  12601.  PDS 7.00.
  12602.  
  12603.  For more information on this topic, see Pages 333-334 of the
  12604.  "Microsoft BASIC 7.0: Programmer's Guide."
  12605.  
  12606.  
  12607.  213. BASIC and C, /FPa, LINK L2025 "Symbol Defined More Than Once"
  12608.  
  12609.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  12610.  Operating System:   MS-DOS          | OS/2
  12611.  Flags: ENDUSER | SR# S900202-109 S_C buglist6.00 buglist6.00b buglist7.00
  12612.  Last Modified: 18-OCT-1990    ArticleIdent: Q59321
  12613.  
  12614.  When linking BASIC and C, where the C routine uses math functions
  12615.  (such as SIN, COS) and was compiled with the /FPa (alternate math)
  12616.  option and where the BASIC program was compiled with the /FPa option
  12617.  and without the /O (stand-alone) option, several "L2025 Symbol defined
  12618.  more than once" errors will occur. These errors are not affected by
  12619.  /NOD or /NOE LINK options.
  12620.  
  12621.  Any of the following three workarounds corrects the problem:
  12622.  
  12623.  1. Compile the BASIC program with BC /o (stand-alone).
  12624.  
  12625.  2. Compile BASIC and C with (default) BC /FPi.
  12626.  
  12627.  3. Call all math functions from BASIC. (C can call BASIC externs to do
  12628.     math -- see below.)
  12629.  
  12630.  Microsoft has confirmed this to be a problem in Microsoft C Compiler
  12631.  versions 5.00 and 5.10 (buglist5.00, buglist5.10), in Microsoft BASIC
  12632.  Compiler versions 6.00 and 6.00b for MS-DOS and MS OS/2, and in
  12633.  Microsoft BASIC Professional Development System (PDS) version 7.00 for
  12634.  MS-DOS and MS OS/2. We are researching this problem and will post new
  12635.  information here as it becomes available.
  12636.  
  12637.  The following code example causes the "symbol defined more than once"
  12638.  errors when compiled as listed. The following are the compile and link
  12639.  lines for the BASIC and C programs:
  12640.  
  12641.     BC /FPa testb;
  12642.     CL -c -AL -FPa test.c ;
  12643.     LINK /NOD /NOE testb+test,,,brt70anr llibcar;
  12644.  
  12645.  When the code below is compiled and LINKed as specified, the following
  12646.  LINK errors will occur:
  12647.  
  12648.     llibcar.LIB(fcall.ASM) : error L2025: __fpmath : symbol defined
  12649.        more than once
  12650.  
  12651.     llibcar.LIB(..\ccalle.ASM) : error L2025: __fpsignal : symbol defined
  12652.        more than once
  12653.  
  12654.  For more information about calling C from BASIC, search in this
  12655.  Knowledge Base using the following word:
  12656.  
  12657.     BAS2C
  12658.  
  12659.  BASIC Program, TESTB.BAS
  12660.  ------------------------
  12661.  
  12662.  DECLARE SUB test CDECL
  12663.  CALL test
  12664.  
  12665.  'Function used by C for workaround #3
  12666.  FUNCTION BasSin#(a AS DOUBLE)
  12667.     BasSin#=SIN(a)
  12668.  END FUNCTION
  12669.  
  12670.  C Program, TEST.C
  12671.  -----------------
  12672.  
  12673.  #include <stdio.h>
  12674.  
  12675.  extern double pascal BasSin(double near *);  // BASIC function for
  12676.                                               // workaround #3
  12677.  void test()
  12678.  {
  12679.  double d=1.2;
  12680.  printf("%f",sin(d));           // Comment this line and
  12681.  //printf("%f",BasSin(&d));     // uncomment this line for workaround #3
  12682.  }
  12683.  
  12684.  
  12685.  214. PRINT Ignored After PRINT CURRENCY Variable in QBX.EXE 7.00
  12686.  
  12687.  Product Version(s): 7.00
  12688.  Operating System:   MS-DOS
  12689.  Flags: ENDUSER | buglist7.00 fixlist7.10
  12690.  Last Modified: 20-SEP-1990    ArticleIdent: Q59398
  12691.  
  12692.  The program below demonstrates a problem with executing a PRINT
  12693.  statement to produce a blank line.
  12694.  
  12695.  After printing a variable or array element that has been dimensioned
  12696.  as a CURRENCY data type, a blank line cannot be produced by issuing a
  12697.  successive PRINT. This problem occurs only within the QBX.EXE
  12698.  environment, and does not occur with programs compiled with BC.EXE.
  12699.  
  12700.  Microsoft has confirmed this to be a problem in the QBX.EXE
  12701.  environment of Microsoft BASIC Professional Development System (PDS)
  12702.  version 7.00 for MS-DOS. This problem was corrected in BASIC PDS
  12703.  version 7.10.
  12704.  
  12705.  Code Example
  12706.  ------------
  12707.  
  12708.     DIM A AS CURRENCY
  12709.     A = 10
  12710.     PRINT A
  12711.     PRINT
  12712.     PRINT "Where did the space go?"
  12713.     END
  12714.  
  12715.  Output
  12716.  ------
  12717.  
  12718.     10
  12719.     Where did the space go?
  12720.  
  12721.  Workaround Code Example
  12722.  -----------------------
  12723.  
  12724.  Each additional PRINT statement will correctly produce a blank line,
  12725.  as shown in the following program:
  12726.  
  12727.     DIM A AS CURRENCY
  12728.     A = 10
  12729.     PRINT A
  12730.     PRINT
  12731.     PRINT
  12732.     PRINT "A blank line was printed"
  12733.  
  12734.  Output
  12735.  ------
  12736.  
  12737.     10
  12738.  
  12739.     A blank line was printed
  12740.  
  12741.  
  12742.  215. BASIC 7.0 UEVENT Example Causes Subsequent Programs to Hang
  12743.  
  12744.  Product Version(s): m7.00 7.10
  12745.  Operating System:   MS-DOS
  12746.  Flags: ENDUSER | SR# S900222-46 docerr buglist7.00 buglist7.10
  12747.  Last Modified: 20-SEP-1990    ArticleIdent: Q59399
  12748.  
  12749.  The sample program for trapping a user-defined event on Pages 310-312
  12750.  of the "Microsoft BASIC 7.0: Programmer's Guide" for Microsoft BASIC
  12751.  Professional Development System (PDS) versions 7.00 and 7.10 contains
  12752.  a misprint, but even if corrected, this sample program may cause the
  12753.  computer to hang after it is run.
  12754.  
  12755.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  12756.  Professional Development System (PDS) versions 7.00 and 7.10. We are
  12757.  researching this problem and will post new information here as it
  12758.  becomes available.
  12759.  
  12760.  Page 311 of "Microsoft BASIC 7.0: Programmer's Guide" contains a
  12761.  misprint in the MASM programming example for trapping a user-defined
  12762.  event. If the code is not corrected, an "A2009: Symbol not defined"
  12763.  error will result when the code is assembled.
  12764.  
  12765.  The last section of code for this example reads as follows:
  12766.  
  12767.      RestInt  proc  uses ds
  12768.         lds dx, cs:OldVector
  12769.         mov  x, 251CH          ; <== this line contains the misprint
  12770.  
  12771.  To correct the code, make the following change:
  12772.  
  12773.      RestInt  proc  uses ds
  12774.         lds dx, cs:OldVector
  12775.         mov ax, 251CH          ; <== change "x" to "ax"
  12776.  
  12777.  However, even when this misprint is corrected, if the BASIC program is
  12778.  compiled so that it requires a run-time module or if the assembly code
  12779.  is put into a Quick library, running the program may cause the
  12780.  computer to hang. The problem does not occur if the BASIC program is
  12781.  compiled with the BC /O option.
  12782.  
  12783.  The following compiling and linking steps will reproduce the problem:
  12784.  
  12785.  1. Assemble the MASM code as follows:
  12786.  
  12787.        MASM MASMPROG.ASM;
  12788.  
  12789.  2. Compile the BASIC code so that it requires a run-time module (no
  12790.     /O) and enables event trapping (/V). If the program is compiled as
  12791.     a stand-alone program (with the /O option), the problem does not
  12792.     exist.
  12793.  
  12794.        BC BASPROG.BAS /V;
  12795.  
  12796.  3. LINK the program using the BASIC PDS 7.00 or 7.10 linker, as
  12797.     follows:
  12798.  
  12799.        LINK BASPROG.OBJ + MASMPROG.OBJ;
  12800.  
  12801.  4. Run the program.
  12802.  
  12803.  5. The computer may hang instantly or may hang after attempting to run
  12804.     another program, such as QBX.EXE.
  12805.  
  12806.  
  12807.  216. CHDIR & SHELL "CHDIR" in OS/2 Protected Mode Differs from DOS
  12808.  
  12809.  Product Version(s): 6.00 6.00b 7.00
  12810.  Operating System:   OS/2
  12811.  Flags: ENDUSER | SR# S900226-124
  12812.  Last Modified:  9-MAR-1990    ArticleIdent: Q59400
  12813.  
  12814.  In OS/2 protected mode, if a BASIC program issues a CHDIR, the command
  12815.  will affect only the current BASIC process; other processes in the
  12816.  system will not be affected. However, this behavior changes when a
  12817.  SHELL statement is issued because a SHELL statement executes a copy of
  12818.  CMD.EXE. The SHELLed program is considered to be a "child process" of
  12819.  the program that issued the SHELL. If the SHELLed program executes
  12820.  OS/2's CD or CHDIR command, only the SHELLed process will be affected,
  12821.  not the currently running BASIC program that issued the SHELL. This is
  12822.  not a problem with BASIC under OS/2; it is correct behavior that is
  12823.  dictated by the design of OS/2.
  12824.  
  12825.  This information applies to Microsoft BASIC Compiler Versions 6.00 and
  12826.  6.00b for OS/2 and to Microsoft BASIC Professional Development System
  12827.  (PDS) Version 7.00 for OS/2.
  12828.  
  12829.  The OS/2 API function, DosChDir(), has the same effect as the BASIC
  12830.  CHDIR statement. For both of these, the currently executing BASIC
  12831.  process is changed, but the parent process (which started the BASIC
  12832.  process) is unchanged. Similar to CHDIR, the ENVIRON statement (and
  12833.  other statements that modify the OS/2 protected-mode environment) has
  12834.  no effect on the parent process.
  12835.  
  12836.  This is a feature of the protected mode of OS/2; child processes
  12837.  cannot affect the parent process's environment. This represents a
  12838.  notable change from DOS. In DOS, there are "programs," but not
  12839.  "processes" as in OS/2. In DOS, you cannot have multiple programs
  12840.  running simultaneously. There is only one program running and
  12841.  therefore it is reasonable to assume that any change directory command
  12842.  will change the current DOS directory for both the parent and child in
  12843.  a program. Changing the "current directory" under DOS changes it for
  12844.  the entire operating system -- the change is global. This means the
  12845.  change also takes effect for any programs run later unless the user or
  12846.  program specifically changes the current directory. In OS/2 protected
  12847.  mode where there can be many programs running at once, having one
  12848.  global working directory that could be changed by any process at any
  12849.  moment would not be reasonable.
  12850.  
  12851.  Code Example
  12852.  ------------
  12853.  
  12854.  In OS/2 protected mode, the following code example has no effect on
  12855.  the screen group that starts the EXE file, but the FILES statement
  12856.  illustrates that the directory has been changed for the current
  12857.  process:
  12858.  
  12859.  a$ = "\bc7"
  12860.  CHDIR a$            'This only affects the current BASIC process
  12861.                      'API Function DosChDir has same effect as CHDIR
  12862.  'SHELL "cd "+a$     'This only affects the SHELLed process. After
  12863.  FILES "*.*"         'returning from the SHELL, it has no effect.
  12864.  
  12865.  In DOS, either the CHDIR statement or the commented SHELL statement in
  12866.  the above program will change the directory for the DOS command line.
  12867.  
  12868.  
  12869.  217. QBX & BC /Es Option Shares Expanded Memory with Mixed Language
  12870.  
  12871.  Product Version(s): 7.00 7.10
  12872.  Operating System:   MS-DOS
  12873.  Flags: ENDUSER | SR# S900227-66 docerr
  12874.  Last Modified:  8-JAN-1991    ArticleIdent: Q59402
  12875.  
  12876.  This article discusses the /Es (share expanded memory) option for
  12877.  QBX.EXE and BC.EXE in Microsoft BASIC Professional Development System
  12878.  (PDS) Versions 7.00 and 7.10 for MS-DOS.
  12879.  
  12880.  The BC /Es Option
  12881.  -----------------
  12882.  
  12883.  The /Es option for BC.EXE needs to be added to the list of BC options
  12884.  on Page 559 of the "Microsoft BASIC 7.0: Programmer's Guide" for
  12885.  versions 7.00 and 7.10.
  12886.  
  12887.  The BC /Es option is correctly described on Page 608 of the "Microsoft
  12888.  BASIC 7.0: Language Reference" (Appendix C: "Command-Line Tools Quick
  12889.  Reference") for 7.00 and 7.10. The BC /Es option is also correctly
  12890.  documented as follows in the Microsoft Advisor online Help system in
  12891.  QBX.EXE, found by choosing Contents from the Help menu, then selecting
  12892.  "BC Command Line":
  12893.  
  12894.     "HELP: BC Command Line"
  12895.     /Es       Allows you to share expanded memory between BASIC and
  12896.               mixed-language routine(s) that make use of expanded memory.
  12897.               Specify /Es when you are going to use a mixed-language
  12898.               routine that makes use of expanded memory.
  12899.  
  12900.  Note: The only way an .EXE program compiled with BC.EXE can use
  12901.  expanded memory is with ISAM file buffers, or when linked to use
  12902.  overlays, as described in a separate article found with the following
  12903.  query:
  12904.  
  12905.     how and LINK and overlays and BASIC and 7.00
  12906.  
  12907.  The QBX /Es Option
  12908.  ------------------
  12909.  
  12910.  QBX.EXE, the programming environment included with Microsoft BASIC
  12911.  Professional Development System (PDS) Version 7.00, can use expanded
  12912.  memory for procedures smaller than 16K.
  12913.  
  12914.  Note that the QBX /Es option cannot be used together with the /Ea
  12915.  option. (The QBX /Ea option lets each non-variable-length string array
  12916.  smaller than 16K use one 16K page of expanded memory.)
  12917.  
  12918.  By invoking QBX with the /Es switch, QBX can share expanded memory
  12919.  with mixed-language routines (in Quick libraries) that make DOS
  12920.  interrupts to access expanded memory.
  12921.  
  12922.  The QBX /Es switch is correctly documented on Page 626 of the
  12923.  "Microsoft BASIC 7.0: Language Reference," and in the Microsoft
  12924.  Advisor online Help system in QBX.EXE, found by choosing Contents from
  12925.  the Help menu, then selecting "QBX Command Line":
  12926.  
  12927.     "HELP: QBX Command Line"
  12928.     /Es      Allows you to share expanded memory between QBX and
  12929.              Quick libraries or mixed-language routines that make use
  12930.              of expanded memory. Specify /Es when you are using a
  12931.              Quick library or mixed-language routine that makes use
  12932.              of expanded memory. Do not use /Es with the /Ea option.
  12933.  
  12934.  
  12935.  218. Illegal DIM x AS STRING*<Variable> Can Hang QB.EXE or QBX.EXE
  12936.  
  12937.  Product Version(s): 6.00 6.00b 7.00
  12938.  Operating System:   MS-DOS
  12939.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 fixlist7.10 B_QuickBas
  12940.  Last Modified: 20-SEP-1990    ArticleIdent: Q59405
  12941.  
  12942.  Illegally defining fixed-length strings (DIM AS STRING * N%) with
  12943.  integer variables (N%) can in some cases cause problems inside the
  12944.  QB.EXE and QBX.EXE environments. (The length of fixed-length strings
  12945.  must be defined with constants, not variables.)
  12946.  
  12947.  Microsoft has confirmed this to be a problem in the QB.EXE environment
  12948.  of Microsoft QuickBASIC versions 4.00, 4.00b, and 4.50 (buglist4.00,
  12949.  buglist4.00b, buglist4.50); in the QB.EXE environment of Microsoft
  12950.  BASIC Compiler versions 6.00 and 6.00b; and in the QBX.EXE environment
  12951.  of Microsoft BASIC Professional Development System (PDS) version 7.00
  12952.  for MS-DOS. This problem was corrected in the QBX.EXE environment of
  12953.  BASIC PDS 7.10.
  12954.  
  12955.  To find a related article on this topic, query in this Knowledge Base
  12956.  on the following words:
  12957.  
  12958.     invalid and constant and variable and fixed and length and string
  12959.  
  12960.  The QB.EXE environment of QuickBASIC 4.00 and 4.00b runs Examples 1
  12961.  and 2 (below) without hanging; however, it fails to flag the variable
  12962.  on the STRING * flen declaration as an error.
  12963.  
  12964.  In both Examples 1 and 2, getting rid of flen and defining the string
  12965.  with a constant value (x AS STRING * 82) corrects the problem. You can
  12966.  also work around the problem by making flen a CONST constant, for
  12967.  example:
  12968.  
  12969.     CONST flen = 82
  12970.  
  12971.  Also, by changing flen to a noninteger variable, the QB.EXE or QBX.EXE
  12972.  environment correctly flags the error. BC.EXE (the command-line
  12973.  compiler) always correctly flags the error.
  12974.  
  12975.  Example 1
  12976.  ---------
  12977.  
  12978.  When the following program is run inside the QuickBASIC Extended
  12979.  (QBX.EXE) 7.00 environment, the error message "INVALID CONSTANT" is
  12980.  flagged on the line "flen = 82" instead of on the DIM line:
  12981.  
  12982.     DEFINT A-Z
  12983.     flen = 82
  12984.     DIM x AS STRING * flen
  12985.  
  12986.  Example 2
  12987.  ---------
  12988.  
  12989.  When the following program is run in QB.EXE 4.50 or QBX.EXE 7.00, the
  12990.  computer may hang, or the error message "STRING SPACE CORRUPT" may
  12991.  display and the computer may exit back to DOS:
  12992.  
  12993.     DEFINT A-Z
  12994.     flen = 82
  12995.     TYPE recordtype
  12996.        x AS STRING * flen
  12997.     END TYPE
  12998.     DIM datetest AS recordtype
  12999.  
  13000.  
  13001.  219. QB.EXE/QBX.EXE "Identifier Too Long" Using User-Defined TYPE
  13002.  
  13003.  Product Version(s): 6.00 6.00b 7.00 7.10
  13004.  Operating System:   MS-DOS
  13005.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 buglist7.10 B_QuickBas
  13006.  Last Modified: 20-SEP-1990    ArticleIdent: Q59429
  13007.  
  13008.  Inside the QuickBASIC environment (QB.EXE or QBX.EXE), an "Identifier
  13009.  Too Long" error is incorrectly generated under the following
  13010.  circumstances:
  13011.  
  13012.  1. Create a user-defined TYPE (record). Give it one field with a long
  13013.     name (20 to 40 characters).
  13014.  
  13015.  2. DIMension a variable of that TYPE. Give the variable a long name
  13016.     (20 to 40 characters).
  13017.  
  13018.  3. Use the variable in some statement in the program and run the
  13019.     program.
  13020.  
  13021.  4. If the length of the entire identifier (record name plus the field
  13022.     name) is longer than forty characters, an "Identifier Too Long"
  13023.     error message is generated in the environment.
  13024.  
  13025.  This error occurs in QB.EXE and QBX.EXE, but does NOT occur with
  13026.  BC.EXE.
  13027.  
  13028.  Microsoft has confirmed this to be a problem in the QB.EXE environment
  13029.  of Microsoft QuickBASIC versions 4.00, 4.00b, and 4.50 (buglist4.00,
  13030.  buglist4.00b, buglist4.50); in the QB.EXE environment of Microsoft
  13031.  BASIC Compiler versions 6.00 and 6.00b; and in QuickBASIC Extended
  13032.  (QBX.EXE), the extended environment provided with Microsoft BASIC
  13033.  Professional Development System (PDS) versions 7.00 and 7.10. We are
  13034.  researching this problem and will post new information here as it
  13035.  becomes available.
  13036.  
  13037.  When using TYPEd variables, both parts of the variable, the variable's
  13038.  name and its field name, are supposed to have a limit of 40
  13039.  characters. This means that the total possible length of a TYPEd
  13040.  variable when used in a statement is 80 characters.
  13041.  
  13042.  This problem can be worked around by either shortening the name of the
  13043.  variable, shortening the name of the field in the TYPE, or by placing
  13044.  the single variable into an array of that TYPE.
  13045.  
  13046.  Code Example
  13047.  ------------
  13048.  
  13049.  TYPE temp
  13050.    '012345678901234567890123456789; Forty characters is a legal name:
  13051.     thisisatesttoobutthisistoolong AS INTEGER
  13052.  END TYPE
  13053.  
  13054.  DIM thisisatest AS temp
  13055.  
  13056.  ' The following causes an "identifier too long" error
  13057.  ' when the entire name exceeds forty characters.
  13058.  '012345678901234567890123456789012345678901
  13059.   thisisatest.thisisatesttoobutthisistoolong = 10
  13060.  
  13061.  DIM thisisatest(1) AS temp
  13062.  
  13063.  'If you make "thisisatest" an array instead of a single type
  13064.  'variable the problem is eliminated.
  13065.  thisisatest(1).thisisatesttoobutthisistoolong = 10
  13066.  
  13067.  
  13068.  220. 3 Cases Where DIR$ Gives "Illegal Function Call" in BASIC 7.00
  13069.  
  13070.  Product Version(s): 7.00 7.10 | 7.00 7.10
  13071.  Operating System:   MS-DOS    | OS/2
  13072.  Flags: ENDUSER | docerr
  13073.  Last Modified:  8-JAN-1991    ArticleIdent: Q59430
  13074.  
  13075.  Page 107 of the "Microsoft BASIC 7.0: Language Reference" manual (for
  13076.  7.00 and 7.10) incorrectly states that you can only receive "Illegal
  13077.  Function Call" using the DIR$ function if you don't specify a
  13078.  filespec$ the first time you call DIR$.
  13079.  
  13080.  However, the DIR$ function returns an "Illegal Function Call" in the
  13081.  following three circumstances:
  13082.  
  13083.  1. Invoking DIR$ for the first time without a filespec$ parameter
  13084.     causes an "Illegal Function Call" error.
  13085.  
  13086.  2. If you invoke DIR$ with a filespec$ and no matching files are found
  13087.     (it returns a null string -- ""), if you then invoke DIR$ another
  13088.     time without the filespec$ parameter, you will receive an "Illegal
  13089.     Function Call" error. In other words, you must call DIR$ with a
  13090.     filespec$ until a match is found. After that, DIR$ can be called
  13091.     again with no filespec$ to get the next filename in the list of
  13092.     files found.
  13093.  
  13094.  3. Once the entire list of matched file names has been retrieved,
  13095.     using DIR$ without a filespec$ correctly returns a null string
  13096.     telling you that the end of the list has been reached. Invoking
  13097.     DIR$ one more time after that point generates an "Illegal Function
  13098.     Call." In other words, once you run out of files that matched your
  13099.     original filespec$, you must call DIR$ with a filespec$ again until
  13100.     another match is achieved.
  13101.  
  13102.  This information applies to Microsoft BASIC Professional Development
  13103.  System (PDS) Versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  13104.  
  13105.  The code example below demonstrates that when DIR$ is used
  13106.  incorrectly, it generates an "Illegal Function Call." If you comment
  13107.  out DIR$ after the WHILE loop, the program runs correctly.
  13108.  
  13109.  The DIR$ function is a new function introduced in Microsoft BASIC PDS
  13110.  7.00. It is designed to let you find files and browse through
  13111.  directories looking for files without having to use SHELL, as in
  13112.  earlier versions of BASIC. DIR$ takes a filespec$ parameter that is
  13113.  very similar to the parameters that can be passed to the DIR command
  13114.  found in MS-DOS or OS/2.
  13115.  
  13116.  Code Example
  13117.  ------------
  13118.  
  13119.     DIM test(200) AS STRING * 12
  13120.     CLS
  13121.     temp$ = DIR$("*.*")
  13122.     count = 0
  13123.     WHILE temp$ <> "" ' When it returns null,
  13124.                       ' the end of the list has been reached.
  13125.        test(count) = temp$
  13126.        count = count + 1
  13127.        PRINT temp$
  13128.        temp$ = DIR$
  13129.     WEND
  13130.     PRINT DIR$       ' If this line is left here, it will cause the error
  13131.                      ' "Illegal Function Call" to occur.
  13132.     END
  13133.  
  13134.  
  13135.  221. 7.10 Correction for OPEN COM Transfer & Receive Buffer; TB, RB
  13136.  
  13137.  Product Version(s): 7.00 7.10
  13138.  Operating System:   MS-DOS
  13139.  Flags: ENDUSER | SR# S900217-4 docerr
  13140.  Last Modified: 16-JAN-1991    ArticleIdent: Q59431
  13141.  
  13142.  This article corrects three documentation errors in the description
  13143.  of the Transfer Buffer (TB[n]) and Receive Buffer (RB[n]) options for
  13144.  the OPEN COM statement on page 240 of the "Microsoft BASIC 7.0:
  13145.  Language Reference" manual for BASIC PDS versions 7.00 and 7.10.
  13146.  
  13147.  Also, page 559 of "Microsoft BASIC 7.0: Programmer's Guide"
  13148.  incorrectly states that "the transmission buffer is allocated 128
  13149.  bytes for each communications port." This should be changed to "512
  13150.  bytes" for the default transmission buffer size.
  13151.  
  13152.  To illustrate the documentation corrections (listed below), consider
  13153.  the following program sequence. PROG1.EXE is started from the DOS or
  13154.  OS/2 command line. PROG1 sets the receive-buffer size to 4096 in the
  13155.  OPEN COM statement, CLOSEs the communications port, and CHAINS to
  13156.  PROG2.EXE. When PROG2 OPENs the COM port, if PROG2 does not use the RB
  13157.  parameter, the size of the receive buffer will still be 4096. This is
  13158.  true whether you compile with /O or use the BRTxxx.EXE run-time
  13159.  module.
  13160.  
  13161.  Note that the size of the transmit buffer (TB) in PROG1.EXE never
  13162.  affects the size of the transmit buffer in PROG2.EXE. The size of the
  13163.  transmit-buffer is not transferred across a CHAIN. (This is by
  13164.  design.)
  13165.  
  13166.  This information applies to Microsoft BASIC Professional Development
  13167.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  13168.  
  13169.  The following are three documentation errors in the description of the
  13170.  Transfer Buffer (TB[n]) and Receive Buffer (RB[n]) options for the
  13171.  OPEN COM statement on page 240 of the "Microsoft BASIC 7.0: Language
  13172.  Reference" manual:
  13173.  
  13174.  1. For the TB[n] option, the first sentence is incorrect, as follows:
  13175.  
  13176.        Sets the size of the receive buffer to n bytes.
  13177.  
  13178.     This sentence should be changed to read as follows:
  13179.  
  13180.        Sets the size of the transmit buffer to n bytes.
  13181.  
  13182.  2. For the TB[n] option, the last sentence incorrectly describes the
  13183.     default transmit buffer size, as follows:
  13184.  
  13185.        The default value, if n or the TB option is omitted, is the
  13186.        current receive buffer size.
  13187.  
  13188.     This sentence should be changed to read as follows:
  13189.  
  13190.        The default value, if n or the TB option is omitted, is 512
  13191.        bytes.
  13192.  
  13193.     (Note: The default size for the transmit buffer is 512 bytes; the
  13194.     only way to change this size is with the TB option in the OPEN COM
  13195.     statement. The transmit-buffer size is never affected by any
  13196.     receive-buffer options.)
  13197.  
  13198.  3. The description for the RB[n] option should be supplemented to say
  13199.     that the receive buffer size of the program currently being
  13200.     executed, if not changed by the RB in the OPEN COM statement or by
  13201.     the /C:n option on the QB or BC command line, will be the same as
  13202.     for the program from which the current program was CHAINed (if any)
  13203.     with the CHAIN statement.
  13204.  
  13205.  The OPEN COM statement can open the device names "COM1:" and "COM2:".
  13206.  
  13207.  
  13208.  222. Don't Use OPTION BASE 1 in UI Toolbox: "Illegal Function Call"
  13209.  
  13210.  Product Version(s): 7.00
  13211.  Operating System:   MS-DOS
  13212.  Flags: ENDUSER | SR# S900228-24
  13213.  Last Modified: 12-MAR-1990    ArticleIdent: Q59488
  13214.  
  13215.  When writing programs that utilize the User Interface (UI) Toolbox
  13216.  routines, it is not advisable to use the OPTION BASE 1 statement. This
  13217.  can create run-time errors, such as "Illegal function call," because
  13218.  the UI Toolbox uses index "zero" in arrays that must be in COMMON
  13219.  SHARED between your modules.
  13220.  
  13221.  This information applies to Microsoft BASIC Professional Development
  13222.  System (PDS) Version 7.00 for MS-DOS.
  13223.  
  13224.  
  13225.  223. INSTR, Documentation Correction for BASIC PDS 7.00
  13226.  
  13227.  Product Version(s): 7.00 7.10 | 7.00 7.10
  13228.  Operating System:   MS-DOS    | OS/2
  13229.  Flags: ENDUSER | SR# S900306-120 docerr
  13230.  Last Modified:  8-JAN-1991    ArticleIdent: Q59562
  13231.  
  13232.  The following sentence describing the INSTR function on Page 138 of
  13233.  the "Microsoft BASIC 7.0: Programmer's Guide" for Microsoft BASIC
  13234.  Professional Development System (PDS) Versions 7.00 and 7.10 is
  13235.  incorrect. The second sentence under the "Searching for Strings"
  13236.  paragraph states the following:
  13237.  
  13238.     The INSTR(stringexpression1$, stringexpression2$) function tells
  13239.     you whether or not string2 is contained...
  13240.  
  13241.  This sentence should be changed to refer to stringexpresion2$ instead
  13242.  of string2, as follows:
  13243.  
  13244.     The INSTR(stringexpression1$, stringexpression2$) function tells
  13245.     you whether or not stringexpression2$ is contained...
  13246.  
  13247.  
  13248.  224. "Cannot Load File" Error with ISAMREPR.EXE and SHARE.EXE
  13249.  
  13250.  Product Version(s): 7.00
  13251.  Operating System:   MS-DOS
  13252.  Flags: ENDUSER | SR# S900227-52 buglist7.00 fixlist7.10
  13253.  Last Modified: 14-FEB-1991    ArticleIdent: Q59565
  13254.  
  13255.  If SHARE.EXE is loaded, attempting to repair an ISAM file using
  13256.  ISAMREPR.EXE results in the error:
  13257.  
  13258.     Cannot open 'file.mdb'
  13259.  
  13260.  This error occurs regardless of the version of MS-DOS being used.
  13261.  
  13262.  ISAMREPR.EXE is an ISAM file repair utility provided with Microsoft
  13263.  BASIC Professional Development System (PDS) version 7.00. This
  13264.  information applies only to BASIC PDS for MS-DOS.
  13265.  
  13266.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  13267.  7.00. This problem is corrected if you use SHARE.EXE from MS-DOS
  13268.  version 4.01 and ISAMREPR.EXE from BASIC PDS version 7.10. (You must
  13269.  recompile your programs in BASIC PDS version 7.10.)
  13270.  
  13271.  To reproduce the problem, load SHARE.EXE, then, using the ISAM
  13272.  database file "BOOKS.MDB" provided with BASIC PDS 7.00, attempt to
  13273.  repair the file using ISAMREPR.EXE, as follows:
  13274.  
  13275.     C:\> SHARE
  13276.  
  13277.     C:\> ISAMREPR BOOKS
  13278.     Microsoft  (R)  ISAM Repair Utility   Version 1.00
  13279.     Copyright  (C)  Microsoft Corp 1989.  All rights reserved.
  13280.  
  13281.     ISAMREPR : Cannot open 'BOOKS.MDB'
  13282.  
  13283.  
  13284.  225. OS/2 DosFindFirst Code Example Correction; Missing Comma
  13285.  
  13286.  Product Version(s): 7.00 7.10
  13287.  Operating System:   OS/2
  13288.  Flags: ENDUSER | docerr
  13289.  Last Modified:  8-JAN-1991    ArticleIdent: Q59723
  13290.  
  13291.  On Page 525 of the "Microsoft BASIC 7.0: Programmer's Guide" for
  13292.  Microsoft BASIC Professional Development System (PDS) Versions 7.00
  13293.  and 7.10, the code example given is missing a comma to delimit the
  13294.  VARSEG and SADD parameters when invoking the function DosFindFirst%.
  13295.  
  13296.  The incorrect syntax documented in the manual is as follows:
  13297.  
  13298.     x = DosFindFirst%(VARSEG(flname$) SADD(flname$), dirh,_
  13299.                      atr, buffer, bufflen, searchcount, reserved)
  13300.  
  13301.  The correct syntax of the CALL is as follows:
  13302.  
  13303.     x = DosFindFirst%(VARSEG(flname$), SADD(flname$), dirh,_
  13304.                      atr, buffer, bufflen, searchcount, reserved)
  13305.  
  13306.  A comma is needed between VARSEG(flname$) and SADD(flname$).
  13307.  
  13308.  
  13309.  226. List Box Width Can Be Only 14-55 Characters in 7.00 UI Toolbox
  13310.  
  13311.  Product Version(s): 7.00
  13312.  Operating System:   MS-DOS
  13313.  Flags: ENDUSER | SR# S900222-126
  13314.  Last Modified: 26-MAR-1990    ArticleIdent: Q59724
  13315.  
  13316.  The ListBox() function of the WINDOW.BAS toolbox file takes two
  13317.  parameters: a string array containing the list of items to be
  13318.  displayed, and an integer variable containing the number of items in
  13319.  the list.
  13320.  
  13321.  The header comment of the ListBox() function describes how to add a
  13322.  third parameter, an integer variable (BoxWidth%) that contains the
  13323.  desired width of the list box to be displayed. Unless this parameter
  13324.  is added, the width of the list box always defaults to 14 characters.
  13325.  However, even if this parameter is given, the width cannot be less
  13326.  than 14 or greater than 55 characters. The ListBox() function ensures
  13327.  that the width is within this range.
  13328.  
  13329.  This information applies to the User Interface (UI) Toolbox in
  13330.  Microsoft BASIC Professional Development System (PDS) Version 7.00 for
  13331.  MS-DOS.
  13332.  
  13333.  After adding the modification that allows the desired list box width
  13334.  to be specified, a sample invocation of the ListBox() function would
  13335.  be as follows
  13336.  
  13337.     x% = ListBox(text$(),MaxRec%,BoxWidth%)
  13338.  
  13339.  where:
  13340.  
  13341.     x%         is the array element selected from the list box
  13342.     text$()    is the string(s) to display in the list box
  13343.     MaxRec%    is the number of strings to display in the list box
  13344.     BoxWidth%  is the desired width of the list box
  13345.  
  13346.  If BoxWidth% is less than 14, ListBox() changes it to 14. If BoxWidth%
  13347.  is greater than 55, ListBox() changes it to 55. The statements that
  13348.  perform these checks are located toward the end of the function under
  13349.  the subroutine heading ListBoxWidthCalc:
  13350.  
  13351.     IF BoxWidth < 14 THEN BoxWidth = 14
  13352.     IF BoxWidth > 55 THEN BoxWidth = 55
  13353.  
  13354.  It is NOT recommended that you change or delete these IF statements to
  13355.  allow any list box width. If the width is too small, the OK and Cancel
  13356.  buttons may not fit in the list box. If the width is too large, the
  13357.  resulting list box may not fit on the screen.
  13358.  
  13359.  
  13360.  227. BASIC 7.00 Can Write Whole Array (in TYPE) to Disk at Once
  13361.  
  13362.  Product Version(s): 7.00 7.10 | 7.00 7.10
  13363.  Operating System:   MS-DOS    | OS/2
  13364.  Flags: ENDUSER |
  13365.  Last Modified:  3-AUG-1990    ArticleIdent: Q59734
  13366.  
  13367.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  13368.  and 7.10 introduce support for static arrays in user-defined TYPE
  13369.  definitions. This means that you can write an entire array (in a user
  13370.  TYPE record) to a disk file at once. The code example below writes an
  13371.  entire array to a RANDOM or BINARY file using a single PUT# statement.
  13372.  
  13373.  Note that you cannot output arrays all at once (in one PRINT# or
  13374.  WRITE# statement) to files opened with sequential access (OPEN FOR
  13375.  OUTPUT). With sequential access (OPEN FOR OUTPUT or INPUT), you must
  13376.  output or input just one array element at a time.
  13377.  
  13378.  You must use RANDOM or BINARY access to write a static
  13379.  nonvariable-length string array to a file all at once (as shown in the
  13380.  examples below).
  13381.  
  13382.  Note that in Microsoft QuickBASIC versions 4.00, 4.00b, and 4.50 for
  13383.  MS-DOS, in Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS
  13384.  and MS OS/2, and in Microsoft BASIC PDS versions 7.00 and 7.10 for
  13385.  MS-DOS and MS OS/2, you can directly write whole records (variables)
  13386.  of a given user-defined TYPE to disk as the third argument of the PUT#
  13387.  statement. Each and every element of the user-defined TYPE record is
  13388.  automatically copied to the file. If the data is numeric and you
  13389.  output to a file OPENed with RANDOM or BINARY access, the data is
  13390.  automatically stored in numeric format (without requiring a lengthy
  13391.  FIELD statement or numeric-to-string conversion functions such as
  13392.  MKS$, MKD$, MKI$, or MKL$).
  13393.  
  13394.  Since an array can be an element of a record of user-defined TYPE in
  13395.  BASIC 7.00 and 7.10 (but not in earlier versions), you can write a
  13396.  whole array at once into a disk file, as shown below.
  13397.  
  13398.  Code Example
  13399.  ------------
  13400.  
  13401.  The following example, compiled in BASIC PDS 7.00 or 7.10, shows how
  13402.  to write a whole array to disk at once, using just one PUT# statement:
  13403.  
  13404.  TYPE rec1
  13405.    array1(20) AS INTEGER
  13406.  END TYPE
  13407.  DIM var1 AS rec1, var2 AS rec1  'DIMension var1 & var2 with TYPE rec1
  13408.  FOR i = 1 TO 20      ' Fill each element of the array:
  13409.    var1.array1(i) = i
  13410.  NEXT
  13411.  
  13412.  ' The following OPEN statements may OPEN FOR either RANDOM or BINARY:
  13413.  OPEN "test.dat" FOR RANDOM AS #1
  13414.  PUT #1, , var1       ' Write whole array to disk all at once.
  13415.  CLOSE
  13416.  
  13417.  OPEN "test.dat" FOR RANDOM AS #1
  13418.  GET #1, , var2      ' Reads array all at once into var2.
  13419.  FOR i = 1 TO 20     ' Print the contents of the array var2.array1:
  13420.    PRINT var2.array1(i);
  13421.  NEXT
  13422.  CLOSE
  13423.  
  13424.  
  13425.  228. ISAMCVT.EXE Fails to Convert db/LIB File, Try Packing First
  13426.  
  13427.  Product Version(s): 7.00
  13428.  Operating System:   MS-DOS
  13429.  Flags: ENDUSER | SR# S900312-79
  13430.  Last Modified: 26-MAR-1990    ArticleIdent: Q59765
  13431.  
  13432.  A customer reported that when converting db/LIB (dBASE) files to
  13433.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  13434.  ISAM files with the ISAMCVT.EXE utility, the ISAM files are not
  13435.  created correctly if the db/LIB file contains logically deleted
  13436.  records. For the process to be successful, the logically deleted
  13437.  records must be physically removed from the file. According to the
  13438.  customer, db/LIB provides a packing feature to do this.
  13439.  
  13440.  This information applies to Microsoft BASIC PDS 7.00 for MS-DOS.
  13441.  
  13442.  The utility ISAMCVT.EXE is used to convert other types of indexed
  13443.  files to BASIC's ISAM format. One of these types is db/LIB. A customer
  13444.  reported that if the db/LIB file to be converted has records in it
  13445.  that are marked for deletion, ISAMCVT.EXE either produces a corrupted
  13446.  ISAM file or does not produce one at all.
  13447.  
  13448.  Packing an indexed file is a method of physically removing records
  13449.  that are marked for deletion. The utility ISAMPACK.EXE is used to
  13450.  perform this function on BASIC's ISAM files. According to the
  13451.  customer, using a similar utility on a db/LIB file that has records
  13452.  marked for deletion allows ISAMCVT.EXE to successfully convert the
  13453.  file to the ISAM format.
  13454.  
  13455.  Microsoft has not verified this information, but it is recommended to
  13456.  pack all data files before they are converted to BASIC PDS ISAM with
  13457.  the ISAMCVT.EXE utility.
  13458.  
  13459.  
  13460.  229. Problem with MID$ Statement and MID$ Function in QBX.EXE
  13461.  
  13462.  Product Version(s): 7.00 7.10
  13463.  Operating System:   MS-DOS
  13464.  Flags: ENDUSER | SR# S900315-77 buglist7.00 buglist7.10
  13465.  Last Modified: 20-SEP-1990    ArticleIdent: Q60131
  13466.  
  13467.  Using the MID$ function as an argument of the MID$ statement can
  13468.  produce incorrect results in the QBX.EXE environment that comes with
  13469.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  13470.  and 7.10, as shown in the program below.
  13471.  
  13472.  The problem does not occur when compiled with the BC.EXE environment
  13473.  of Microsoft BASIC PDS 7.00 and 7.10; with the BC.EXE or QB.EXE
  13474.  environment of Microsoft QuickBASIC version 4.00, 4.00b, or 4.50; or
  13475.  with the BC.EXE or QB.EXE environment of Microsoft BASIC Compiler
  13476.  versions 6.00 and 6.00b.
  13477.  
  13478.  Microsoft has confirmed this to be a problem in the QBX.EXE
  13479.  environment of Microsoft BASIC PDS versions 7.00 and 7.10. We are
  13480.  researching this problem and will post new information here as it
  13481.  becomes available.
  13482.  
  13483.  The program below should correctly output "1212345678". However, when
  13484.  run from within the QBX.EXE environment, it incorrectly outputs
  13485.  "1212121212". This behavior also occurs if a length% argument of 10 is
  13486.  used in the MID$ function. If 8 or 9 is used as the length% argument
  13487.  of the MID$ function, the correct output is produced. If the start%
  13488.  argument of the MID$ function is not taken to be 1, correct output
  13489.  displays.
  13490.  
  13491.  Code Example
  13492.  ------------
  13493.  
  13494.     A$= "1234567890"
  13495.     MID$(A$, 3) = MID$(A$, 1)
  13496.     PRINT A$
  13497.  
  13498.  Note: The first MID$ occurrence above is the MID$ statement, and the
  13499.  second occurrence is the MID$ function.
  13500.  
  13501.  
  13502.  230. BASIC PDS 7.00: ISAMREPR Always Adds 32K to a .MDB File
  13503.  
  13504.  Product Version(s): 7.00
  13505.  Operating System:   MS-DOS
  13506.  Flags: ENDUSER | SR# S900321-28
  13507.  Last Modified:  3-APR-1990    ArticleIdent: Q60132
  13508.  
  13509.  The ISAMREPR.EXE utility provided with Microsoft BASIC Professional
  13510.  Development System (PDS) Version 7.00 always adds at least 32K to an
  13511.  ISAM database file during the repair process. This is correct behavior
  13512.  for ISAMREPR and is documented on Page 384 of the "Microsoft BASIC PDS
  13513.  7.0: Programmer's Guide."
  13514.  
  13515.  This information applies to Microsoft BASIC Professional Development
  13516.  System (PDS) Version 7.00 for MS-DOS.
  13517.  
  13518.  During the repair process, ISAMREPR allocates 32K or more of extra
  13519.  space as "work space" for use while repairing the file. This space is
  13520.  automatically added to the file at the beginning, before any deleted
  13521.  or damaged records are found during the process. For instance, if
  13522.  ISAMREPR is run twice on the same file, at least 64K will be added to
  13523.  the file, even though the repair might not have been necessary the
  13524.  first time. However, this added space is not "lost"; it is reused as
  13525.  new records or tables are added to the file.
  13526.  
  13527.  If the size of the file becomes unmanageable because of unused space,
  13528.  ISAMPACK.EXE can be used to remove the unused space and reduce the
  13529.  size of the file.
  13530.  
  13531.  
  13532.  231. L2025 Creating Quick Library Using Functions in SIGNAL.H
  13533.  
  13534.  Product Version(s): 7.00
  13535.  Operating System:   MS-DOS
  13536.  Flags: ENDUSER | SR# S900114-12
  13537.  Last Modified:  3-APR-1990    ArticleIdent: Q60135
  13538.  
  13539.  When placing a C program using the functions from SIGNAL.H into a
  13540.  Quick library for QuickBASIC (QB.EXE) or QuickBASIC Extended
  13541.  (QBX.EXE), LINK flags multiple occurrences of L2025 "Symbol defined
  13542.  more than once" in the CRT0DAT.ASM module of the C library. These
  13543.  errors are not affected by the /NOE (No Extended library search)
  13544.  option. This conflict is a limitation of Quick libraries. The SIGNAL.H
  13545.  functions work correctly when linked with a compiled BASIC program.
  13546.  
  13547.  This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
  13548.  and 4.50, QB.EXE from Microsoft BASIC Compiler Versions 6.00 and 6.00b
  13549.  for MS-DOS, QBX.EXE from Microsoft BASIC Professional Development
  13550.  System (PDS) Version 7.00 for MS-DOS, Microsoft QuickC Versions 1.00,
  13551.  1.01, 2.00, and 2.01, and Microsoft C Compiler Versions 5.00 and 5.10
  13552.  for MS-DOS.
  13553.  
  13554.  When the C code from the example below is compiled and linked into a
  13555.  Quick library as shown, the error L2025 is cited multiple times:
  13556.  
  13557.     QCL -c -AL signal.c ;     (QuickC)
  13558.     CL -c -AL signal.c ;      (C Compiler)
  13559.  
  13560.     LINK /Q signal,,,qbxqlb;      (LINK -> QLB in BC7)
  13561.     LINK /Q signal,,,bqlb45;      (LINK -> QLB in QB45)
  13562.  
  13563.  Code Example
  13564.  ------------
  13565.  
  13566.  The following code example demonstrates calling the raise() function
  13567.  from the SIGNAL.H file in C. When compiled and linked to a QLB as
  13568.  listed above, multiple L2025 errors occur:
  13569.  
  13570.     #include <signal.h>
  13571.     void test()
  13572.        {
  13573.        printf("SigFPE: %d\n",raise(SIGFPE));   /* Signal float error */
  13574.        }
  13575.  
  13576.  The following BASIC source demonstrates how to call the above C
  13577.  routine:
  13578.  
  13579.     DECLARE SUB test CDECL ()
  13580.     CALL test
  13581.  
  13582.  The above BASIC program compiles and links correctly to an EXE despite
  13583.  the fact that it fails to create a usable QLB file. The BASIC compile
  13584.  and link lines are as follows:
  13585.  
  13586.     BC testsig;
  13587.     LINK /NOE testsig+signal;
  13588.  
  13589.  The working EXE produces the following output:
  13590.  
  13591.     SigFPE: -1
  13592.  
  13593.  
  13594.  232. Near Strings Hotkey in Make EXE Dialog Box Does Not Toggle
  13595.  
  13596.  Product Version(s): 7.00
  13597.  Operating System:   MS-DOS
  13598.  Flags: ENDUSER | SR# S900319-29 buglist7.00 fixlist7.10
  13599.  Last Modified: 20-SEP-1990    ArticleIdent: Q60136
  13600.  
  13601.  In the QBX.EXE editor, the Near Strings hotkey (ALT+N) in the Make EXE
  13602.  File dialog box does not move the option marker to the Near Strings
  13603.  option -- only the cursor is moved to the option. The arrow keys must
  13604.  be used to change this option.
  13605.  
  13606.  All other hotkeys -- ALT+F for Far Strings, ALT+A for Alternate Math
  13607.  and so on -- move the option marker to the desired option. Only the
  13608.  Near Strings hotkey (ALT+N) does not.
  13609.  
  13610.  To work around this problem, use the arrow keys to move to the Near
  13611.  Strings option. (The arrows can be used for any of the choices.)
  13612.  
  13613.  Microsoft has confirmed this to be a problem in the QBX.EXE
  13614.  environment that comes with Microsoft BASIC Professional Development
  13615.  System (PDS) version 7.00. This problem was corrected in QBX.EXE in
  13616.  BASIC PDS 7.10.
  13617.  
  13618.  
  13619.  233. WIDTH Syntax Correction; WIDTH Parameter Is Required
  13620.  
  13621.  Product Version(s): 7.00 7.10
  13622.  Operating System:   MS-DOS
  13623.  Flags: ENDUSER | SR# S900315-50 docerr B_QuickBas
  13624.  Last Modified: 15-JAN-1991    ArticleIdent: Q60137
  13625.  
  13626.  The following WIDTH statement syntax (taken from the documentation
  13627.  listed further below) incorrectly indicates that both "screenwidth%"
  13628.  and  ", screenheight%" are optional:
  13629.  
  13630.     WIDTH [screenwidth%][, screenheight%]
  13631.  
  13632.  According to the above syntax description, "WIDTH" with no parameters
  13633.  is a legal statement; however, WIDTH with no arguments correctly
  13634.  causes the following error in the QBX.EXE environment:
  13635.  
  13636.     Expected: # or LPRINT or expression or ,
  13637.  
  13638.  The syntax description for the WIDTH statement should be corrected to
  13639.  read as follows:
  13640.  
  13641.     WIDTH {screenwidth% | , screenheight% | screenwidth%, screenheight%}
  13642.  
  13643.  Note that screenwidth% is measured in columns, and screenheight% is
  13644.  measured in lines.
  13645.  
  13646.  This correction applies to the WIDTH statement on page 449 of the
  13647.  "Microsoft QuickBASIC 4.0: Language Reference" for 4.00 and 4.00b; on
  13648.  page 409 of the "Microsoft BASIC 7.0: Language Reference" manual for
  13649.  BASIC PDS 7.00 and 7.10; to the WIDTH statement in the QBX.EXE
  13650.  Microsoft Advisor online Help system from Microsoft BASIC Professional
  13651.  Development System (PDS) version 7.00; and in the QB.EXE QB Advisor
  13652.  online Help system from Microsoft QuickBASIC version 4.50.
  13653.  
  13654.  This documentation error has been corrected in the QBX.EXE online Help
  13655.  in BASIC PDS 7.10.
  13656.  
  13657.  The following section of the QBX.EXE online Help system defines the
  13658.  notation used for syntax description (in all of the above products):
  13659.  
  13660.  [optional item]      Items inside square brackets are optional; you
  13661.                       do not have to use them in the statement.
  13662.  
  13663.  {choice1 | choice2}  Braces and a vertical bar indicate a choice
  13664.                       between two or more items. You must use one of
  13665.                       the items in the statement unless the braces
  13666.                       are enclosed in square brackets.
  13667.  
  13668.  
  13669.  234. Explanation and Example of the NMAKE.EXE Utility
  13670.  
  13671.  Product Version(s): 7.00   | 7.00
  13672.  Operating System:   MS-DOS | OS/2
  13673.  Flags: ENDUSER | SR# S900314-143
  13674.  Last Modified: 20-JUL-1990    ArticleIdent: Q60138
  13675.  
  13676.  Microsoft's NMAKE.EXE is a program-maintenance utility. It saves time
  13677.  by automating the process of updating project files. NMAKE compares
  13678.  the modification dates for one set of files, the target files, to
  13679.  those of another file type, the dependent files. If any of the
  13680.  dependent files have changed more recently than the target files,
  13681.  NMAKE executes a specified series of commands.
  13682.  
  13683.  This information applies to Microsoft BASIC Professional Development
  13684.  System (PDS) version 7.00 for MS-DOS and MS OS/2.
  13685.  
  13686.  The main purpose of NMAKE is to help you update applications quickly
  13687.  and simply. However, it can execute any command, so it is not limited
  13688.  to compiling and linking. NMAKE can also make backups, move files, and
  13689.  do many other project management tasks.
  13690.  
  13691.  NMAKE works by comparing the times and dates of two sets of files,
  13692.  which are called "targets" and "dependents":
  13693.  
  13694.   - A target file is a file that you want to create, such as an
  13695.     executable file.
  13696.  
  13697.   - A dependent file is a file used to create a target, such as a BASIC
  13698.     source file.
  13699.  
  13700.  When you run NMAKE, it reads a "description file" that you supply. The
  13701.  description file consists of one or more blocks. Each block lists a
  13702.  target, the target-dependents, and the command that builds the target.
  13703.  If any dependent has changed more recently than the target, NMAKE
  13704.  updates the target by executing the command listed in the block.
  13705.  
  13706.  You can invoke NMAKE with the following two options:
  13707.  
  13708.  1. Specify options, macro definitions, and the names of targets to be
  13709.     built on the DOS or OS/2 command line.
  13710.  
  13711.  2. Specify options, macro definitions, and the names to be built in a
  13712.     command file, and give the filename on the DOS command line.
  13713.  
  13714.  NMAKE accepts a number of command-line options, which are described in
  13715.  detail in the Microsoft programmer's guide in Chapter 20.
  13716.  
  13717.  NMAKE reads a description file (text file, saved as text only with
  13718.  line breaks) to determine what to do. The description file may contain
  13719.  any number of description blocks.
  13720.  
  13721.  For example, if you have the following three source files that are
  13722.  part of the same program
  13723.  
  13724.     MAIN.BAS
  13725.     FILE1.BAS
  13726.     FILE2.BAS
  13727.  
  13728.  and if the files through the program-development process need to be
  13729.  updated, you would use NMAKE. First, you create the description file
  13730.  that will contain the description blocks, as follows:
  13731.  
  13732.  #####################COMPILE.MAK##########################
  13733.  
  13734.      ALL: Sample.exe
  13735.      main.obj: main.bas      #target : dependent
  13736.         BC main.bas;         #command field: any DOS command
  13737.      file1.obj: file1.bas        #line
  13738.         BC file1.bas;
  13739.      file2.obj: file2.bas
  13740.         BC file2.bas;
  13741.      files.lib: file1.obj file2.obj
  13742.         LIB files.lib file1.obj + file2.obj
  13743.  
  13744.      sample.exe: main.obj files.lib
  13745.         LINK main.obj + files.lib, sample.exe;
  13746.  
  13747.  ##########################################################
  13748.  
  13749.  Then, you invoke NMAKE. The syntax for invoking NMAKE is as follows:
  13750.  
  13751.     NMAKE  COMPILE.MAK
  13752.  
  13753.  Code Example
  13754.  ------------
  13755.  
  13756.  MAIN.BAS
  13757.  --------
  13758.  
  13759.  PRINT "We are in the Main Program"
  13760.  CALL file1
  13761.  CALL file2
  13762.  PRINT "We are DONE!!"
  13763.  
  13764.  FILE1.BAS
  13765.  ---------
  13766.  
  13767.  PRINT "We are in FILE1.BAS "
  13768.  SUB file1
  13769.    PRINT "We are in the sub of file1.bas"
  13770.  END SUB
  13771.  
  13772.  FILE2.BAS
  13773.  ---------
  13774.  
  13775.  PRINT "We are in FILE2.BAS"
  13776.  
  13777.  SUB file2
  13778.    PRINT "We are in the sub of file2.bas"
  13779.  END SUB
  13780.  
  13781.  
  13782.  235. LEN Function Returns Wrong Length in LEFT$ in OPEN Statement
  13783.  
  13784.  Product Version(s): 7.00   | 7.00
  13785.  Operating System:   MS-DOS | OS/2
  13786.  Flags: ENDUSER | SR# S900319-95 buglist7.00 fixlist7.10
  13787.  Last Modified: 20-SEP-1990    ArticleIdent: Q60139
  13788.  
  13789.  The LEN function in Microsoft BASIC Professional Development System
  13790.  (PDS) version 7.00 may return an incorrect string length when used
  13791.  within a string function in an OPEN statement. This occurs only when
  13792.  the program is compiled with the Far Strings (BC /Fs) option, and
  13793.  doesn't occur in the QuickBASIC Extended (QBX.EXE) environment or when
  13794.  the program is compiled without the Far Strings option (in other
  13795.  words, compiled with the BC.EXE default near strings).
  13796.  
  13797.  To work around this problem, use a temporary variable for the result
  13798.  of the LEN function and use that result in the string function.
  13799.  
  13800.  Microsoft has confirmed this to be a problem with BC /Fs in Microsoft
  13801.  BASIC Professional Development System (PDS) version 7.00. This problem
  13802.  was corrected in BASIC PDS 7.10.
  13803.  
  13804.  This problem occurs because the compiler incorrectly assumes that the
  13805.  length will be the first 2 bytes of the descriptor when LEN is used in
  13806.  a string function in the OPEN statement. This assumption is correct
  13807.  for near strings, but the far string descriptor is different and the
  13808.  length must be retrieved in a different manner.
  13809.  
  13810.  Code Example
  13811.  ------------
  13812.  
  13813.  The following are the compile and link lines that reproduce the
  13814.  problem in the code example:
  13815.  
  13816.     BC LENTEST /Fs;
  13817.     LINK LENTEST;
  13818.  
  13819.  The following code example OPENs the wrong file on the first OPEN
  13820.  statement:
  13821.  
  13822.     ' LENTEST.BAS
  13823.     tmp$ = "TEST.12X"
  13824.     l% = LEN(tmp$)        'Temporary for work-around
  13825.  
  13826.     'This should incorrectly create a file named 'TEST.12X'
  13827.     OPEN LEFT$(tmp$, LEN(tmp$) - 1) FOR RANDOM AS #1
  13828.     CLOSE #1
  13829.  
  13830.     'For a workaround, use temporary variable (l%) for LEN(tmp$) and
  13831.     'you will get 'TEST.12'
  13832.     OPEN LEFT$(tmp$, l% - 1) FOR RANDOM AS #1
  13833.     CLOSE #1
  13834.  
  13835.  Both OPEN statements in the above code example should open "TEST.12",
  13836.  but the first OPEN actually opens "TEST.12X" because the string length
  13837.  is returned incorrectly and is thus too large. Subtracting 1 from this
  13838.  larger value still leaves the full string to be returned from LEFT$.
  13839.  
  13840.  
  13841.  236. HELPMAKE ":p" Option Does Not Work Correctly
  13842.  
  13843.  Product Version(s): 7.00 7.10 | 7.00 7.10
  13844.  Operating System:   MS-DOS    | OS/2
  13845.  Flags: ENDUSER | buglist7.00 buglist7.10 s_utility
  13846.  Last Modified: 21-SEP-1990    ArticleIdent: Q60141
  13847.  
  13848.  When using the HELPMAKE.EXE utility (for modifying the online Help
  13849.  system of QBX.EXE environment), the ":p" command does not work as
  13850.  described on Page 681 of the "Microsoft BASIC 7.0: Programmer's
  13851.  Guide." The ":p" is described as setting a screen break for the Help
  13852.  environment. If ":p" is used, the Help environment behaves as if it
  13853.  were not used.
  13854.  
  13855.  Microsoft has confirmed this to be a problem with HELPMAKE in
  13856.  Microsoft Professional Development System (PDS) versions 7.00 and 7.10
  13857.  for MS-DOS. We are researching this problem and will post new
  13858.  information here as it becomes available.
  13859.  
  13860.  A workaround for this problem is to use the ":ln" command, which is
  13861.  also described on Page 681 of the "Microsoft BASIC 7.0: Programmer's
  13862.  Guide" for BASIC PDS 7.00 and 7.10. The ":ln" command specifies the
  13863.  size of the help window, where "n" is the number of lines. If this
  13864.  command is used, the size of the window is n + 1. If you want
  13865.  something to show up on the next page, you must have n + 1 number of
  13866.  lines before the next page. If this option is not used, the size of
  13867.  the window will default to the number of lines in the Help screen + 1,
  13868.  with 19 being the maximum number of lines.
  13869.  
  13870.  For any of the ":" commands described on Page 681 to take effect,
  13871.  HELPMAKE must be invoked with the /Ac option as described on Page 673.
  13872.  
  13873.  Note: HELPMAKE.EXE is the Microsoft Help File Maintenance Utility.
  13874.  HELPMAKE version 1.04 is shipped with BASIC PDS 7.00, and HELPMAKE
  13875.  version 1.05 is shipped with BASIC PDS 7.10.
  13876.  
  13877.  
  13878.  237. Configuring M.EXE to Epsilon Format
  13879.  
  13880.  Product Version(s): 7.00   | 7.00
  13881.  Operating System:   MS-DOS | OS/2
  13882.  Flags: ENDUSER | SR# S900322-11
  13883.  Last Modified: 11-JUL-1990    ArticleIdent: Q60142
  13884.  
  13885.  This article describes the correct way to set up the Microsoft M
  13886.  Editor (M.EXE) to simulate the Epsilon editor environment. The Epsilon
  13887.  editor is a text editing utility published by Lugaru Software, which
  13888.  emulates EMACS-type editors running on larger computers.
  13889.  
  13890.  This article applies to Microsoft BASIC Professional Development
  13891.  System (PDS) Version 7.00.
  13892.  
  13893.  In the BIN directory that Setup installs on the hard drive, there is a
  13894.  file called EPSILON.INI. This file contains the keystroke assignments
  13895.  necessary to reconfigure the M.EXE Editor. To get this field
  13896.  recognized, do one of the following:
  13897.  
  13898.  1. Rename the file to TOOLS.INI.
  13899.  
  13900.  2. Copy this file into your current TOOLS.INI file.
  13901.  
  13902.  Then, make sure that your DOS INIT variable is set to the directory
  13903.  that your TOOLS.INI file is located in; for example:
  13904.  
  13905.     SET INIT=D:\BC7\BIN
  13906.  
  13907.  At the top of the EPSILON.INI file is the clause [M MEP]. This clause
  13908.  tells the computer that the following commands should be issued when a
  13909.  program called M.EXE or a program called MEP.EXE is executed. If you
  13910.  have changed the name of your M Editor, this label should be changed
  13911.  to include the current name of the editor.
  13912.  
  13913.  
  13914.  238. /FPa, /Lp, and Near Strings Disabled with Quick Library
  13915.  
  13916.  Product Version(s): 7.00 7.10
  13917.  Operating System:   MS-DOS
  13918.  Flags: ENDUSER | SR# S900321-16
  13919.  Last Modified: 17-JAN-1991    ArticleIdent: Q60143
  13920.  
  13921.  If QBX.EXE is invoked with the /L option to load in a Quick library,
  13922.  the following compiler options will be disabled when the Make EXE File
  13923.  command is chosen from the Run menu:
  13924.  
  13925.     Alternate Math        /FPa
  13926.     OS/2 Protected Mode   /Lp
  13927.     Near Strings
  13928.  
  13929.  This information applies to Microsoft BASIC Professional Development
  13930.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  13931.  
  13932.  A Quick library must be compiled using 80x87 or Emulator Math (/FPi),
  13933.  DOS or OS/2 real mode (/Lr), and Far Strings (/FS). Therefore, even if
  13934.  BASIC 7.00 or 7.10 is installed to support the Alternate Math library,
  13935.  OS/2 protected mode, and Near Strings, these compiler options cannot
  13936.  be selected from the Make EXE File menu option when a Quick library is
  13937.  loaded.
  13938.  
  13939.  
  13940.  239. CHAINing with Additional Variables in COMMON Causes Hang
  13941.  
  13942.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  13943.  Operating System:   MS-DOS               | OS/2
  13944.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 buglist7.10
  13945.  Last Modified: 20-SEP-1990    ArticleIdent: Q60147
  13946.  
  13947.  In a compiled BASIC program, CHAINing from a program that has a
  13948.  DYNAMIC variable-length string array in COMMON to a program that has
  13949.  an additional variable in COMMON whose length is greater than 530
  13950.  bytes will cause the program to either terminate and display an
  13951.  "Unprintable Error" message or hang, depending on the version of BASIC
  13952.  compiler being used.
  13953.  
  13954.  This problem does not occur in the QB.EXE or QBX.EXE editors or when
  13955.  the /Fs compiler option is used with Microsoft BASIC Professional
  13956.  Development System (PDS) versions 7.00 or 7.10.
  13957.  
  13958.  Microsoft has confirmed this to be a problem in Microsoft QuickBASIC
  13959.  versions 4.00, 4.00b and 4.50; in Microsoft BASIC Compiler versions
  13960.  6.00 and 6.00b for MS-DOS and OS/2; and in Microsoft BASIC PDS
  13961.  versions 7.00 and 7.10 for MS-DOS and OS/2. We are researching this
  13962.  problem and will post new information here as it becomes available.
  13963.  
  13964.  With BASIC PDS 7.00 or 7.10, the "Unprintable Error" message displays.
  13965.  In the other BASICs listed above, the program hangs.
  13966.  
  13967.  To duplicate the problem, the following conditions must be met:
  13968.  
  13969.  1. The first program must have a dynamic variable-length string array
  13970.     in COMMON.
  13971.  
  13972.  2. The first program must assign a value to an element of the array.
  13973.  
  13974.  3. The second program must have an additional COMMON variable (not in
  13975.     the first program's COMMON) with a length greater than 530 bytes.
  13976.     This can be either a fixed-length string or a user-defined TYPE.
  13977.  
  13978.  4. The second program must assign a value to the additional variable.
  13979.  
  13980.  5. Both programs must be compiled with near strings (no /Fs).
  13981.  
  13982.  Similarly, to work around the problem, any of the following methods
  13983.  can be used:
  13984.  
  13985.  1. Make the array $STATIC (DIM before COMMON in both programs).
  13986.  
  13987.  2. Put the additional COMMON variable in the COMMON block for the
  13988.     first program as well.
  13989.  
  13990.  3. Compile both programs with the Far Strings (/Fs) option in BASIC
  13991.     PDS 7.00 or 7.10.
  13992.  
  13993.  When the programs below are compiled for OS/2 protected mode, the
  13994.  problem is almost identical. The only difference in protected mode is
  13995.  the size of the additional variable in the COMMON block. The process
  13996.  will hang whenever the additional COMMON variable is greater than 20
  13997.  bytes (instead of 530 as in DOS). Besides the length of the COMMON
  13998.  variable, the conditions and the workarounds (listed above) apply to
  13999.  both OS/2 protected mode and DOS (and OS/2 real mode).
  14000.  
  14001.  Code Example #1
  14002.  ---------------
  14003.  
  14004.  The following program CHAINs to Code Example #2, which produces the
  14005.  "Unprintable Error" in BASIC PDS 7.00 or 7.10 and hangs in the other
  14006.  BASIC versions listed above when compiled as shown:
  14007.  
  14008.  'FIRST.BAS compile and LINK lines:
  14009.  '    BC FIRST;
  14010.  '    LINK FIRST;
  14011.  'NOTE: Compiling with the Far Strings option (/FS) corrects problem.
  14012.  
  14013.  'DIM VarStrArray(0) AS STRING      'Static array works correctly.
  14014.  COMMON VarStrArray() AS STRING
  14015.  'More COMMON variables can be added to both without changing
  14016.  ' problem.
  14017.  COMMON FixStr AS STRING * 531      'Full COMMON in both files works.
  14018.  DIM VarStrArray(0) AS STRING       'Dynamic array (any size) fails.
  14019.  VarStrArray(0) = "Test"            'Must assign a value to array.
  14020.  PRINT "Chaining FIRST->SECOND"
  14021.  CHAIN "SECOND"
  14022.  END
  14023.  
  14024.  Code Example #2
  14025.  ---------------
  14026.  
  14027.  The following is the CHAINed program, which will terminate and produce
  14028.  the "Unprintable Error" or hang (depending on the version of BASIC
  14029.  being used) when compiled as shown:
  14030.  
  14031.  'SECOND.BAS compile and LINK lines:
  14032.  '    BC SECOND;
  14033.  '    LINK SECOND;
  14034.  'NOTE: Compiling with the Far Strings option (/FS) corrects problem.
  14035.  
  14036.  'DIM VarStrArray(0) AS STRING  'Static array works correctly.
  14037.  COMMON VarStrArray() AS STRING 'Must be Dynamic string array.
  14038.  'More COMMON variables can be added to both without changing problem.
  14039.  COMMON FixStr AS STRING * 531  'Must be fixed STRING with LEN > 530
  14040.  
  14041.  PRINT "In SECOND"
  14042.  FixStr = "Test"                'Assignment to new COMMON var required.
  14043.  END
  14044.  
  14045.  
  14046.  240. No Space Needed in "/O MY.SRC" in HELPMAKE, Programmer's Guide
  14047.  
  14048.  Product Version(s): 7.00 7.10 | 7.00 7.10
  14049.  Operating System:   MS-DOS    | OS/2
  14050.  Flags: ENDUSER | docerr
  14051.  Last Modified:  8-JAN-1991    ArticleIdent: Q60220
  14052.  
  14053.  Page 673 in the "Microsoft BASIC 7.0: Programmer's Guide" (for
  14054.  versions 7.00 and 7.10) incorrectly shows a space between "/O" and
  14055.  "MY.SRC" in the following example for decoding a Help database:
  14056.  
  14057.     HELPMAKE /V /D /O MY.SRC MY.HLP > MY.LOG
  14058.  
  14059.  Using this syntax gives the error ":fatal error H1100: cannot open
  14060.  file." The correct syntax is as follows:
  14061.  
  14062.     HELPMAKE /V /D /OMY.SRC MY.HLP > MY.LOG
  14063.  
  14064.  The sample syntax given on the bottom of Page 672 shows the "/O"
  14065.  option as it should be used.
  14066.  
  14067.  This information applies to Microsoft BASIC Professional Development
  14068.  System (PDS) Versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  14069.  
  14070.  
  14071.  241. How to Run the CHRTDEMO.BAS Example Program
  14072.  
  14073.  Product Version(s): 7.00
  14074.  Operating System:   MS-DOS
  14075.  Flags: ENDUSER | SR# S900329-119
  14076.  Last Modified: 11-APR-1990    ArticleIdent: Q60422
  14077.  
  14078.  The CHRTDEMO.BAS example program requires several additional files to
  14079.  run properly. If any of these files is not loaded in the QBX.EXE
  14080.  environment, the "Subprogram not defined" error occurs. If any of the
  14081.  files are left out when LINKing, the "Unresolved external" LINK error
  14082.  occurs.
  14083.  
  14084.  The steps to set up the files to run CHRTDEMO (for either the QBX.EXE
  14085.  environment or as an EXE program) are documented in the banner
  14086.  comments at the beginning of CHRTDEMO.BAS.
  14087.  
  14088.  This information applies to Microsoft BASIC Professional Development
  14089.  System (PDS) Version 7.00.
  14090.  
  14091.  The following table shows the files required to run the CHRTDEMO
  14092.  example program and in which Quick library the modules are contained
  14093.  (Note: Assembly modules are contained in each QLB):
  14094.  
  14095.     Source File    CHRTBEFR.QLB   UITBEFR.QLB
  14096.     -----------    ------------   -----------
  14097.  
  14098.     CHRTDEMO.BAS
  14099.     CHRTDEM1.BAS
  14100.     CHRTDEM2.BAS
  14101.     CHRTB.BAS            X
  14102.     FONTB.BAS            X
  14103.     CHRTASM.ASM          X              X
  14104.     FONTASM.ASM          X              X
  14105.     UIASM.ASM            X              X
  14106.     WINDOW.BAS                          X
  14107.     MENU.BAS                            X
  14108.     MOUSE.BAS                           X
  14109.     GENERAL.BAS                         X
  14110.  
  14111.  In addition to the files listed above, expanded memory [with an LIM
  14112.  4.0 EMM (Expanded Memory Manager)] is required to run in the QBX.EXE
  14113.  environment. In EXE form, the program will run without EMS (expanded
  14114.  memory support).
  14115.  
  14116.  When running the CHRTDEMO program, you must first enter data through
  14117.  the dialog box for the Data option of the View menu. When the program
  14118.  begins, the Chart option of the View menu is gray, since there are no
  14119.  series to chart. If a chart is requested without data entered in any
  14120.  series, the following dialog box message appears:
  14121.  
  14122.     No data in series.
  14123.  
  14124.  When entering the data, the Series name and Category labels are the
  14125.  same for the entire chart, but you must enter a different set of data
  14126.  for each series. Thus, the numbers entered in the Values column apply
  14127.  only to the currently selected Series. If an unnamed Series is
  14128.  selected, the values will be lost when OK is chosen to close the
  14129.  dialog box. When OK is chosen with data in an unnamed series, the
  14130.  following dialog box message appears:
  14131.  
  14132.     Series without names will be deleted upon exit.
  14133.  
  14134.  The following banner comment from CHRTDEMO.BAS describes the steps
  14135.  (and memory requirements) to run the CHRTDEMO program in either the
  14136.  QBX.EXE environment or as an EXE program:
  14137.  
  14138.  ' This demo program uses the Presentation Graphics and User
  14139.  ' Interface toolboxes to implement a general purpose charting
  14140.  ' package.
  14141.  '
  14142.  ' It consists of three modules (CHRTDEMO.BAS, CHRTDEM1.BAS, and
  14143.  ' CHRTDEM2.BAS) and one include file (CHRTDEMO.BI). It requires
  14144.  ' access to both the Presentation Graphics and User Interface
  14145.  ' toolboxes.
  14146.  '
  14147.  ' EMS is needed to load and run the demo under QBX. If you do not
  14148.  ' have EMS, refer to the command line compile instructions below,
  14149.  ' which will allow you to run the demo from the DOS prompt. Running
  14150.  ' the demo under QBX requires access to the Presentation Graphics
  14151.  ' and User Interface toolboxes. This can be done using one of two
  14152.  ' methods:
  14153.  '
  14154.  '   1. One large Quick library covering both toolboxes can be created.
  14155.  '      The library "CHRTDEM.LIB" and Quick library "CHRTDEM.QLB" are
  14156.  '      created as follows:
  14157.  '
  14158.  '         BC /X/FS chrtb.bas;
  14159.  '         BC /X/FS fontb.bas;
  14160.  '         LIB chrtdem.lib+uitbefr.lib+fontasm+chrtasm+fontb+chrtb;
  14161.  '         LINK /Q chrtdem.lib, chrtdem.qlb,,qbxqlb.lib;
  14162.  '
  14163.  '      Once created, start QBX with this Quick library and load the
  14164.  '      demo's modules (CHRTDEMO.BAS, CHRTDEM1.BAS and CHRTDEM2.BAS).
  14165.  '
  14166.  '   2. Either the Presentation Graphics or User Interface Quick Library
  14167.  '      may be used alone provided the other's source code files
  14168.  '      are loaded into the QBX environment. If CHRTBEFR.QLB is
  14169.  '      is used, then WINDOW.BAS, GENERAL.BAS, MENU.BAS, and MOUSE.BAS
  14170.  '      must be loaded. If UITBEFR.QLB is used, then CHRTB.BAS and
  14171.  '      FONTB.BAS must be loaded. Once a Quick Library is specified and
  14172.  '      all necessary source files are loaded, load the program
  14173.  '      modules (CHRTDEMO.BAS, CHRTDEM1.BAS and CHRTDEM2.BAS).
  14174.  '
  14175.  ' To create a compiled version of the chart demo program, perform the
  14176.  ' following steps:
  14177.  '
  14178.  '   BC /X/FS chrtb.bas;
  14179.  '   BC /X/FS fontb.bas;
  14180.  '   LIB chrtdem.lib + uitbefr.lib + fontasm + chrtasm + fontb
  14181.  '                   + chrtb;
  14182.  '   BC /X/FS chrtdemo.bas;
  14183.  '   BC /FS chrtdem1.bas;
  14184.  '   BC /FS chrtdem2.bas;
  14185.  '   LINK /EX chrtdemo chrtdem1 chrtdem2, chrtdemo.exe,, chrtdem.lib;
  14186.  '
  14187.  ' "CHRTDEMO" can now be run from the command line.
  14188.  
  14189.  
  14190.  242. Unresolved External Making Quick Library from CHRTB.BAS
  14191.  
  14192.  Product Version(s): 7.00 7.10
  14193.  Operating System:   MS-DOS
  14194.  Flags: ENDUSER | SR# S900402-93 docerr
  14195.  Last Modified:  8-JAN-1991    ArticleIdent: Q60425
  14196.  
  14197.  The CHRTB.BAS file contains BASIC source code for the Presentation
  14198.  Graphics Toolbox Chart Routines.
  14199.  
  14200.  At the beginning of this file, there are instructions for creating a
  14201.  library and Quick library that contain the charting routines found in
  14202.  CHRTB.BAS. However, numerous unresolved external link errors (L2029)
  14203.  will be produced unless alterations are made to these instructions.
  14204.  
  14205.  This documentation error occurs in the CHRTB.BAS file in Microsoft
  14206.  BASIC Professional Development System (PDS) Versions 7.00 and 7.10 for
  14207.  MS-DOS.
  14208.  
  14209.  Since CHRTB.BAS makes calls to routines found in the Fonts Toolbox,
  14210.  FONTB.OBJ and FONTASM.OBJ must be included when making a library or
  14211.  Quick library out of CHRTB.BAS. These two files were mistakenly
  14212.  omitted from the instructions found in the CHRTB.BAS file.
  14213.  
  14214.  The correct method of creating a library and Quick library containing
  14215.  the charting routines found in CHRTB.BAS is as follows:
  14216.  
  14217.     BC /X /FS chrtb.bas
  14218.     BC /X /FS fontb.bas
  14219.     LIB chrtb.lib +chrtb+chrtasm+fontb+fontasm+qbx.lib;
  14220.     LINK /Q chrtb.lib, chrtb.qlb,,qbxqlb.lib;
  14221.  
  14222.  If the charting routines are going to be used in conjunction with the
  14223.  User Interface Toolbox source code (GENERAL.BAS, WINDOW.BAS, MENU.BAS,
  14224.  and MOUSE.BAS), the library should instead be created in the following
  14225.  manner:
  14226.  
  14227.     LIB chrtb.lib +chrtb+chrtasm+uiasm+fontb+fontasm+qbx.lib;
  14228.  
  14229.  
  14230.  243. TSCNIOxx.OBJ Stub Files Remove COLOR Border Parameter
  14231.  
  14232.  Product Version(s): 7.00
  14233.  Operating System:   MS-DOS
  14234.  Flags: ENDUSER | SR# S900327-66
  14235.  Last Modified: 20-APR-1990    ArticleIdent: Q60851
  14236.  
  14237.  When a Microsoft BASIC Professional Development System (PDS) Version
  14238.  7.00 program is linked with one of the TSCNIOxx.OBJ stub files, most
  14239.  graphics statements and functions are stubbed out. When a program that
  14240.  has been linked in this manner attempts to use the "border" parameter
  14241.  syntax of the COLOR statement, the run-time error "Feature
  14242.  unavailable" should be generated. This is because the border parameter
  14243.  syntax support is contained in the graphics portion of the BASIC
  14244.  run-time module and this is removed, or stubbed, during LINK time.
  14245.  
  14246.  The syntax for the COLOR statement that applies here is as follows:
  14247.  
  14248.     COLOR [foreground][,background][,border]
  14249.  
  14250.  This statement is only supported on a CGA graphics adapter in SCREEN 0.
  14251.  
  14252.  
  14253.  244. Passing Far Strings to C Using StringAddress and StringLength
  14254.  
  14255.  Product Version(s): 7.00   | 7.00
  14256.  Operating System:   MS-DOS | OS/2
  14257.  Flags: ENDUSER | SR# S900328-95
  14258.  Last Modified: 19-APR-1990    ArticleIdent: Q60852
  14259.  
  14260.  Programs compiled with the /Fs option, functions and procedures
  14261.  (compiled with /Fs) in a Quick library, and programs designed to run
  14262.  under the QuickBASIC Extended (QBX.EXE) environment now need to handle
  14263.  strings passed to non-BASIC routines differently.
  14264.  
  14265.  The following program demonstrates how to pass a variable-length far
  14266.  string to a Microsoft C function using the BASIC run-time routines
  14267.  StringAddress and StringLength. These routines are necessary to obtain
  14268.  the string's far address and length.
  14269.  
  14270.  Code Example
  14271.  ------------
  14272.  
  14273.  '----------- Here is the file TESTB.BAS
  14274.  DECLARE SUB TestC CDECL (A$)
  14275.  A$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + CHR$(0)
  14276.                  'Add Hex 0 at the end for the C printf function
  14277.  CLS : PRINT : PRINT
  14278.  PRINT "BASIC: "; A$
  14279.  PRINT "Len: "; LEN(A$)
  14280.  PRINT
  14281.  CALL TestC(A$)
  14282.  LOCATE CSRLIN + 3
  14283.  PRINT "Back in BASIC"
  14284.  SYSTEM
  14285.  
  14286.  /* ---------- Here is the file TESTC.C
  14287.  extern char far * pascal StringAddress(long near *);
  14288.  extern int pascal StringLength(long near *);
  14289.  
  14290.  void TestC (long near * Desc)
  14291.  {
  14292.    int  len;
  14293.    char far *segadd;
  14294.  
  14295.    len = StringLength( Desc );
  14296.    segadd = StringAddress( Desc );
  14297.    printf("C: %s\n", segadd);
  14298.    printf("Len: %i\n", len);
  14299.  }
  14300.  
  14301.  Compile and link options, as follows:
  14302.  
  14303.     BC /o TESTB;
  14304.     CL -c -AM TESTC.C
  14305.     LINK /noe TESTB TESTC;
  14306.  
  14307.  The output should from this program should be as follows:
  14308.  
  14309.     BASIC: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  14310.     Len: 27
  14311.  
  14312.     C: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  14313.     Len: 27
  14314.  
  14315.     Back in BASIC
  14316.  
  14317.  
  14318.  245. Floating-Point Bench Marks: QB vs BC6 vs PDS, /FPi vs /FPa
  14319.  
  14320.  Product Version(s): 7.00   | 7.00
  14321.  Operating System:   MS-DOS | OS/2
  14322.  Flags: ENDUSER | SR# S900403-121 B_QuickBas
  14323.  Last Modified: 19-APR-1990    ArticleIdent: Q60858
  14324.  
  14325.  This article provides some informal benchmarks for various versions of
  14326.  Microsoft BASIC. It demonstrates the speed differences between them
  14327.  using certain mathematic operations with different versions of BASIC
  14328.  and different math packages. The data listed below was generated on a
  14329.  Wyse 386 16 MHz PC without a coprocessor.
  14330.  
  14331.  This information applies to Microsoft QuickBASIC Version 4.50,
  14332.  Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS and OS/2,
  14333.  and Microsoft BASIC Professional Development System (PDS) Version 7.00
  14334.  for MS-DOS and OS/2.
  14335.  
  14336.  The emulator (/FPi) is a math package that uses software to emulate
  14337.  the floating-point coprocessor functions as closely as possible when a
  14338.  coprocessor is not present. The alternate math package (/FPa) is
  14339.  another method of emulating the coprocessor functions. The main
  14340.  difference is that the emulator always uses an 80-bit temporary work
  14341.  area (to emulate the coprocessor's 80-bit register), whereas the
  14342.  alternate math package uses a smaller temporary storage area for most
  14343.  operations. The alternate math package can generate significantly
  14344.  faster code, but at a loss of precision for floating-point
  14345.  calculations.
  14346.  
  14347.  QuickBASIC uses only the emulator math (EM) package (/FPi). The
  14348.  alternate math package is not available with QuickBASIC, but is
  14349.  available with BASIC compiler 6.00 and 6.00b and BASIC PDS 7.00.
  14350.  
  14351.  The following table gives the times for the various operations in the
  14352.  program listed below (these operations were performed 10,000 times on
  14353.  a 386/16 MHz):
  14354.  
  14355.     10,000        PDS 7.00       BC 6.00b       BC 6.00       QB 4.50
  14356.     Operations  /FPi    /FPa   /FPi    /FPa   /FPi    /FPa   (EM only)
  14357.     ----------  ------------   ------------   ------------   ---------
  14358.  
  14359.     empty loop   3.19   1.87   3.91    1.21   3.94    1.22   3.56
  14360.     J#=I#+I#     4.53   1.84   5.78    1.84   5.78    1.85   5.15
  14361.     J#=I#*I#     4.72   2.03   5.97    2.12   5.91    2.03   5.19
  14362.     J#=I#^2     33.91   3.68  46.32    3.81  45.47    3.72  42.31
  14363.     J#=I#^.5    33.93  29.34  46.50   30.57  45.66   29.47  42.63
  14364.     J#=SQR(I#)   5.57   3.25   6.84    3.40   6.71    3.28   6.00
  14365.     J#=COS(I#)  16.87  15.90  31.44   16.22  31.47   16.15  29.94
  14366.  
  14367.  Please note the following about the above table:
  14368.  
  14369.  1. Any exponents are slow in the emulator. Equivalent multiplication
  14370.     is much faster for small cases.
  14371.  
  14372.  2. Fractional exponents are almost as slow with the alternate math
  14373.     package as the emulator. The times for other noninteger exponents
  14374.     are similarly slow with the alternate math package. Note that SQR
  14375.     is much faster than raising to the .5 exponent.
  14376.  
  14377.  3. BASIC PDS 7.00 greatly improves the emulator speed for many of the
  14378.     operations (COS, exponentiation) over previous versions. Since the
  14379.     alternate math package doesn't have the same factor of improvement,
  14380.     the emulator runs closer to the alternate package for many
  14381.     operations in BASIC PDS 7.00.
  14382.  
  14383.  4. The time of execution for most operations using /FPa in PDS 7.00 is
  14384.     40-60 percent of the time with /FPi in PDS 7.00.
  14385.  
  14386.  Code Example
  14387.  ------------
  14388.  
  14389.  The following code example demonstrates the times of various
  14390.  operations using the different versions of BASIC:
  14391.  
  14392.     'Compile and link lines for emulator (only mode for QuickBASIC):
  14393.     '
  14394.     ' BC /O BENCH.BAS;
  14395.     ' LINK BENCH;
  14396.     '
  14397.     'Compile and link for alternate math in BASIC compiler and PDS:
  14398.     '
  14399.     ' BC /O /FPa BENCH.BAS;
  14400.     ' LINK BENCH;
  14401.     orig = TIMER
  14402.     FOR I# = 1 TO 10000
  14403.     NEXT
  14404.     PRINT "Empty loop:"; TIMER - orig
  14405.  
  14406.     orig = TIMER
  14407.     FOR I# = 1 TO 10000
  14408.     J# = I# + I#
  14409.     NEXT
  14410.     PRINT "J#=I#+I#:"; TIMER - orig
  14411.  
  14412.     orig = TIMER
  14413.     FOR I# = 1 TO 10000
  14414.     J# = I# * I#
  14415.     NEXT
  14416.     PRINT "J#=I#*I#:"; TIMER - orig
  14417.  
  14418.     orig = TIMER
  14419.     FOR I# = 1 TO 10000
  14420.     J# = I# ^ 2
  14421.     NEXT
  14422.     PRINT "J#=I#^2: "; TIMER - orig
  14423.  
  14424.     orig = TIMER
  14425.     FOR I# = 1 TO 10000
  14426.     J# = I# ^ .5
  14427.     NEXT
  14428.     PRINT "J#=I#^.5: "; TIMER - orig
  14429.  
  14430.     orig = TIMER
  14431.     FOR I# = 1 TO 10000
  14432.     J# = SQR(I#)
  14433.     NEXT
  14434.     PRINT "J#=SQR(I#):"; TIMER - orig
  14435.  
  14436.     orig = TIMER
  14437.     FOR I# = 1 TO 10000
  14438.     J# = COS(I#)
  14439.     NEXT
  14440.     PRINT "J#=COS(I#): "; TIMER - orig
  14441.     END
  14442.  
  14443.  
  14444.  246. Vectored Fonts Not Usable in BASIC PDS 7.00
  14445.  
  14446.  Product Version(s): 7.00 7.10
  14447.  Operating System:   MS-DOS
  14448.  Flags: ENDUSER | SR# S900408-2 bit map
  14449.  Last Modified: 21-SEP-1990    ArticleIdent: Q60859
  14450.  
  14451.  The font files MODERN.FON, SCRIPT.FON, and ROMAN.FON from Microsoft
  14452.  Windows/286 and Microsoft Windows/386 cannot be used with the
  14453.  Microsoft BASIC Professional Development System (PDS) version 7.00 or
  14454.  7.10 font toolbox.
  14455.  
  14456.  The "Microsoft BASIC 7.0: Language Reference" manual correctly states
  14457.  on Page 518 that the font toolbox supplied with BASIC PDS 7.00 works
  14458.  with any standard Windows bitmap .FON file. However, the files
  14459.  MODERN.FON, SCRIPT.FON, and ROMAN.FON are vectored fonts, not
  14460.  bitmapped fonts. The BASIC PDS font toolbox will use the rest of the
  14461.  fonts supplied with Windows/286 or Windows/386 without any problem.
  14462.  
  14463.  The difference between bitmapped and vectored fonts is that bitmapped
  14464.  fonts are fixed in size and shape. To get a different-sized font, you
  14465.  must use a different bitmap for each character. Vectored fonts, also
  14466.  called scalable or resizeable fonts, are actually made up of
  14467.  instructions for drawing the different characters. As a result, you
  14468.  can easily resize the figures.
  14469.  
  14470.  The same .FON files are supplied with Windows/286 and Windows/386.
  14471.  
  14472.  The message "Bad Font File" will be generated by the BASIC PDS font
  14473.  toolbox if it cannot use a specific font.
  14474.  
  14475.  
  14476.  247. CommandKeySet Subprogram Should Be ShortCutKeySet
  14477.  
  14478.  Product Version(s): 7.00 7.10
  14479.  Operating System:   MS-DOS
  14480.  Flags: ENDUSER | SR# S900410-29 docerr
  14481.  Last Modified:  8-JAN-1991    ArticleIdent: Q60860
  14482.  
  14483.  Page 549 of the "Microsoft BASIC 7.0: Language Reference" (for 7.00
  14484.  and 7.10) incorrectly refers to the CommandKeySet SUBprogram where it
  14485.  should refer to the ShortCutKeySet SUBprogram.
  14486.  
  14487.  This information applies to Microsoft BASIC Professional Development
  14488.  System (PDS) Versions 7.00 and 7.10 for MS-DOS.
  14489.  
  14490.  
  14491.  248. Problem When Using Integer Array and FOR Loop in BASIC 7.00
  14492.  
  14493.  Product Version(s): 7.00   | 7.00
  14494.  Operating System:   MS-DOS | OS/2
  14495.  Flags: ENDUSER | SR# S900411-147 buglist7.00 fixlist7.10
  14496.  Last Modified:  1-AUG-1990    ArticleIdent: Q60965
  14497.  
  14498.  The code example below shows a case where using an integer variable
  14499.  for a FOR loop-counter can produce incorrect results in a compiled
  14500.  BASIC program. The program must have the following elements to
  14501.  reproduce the problem:
  14502.  
  14503.  1. The program must contain a simple FOR loop (not nested, etc.).
  14504.  
  14505.  2. The FOR loop must contain a call to the INT function.
  14506.  
  14507.  3. The upper bound of the FOR loop must be specified with a
  14508.     variable, not a literal.
  14509.  
  14510.  4. The loop-counter variable and upper-bound variable must be
  14511.     integers.
  14512.  
  14513.  The code example below demonstrates these conditions and prints out
  14514.  the value of the loop counter each time it loops. In a compiled BASIC
  14515.  program, this example always prints the upper bound of the loop
  14516.  counter.
  14517.  
  14518.  Microsoft has confirmed this to be a problem in the BC.EXE compiler
  14519.  that comes with Microsoft BASIC Professional Development System (PDS)
  14520.  version 7.00 for MS-DOS and MS OS/2. This problem was corrected in
  14521.  BASIC PDS version 7.10.
  14522.  
  14523.  This problem does not occur in QBX.EXE (the QuickBASIC extended
  14524.  environment that comes with BASIC PDS 7.00). This problem also does
  14525.  not occur in the BC.EXE or QB.EXE environments that come with
  14526.  QuickBASIC versions 4.00, 4.00b, or 4.50.
  14527.  
  14528.  Any of the following workarounds corrects the problem:
  14529.  
  14530.  1. Compile with the BC /X option.
  14531.  
  14532.  2. Compile with the BC /FPa option.
  14533.  
  14534.  3. Change the DEFINT statement to DEFtype, where "type" is anything
  14535.     but INT (integer).
  14536.  
  14537.  4. Change the upper bound on the FOR-LOOP to a literal.
  14538.  
  14539.  Code Example
  14540.  ------------
  14541.  
  14542.  DEFINT A-Z                    'Change to something other than INT
  14543.                                'or remove the line
  14544.  DIM test(4)
  14545.  temp = 4
  14546.  FOR k = 1 TO temp             'Use 4 instead of temp.
  14547.     PRINT k                    'In a compiled program, this line
  14548.                                'always prints the upper bound
  14549.                                'of the FOR-LOOP.
  14550.     test(k) = INT(1.0)         'Remove the INT function CALL.
  14551.  NEXT k
  14552.  
  14553.  The following is the output in the QBX.EXE environment (correct):
  14554.  
  14555.     1
  14556.     2
  14557.     3
  14558.     4
  14559.  
  14560.  The following is the output from a compiled 7.00 .EXE program
  14561.  (incorrect):
  14562.  
  14563.     4
  14564.     4
  14565.     4
  14566.     4
  14567.  
  14568.  
  14569.  249. QBX.EXE 7.10 Expanded Memory Usage Better Than 7.00; 32K Table
  14570.  
  14571.  Product Version(s): 7.00 7.10
  14572.  Operating System:   MS-DOS
  14573.  Flags: ENDUSER | SR# S900228-5
  14574.  Last Modified: 10-AUG-1990    ArticleIdent: Q60968
  14575.  
  14576.  The QuickBASIC Extended environment (QBX.EXE) can use up to 16 MB
  14577.  (megabytes) of Lotus-Intel-Microsoft (LIM) 4.0 expanded memory
  14578.  under MS-DOS. If the expanded memory is available, QBX.EXE
  14579.  automatically stores in it SUBs, FUNCTIONs, and module-level code
  14580.  units that are no greater than 16K in size. If QBX.EXE is invoked with
  14581.  the /Ea switch, arrays that are no greater than 16K in size are also
  14582.  stored in expanded memory.
  14583.  
  14584.  In QBX.EXE in BASIC PDS version 7.00, the memory is allocated in 16K
  14585.  pages; for example, a 2K procedure consumes 16K and wastes 14K (16K
  14586.  minus 2K) of expanded memory. Also, when one or more SUBs or FUNCTIONs
  14587.  are stored in expanded memory, QBX.EXE makes a one-time allocation of
  14588.  32K (two 16K pages) in expanded memory as overhead for its own
  14589.  internal tables.
  14590.  
  14591.  QBX.EXE in BASIC PDS version 7.10 is enhanced so that memory is
  14592.  allocated in 1K pages; for example, a 1K procedure or array takes up
  14593.  1K, thus using expanded memory much more efficiently than in QBX.EXE
  14594.  7.00.
  14595.  
  14596.  This article applies to Microsoft BASIC Professional Development
  14597.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  14598.  
  14599.  Examples of Expanded Memory Usage in QBX.EXE 7.00
  14600.  -------------------------------------------------
  14601.  
  14602.  As an example for BASIC PDS 7.00, suppose QBX.EXE is run on a machine
  14603.  for which FRE(-3) reports that 2720K of expanded memory is available.
  14604.  When the first module-level statement is entered, FRE(-3) would then
  14605.  return 2704K, 16K less. When the first SUB or FUNCTION is created
  14606.  after that, FRE(-3) would return 2656K, 48K less -- 16K for the SUB or
  14607.  FUNCTION itself and 32K for QBX.EXE's internal tables.
  14608.  
  14609.  When SUBs, FUNCTIONs, module-level code units, or arrays (if /Ea is
  14610.  used) are deleted, QBX.EXE deallocates the expanded memory they were
  14611.  using. The tables, however, will not be deallocated unless New Program
  14612.  is chosen from the File menu.
  14613.  
  14614.  In 7.00, a single-element integer array takes the same expanded memory
  14615.  space (16K) as an array with 8192 elements. Likewise, a SUB with a
  14616.  single PRINT statement takes the same space (16K) as a large SUB with
  14617.  hundreds of statements. (This is no longer true in 7.10, where
  14618.  expanded memory usage is more efficient.)
  14619.  
  14620.  To use expanded memory to its best potential in the QBX.EXE 7.00
  14621.  environment, you should try to make your SUBs as close to the 16K
  14622.  limit as possible without exceeding it. (This is not necessary in
  14623.  7.10.) The size of the SUBs (in kilobytes) is listed in the View Subs
  14624.  (F2) dialog box to the right of each SUB.
  14625.  
  14626.  Likewise, arrays in QBX.EXE 7.00 will use expanded memory more
  14627.  efficiently if they are dimensioned to be just under the 16K page
  14628.  size. (This is not necessary in 7.10.)
  14629.  
  14630.  References:
  14631.  
  14632.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  14633.  and 7.10 offer expanded memory support under the Lotus-Intel-Microsoft
  14634.  version 4.0 Expanded Memory Specification (LIM 4.0 EMS) for code and
  14635.  data in the QBX.EXE environment under MS-DOS. Earlier versions do not
  14636.  offer any expanded memory support. LIM 4.0 EMS support is discussed in
  14637.  the "Microsoft BASIC 7.0: Getting Started" manual and in the
  14638.  "Microsoft BASIC 7.1: Getting Started" manual.
  14639.  
  14640.  To be compatible with BASIC PDS 7.00 or 7.10, the expanded-memory
  14641.  device driver must observe the LIM 4.0 EMS.
  14642.  
  14643.  
  14644.  250. NMAKE Example Using ALL, Pseudotarget and Macros
  14645.  
  14646.  Product Version(s): 7.00   | 7.00
  14647.  Operating System:   MS-DOS | OS/2
  14648.  Flags: ENDUSER | SR# S900319-89
  14649.  Last Modified: 14-MAY-1990    ArticleIdent: Q60969
  14650.  
  14651.  NMAKE works by comparing the dates and times of two sets of files,
  14652.  which are called "targets" and "dependents." A target is a file that
  14653.  you want to create, such as an executable file. A dependent is a file
  14654.  used to create a target, such as a BASIC source file. If any dependent
  14655.  has changed more recently than the target, NMAKE updates the target by
  14656.  executing the command listed in the block.
  14657.  
  14658.  This information applies to Microsoft BASIC Professional Development
  14659.  System (PDS) version 7.00 for MS-DOS and MS OS/2.
  14660.  
  14661.  The pseudotarget is a name that serves as a "handle" for building a
  14662.  group of files or executing a group of commands. In the following
  14663.  example, ALL is the pseudotarget. After ALL, you would list all the
  14664.  EXE files that you want to create with this NMAKE file.
  14665.  
  14666.  Inference rules are templates that NMAKE uses to generate files with a
  14667.  given extension. When NMAKE encounters a description block with no
  14668.  commands, it looks for an inference rule that specifies how to create
  14669.  the target from the dependent files, given the two file extensions.
  14670.  Inference rules eliminate the need to put the same commands in several
  14671.  description blocks. In this example, the inference rules are to
  14672.  compile BASIC source files with no options and also to link the files
  14673.  with no linker options. If you wanted to specify compiler options (for
  14674.  example, /W, /X, etc.), you must include the command line "BC
  14675.  myprog.bas /X ;" in your description block for myprog.obj :
  14676.  myprog.bas.
  14677.  
  14678.  The OBJS statement in the description block for mymain2 is called a
  14679.  macro. Macros provide a convenient way to replace a string in the
  14680.  description file with another string. This statement is telling NMAKE
  14681.  that MYLIB.LIB is made up of these object files. The "!" on the LIB
  14682.  command is a repetition modifier that tells NMAKE to repeat the
  14683.  command as many times as it needs for dependents that are out of date
  14684.  with respect to the target. If both members of the library were
  14685.  updated, they would both be compiled and the library would be
  14686.  incrementally updated. The following commands would be executed:
  14687.  
  14688.     lib mylib.lib -+ libsub.obj ;
  14689.     lib mylib.lib -+ libsub2.obj ;
  14690.  
  14691.  The library could also contain modules written in assembler or C. You
  14692.  would need to add an assemble or C compile line, either as an
  14693.  inference rule or specifically to the module's description block. For
  14694.  example, the inference rules for a C compile and a MASM assemble would
  14695.  be as follows:
  14696.  
  14697.     .c.obj:
  14698.        cl /c $?
  14699.  
  14700.     .asm.obj:
  14701.        masm $? ;
  14702.  
  14703.  The following is a sample NMAKE description file, MYMAKE.MAK, which
  14704.  compiles and links two programs. The first is a main module and a
  14705.  subprogram, and the second is a main module with a library containing
  14706.  two members. To execute the description file, type the following:
  14707.  
  14708.     NMAKE MYMAKE.MAK
  14709.  
  14710.  Code Example
  14711.  ------------
  14712.  
  14713.  #----------------MYMAKE.MAK-------------------
  14714.  
  14715.  #----------pseudotarget
  14716.  
  14717.  ALL : mymain.exe mymain2.exe
  14718.  
  14719.  #----------inference rules
  14720.  
  14721.  .BAS.OBJ:
  14722.     BC $< ;
  14723.  
  14724.  .OBJ.EXE:
  14725.     LINK $** ;
  14726.  
  14727.  #----------mymain description block
  14728.  
  14729.  # target : dependent
  14730.  mymain.obj : mymain.bas  # (these will use inference rules
  14731.  mysub.obj : mysub.bas    #  to compile and link)
  14732.  mymain.exe : mymain.obj mysub.obj
  14733.  
  14734.  #----------mymain2 description block
  14735.  
  14736.  mymain2.obj : mymain2.bas
  14737.      BC mymain2.bas /X ;    # (this command used for compile)
  14738.  
  14739.  libsub.obj : libsub.bas    # (these will use the inference
  14740.  libsub2.obj : libsub2.bas  #  rules for compiling)
  14741.  
  14742.  OBJS = libsub.obj libsub2.obj
  14743.  
  14744.  mylib.lib : $(OBJS)
  14745.        !lib mylib.lib -+ $?;
  14746.  
  14747.  mymain2.exe : mymain2.obj mylib.lib   # (this uses inference
  14748.                                        #  rule for linking)
  14749.  
  14750.  
  14751.  251. BASIC PDS 7.00 Not Compatible with C PDS Version 6.00
  14752.  
  14753.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  14754.  Operating System:   MS-DOS          | OS/2
  14755.  Flags: ENDUSER | SR# S900415-6 B_QuickBas S_C S_QuickC
  14756.  Last Modified: 18-OCT-1990    ArticleIdent: Q61337
  14757.  
  14758.  Microsoft BASIC Professional Development System (PDS) version 7.00,
  14759.  QuickBASIC version 4.50, and earlier versions of BASIC are not
  14760.  compatible with Microsoft C Professional Development System version
  14761.  6.00 or Microsoft QuickC version 2.50 or 2.51. You must obtain BASIC
  14762.  PDS 7.10 to be compatible with these versions of C and QuickC.
  14763.  
  14764.  Below are some of the LINK L2025 errors that can occur when you LINK
  14765.  an incompatible BASIC version with Microsoft C PDS version 6.00:
  14766.  
  14767.     E:\C600\LIB\MLIBCE.LIB(chkstk.asm) : error L2025: STKHQQ : symbol
  14768.      defined more than once
  14769.  
  14770.     E:\C600\LIB\MLIBCE.LIB(chkstk.asm) : error L2025: __aaltstkovr :
  14771.      symbol defined more than once
  14772.  
  14773.     E:\C600\LIB\MLIBCE.LIB(chkstk.asm) : error L2025: __chkstk :
  14774.      symbol defined more than once
  14775.  
  14776.  This information applies to Microsoft QuickBASIC versions 4.00, 4.00b,
  14777.  and 4.50 for MS-DOS, to Microsoft BASIC Compiler versions 6.00 and
  14778.  6.00b for MS-DOS, and to Microsoft BASIC PDS version 7.00 for MS-DOS
  14779.  and MS OS/2.
  14780.  
  14781.  A separate article, found by querying in this Knowledge Base using the
  14782.  following words, describes which specific Microsoft language compiler
  14783.  versions are designed to be linked together:
  14784.  
  14785.     BASIC and C and QuickC and calling and linked and modules
  14786.  
  14787.  For more specific information about how to do mixed-language
  14788.  programming with Microsoft C and Microsoft BASIC, query in this
  14789.  Knowledge Base on the following word:
  14790.  
  14791.     BAS2C
  14792.  
  14793.  Microsoft C PDS version 6.00 and Microsoft QuickC versions 2.50 and
  14794.  2.51 use different start-up and heap management code than previous
  14795.  versions of C and QuickC. Since the BASIC libraries must be put first
  14796.  on the LINK line, the BASIC libraries supply alternate start-up, heap,
  14797.  and low-level I/O code for the LINKed C routines. These alternate
  14798.  routines are specific to the versions of C available when the BASIC
  14799.  products shipped.
  14800.  
  14801.  Each version of BASIC is tested and designed to work with the versions
  14802.  of Microsoft C and QuickC currently on the market when the BASIC
  14803.  package is released. Incompatibilities caused by new releases of C and
  14804.  QuickC are resolved whenever an updated BASIC product ships.
  14805.  
  14806.  To find a separate article in this Knowledge Base that describes the /Gh
  14807.  option (which makes C 6.00 use the C 5.10 libraries, for Microsoft
  14808.  Windows 2.x compatibility), as mentioned in the C 6.00 README.DOC
  14809.  file, query on the following words:
  14810.  
  14811.     /Gh and 6.00 and 5.10 and C and library and compatibility
  14812.  
  14813.  However, BASIC PDS 7.00 and QuickBASIC 4.50 (and earlier versions) are
  14814.  not compatible with routines compiled with C 6.00, even when the C
  14815.  6.00 /Gh option is used.
  14816.  
  14817.  
  14818.  252. Docerr in MenuSet and MenuSetState in UI Toolbox of PDS 7.00
  14819.  
  14820.  Product Version(s): 7.00 7.10 | 7.00 7.10
  14821.  Operating System:   MS-DOS    | OS/2
  14822.  Flags: ENDUSER | SR# S900412-65 docerr
  14823.  Last Modified:  8-JAN-1991    ArticleIdent: Q61338
  14824.  
  14825.  Pages 546 and 547 of the "Microsoft BASIC 7.0: Language Reference" for
  14826.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  14827.  and 7.10 incorrectly state that the subroutine MenuSetState treats -1
  14828.  as a legal value for the parameter state%. The lowest legal value for
  14829.  state% is 0. This is the scope of the MenuSetState routine. The
  14830.  MenuSet subroutine should be called to remove an item from a menu.
  14831.  
  14832.  The MenuSet subroutine, on Pages 545 and 546 of the same manual, is
  14833.  also documented incorrectly because the lowest legal value of MenuSet
  14834.  is actually -1, not 0. To make a menu item or menu title disappear,
  14835.  you must call MenuSet with state% equal to -1.
  14836.  
  14837.  
  14838.  253. Problem When Using IMP with a Variable and a Literal
  14839.  
  14840.  Product Version(s): 7.00 7.10 | 7.00 7.10
  14841.  Operating System:   MS-DOS    | OS/2
  14842.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 buglist7.10 B_QuickBas
  14843.  Last Modified: 21-SEP-1990    ArticleIdent: Q61339
  14844.  
  14845.  The code example below using the IMP logical-implication operator
  14846.  incorrectly prints -1 when compiled with the BC.EXE environment of
  14847.  Microsoft BASIC Professional Development System (PDS) version 7.00 or
  14848.  7.10. When executed in the QBX.EXE (QuickBASIC Extended) environment,
  14849.  the correct answer of 0 (zero) prints.
  14850.  
  14851.  The only workaround is to change the -1 to a variable or change i% in
  14852.  the PRINT statement to a 0 (zero).
  14853.  
  14854.  Microsoft has confirmed this to be a problem in the BC.EXE environment
  14855.  of Microsoft BASIC Professional Development System (PDS) versions 7.00
  14856.  and 7.10 for MS-DOS and MS OS/2; in the BC.EXE environment of
  14857.  Microsoft QuickBASIC versions 4.00, 4.00b, and 4.50 (buglist4.00,
  14858.  buglist4.00b, buglist4.50) for MS-DOS; and in the BC.EXE environment
  14859.  of Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS and MS
  14860.  OS/2. We are researching this problem and will post new information
  14861.  here as it becomes available.
  14862.  
  14863.  For your information, the following definition of IMP is taken from
  14864.  the Microsoft Advisor online Help system in QBX.EXE:
  14865.  
  14866.  HELP: IMP Operator
  14867.  ------------------
  14868.  
  14869.     result = numeric - expression1 IMP numeric - expression2
  14870.  
  14871.  The logical-implication operator, IMP, compares corresponding bits in
  14872.  numeric-expression1 and numeric-expression2, and then sets the
  14873.  corresponding bit in the result according to the following table:
  14874.  
  14875.     Bit in first expression   Bit in second expression   Bit in result
  14876.     -----------------------   ------------------------   -------------
  14877.                  1                          1                    1
  14878.                  1                          0                    0
  14879.                  0                          1                    1
  14880.                  0                          0                    1
  14881.  
  14882.  Code Example
  14883.  ------------
  14884.  
  14885.     DEFINT A-Z
  14886.     i% = 0
  14887.     PRINT -1 IMP i%
  14888.  
  14889.  If a variable is used in the place of the -1 or the i% is replaced
  14890.  with a 0, then this program prints the correct answer of 0.
  14891.  
  14892.  Note that the constant -1 is stored internally (in two's complement
  14893.  signed binary integer format) with all 16 bits set equal to 1 (on).
  14894.  The constant 0, when stored in an integer variable, is stored with all
  14895.  16 bits set equal to 0 (off).
  14896.  
  14897.  
  14898.  254. CodeView Does Not Support the BASIC CHAIN Statement
  14899.  
  14900.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  14901.  Operating System:   MS-DOS               | OS/2
  14902.  Flags: ENDUSER | SR# S900415-4 B_QuickBas S_CodeView CV CVP
  14903.  Last Modified:  4-SEP-1990    ArticleIdent: Q61341
  14904.  
  14905.  Versions 2.20, 2.30, 2.35, and 3.10 of the Microsoft CodeView debugger
  14906.  do not support the BASIC CHAIN command. When a program is CHAINed in
  14907.  BASIC, CodeView executes the entire CHAINed-to program and will not
  14908.  allow it to be single-stepped through.
  14909.  
  14910.  This information applies to Microsoft QuickBASIC versions 4.00, 4.00b,
  14911.  and 4.50 for MS-DOS; to Microsoft BASIC Compiler versions 6.00 and
  14912.  6.00b for MS-DOS and MS OS/2; and to Microsoft BASIC Professional
  14913.  Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS
  14914.  OS/2.
  14915.  
  14916.  The CHAIN command is unique to BASIC and is not supported by the
  14917.  CodeView debugger. CodeView is a mixed-language source code debugger
  14918.  supplied with BASIC compiler versions 6.00 and 6.00b and BASIC PDS
  14919.  versions 7.00 and 7.10. CodeView is NOT shipped with QuickBASIC 4.00,
  14920.  4.00b, or 4.50 for MS-DOS.
  14921.  
  14922.  The following table lists which versions of CodeView are shipped with
  14923.  which versions of BASIC:
  14924.  
  14925.     BASIC Version      Is Shipped with CodeView Version
  14926.     -------------      --------------------------------
  14927.  
  14928.     6.00               2.20
  14929.     6.00b              2.30
  14930.     7.00               2.35
  14931.     7.10               3.10
  14932.  
  14933.  Note: CV.EXE is the CodeView utility for MS-DOS. CVP.EXE is the
  14934.  CodeView utility for MS OS/2.
  14935.  
  14936.  
  14937.  255. Description for L2043 in BASIC PDS 7.00 Manual Incorrect
  14938.  
  14939.  Product Version(s): 7.00 7.10
  14940.  Operating System:   MS-DOS
  14941.  Flags: ENDUSER | docerr SR# S900415-3
  14942.  Last Modified:  8-JAN-1991    ArticleIdent: Q61342
  14943.  
  14944.  Page 689 of the "Microsoft BASIC 7.0: Language Reference" for
  14945.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  14946.  and 7.10 incorrectly states for LINKer error message L2043 that the
  14947.  module QUICKLIB.OBJ was missing. This should be changed to say that
  14948.  the module QBXQLB.LIB was missing.
  14949.  
  14950.  This information applies to Microsoft BASIC PDS versions 7.00 and 7.10
  14951.  for MS-DOS.
  14952.  
  14953.  The description on Page 689 for the LINKer error message L2043 is
  14954.  incorrectly given as follows:
  14955.  
  14956.     L2043    Quick Library support module missing
  14957.  
  14958.              The required module QUICKLIB.OBJ was missing.
  14959.  
  14960.              The module QUICKLIB.OBJ must be linked when creating a
  14961.              Quick library.
  14962.  
  14963.  The correct explanation is as follows:
  14964.  
  14965.     L2043    Quick Library support module missing
  14966.  
  14967.              The required module QBXQLB.OBJ was missing.
  14968.  
  14969.              The module QBXQLB.OBJ must be linked when creating a
  14970.              Quick library.
  14971.  
  14972.  
  14973.  256. ON ERROR GOTO 0 in BASIC PDS Won't Give Error Line's Address
  14974.  
  14975.  Product Version(s): 7.00 7.10 | 7.00 7.10
  14976.  Operating System:   MS-DOS    | OS/2
  14977.  Flags: ENDUSER | SR# S900415-2
  14978.  Last Modified: 15-JAN-1991    ArticleIdent: Q61343
  14979.  
  14980.  Because of new flexibility added to the ON ERROR GOTO handling in
  14981.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  14982.  and 7.10, the address given when an .EXE program aborts from within an
  14983.  error handler may not be the actual address of the line that produced
  14984.  the error.
  14985.  
  14986.  If error trapping is turned on, an error occurs, and an ON ERROR GOTO
  14987.  0 or ERROR ERR statement is used in the error handler to abort the
  14988.  program, then the address of the ON ERROR GOTO 0 or ERROR ERR line
  14989.  displays when the program stops. This behavior differs from .EXE
  14990.  programs compiled in previous versions of BASIC (including QuickBASIC
  14991.  4.x and BASIC compiler 6.00 and 6.00b), which return the address of
  14992.  the line that originally caused the error.
  14993.  
  14994.  This information applies to .EXE programs compiled in Microsoft BASIC
  14995.  PDS versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  14996.  
  14997.  Because BASIC PDS versions 7.00 and 7.10 allow errors generated in a
  14998.  module's error handler to be trapped in another module's error
  14999.  handler, the compiler must generate the address of the ON ERROR GOTO
  15000.  0 (or ERROR ERR) line. Otherwise, if the error were transferred to
  15001.  another error handler that did a RESUME NEXT, the program would not
  15002.  resume to the error handler, but to the user code (because that is the
  15003.  address the compiler would have passed to it). This leaves the error
  15004.  handler still on the stack. If this occurred multiple times, the
  15005.  program would eventually run out of stack space.
  15006.  
  15007.  Note that the QB.EXE interpreter environment found in QuickBASIC 4.x
  15008.  and BASIC compiler 6.00/6.00b treats an ON ERROR GOTO 0 in an error
  15009.  handler as if it were an ERROR ERR, causing QB.EXE to stop the program
  15010.  and flag the error on the ON ERROR GOTO 0 line. However, the BC.EXE
  15011.  compiler in these products goes to the extra work of making .EXE
  15012.  programs that report the error back where the error originally
  15013.  occurred.
  15014.  
  15015.  The following program, ERR.BAS, when compiled using BC.EXE from BASIC
  15016.  PDS version 7.00 or 7.10, will abort with an error and display the
  15017.  address of the ON ERROR GOTO 0 line. Compile and LINK as follows:
  15018.  
  15019.     BC /x ERR.BAS,,ERR.LST;
  15020.     LINK ERR ;
  15021.  
  15022.  The following is ERR.BAS:
  15023.  
  15024.     ON ERROR GOTO handler
  15025.     y = 0
  15026.     x = 1/y
  15027.     END
  15028.  
  15029.     handler:
  15030.        ON ERROR GOTO 0
  15031.        RESUME
  15032.  
  15033.  In BASIC PDS version 7.00 or 7.10, when the program aborts, the
  15034.  following error message is given (note: the address given will be
  15035.  different on different machines):
  15036.  
  15037.     Division by zero in line 0 of module ERR      at address 23E5:0066
  15038.  
  15039.  Looking at the following listing file (ERR.LST) produced by the
  15040.  compiler shows that the address given when the program stops in error
  15041.  is that of the ON ERROR GOTO 0 line:
  15042.  
  15043.     0030   0006
  15044.     0030   0006            ON ERROR GOTO handler
  15045.     003A   0006            y = 0
  15046.     0046   000A            x = 1/y
  15047.     0057   000E            end
  15048.     005C   000E            handler:
  15049.     005C   000E               ON ERROR GOTO 0
  15050.     0066   000E               RESUME
  15051.     006B   000E
  15052.     008E   000E
  15053.  
  15054.  The address given (0066) shows as the RESUME statement. This is
  15055.  because the error occurs at the end of the ON ERROR GOTO 0 statement,
  15056.  which is the starting address of the RESUME statement line. In .EXE
  15057.  programs compiled in versions of BASIC earlier than 7.00, the address
  15058.  given was of the actual line that the error occurred on (the line at
  15059.  address 0046: x = 1/y).
  15060.  
  15061.  The address given in a program without ON ERROR trapping active is
  15062.  still the address of the actual error line, x = 1/y, in BASIC 7.00 and
  15063.  7.10 (and earlier versions of BC.EXE).
  15064.  
  15065.  
  15066.  257. Differences Between FormatX$ Functions & PRINT USING Statement
  15067.  
  15068.  Product Version(s): 7.00 7.10 | 7.00 7.10
  15069.  Operating System:   MS-DOS    | OS/2
  15070.  Flags: ENDUSER | SR# S900305-84
  15071.  Last Modified: 27-JUL-1990    ArticleIdent: Q61345
  15072.  
  15073.  This article demonstrates the differences between the FormatX$
  15074.  Add-On-Library (DTFMTxx.LIB) functions and the BASIC PRINT USING
  15075.  statement, specifically in the case of the "#" character.
  15076.  
  15077.  This information applies to Microsoft BASIC Professional Development
  15078.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2. FormatX$
  15079.  refers to the Add-On-Library functions FormatI$, FormatL$, FormatS$,
  15080.  FormatD$, and FormatC$ found in BASIC PDS 7.00 and 7.10.
  15081.  
  15082.  In the PRINT USING statement, the # sign is used in the string
  15083.  identifier to specify a digit placeholder. If there isn't a digit in
  15084.  that location, a space is put in its place. In the FormatX$ functions,
  15085.  the # is also a placeholder. However, if there isn't a digit, the
  15086.  location is not padded with a space.
  15087.  
  15088.  The FormatX$ functions can be invoked from within the QB.EXE
  15089.  environment by installing the DTFMTER.QLB Quick library. These
  15090.  functions can be invoked from .EXE programs by linking in the
  15091.  appropriate DTFMTxx.LIB library.
  15092.  
  15093.  The FUNCTION declarations necessary for the FormatX$ functions are
  15094.  contained in the FORMAT.BI include file, which can be included in your
  15095.  source file as follows:
  15096.  
  15097.     REM $INCLUDE:'FORMAT.BI'
  15098.  
  15099.  The syntax for the FormatX$ function(s) is as follows
  15100.  
  15101.     FORMATx$ (Variable, fmt$)
  15102.  
  15103.  where:
  15104.  
  15105.  1. "x" is the first letter of the data type being manipulated:
  15106.  
  15107.        Data Type           Syntax
  15108.        ---------           ------
  15109.  
  15110.        Integer             FORMATI$
  15111.        Long integer        FORMATL$
  15112.        Single precision    FORMATS$
  15113.        Double precision    FORMATD$
  15114.        Currency            FORMATC$
  15115.  
  15116.  2. "Variable" is the variable to be manipulated.
  15117.  
  15118.  3. "fmt$" is a string expression defining the output format.
  15119.  
  15120.  The format for the PRINT USING statement is as follows
  15121.  
  15122.     PRINT USING fmt$; Variable [,Variable2...][,|;]
  15123.  
  15124.  where:
  15125.  
  15126.  1. "fmt$" is a string expression defining the output format.
  15127.  
  15128.  2. "Variable" is an expression(s) to be manipulated.
  15129.  
  15130.  3. "," or ";" are optional output choices to print next output
  15131.     immediately following. (Note that PRINT USING does not support
  15132.     "print zones.")
  15133.  
  15134.  The following code example demonstrates the difference in the #
  15135.  operand in the fmt$ argument for FORMATX$ versus PRINT USING:
  15136.  
  15137.     ' $INCLUDE: 'FORMAT.BI'
  15138.     A = 123.456
  15139.     B = 88.99
  15140.  
  15141.     ' ------  PRINT USING STATEMENTS:
  15142.     PRINT USING "#####.##";A
  15143.     PRINT USING "######.###";B
  15144.     PRINT
  15145.  
  15146.     ' ------  FORMATX$ STATEMENTS:
  15147.     PRINT FORMATS$(A,"#####.##")
  15148.     PRINT FORMATS$(B,"######.###";B
  15149.     END
  15150.  
  15151.  The output will resemble the following:
  15152.  
  15153.       123.46
  15154.         88.990
  15155.  
  15156.     123.46
  15157.     88.99
  15158.  
  15159.  
  15160.  258. Dynamic Array Using INT in FOR Loop Returns Bad Results
  15161.  
  15162.  Product Version(s): 7.00   | 7.00
  15163.  Operating System:   MS-DOS | OS/2
  15164.  Flags: ENDUSER | SR# S900409-113 buglist7.00 fixlist7.10
  15165.  Last Modified: 20-SEP-1990    ArticleIdent: Q61346
  15166.  
  15167.  Assigning values to a dynamic array using the INT function in a FOR
  15168.  loop that contains a variable for the maximum index can produce
  15169.  incorrect results when compiled. The problem seems to be an addressing
  15170.  problem where all array values contain the result of the last
  15171.  computation.
  15172.  
  15173.  Microsoft has confirmed this to be a problem in the BC.EXE environment
  15174.  of Microsoft BASIC Professional Development System (PDS) version 7.00.
  15175.  This problem was corrected in BASIC PDS 7.10. This problem does not
  15176.  occur in the QBX.EXE editor in 7.00, or in earlier versions of
  15177.  Microsoft QuickBASIC or Microsoft BASIC Compiler.
  15178.  
  15179.  Any of the following workarounds will correct this problem:
  15180.  
  15181.  1. Compile with the BC /D compiler option.
  15182.  2. Use a static array.
  15183.  3. Use a temporary variable for the function value.
  15184.  4. Use a literal to define the FOR loop.
  15185.  
  15186.  Code Example
  15187.  ------------
  15188.  
  15189.  The following code example demonstrates the problem:
  15190.  
  15191.     'Compile and link lines:
  15192.     '
  15193.     ' BC FORARRAY;               NOTE: The BC /D compiler option
  15194.     '                                  corrects the problem.
  15195.     ' LINK FORARRAY;
  15196.     DEFINT A-Z                   'Any numeric type shows problem.
  15197.     n = 1                        'n=1 is required for FOR upper index.
  15198.     DIM a(n)                   'Array must be dynamic to show problem.
  15199.     a(0) = 1
  15200.     a(1) = 2
  15201.     FOR i = 0 TO n               'Variable n required to cause problem.
  15202.        a(i) = INT(a(i))          'INT or FIX functions cause problem.
  15203.        PRINT a(i)       'Incorrectly prints 2 for each iteration; it
  15204.                         'should have printed 1, then 2.
  15205.     NEXT
  15206.     END
  15207.  
  15208.  When compiled without /D, the above program displays the following
  15209.  incorrect results:
  15210.  
  15211.     2
  15212.     2
  15213.  
  15214.  When run in the QBX.EXE editor or compiled with /D option, the above
  15215.  program displays the following correct results:
  15216.  
  15217.     1
  15218.     2
  15219.  
  15220.  
  15221.  259. BASIC PDS 7.00 "Program Memory Overflow" with Too Many CONST
  15222.  
  15223.  Product Version(s): 7.00 7.10 | 7.00 7.10
  15224.  Operating System:   MS-DOS    | OS/2
  15225.  Flags: ENDUSER | SR# S900329-74
  15226.  Last Modified: 27-JUL-1990    ArticleIdent: Q61349
  15227.  
  15228.  When used with the /V switch, the BC.EXE compiler that comes with
  15229.  Microsoft BASIC Professional Development System (PDS) version 7.00
  15230.  produces a "Program memory overflow" error when compiling a program
  15231.  that has approximately 680+ CONSTants. The compiler can still have up
  15232.  to 13K "bytes free" of compiler workspace when reporting this error.
  15233.  
  15234.  "Program memory overflow" also occurs when compiling the TEST1.BAS
  15235.  program generated below using 756+ CONSTants with the BC /Fs (far
  15236.  strings) option.
  15237.  
  15238.  The CONST limits are improved in BASIC PDS version 7.10, which can
  15239.  handle significantly more CONSTants than BASIC 7.00.
  15240.  
  15241.  The error message "Program memory overflow" is misleading because
  15242.  normally the compiler only gives that error when more than 64K of code
  15243.  has been generated for the module being compiled. This error
  15244.  represents a limitation of the compiler. This error is generated when
  15245.  the number of CONSTants that can be included in a BASIC module has
  15246.  been exceeded.
  15247.  
  15248.  The "Program memory overflow" error above is due to the amount of
  15249.  internal overhead that the compiler sets aside to do its work with
  15250.  CONSTants. The error message is not generated because of a lack of
  15251.  compiler workspace. In this case, 13K "bytes free" is a valid number.
  15252.  There is actually 13K of compiler workspace free. A different
  15253.  limitation has been encountered -- the number of CONSTants BC.EXE can
  15254.  handle.
  15255.  
  15256.  The BC.EXE in QuickBASIC version 4.50 and the BC.EXE compiler in BASIC
  15257.  versions 6.00b and 7.10 will successfully compile a program with over
  15258.  1000 CONSTants.
  15259.  
  15260.  Illustration
  15261.  ------------
  15262.  
  15263.  To demonstrate the limitation in 7.00, use the FIRST.BAS program below
  15264.  to create the BASIC program TEST1.BAS with "n" number of CONSTants.
  15265.  For example, a TEST1.BAS program created with approximately 650
  15266.  CONSTants will compile with no errors in BASIC PDS 7.00. A program
  15267.  with 680+ CONSTants compiled with BC /V gives "Program-memory
  15268.  overflow" in BASIC PDS 7.00.
  15269.  
  15270.  As a comparison to versions earlier than 7.00, if you create a
  15271.  TEST1.BAS program with 1000 CONSTants, it will compile correctly with
  15272.  BC.EXE 4.50 and BC.EXE 6.00b (which have a greater capacity for
  15273.  CONSTants than 7.00).
  15274.  
  15275.  As a comparison to 7.10, in TEST1.BAS created below, 7.10 can handle
  15276.  1100 CONSTants when compiled BC /V (but 1200 CONSTants gives "Program
  15277.  memory overflow"). In TEST1.BAS created below, 7.10 can handle 2100
  15278.  CONSTants when compiled BC /Fs (but 2200 CONSTants gives "Compiler out
  15279.  of memory, 0 bytes free"). BASIC 7.10 can thus handle many more
  15280.  CONSTants than 7.00.
  15281.  
  15282.  FIRST.BAS
  15283.  ---------
  15284.  
  15285.  FIRST.BAS prompts you for a number, and then creates another BASIC
  15286.  program, TEST1.BAS, with that many CONSTants. Compile the resulting
  15287.  TEST1.BAS with BC /V or /Fs to test for compiler limitations.
  15288.  
  15289.     DEFINT A-Z
  15290.     CLS
  15291.     INPUT "How many CONSTants to you want in the file: ", Num%
  15292.     OPEN "test1.bas" FOR OUTPUT AS #1
  15293.     beg$ = "CONST p"
  15294.     equals$ = " ="
  15295.     FOR i = 1 TO Num%
  15296.        constant$ = beg$ + LTRIM$(RTRIM$(STR$(i))) + equals$ + STR$(i)
  15297.        PRINT #1, constant$
  15298.     NEXT
  15299.     CLOSE
  15300.     PRINT "File 'test.bas' successfully created"
  15301.     END
  15302.  
  15303.  
  15304.  260. Disk vs. RAM Memory of Stand Alone vs. Run Time in BASIC PDS
  15305.  
  15306.  Product Version(s): 7.00 7.10 | 7.00 7.10
  15307.  Operating System:   MS-DOS    | OS/2
  15308.  Flags: ENDUSER | SR# S900407-1 docerr
  15309.  Last Modified: 15-JAN-1991    ArticleIdent: Q61350
  15310.  
  15311.  There is an apparent contradiction, which needs clarification, at the
  15312.  top of page 566 in the "Microsoft BASIC 7.0: Programmer's Guide" for
  15313.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  15314.  and 7.10. Page 566 first states, "Stand-alone programs require more
  15315.  disk space than those requiring the run-time module." Then it states,
  15316.  "Stand-alone programs do have the following advantages, however:
  15317.  Stand-alone programs always require less memory than their run-time
  15318.  equivalents."
  15319.  
  15320.  The first statement means to say that one stand-alone program requires
  15321.  more disk space than one equivalent run-time program if you do not
  15322.  count the size of the run-time module. The second statement means to
  15323.  say that stand-alone programs always require less memory in RAM than
  15324.  their run-time equivalents (counting the run-time module).
  15325.  
  15326.  One stand-alone program requires less RAM or disk memory than its
  15327.  run-time equivalent if you count the size of the run-time module.
  15328.  However, with a large enough number of .EXE programs, the combined
  15329.  stand-alone programs require more disk storage space than the combined
  15330.  run-time equivalents, which share one run-time module.
  15331.  
  15332.  
  15333.  261. LPRINT Followed by BLOAD or BSAVE Gives "File Already Open"
  15334.  
  15335.  Product Version(s): 7.00   | 7.00
  15336.  Operating System:   MS-DOS | OS/2
  15337.  Flags: ENDUSER | SR# S900417-59 buglist7.00 fixlist7.10
  15338.  Last Modified: 13-AUG-1990    ArticleIdent: Q61403
  15339.  
  15340.  Performing an LPRINT statement prior to a BLOAD or BSAVE statement
  15341.  causes a "file already open" error to occur on the BLOAD or BSAVE
  15342.  statement if the program is run from the QBX.EXE environment or if it
  15343.  is compiled with the BC /Fs (Far Strings) option.
  15344.  
  15345.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  15346.  Professional Development System (PDS) version 7.00 for MS-DOS and MS
  15347.  OS/2. It does not occur in earlier BASIC versions. This problem was
  15348.  corrected in Microsoft BASIC PDS version 7.10.
  15349.  
  15350.  The program below demonstrates this problem. To generate the "file
  15351.  already open" error, run this program from the QBX.EXE environment or
  15352.  compile it with the Far Strings option.
  15353.  
  15354.  The following is a list of workarounds for this problem:
  15355.  
  15356.  1. Open the printer as a device and send output to the printer using
  15357.     the PRINT #<file number> statement instead of the LPRINT statement.
  15358.  
  15359.  2. Issue a CLOSE statement after the LPRINT statement.
  15360.  
  15361.  3. For an executable program, compile the program with the Near
  15362.     Strings option.
  15363.  
  15364.  Code Example
  15365.  ------------
  15366.  
  15367.     CLS
  15368.     PRINT "hello"
  15369.     DEF SEG = &HB800          'points to the segment at the screen buffer
  15370.     BSAVE "picture", 0, 4000  'save the screen in the file named picture
  15371.     DEF SEG                   'restore default segment
  15372.     LPRINT "bob"
  15373.     DEF SEG = &HB800
  15374.     BLOAD "picture", 0        '**file already open error occurs here
  15375.     DEF SEG
  15376.  
  15377.  
  15378.  262. NOFLTIN.OBJ: Hex Numbers Not Allowed with INPUT, READ, or VAL
  15379.  
  15380.  Product Version(s): 7.00 7.10 | 7.00 7.10
  15381.  Operating System:   MS-DOS    | OS/2
  15382.  Flags: ENDUSER | SR# S900409-55
  15383.  Last Modified: 21-SEP-1990    ArticleIdent: Q61406
  15384.  
  15385.  When you LINK the stub file NOFLTIN.OBJ into a program compiled with
  15386.  the /O switch, or into a custom run-time module built with
  15387.  BUILDRTM.EXE, the numeric parsing code will be replaced with an
  15388.  integer-only version.
  15389.  
  15390.  If you link with NOFLTIN.OBJ, all numbers used by INPUT, READ, and VAL
  15391.  must be within the range of legal long integers.
  15392.  
  15393.  Although it seems that a number represented in hexadecimal should fall
  15394.  into the category of "legal long integers," it does not. A program
  15395.  that INPUTs, READs, or uses the VAL function on a hexadecimally
  15396.  represented integer will either generate an error or return incorrect
  15397.  results. Hexadecimal number parsing is also eliminated with the
  15398.  NOFLTIN.OBJ stub file.
  15399.  
  15400.  This information applies to Microsoft BASIC Professional Development
  15401.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  15402.  
  15403.  The following is an explanation of what happens when a program linked
  15404.  with the NOFLTIN.OBJ stub file uses either the INPUT, READ, or VAL
  15405.  commands on a hexadecimal number:
  15406.  
  15407.     INPUT - returns a "Redo from start"
  15408.     READ  - returns "Syntax error in module <module name>"
  15409.     VAL   - returns a value of 0
  15410.  
  15411.  
  15412.  263. Machine Hangs When BASIC PDS 7.00 Tries to Call QuickC 2.00
  15413.  
  15414.  Product Version(s): 7.00
  15415.  Operating System:   MS-DOS
  15416.  Flags: ENDUSER | SR# S900405-131 buglist7.00 S_QuickC
  15417.  Last Modified: 11-MAY-1990    ArticleIdent: Q61674
  15418.  
  15419.  When CALLing Microsoft QuickC version 2.00 from Microsoft BASIC
  15420.  Professional Development System (PDS) version 7.00, the machine hangs
  15421.  if a single- or a double-precision number is passed to the C routine
  15422.  and a comparison of that single- or double-precision number is then
  15423.  performed in the C routine.
  15424.  
  15425.  To work around this problem, do one of the following:
  15426.  
  15427.  1. CALL QuickC from QuickBASIC version 4.50 or from Microsoft BASIC
  15428.     Compiler versions 6.00 or 6.00b.
  15429.  
  15430.  2. Use Microsoft C Compiler version 5.10 instead of QuickC.
  15431.  
  15432.  3. Pass an integer or a long integer to QuickC instead of the
  15433.     floating-point number.
  15434.  
  15435.  The program below demonstrates the problem.
  15436.  
  15437.     Compile and LINK Instructions
  15438.     -----------------------------
  15439.  
  15440.        BC Basside.bas ;
  15441.        QCL /AM /c Cside.c ;
  15442.        LINK Basside + Cside,,,BRT70ENR.lib + MLIBCE.LIB ;
  15443.  
  15444.     Code Example
  15445.     ------------
  15446.  
  15447.     ' Here is the BASIC Code
  15448.  
  15449.     DECLARE SUB Mycfun CDECL (temp#)
  15450.  
  15451.     CLS
  15452.     PRINT "On the basic side"
  15453.     INPUT "Enter the double precision number "; one#
  15454.     CALL Mycfun(one#)
  15455.     LOCATE 10, 10
  15456.     PRINT "Enter any key to end"
  15457.     SLEEP
  15458.     CLS
  15459.     END
  15460.  
  15461.     ' Here is the C code
  15462.  
  15463.     #include <c:\qc2\include\stdio.h>
  15464.  
  15465.     void Mycfun( double *testdoub)
  15466.     {
  15467.       printf("I am in the C routine  %lf \n",*testdoub);
  15468.      if ((*testdoub) > 2000.0)
  15469.       {
  15470.          printf ("In the then \n");
  15471.       }
  15472.       else
  15473.       {
  15474.          printf("In the else \n");
  15475.       };
  15476.  
  15477.     printf ("Returning to BASIC \n");
  15478.  
  15479.     }
  15480.  
  15481.  
  15482.  264. Slow Printing from BASIC to Network Printer Under OS/2
  15483.  
  15484.  Product Version(s): 6.00 6.00b 7.00
  15485.  Operating System:   OS/2
  15486.  Flags: ENDUSER | SR# S900122-142
  15487.  Last Modified: 10-MAY-1990    ArticleIdent: Q61438
  15488.  
  15489.  BASIC prints very slowly to a networked printer under OS/2 when
  15490.  compared to the same printing under DOS or the OS/2 DOS box. The
  15491.  printing speed is the same under OS/2 versions 1.00, 1.10, and 1.20.
  15492.  
  15493.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  15494.  6.00b for MS OS/2, and to Microsoft BASIC Professional Development
  15495.  System (PDS) version 7.00 for MS OS/2.
  15496.  
  15497.  The following code, PTEST.BAS, demonstrates the slow printing speeds
  15498.  under OS/2. Compile and LINK the program as follows:
  15499.  
  15500.     BC /O PTEST.BAS ;
  15501.     LINK PTEST ;
  15502.  
  15503.  The following is the program PTEST.BAS:
  15504.  
  15505.     start = TIMER
  15506.     FOR x = 1 TO 50
  15507.        LPRINT "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLM:";x
  15508.     NEXT
  15509.     PRINT "Final time: "; TIMER - start
  15510.  
  15511.  The following is the output from a 386 machine running at 16Mhz with
  15512.  the print spooler disabled:
  15513.  
  15514.     Operating System     Printer          Time (seconds)
  15515.     ----------------     -------          ----
  15516.  
  15517.     OS/2                 Network            64
  15518.     DOS box              Network             6
  15519.     DOS 4.01             Network             4
  15520.     OS/2                 Direct             46
  15521.     DOS                  Direct             46
  15522.  
  15523.  Note: The direct connect times are longer because the printer has no
  15524.  spooler, and therefore, the computer must wait for the printer to
  15525.  print each line. Also, a similar C routine prints at normal speed
  15526.  under OS/2.
  15527.  
  15528.  
  15529.  265. TEXTCOMP in BASIC PDS 7.00 Must Have PROISAM Loaded
  15530.  
  15531.  Product Version(s): 7.00
  15532.  Operating System:   MS-DOS
  15533.  Flags: ENDUSER | SR# S900420-97
  15534.  Last Modified:  1-MAY-1990    ArticleIdent: Q61439
  15535.  
  15536.  When invoking the function TEXTCOMP in Microsoft BASIC Professional
  15537.  Development System (PDS) version 7.00, you must have PROISAM.EXE or
  15538.  PROISAMD.EXE in memory. If you do not have one of the PROISAM.EXE
  15539.  files in memory, you will get a "Feature Unavailable" error when you
  15540.  try to invoke the function.
  15541.  
  15542.  This information only applies to Microsoft BASIC Professional
  15543.  Development System (PDS) version 7.00 for MS-DOS.
  15544.  
  15545.  The TEXTCOMP function is in the ISAM terminate-and-stay-resident
  15546.  program (TSR) because it needs the international sorting tables, which
  15547.  are also in the ISAM TSR, to perform its comparison.
  15548.  
  15549.  To load TSR and QBX from DOS, type:
  15550.  
  15551.     C:\>PROISAM
  15552.  or
  15553.     C:\>PROISAMD
  15554.  
  15555.  Then type the following:
  15556.  
  15557.     C:\>QBX
  15558.  
  15559.  Code Example
  15560.  ------------
  15561.  
  15562.     areequal% = TEXTCOMP ("this is a test","this is a test too")
  15563.  
  15564.  
  15565.  266. "Illegal Function Call" CHAINing to Stand Alone, /Fpa, or /Fs
  15566.  
  15567.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  15568.  Operating System:   MS-DOS               | OS/2
  15569.  Flags: ENDUSER | SR# S900416-144 B_QuickBas
  15570.  Last Modified: 20-SEP-1990    ArticleIdent: Q61483
  15571.  
  15572.  Attempting to CHAIN from an EXE that requires a run-time module to a
  15573.  stand-alone EXE causes the run-time error "Illegal Function Call" on
  15574.  the CHAIN statement.
  15575.  
  15576.  This error message does not occur when CHAINing in the reverse
  15577.  direction (from a stand-alone EXE to an EXE that requires a run-time
  15578.  module), or when CHAINing between identical EXE types (both stand
  15579.  alone, or both run time), or when using the RUN statement instead of
  15580.  CHAIN.
  15581.  
  15582.  "Illegal Function Call" also occurs when CHAINing from an EXE that
  15583.  requires a run-time module to an EXE compiled with a different math
  15584.  package (/Fpa versus /Fpi; found only in BC.EXE 6.00, 6.00b, 7.00, or
  15585.  7.10) or compiled with a different string option (/Fs far strings
  15586.  versus near strings; found only in Microsoft BASIC Professional
  15587.  Development System (PDS) version 7.00 or 7.10).
  15588.  
  15589.  This information applies to Microsoft QuickBASIC versions 4.00, 4.00b,
  15590.  and 4.50 for MS-DOS; to Microsoft BASIC Compiler versions 6.00 and
  15591.  6.00b for MS-DOS and MS OS/2; and to Microsoft BASIC PDS versions 7.00
  15592.  and 7.10 for MS-DOS and MS OS/2.
  15593.  
  15594.  When transferring control to an EXE with a different run-time module,
  15595.  the RUN statement is the preferred method. RUN makes no attempt to
  15596.  preserve any values on the transfer, whereas CHAIN tries to maintain
  15597.  COMMON variables. The CHAIN statement should be used only when
  15598.  transferring control to another BASIC program that uses the same BASIC
  15599.  run-time library as the one being CHAINed from.
  15600.  
  15601.  Code Example
  15602.  ------------
  15603.  
  15604.  The following code example produces an "Illegal Function Call" on the
  15605.  CHAIN statement when the two programs are compiled as indicated:
  15606.  
  15607.     'A.BAS
  15608.     'Compile and link lines:
  15609.     '   BC A;
  15610.     '   LINK A;
  15611.     CHAIN "B"         'RUN does not cause the error
  15612.     END
  15613.  
  15614.     'B.BAS
  15615.     'Compile and link lines:
  15616.     '   BC /o B;
  15617.     '   LINK B;
  15618.     PRINT "In Program B"
  15619.  
  15620.  
  15621.  267. Maximum Number of ISAM Files Open at Once in BASIC 7.00/7.10
  15622.  
  15623.  Product Version(s): 7.00 7.10 | 7.10
  15624.  Operating System:   MS-DOS    | OS/2
  15625.  Flags: ENDUSER | SR# S900408-3
  15626.  Last Modified:  6-FEB-1991    ArticleIdent: Q61485
  15627.  
  15628.  The number of ISAM tables that you can have open at one time is
  15629.  determined by the number of database files that you have open. (See
  15630.  table below.)
  15631.  
  15632.  The maximum number of database files that you can have open at once is
  15633.  4 files. However, this is not the maximum number of tables you can
  15634.  have open at once. The maximum number of tables that you can have open
  15635.  at once is 13 tables in 1 database file, 10 tables in 2 database
  15636.  files, 7 tables in 3 database files, or 4 tables in 4 database files.
  15637.  
  15638.  Attempting to open more than the maximum allowed number of tables or
  15639.  database files at once gives error 67, "Too many files."
  15640.  
  15641.  A database file in Microsoft BASIC Professional Development System
  15642.  (PDS) version 7.00 or 7.10 is created with the default extension .MDB
  15643.  and contains the physical data for each table plus the indexes used to
  15644.  define and point to the data.
  15645.  
  15646.  This information applies to Microsoft BASIC Professional Development
  15647.  System (PDS) versions 7.00 and 7.10 for MS-DOS and 7.10 for MS OS/2.
  15648.  
  15649.  The ISAM engine in Microsoft BASIC PDS 7.00 and 7.10 has a maximum
  15650.  number of 16 pointers or ISAM handles that it can use with ISAM files.
  15651.  These are NOT the same as DOS file handles.
  15652.  
  15653.  Each file still takes one DOS file handle for its first open, but it
  15654.  doesn't need any additional DOS file handles for additional tables
  15655.  opened in the same database file.
  15656.  
  15657.  Each database file takes four ISAM handles on its initial open: one
  15658.  handle for the file, one for the indexes, one for the data, and one
  15659.  for the initial table. Each additional table referenced in an already
  15660.  opened database takes only one additional ISAM handle and no more DOS
  15661.  handles. This is because ISAM handles that point to the same file,
  15662.  indexes, and data already exist.
  15663.  
  15664.  As a result, the number of tables that you can have open at once is
  15665.  determined by the number of database files you are using. The
  15666.  following table gives the combinations of databases (.MDBs) and
  15667.  additional ISAM tables that you can have open at one time:
  15668.  
  15669.              Maximum Number of ISAM Files and Tables
  15670.  
  15671.     ---------------------------------------------------------
  15672.     # of .MDBs (files):  |    1         2        3        4
  15673.                          |
  15674.     # of additional      |
  15675.     tables in already    |    12        8        4        0
  15676.     opened .MDBs:        |
  15677.                          |
  15678.     Total tables:        |    13        10       7        4
  15679.                          |
  15680.                          |
  15681.     Total ISAM handles:  |    16        16       16       16
  15682.     ---------------------------------------------------------
  15683.  
  15684.  Therefore, if you have all of your tables in only 1 database file, you
  15685.  can open a total of 13 tables at once. However, if you open tables in
  15686.  4 database files, you can open only those 4 tables at once.
  15687.  
  15688.  This information is taken from page 388 of the "Microsoft BASIC 7.0:
  15689.  Programmer's Guide" for versions 7.00 and 7.10 (Chapter 10, "Database
  15690.  Programming with ISAM").
  15691.  
  15692.  
  15693.  268. SSEGADD Example Requires Large Model (/AL) for C Routine
  15694.  
  15695.  Product Version(s): 7.00   | 7.00
  15696.  Operating System:   MS-DOS | OS/2
  15697.  Flags: ENDUSER | SR# S900501-79 docerr S_C S_QuickC
  15698.  Last Modified: 11-MAY-1990    ArticleIdent: Q61675
  15699.  
  15700.  The SSEGADD example on Page 351 of the "Microsoft BASIC 7.0: Language
  15701.  Reference" manual requires that the C routine (printmessage) be
  15702.  compiled with the large memory model (/AL). The following compile
  15703.  lines should be added for the C routine:
  15704.  
  15705.     For C 5.00 and 5.10
  15706.     -------------------
  15707.  
  15708.       CL -AL printmsg.c ;
  15709.  
  15710.     For QuickC 1.00, 1.01, 2.00, and 2.01
  15711.     -------------------------------------
  15712.  
  15713.       QCL -AL printmsg.c ;
  15714.  
  15715.  This information applies to Microsoft BASIC Professional Development
  15716.  System (PDS) version 7.00.
  15717.  
  15718.  In general, routines written in C (or other languages) need to be
  15719.  compiled either for the medium memory (/AM) or the large memory (/AL)
  15720.  model. The model size affects the default pointer type (near or far).
  15721.  
  15722.  When the SSEGADD example is compiled for medium model, the program
  15723.  runs without error, but the wrong data is displayed. This is because
  15724.  the printf() function is expecting a near pointer (offset in the data
  15725.  segment) and printmessage is accepting a far pointer (segment and
  15726.  offset). If you use the large memory model, printf() expects a far
  15727.  pointer, and the program runs correctly.
  15728.  
  15729.  
  15730.  269. EMS Corrupt in QBX When 386MAX Loaded with the Noframe Option
  15731.  
  15732.  Product Version(s): 7.00
  15733.  Operating System:   MS-DOS
  15734.  Flags: ENDUSER | SR# S900430-50
  15735.  Last Modified: 11-MAY-1990    ArticleIdent: Q61679
  15736.  
  15737.  The error "EMS Corrupt" occurs when running QBX.EXE with 386MAX using
  15738.  the "noframe" option for 386MAX. This option causes 386MAX to not use
  15739.  any page frames in base memory. QBX.EXE does not support this method
  15740.  of expanded memory management.
  15741.  
  15742.  This information applies to Microsoft BASIC Professional Development
  15743.  System (PDS) version 7.00.
  15744.  
  15745.  
  15746.  270. QBX ISAM Capitalizes the Field Names of a Table in an .EXE
  15747.  
  15748.  Product Version(s): 7.00
  15749.  Operating System:   MS-DOS
  15750.  Flags: ENDUSER | SR# S900508-29
  15751.  Last Modified: 22-MAY-1990    ArticleIdent: Q62055
  15752.  
  15753.  Microsoft BASIC Professional Development System (PDS) version 7.00
  15754.  ISAM behaves in a slightly different manner in the QBX.EXE environment
  15755.  than when compiled. In a compiled program, when a database is created,
  15756.  the ISAM engine capitalizes all field names in the TYPE used to create
  15757.  the table. In the QBX.EXE environment, the ISAM engine leaves field
  15758.  names in whatever case they were coded in. This slight difference in
  15759.  behavior of the ISAM engine should not cause any problems in ISAM.
  15760.  BASIC variable names are not case sensitive. This includes the
  15761.  variable names used to create and access ISAM tables and indexes.
  15762.  
  15763.  This information applies to Microsoft BASIC PDS version 7.00 for MS-DOS.
  15764.  
  15765.  The following program displays this behavior. Run the program in the
  15766.  QBX.EXE environment, then use the ISAMPACK.EXE utility on the file the
  15767.  program creates. ISAMPACK.EXE displays the structure of the database
  15768.  as it repairs the file. It also shows the case on all tables, fields
  15769.  in the table, and indexes. Compile the program, run it, and use
  15770.  ISAMPACK to display the database structure again. This shows the
  15771.  difference in the case of the field names.
  15772.  
  15773.  This difference occurs no matter how ISAM is used. ISAM can be used
  15774.  in four different ways: PROISAM(d) TSR with or without the run-time
  15775.  module; linked directly into the program itself; or linked into the
  15776.  run-time module. All forms of accessing the ISAM engine behave the
  15777.  same way.
  15778.  
  15779.  Code Example
  15780.  ------------
  15781.  
  15782.      TYPE table
  15783.          Field1      AS LONG
  15784.          Field2      AS LONG
  15785.          Field3      AS LONG
  15786.      END TYPE
  15787.      ' Check if the table already exists. If so, delete it.
  15788.      IF (DIR$("db1.mdb") <> "") THEN
  15789.          DELETETABLE "db1.mdb", "Table1"
  15790.      END IF
  15791.      OPEN "db1.mdb" FOR ISAM table "Table1" AS 1
  15792.      CREATEINDEX 1, "Idx", 1, "Field1", "Field2", "Field3"
  15793.      CLOSE
  15794.      END
  15795.  
  15796.  
  15797.  271. Description of EM-Management Switches for BASIC PDS 7.00
  15798.  
  15799.  Product Version(s): 7.00   | 7.00
  15800.  Operating System:   MS-DOS | OS/2
  15801.  Flags: ENDUSER | SR# S900503-164
  15802.  Last Modified: 22-MAY-1990    ArticleIdent: Q62056
  15803.  
  15804.  This article describes the purpose and use of the Microsoft BASIC
  15805.  Professional Development System (PDS) version 7.00 switches that allow
  15806.  you to configure the use of expanded memory (EM). Especially important
  15807.  is the description of the /Es switch and its relationship to the other
  15808.  EM switches.
  15809.  
  15810.  This information applies to Microsoft BASIC PDS 7.00 for MS-DOS and MS
  15811.  OS/2.
  15812.  
  15813.  Saving and Restoring the EM State
  15814.  ---------------------------------
  15815.  
  15816.  By default, QBX.EXE and programs compiled with BC.EXE 7.00 perform
  15817.  only the minimum saving and restoring of the EM state necessary to
  15818.  allow the program to work properly. This assumes that no third-party
  15819.  code using EM is present. To get more than this minimal amount of EM
  15820.  save and restore, you must specify /Es upon loading QBX.EXE or when
  15821.  compiling programs with BC.EXE. This is by design. If BASIC always
  15822.  saved and restored the EM state, the save and restore operations would
  15823.  significantly affect the speed of ISAM and quick library (QLB)
  15824.  calling. The purpose of the /Es switch is to allow programs to use
  15825.  third-party code that uses EM. The trade-off is a degradation in
  15826.  speed.
  15827.  
  15828.  Table of EM Switches and Where You Can Use Them
  15829.  -----------------------------------------------
  15830.  
  15831.     Use With     Switch Name   Switch Purpose
  15832.     --------     -----------   --------------
  15833.  
  15834.     QBX only     /Ea           Arrays > 512 bytes but < 16K in
  15835.                                EM. Default: no arrays in EM.
  15836.  
  15837.     QBX only     /E:n          n = amount in kilobytes of EM QBX
  15838.                                will use. 0 means QBX uses no EM.
  15839.                                Default: use all available EM.
  15840.  
  15841.     QBX and BC   /Es           Enable EM state save/restore.
  15842.  
  15843.     PROISAM(D)   /Ie:n         Reserves n kilobytes of EM for
  15844.                                other applications (Such as QBX).
  15845.                                ISAM will use only 1.2 MB of EM
  15846.                                maximum.
  15847.  
  15848.  Examples: Use of the Switches, Their Effects, and How They Interact
  15849.  -------------------------------------------------------------------
  15850.  
  15851.  QBX /E:0
  15852.  
  15853.     * This switch causes QBX.EXE to disable use of EM for code storage.
  15854.  
  15855.     * If the program has ISAM using EM, it is assumed that no
  15856.       third-party code that is accessing EM is present. With /E:0, the
  15857.       default for QBX.EXE is not to save and restore the EM state on
  15858.       ISAM use. This maximizes the speed of ISAM performance.
  15859.  
  15860.  QBX /E:0 /Es
  15861.  
  15862.     * Save and restore operations occur on any ISAM statement or QLB
  15863.       call. Use this combination if you are loading QLBs that use EM
  15864.       and ISAM using EM is being used as well.
  15865.  
  15866.  QBX /E:N and N Is Nonzero
  15867.  
  15868.     * The EM state on QLB calls is not saved and restored.
  15869.  
  15870.     * ISAM calls will be saved and restored when both QBX.EXE and ISAM
  15871.       are sharing EM.
  15872.  
  15873.     * It is assumed there are no QLBs using EM.
  15874.  
  15875.  QBX /Es or QBX /E:N /Es
  15876.  
  15877.     * This switch forces QLB calls and ISAM statements to be saved and
  15878.       restored.
  15879.  
  15880.     * This switch would be used if you are using QBX.EXE and calling
  15881.       QLB routines that access EM.
  15882.  
  15883.  BC with No EM-Management Switches, No Overlays, No ISAM
  15884.  
  15885.     * The EM state is not saved or restored.
  15886.  
  15887.     * Third-party routines accessing EM should work correctly.
  15888.  
  15889.  BC with Overlays That Will Load from EM
  15890.  
  15891.     * EM will be used by compiled code in the overlays.
  15892.  
  15893.     * The default is to save and restore EM on all ISAM statements in a
  15894.       program that uses overlays.
  15895.  
  15896.     * This could still cause problems if third-party library routines
  15897.       that use EM are called.
  15898.  
  15899.  BC /Es with Overlays and ISAM
  15900.  
  15901.     * EM will be saved and restored on ISAM statements.
  15902.  
  15903.     * Always use /Es when doing mixed-language calls to routines
  15904.       that use EM as well.
  15905.  
  15906.  BC /Es Without EM Overlays, but With ISAM
  15907.  
  15908.     * /Es always saves and restores ISAM statements when ISAM is using
  15909.       EM.
  15910.  
  15911.     * You would use this switch if the program uses ISAM, if ISAM is
  15912.       using EM, and if there are mixed-language CALLs to routines that
  15913.       use EM.
  15914.  
  15915.     * Note: /Es will not cause ISAM statements to be saved and restored
  15916.       if ISAM is NOT using EM.
  15917.  
  15918.  
  15919.  272. Multiple Duplicate Definition L2025 with Graphics Stub Files
  15920.  
  15921.  Product Version(s): 7.00   | 7.00
  15922.  Operating System:   MS-DOS | OS/2
  15923.  Flags: ENDUSER | SR# S900329-130
  15924.  Last Modified: 22-MAY-1990    ArticleIdent: Q62058
  15925.  
  15926.  Linking a Microsoft BASIC Professional Development System (PDS)
  15927.  version 7.00 program with the NOGRAPH.OBJ stub file and any of the
  15928.  other graphics stub files (NOEGA.OBJ, NOOGA.OBJ, NOVGA.OBJ, or
  15929.  NOHERC.OBJ) produces multiple "L2025 symbol defined more than once"
  15930.  error messages. This is because the NOGRAPH object module is a
  15931.  superset of the other NOxxx.OBJ graphics files. If you use NOGRAPH,
  15932.  you remove all graphics support and should not use any of the other
  15933.  NOxxxx.OBJ graphics stub files. The individual NOxxx.OBJ graphics stub
  15934.  files contain a subset of the stub routines in the NOGRAPH.OBJ stub
  15935.  file. When you try to link them both, you are trying to include the
  15936.  same routines twice, and therefore, the linker generates L2025,
  15937.  telling you that the same stub routine is being linked in twice.
  15938.  
  15939.  NOGRAPH.OBJ should be used by itself. If you want to stub out all
  15940.  graphics support, link with NOGRAPH.OBJ and no other stub file.
  15941.  However, if you want VGA support but not EGA, HERC, or OGA, link your
  15942.  program with NOEGA, NOHERC, and NOOGA, but not with NOVGA and NOGRAPH.
  15943.  
  15944.  This information applies to Microsoft BASIC PDS 7.00 for MS-DOS and MS
  15945.  OS/2.
  15946.  
  15947.  
  15948.  273. WHEREIS.BAS Problem Under MS-DOS 4.00 and 4.01
  15949.  
  15950.  Product Version(s): 7.00
  15951.  Operating System:   MS-DOS
  15952.  Flags: ENDUSER | B_QuickBas
  15953.  Last Modified: 25-MAY-1990    ArticleIdent: Q62202
  15954.  
  15955.  The sample program WHEREIS.BAS searches for the location of a specific
  15956.  file on disk. WHEREIS uses the BASIC SHELL statement to perform a DOS
  15957.  DIR command and redirects the results to a file that WHEREIS.BAS later
  15958.  scans for the file it is searching for.
  15959.  
  15960.  Under MS-DOS versions 4.00 and 4.01, the WHEREIS.BAS program SHELL
  15961.  command does not function correctly. The path specification string
  15962.  passed to the DOS DIR command from WHEREIS ends with a blackslash
  15963.  character, resulting in a DIR command something like the following:
  15964.  
  15965.     DIR C:\QB45\x\
  15966.  
  15967.  This form of the DIR command returns a list of files in the QB45
  15968.  directory when used under MS-DOS 3.x and earlier. Under MS-DOS 4.00
  15969.  and 4.01, this command fails with the error message "Invalid
  15970.  directory." Removing the trailing backslash allows the DIR command to
  15971.  operate under MS-DOS 4.00 and 4.01.
  15972.  
  15973.  To correct WHEREIS.BAS to operate under MS-DOS 4.00 and 4.01, you need
  15974.  to add several lines to the ScanDir SUBprogram in WHEREIS.BAS.
  15975.  
  15976.  In the original version of WHEREIS.BAS, line 12 of the ScanDir SUB
  15977.  reads as follows:
  15978.  
  15979.     SHELL "DIR " + PathSpec$ + " > " + TempSpec$
  15980.  
  15981.  To remove the trailing backslash from the string PathSpec$, replace
  15982.  the line above with the following:
  15983.  
  15984.     StripPath$ = PathSpec$
  15985.  
  15986.     IF RIGHT$(StripPath$,1) = "\" AND LEN(StripPath$) > 1 THEN
  15987.       StripPath$ = LEFT$(StripPath$, LEN(StripPath$) - 1)
  15988.     END IF
  15989.  
  15990.     SHELL "DIR " + StripPath$ + " > " + TempSpec$
  15991.  
  15992.  
  15993.  274. ADAPTER.BAS Needs SLEEP Statement When Compiled
  15994.  
  15995.  Product Version(s): 7.00   | 7.00
  15996.  Operating System:   MS-DOS | OS/2
  15997.  Flags: ENDUSER | SR# S900504-3
  15998.  Last Modified: 29-MAY-1990    ArticleIdent: Q62203
  15999.  
  16000.  The sample program APAPTER.BAS included with Microsoft BASIC
  16001.  Professional Development System (PDS) version 7.00 must have the SLEEP
  16002.  statement added to the code after the call to the SUBprogram so that
  16003.  the message that states what video modes are supported on the monitor
  16004.  is displayed when the program is compiled.
  16005.  
  16006.  This information applies to Microsoft BASIC PDS 7.00 for MS-DOS and
  16007.  OS/2.
  16008.  
  16009.  ADAPTER.BAS works correctly when compiled, except that the message
  16010.  displayed at the end of the program that states what video modes are
  16011.  supported by the monitor is displayed and then erased. This is due to
  16012.  the statement "SCREEN 0, 0", which sets the screen mode back to mode 0
  16013.  following the test. This problem is related to the second parameter,
  16014.  0, which is the "Color switch" parameter. When anything in the video
  16015.  mode changes, the screen is erased. When the message is displayed in
  16016.  the compiled program, the program ends and the screen mode is set back
  16017.  to composite color monitor mode. A color switch parameter of 0 in the
  16018.  SCREEN statement sets it to noncolor. By removing the color switch
  16019.  parameter or setting it to 1, ADAPTER.BAS will work correctly.
  16020.  
  16021.  ADAPTER.BAS works in the environment because the SCREEN mode is not
  16022.  reset until you respond to the "Press any key to continue" message.
  16023.  This can be demonstrated in the compiled program by placing a SLEEP
  16024.  statement following the CALL to the SUBprogram Adapter and leaving the
  16025.  SCREEN 0, 0 statement as is.
  16026.  
  16027.  Code Example
  16028.  ------------
  16029.  
  16030.    -------ADAPTER.BAS-----------
  16031.  
  16032.    DECLARE SUB Adapter ()
  16033.    DEFINT A-Z
  16034.    Adapter
  16035.    SLEEP
  16036.    END
  16037.  
  16038.  
  16039.  275. LINK L1083 "Cannot Open Run File" on Novell Network
  16040.  
  16041.  Product Version(s): 7.00 7.10
  16042.  Operating System:   MS-DOS
  16043.  Flags: ENDUSER | SR# S900423-82
  16044.  Last Modified: 18-OCT-1990    ArticleIdent: Q62206
  16045.  
  16046.  A customer reported that when linking a program in Microsoft BASIC
  16047.  Professional Development System (PDS) version 7.00 on a workstation
  16048.  running Novell NetWare ELS Level I or Level II, you may get LINKer
  16049.  error L1083, "cannot open run file." Another customer reported the
  16050.  problem on Novell NetWare Advanced 286 version 2.15. This problem does
  16051.  not occur when the network software is not installed, according to the
  16052.  customers.
  16053.  
  16054.  The problem seems to occur only if there already is an .EXE file on
  16055.  disk with the same base name as the .OBJ file that was being linked.
  16056.  When the old .EXE file is deleted, the LINK command functions
  16057.  successfully. Microsoft has not tested or confirmed this information.
  16058.  
  16059.  Microsoft BASIC PDS 7.00 and 7.10 have not been tested under, and are
  16060.  not guaranteed to work under, any version of Novell NetWare.
  16061.  
  16062.  This information applies to Microsoft BASIC PDS versions 7.00 and 7.10
  16063.  for MS-DOS.
  16064.  
  16065.  The customer encountered this problem on both a workstation and server
  16066.  machine with the following configurations:
  16067.  
  16068.     286 12-MHz Clone
  16069.     Novell ELS Level 1 version 2.0 A
  16070.     (9/15/87)
  16071.  
  16072.  or
  16073.  
  16074.     Novell ELS Level 2 version 2.15
  16075.     DOS version 3.30
  16076.     Hercules video card
  16077.  
  16078.  
  16079.  276. Calling API Function to Get All Available Drives
  16080.  
  16081.  Product Version(s): 6.00 6.00b 7.00
  16082.  Operating System:   OS/2
  16083.  Flags: ENDUSER | SR# S900517-71
  16084.  Last Modified:  7-JUN-1990    ArticleIdent: Q62214
  16085.  
  16086.  Microsoft BASIC Compiler versions 6.00 and 6.00b and Microsoft BASIC
  16087.  Professional Development System (PDS) version 7.00 protected mode
  16088.  programs can call the OS/2 API function DosQCurDisk() to get all the
  16089.  available logical drives. DosQCurDisk() requires the following
  16090.  parameters:
  16091.  
  16092.     Parameter   Description
  16093.     ---------   -----------
  16094.  
  16095.     PTR WORD    Receives current drive code (1 = A, 2 = B, etc.)
  16096.  
  16097.     PTR DWORD   Receives logical drive bitmap (logical drives A-Z
  16098.                 correspond to bits 0-25; a bit is set if a
  16099.                 logical drive exists)
  16100.  
  16101.  The first parameter is not important in getting the available drives,
  16102.  but it is worthy to note that for API functions, a WORD (2 bytes) has
  16103.  a BASIC type of INTEGER. Likewise, a DWORD (4 bytes) has a BASIC type
  16104.  of LONG. Since the specification requires pointers to these data
  16105.  items, the DECLARE statement for DosQCurDisk() uses the SEG keyword for
  16106.  each of the parameters. This causes 4-byte addresses of the parameters
  16107.  to be passed instead of 2-byte addresses, which is the default because
  16108.  BASIC uses the medium-memory model. Also, API functions return an
  16109.  error code, so for BASIC to retrieve this code, you must declare
  16110.  DosQCurDisk() as a FUNCTION.
  16111.  
  16112.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  16113.  6.00b for MS OS/2 and Microsoft BASIC (PDS) version 7.00 for MS OS/2.
  16114.  
  16115.  For more information on calling OS/2 API functions from Microsoft
  16116.  BASIC Compiler versions 6.00 and 6.00b, see Page 21 of the "Microsoft
  16117.  BASIC Compiler 6.0: User's Guide" included with the product.
  16118.  
  16119.  For more information on calling OS/2 API functions from Microsoft
  16120.  BASIC PDS version 7.00, see Page 523 of the "Microsoft BASIC 7.0:
  16121.  Programmer's Guide" included with the product.
  16122.  
  16123.  For more information on DosQCurDisk(), see Page 547 of "Advanced OS/2
  16124.  Programming," by Ray Duncan (Microsoft Press, 1989).
  16125.  
  16126.  To see a BASIC PDS 7.00 sample program that finds all the available
  16127.  drives in DOS or OS/2 real mode, query in this Knowledge Base on the
  16128.  word "chdrive".
  16129.  
  16130.  The following sample program (LOGICAL.BAS) reports all the available
  16131.  logical drives.
  16132.  
  16133.  To compile the program, use the following:
  16134.  
  16135.     bc logical /lp;
  16136.  
  16137.  To link the program for BASIC 6.00 and 6.00b, use the following:
  16138.  
  16139.     link /nop logical,,,doscalls;
  16140.  
  16141.  To link the program for BASIC 7.00, use the following:
  16142.  
  16143.     link /nop logical,,,os2;
  16144.  
  16145.  Code Example
  16146.  ------------
  16147.  
  16148.  ' This declaration was taken from the include file
  16149.  BSEDOSFL.BI.
  16150.  
  16151.  DECLARE FUNCTION DosQCurDisk% (SEG CurrentDrive AS INTEGER,_
  16152.                                 SEG DriveBitmap  AS LONG)
  16153.  
  16154.  ' CurrentDrive% receives the current drive code (A=1, B=2,
  16155.  ' etc.). DriveBitmap& receives a bitmap of each logical
  16156.  ' drive's availability.
  16157.  ErrorCode% = DosQCurDisk% (CurrentDrive%, DriveBitmap&)
  16158.  
  16159.  IF ErrorCode% THEN
  16160.  
  16161.     PRINT "An error occurred, the code is";ErrorCode%
  16162.  
  16163.  ELSE
  16164.  
  16165.     PRINT "The following drives are available:";
  16166.  
  16167.     ' Bit% is used to circulate through bits 0-25 (drives A-Z)
  16168.     ' of DriveBitmap&.  If (DriveBitmap& AND 2^Bit%) = 2^Bit%,
  16169.     ' then bit Bit% of DriveBitmap& is set and the
  16170.     ' corresponding logical drive is available.
  16171.     FOR Bit% = 0 to 25
  16172.        IF (DriveBitmap& AND 2^Bit%) = 2^Bit% THEN
  16173.           PRINT " ";CHR$(Bit% + 65);
  16174.        END IF
  16175.     NEXT Bit%
  16176.  
  16177.  END IF
  16178.  
  16179.  END
  16180.  
  16181.  
  16182.  277. QBX Hangs Using KEY with Two or More Characters, Then INPUT$
  16183.  
  16184.  Product Version(s): 7.00
  16185.  Operating System:   MS-DOS
  16186.  Flags: ENDUSER | buglist7.00 fixlist7.10 SR# S900517-71
  16187.  Last Modified: 29-JAN-1991    ArticleIdent: Q62216
  16188.  
  16189.  The program below hangs in the QBX.EXE environment of Microsoft BASIC
  16190.  Professional Development System (PDS) version 7.00. The problem occurs
  16191.  when you specify two or more characters in the KEY statement's string
  16192.  to specify a softkey and follow that with an INPUT$ statement. After
  16193.  you run the program in the QBX.EXE environment, press the softkey, and
  16194.  press an additional key, the program hangs after it ends with the
  16195.  "Press any key to continue" message.
  16196.  
  16197.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  16198.  version 7.00. This problem is corrected in BASIC PDS version 7.10.
  16199.  
  16200.  This is only a problem in the QBX.EXE environment. This program works
  16201.  correctly when it is compiled to an .EXE program (with either the Near
  16202.  Strings or Far Strings option).
  16203.  
  16204.  To work around this problem in BASIC 7.00, do any of the following:
  16205.  
  16206.  1. Use the INPUT statement (or INKEY$ function in a loop) instead of
  16207.     the INPUT$ function.
  16208.  
  16209.  2. Use only one character in the string for the KEY statement.
  16210.  
  16211.  The following code sample demonstrates this problem:
  16212.  
  16213.     KEY 10, "*" + CHR$(13)   ' Any two or more characters produce problem.
  16214.     my$ = INPUT$(1)          ' Press F10 then additional key as input.
  16215.     print my$
  16216.  
  16217.  
  16218.  278. EXEHDR.EXE Switch Omissions in 7.00/7.10 Manual
  16219.  
  16220.  Product Version(s): 7.00 7.10 | 7.00 7.10
  16221.  Operating System:   MS-DOS    | OS/2
  16222.  Flags: ENDUSER | SR# S900517-206 docerr
  16223.  Last Modified: 15-JAN-1991    ArticleIdent: Q62217
  16224.  
  16225.  The EXEHDR documentation on page 347 of the "Microsoft CodeView and
  16226.  Utilities User's Guide" for Microsoft BASIC Professional Development
  16227.  System (PDS) versions 7.00 and 7.10 mentions only the /v (verbose)
  16228.  option and omits many additional EXEHDR options. This manual also
  16229.  unnecessarily documents the EXEMOD utility (on pages 307-311), which
  16230.  is an older version of EXEHDR. EXEMOD is not shipped with BASIC PDS
  16231.  7.00 or 7.10 because EXEHDR contains all of EXEMOD's functionality.
  16232.  
  16233.  This information applies to Microsoft BASIC PDS versions 7.00 and 7.10
  16234.  for MS-DOS and MS OS/2.
  16235.  
  16236.  The full list of EXEHDR options can be displayed by typing EXEHDR /?
  16237.  at the DOS prompt. The options are as follows:
  16238.  
  16239.     Usage: EXEHDR [options] <file-list>
  16240.     Valid options are:
  16241.  
  16242.        /?
  16243.        /HEAP:(0H - ffffH)
  16244.        /HELP
  16245.        /MAX:(0H - ffffH)
  16246.        /MIN:(0H - ffffH)
  16247.        /NEWFILES
  16248.        /NOLOGO
  16249.        /PMTYPE:(PM | VIO | NOVIO | WINDOWAPI |
  16250.                    WINDOWCOMPAT | NOTWINDOWCOMPAT)
  16251.        /RESETERROR
  16252.        /STACK:(0H - ffffH)
  16253.        /VERBOSE
  16254.  
  16255.  Note: The hex values are listed in assembly notation (for example,
  16256.  ffffH). Hex values should actually be input with C notation using the
  16257.  "0x" prefix instead of the "H" suffix (for example, ffffH -> 0xffff).
  16258.  The values can also be entered in decimal notation without prefixes or
  16259.  suffixes.
  16260.  
  16261.  If the assembler notation for hex values is used with EXEHDR, the
  16262.  following errors will occur:
  16263.  
  16264.     EXEHDR: error U1110: malformed number FFFFH
  16265.     EXEHDR: error U1115: option /MAX:FFFFH ignored
  16266.  
  16267.  
  16268.  279. OS/2 API Function to Get Current Drive
  16269.  
  16270.  Product Version(s): 6.00 6.00b 7.00
  16271.  Operating System:   OS/2
  16272.  Flags: ENDUSER | SR# S900517-70
  16273.  Last Modified:  7-JUN-1990    ArticleIdent: Q62218
  16274.  
  16275.  Microsoft BASIC Compiler versions 6.00 and 6.00b and Microsoft BASIC
  16276.  Professional Development System (PDS) version 7.00 protected mode
  16277.  programs can call the OS/2 API function DosQCurDisk() to get the
  16278.  currently selected drive. DosQCurDisk() requires the following
  16279.  parameters:
  16280.  
  16281.     Parameter   Description
  16282.     ---------   -----------
  16283.  
  16284.     PTR WORD    Receives current drive code (1 = A, 2 = B, etc.)
  16285.  
  16286.     PTR DWORD   Receives logical drive bitmap (logical drives A-Z
  16287.                 correspond to bits 0-25; a bit is set if a
  16288.                 logical drive exists)
  16289.  
  16290.  The second parameter is not important in getting the current drive,
  16291.  but it is worthy to note that for API functions a DWORD (4 bytes) has
  16292.  a BASIC type of LONG. Likewise, a WORD (2 bytes) has a BASIC type of
  16293.  INTEGER. Since the specification requires pointers to these data
  16294.  items, the DECLARE statement for DosQCurDisk() uses the SEG keyword for
  16295.  each of the parameters. This causes 4-byte addresses of the parameters
  16296.  to be passed instead of 2-byte addresses, which is the default because
  16297.  BASIC uses the medium-memory model. Also, API functions return an
  16298.  error code; therefore, for BASIC to retrieve this code, it must
  16299.  declare DosQCurDisk() as a FUNCTION.
  16300.  
  16301.  The DECLARE statements for almost every API function are located in
  16302.  include files that come with BASIC 6.00 and 6.00b and BASIC PDS 7.00.
  16303.  To modify the DECLARE statement, you just have to include the right
  16304.  file. See the PACKING.LST file included with the product for a
  16305.  description of these include files.
  16306.  
  16307.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  16308.  6.00b for MS OS/2 and Microsoft BASIC PDS version 7.00 for MS OS/2.
  16309.  
  16310.  For more information on calling OS/2 API functions from Microsoft
  16311.  BASIC Compiler versions 6.00 and 6.00b, see Page 21 of the "Microsoft
  16312.  BASIC Compiler 6.0: User's Guide" included with the product.
  16313.  
  16314.  For more information on calling OS/2 API functions from BASIC PDS
  16315.  version 7.00, see Page 523 of the "Microsoft BASIC 7.0: Programmer's
  16316.  Guide" included with the product.
  16317.  
  16318.  For more information on DosQCurDisk(), see Page 547 of "Advanced OS/2
  16319.  Programming," by Ray Duncan (Microsoft Press, 1989).
  16320.  
  16321.  Note that BASIC PDS version 7.00 supports the function "CURDIR$",
  16322.  which can also be used to get the currently selected drive. However,
  16323.  using this method requires some string parsing, so although the code
  16324.  is smaller, it may be slower.
  16325.  
  16326.  The sample program below (GETDRIVE.BAS) reports the currently selected
  16327.  drive.
  16328.  
  16329.  To compile the program, use the following:
  16330.  
  16331.     bc getdrive /lp;
  16332.  
  16333.  To link the program for BASIC 6.00 and 6.00b, use the following:
  16334.  
  16335.     link /nop getdrive,,,doscalls;
  16336.  
  16337.  To link the program for BASIC 7.00, use the following:
  16338.  
  16339.     link /nop getdrive,,,os2;
  16340.  
  16341.  Code Example
  16342.  ------------
  16343.  
  16344.  ' This declaration was taken from the include file
  16345.  ' BSEDOSFL.BI
  16346.  
  16347.  DECLARE FUNCTION DosQCurDisk% (SEG CurrentDrive AS INTEGER,_
  16348.                                 SEG DriveBitmap  AS LONG)
  16349.  
  16350.  ' CurrentDrive receives the current drive code (A=1, B=2,
  16351.  ' etc.)
  16352.  ' DriveBitmap receives a bitmap of each logical drive's
  16353.  ' availability
  16354.  
  16355.  ErrorCode% = DosQCurDisk% (CurrentDrive%, DriveBitmap&)
  16356.  
  16357.  IF ErrorCode% THEN
  16358.     PRINT "An error occurred, the code is";ErrorCode%
  16359.  ELSE
  16360.     PRINT "The current drive is "; CHR$(CurrentDrive% + 64)
  16361.  END IF
  16362.  
  16363.  END
  16364.  
  16365.  
  16366.  280. TSCNIOxx.OBJ Stub Files Remove Screen 0 Page-Switching
  16367.  
  16368.  Product Version(s): 7.00
  16369.  Operating System:   MS-DOS
  16370.  Flags: ENDUSER | SR# S900423-7
  16371.  Last Modified: 20-JUN-1990    ArticleIdent: Q62260
  16372.  
  16373.  If you link the stub file TSCNIOxx.OBJ to your BASIC object module,
  16374.  any attempt to change the visual or active page to any page other than
  16375.  Page 0 generates the error "Feature Removed." The run-time routines
  16376.  responsible for handling page switching are included in those run-time
  16377.  routines stubbed out by TSCNIOxx.OBJ. This information applies to
  16378.  Microsoft BASIC Professional Development System (PDS) version 7.00 for
  16379.  MS-DOS and MS OS/2.
  16380.  
  16381.  The TSCNIOxx.OBJ stub file is used to remove all graphics support that
  16382.  is automatically inserted in your program at link time so that you may
  16383.  generate smaller EXE files.
  16384.  
  16385.  For more information on this and other stub files, query on the
  16386.  following words:
  16387.  
  16388.     smaller and stub and EXE
  16389.  
  16390.  The sample code below reproduces the error "Feature Removed."
  16391.  
  16392.  Compile and link as follows:
  16393.  
  16394.     BC scrntest.bas /o ;
  16395.     LINK scrntest + tscionr.obj,,,bcl70enr.lib /noe ;
  16396.  
  16397.  Code Example
  16398.  ------------
  16399.  
  16400.     CLS
  16401.     PRINT "Switching pages"
  16402.     SLEEP
  16403.     SCREEN 0, , 1, 1        'This line will generate the Feature.
  16404.                             'Removed error because it tries to switch
  16405.                             'pages in Text mode.
  16406.  
  16407.  
  16408.  281. Problem with SCREEN 0 Paging on CGA in QB.EXE & QBX.EXE
  16409.  
  16410.  Product Version(s): 7.00 7.10
  16411.  Operating System:   MS-DOS
  16412.  Flags: ENDUSER | SR# S900517-177 B_QuickBas buglist7.00 buglist7.10
  16413.  Last Modified:  6-AUG-1990    ArticleIdent: Q62270
  16414.  
  16415.  Paging through the active and visible pages of SCREEN 0 does not work
  16416.  correctly on a CGA monitor in the QBX.EXE or QB.EXE environment  This
  16417.  problem occurs only when single-stepping through a program and setting
  16418.  breakpoints to view the output of the various pages. Machines equipped
  16419.  with EGA or VGA video adapters do not demonstrate this problem.
  16420.  
  16421.  Microsoft has confirmed this to be a problem in the QB.EXE environment
  16422.  QuickBASIC version 4.50 (buglist4.50) and in the QBX.EXE environment
  16423.  of Microsoft BASIC Professional Development System (PDS) versions 7.00
  16424.  and 7.10. We are researching this problem and will post new
  16425.  information here as it becomes available.
  16426.  
  16427.  This problem does not occur in QuickBASIC versions 4.00 and 4.00b.
  16428.  
  16429.  The following code example demonstrates the problem in QB.EXE or
  16430.  QBX.EXE. Step through the program using the F8 key. After the PRINT
  16431.  statement, press the F4 function key to view the output screen. The
  16432.  screen will not be updated on a CGA monitor.
  16433.  
  16434.  Code Example
  16435.  ------------
  16436.  
  16437.     DEFINT A-Z
  16438.     DO UNTIL INKEY$ <> ""
  16439.        SCREEN 0, 0, x, x
  16440.        CLS
  16441.        PRINT "SCREEN MODE 0, PAGE"; x
  16442.        x = x + 1          ' Press F4 key to view the output screen
  16443.        IF x = 8 THEN x = 0
  16444.     LOOP
  16445.  
  16446.  
  16447.  282. Incorrect Results When Compiling with Near Strings
  16448.  
  16449.  Product Version(s): 7.00   | 7.00
  16450.  Operating System:   MS-DOS | OS/2
  16451.  Flags: ENDUSER | SR# S900517-165
  16452.  Last Modified:  1-JUN-1990    ArticleIdent: Q62456
  16453.  
  16454.  A program compiled with the Near Strings option (without /Fs) may
  16455.  produce incorrect results when the program uses a combination of the
  16456.  following:
  16457.  
  16458.  1. The LEN function on a variable length string
  16459.  2. Integer division
  16460.  3. String concatenation
  16461.  
  16462.  The same program will run correctly when run from the QBX.EXE
  16463.  environment or when compiled with Far Strings (with /Fs).
  16464.  
  16465.  Microsoft has confirmed this to be a problem in the BC.EXE 7.00
  16466.  compiler provided with Microsoft BASIC Professional Development System
  16467.  (PDS) version 7.00 for MS-DOS and MS OS/2. We are researching this
  16468.  problem and will post new information here as it becomes available.
  16469.  This problem does not occur in earlier versions of Microsoft BASIC
  16470.  Compiler (BC.EXE).
  16471.  
  16472.  This problem results from incorrect optimization by the BC.EXE 7.00
  16473.  compiler. You can disable these optimizations by either compiling with
  16474.  the /X compiler switch or by including line numbers in the area of the
  16475.  program where the error occurs.
  16476.  
  16477.  The following steps reproduce the problem:
  16478.  
  16479.  1. Use the LEN function on a variable-length string.
  16480.  
  16481.  2. Take the number returned by the LEN function and perform integer
  16482.     division on that number.
  16483.  
  16484.  3. Reassign a concatenated string to the variable-length string
  16485.     mentioned in step 1.
  16486.  
  16487.  4. Again, use the LEN function on the variable-length string and
  16488.     perform integer division on that result.
  16489.  
  16490.  If the program is compiled with Near Strings, the result of the
  16491.  calculation in Step 4 will be incorrect.
  16492.  
  16493.  The program below demonstrates the problem. The second PRINT statement
  16494.  should display a value of 9; however, if the program is compiled with
  16495.  Near Strings, a 0 will be displayed instead. The value returned by
  16496.  LEN(a$) is correct, but when integer division is performed on this
  16497.  value, an incorrect result is produced.
  16498.  
  16499.     PRINT LEN(a$) \ 2
  16500.     a$ = "concatenate " + "strings"
  16501.     PRINT LEN(a$) \ 2        'the value printed here is incorrect
  16502.     END
  16503.  
  16504.  Listed below are four different methods to work around the problem:
  16505.  
  16506.  1. Compile the program with /X or include line numbers in the area
  16507.     of the program where the problem occurs. Both of these actions
  16508.     disable some of the compiler optimizations that are the cause
  16509.     of this problem.
  16510.  
  16511.  2. Do not use integer division. Instead, perform regular division
  16512.     and then use the INT function to get the desired result, as in the
  16513.     following example:
  16514.  
  16515.        PRINT INT(LEN(a$) / 2)
  16516.        a$ = "concatenate " + "strings"
  16517.        PRINT INT(LEN(a$) / 2)
  16518.        END
  16519.  
  16520.  3. Avoid string concatenation, as follows:
  16521.  
  16522.        PRINT LEN(a$) \ 2
  16523.        a$ = "concatenate strings"  'assign a$ to 1 string instead of
  16524.                                    'using concatenation
  16525.        PRINT LEN(a$) \ 2
  16526.        END
  16527.  
  16528.  4. Assign the string that was created by concatenating strings to
  16529.     another string variable. Then, perform the LEN function on the
  16530.     new string, as in the following example:
  16531.  
  16532.        PRINT LEN(a$) \ 2
  16533.        a$ = "concatenate " + "strings"
  16534.        b$ = a$                'insert this line
  16535.        PRINT LEN(b$) \ 2      'and perform the rest of the
  16536.                               'calculations on b$
  16537.        END
  16538.  
  16539.  
  16540.  283. ISAM INSERT with Duplicate Key Incorrectly Allocates Record
  16541.  
  16542.  Product Version(s): 7.00 7.10 | 7.00 7.10
  16543.  Operating System:   MS-DOS    | OS/2
  16544.  Flags: ENDUSER | buglist7.00 buglist7.10
  16545.  Last Modified:  8-AUG-1990    ArticleIdent: Q62460
  16546.  
  16547.  When you specify a unique key with CREATEINDEX using Microsoft BASIC
  16548.  Professional Development System (PDS) version 7.00 ISAM, inserting
  16549.  records with duplicate keys causes a trappable error (run-time error
  16550.  86). However, the ISAM engine still inserts one record into the ISAM
  16551.  file per attempt to insert a duplicate key record. The records
  16552.  inserted with the duplicate keys are marked as deleted. The BASIC
  16553.  function LOF, which returns the total number of records in a BASIC PDS
  16554.  7.00 ISAM file, will show the actual number of successful writes to
  16555.  the file, showing that the records written with duplicate keys are not
  16556.  valid. Since these records are marked as deleted, using the ISAMPACK
  16557.  utility will remove the records and reduce the file to its appropriate
  16558.  size.
  16559.  
  16560.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  16561.  Professional Development System (PDS) versions 7.00 and 7.10 for
  16562.  MS-DOS. We are researching this problem and will post new information
  16563.  here as it becomes available.
  16564.  
  16565.  The sample program below demonstrates the problem. If you execute the
  16566.  code below, a record will be inserted into the ISAM file, and then 999
  16567.  more attempts will be made to insert that record. Since the program
  16568.  specifies unique keys in the CREATEINDEX statement, run-time error 86,
  16569.  "Duplicate key," will occur. The program will trap the "Duplicate key"
  16570.  error and resume execution. When the program terminates, the LOF
  16571.  function will show there is only one legitimate record in the file.
  16572.  The file size, however, will be approximately 1.6 MB. Using
  16573.  ISAMPACK.EXE on the ISAM file created by the program will reduce the
  16574.  file to 64K in size.
  16575.  
  16576.  To execute the program below, you must load the BASIC PDS 7.00 or 7.10
  16577.  ISAM support by executing the PROISAMD.EXE TSR (terminate-and-stay-resident)
  16578.  program. After PROISAMD has been loaded, you can execute the program
  16579.  within the QBX.EXE environment.
  16580.  
  16581.  Code Example
  16582.  ------------
  16583.  
  16584.  'WARNING: Even though this program only successfully
  16585.  '         writes one ISAM record, it creates a 1.6 MB file.
  16586.  TYPE NewRec
  16587.     AString AS STRING * 8
  16588.  END TYPE
  16589.  
  16590.  40 ON ERROR GOTO errorhandler
  16591.  50 DIM NewBuf AS NewRec
  16592.  60 OPEN "output.mdb" FOR ISAM NewRec "NewRec" AS #1
  16593.  
  16594.  70 CREATEINDEX #1, "X", 1, "AString"    '* Specify unique key *
  16595.  
  16596.  80 NewBuf.AString = "ABCDEFGH"
  16597.  90 FOR i = 1 TO 1000
  16598.  100     INSERT #1, NewBuf      '* Causes 999 "Duplicate key" errors *
  16599.  110    PRINT i
  16600.  120 NEXT
  16601.  130 PRINT "Size of database (should be 1): "; LOF(1)
  16602.  135 DELETEINDEX #1, "X" ' Delete the index so the program
  16603.                          ' can be run over.
  16604.  140 END
  16605.  
  16606.  errorhandler:
  16607.  150     SELECT CASE ERR
  16608.              CASE 86: PRINT "duplicate key attempted":
  16609.              RESUME NEXT
  16610.          CASE ELSE
  16611.              CLS
  16612.              PRINT "An error occurred. The number is: "; ERR
  16613.              PRINT "It occurred on line: "; ERL
  16614.              DELETEINDEX #1, "X"
  16615.              END
  16616.          END SELECT
  16617.  
  16618.  
  16619.  284. Must Load PROISAM or PROISAMD to Use ISAM Utilities
  16620.  
  16621.  Product Version(s): 7.00 7.10
  16622.  Operating System:   MS-DOS
  16623.  Flags: ENDUSER | SR# S900509-65
  16624.  Last Modified:  8-AUG-1990    ArticleIdent: Q62770
  16625.  
  16626.  As stated on Page 389 of the "Microsoft BASIC 7.0: Programmer's Guide"
  16627.  for versions 7.00 and 7.10, when using the ISAM utilities ISAMIO,
  16628.  ISAMCVT, or ISAMPACK, you must have the ISAM support installed.
  16629.  
  16630.  Depending on how you ran SETUP.EXE, the ISAM utilities ISAMIO.EXE,
  16631.  ISAMCVT.EXE, and ISAMPACK.EXE are built either to run as stand-alone
  16632.  programs or to require the terminate-and-stay-resident (TSR) form of
  16633.  ISAM (PROISAMD.EXE). SETUP always installs the ISAMREPR.EXE (ISAM
  16634.  repair) utility to run as a stand-alone program. For more information
  16635.  about how SETUP installs the ISAM utilities, search for a separate
  16636.  article in this Knowledge Base with the following words:
  16637.  
  16638.     how and SETUP and builds and ISAMIO
  16639.  
  16640.  This information applies to Microsoft BASIC Professional Development
  16641.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  16642.  
  16643.  The following table describes what each of the ISAM utilities does:
  16644.  
  16645.     Utility Name        Use
  16646.     ------------        ---
  16647.  
  16648.     ISAMREPR            Repairs or rebuilds database
  16649.  
  16650.     ISAMCVT             Converts other ISAM file types to the ISAM
  16651.                         format used by BASIC PDS 7.00
  16652.  
  16653.     ISAMPACK            Rotates all deleted records to the end of the
  16654.                         ISAM file, and if a 32K section is marked for
  16655.                         deletion, it decreases the size of the data
  16656.                         file by 32K
  16657.  
  16658.     ISAMIO              Converts to or from simple ASCII text files and
  16659.                         ISAM files
  16660.  
  16661.  
  16662.  285. Record Number for PUT/GET Statement Can Be a Long Integer
  16663.  
  16664.  Product Version(s): 7.00 7.10
  16665.  Operating System:   MS-DOS
  16666.  Flags: ENDUSER | SR# S900319-92 docerr
  16667.  Last Modified:  8-JAN-1991    ArticleIdent: Q62771
  16668.  
  16669.  Pages 147 and 280 in the "Microsoft BASIC 7.0: Language Reference"
  16670.  and Page 110 in the "Microsoft BASIC 7.0: Programmer's Guide"
  16671.  incorrectly state that when specifying the record number in a GET/PUT
  16672.  statement for a random file or the position number for a binary file,
  16673.  the record or position number should be an integer.
  16674.  
  16675.  The explanation for the GET/PUT statement should describe the record
  16676.  or position number as being either an integer or a long integer.
  16677.  
  16678.  This information applies to Microsoft BASIC Professional Development
  16679.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  16680.  
  16681.  The correct syntax for the GET/PUT statement is as follows:
  16682.  
  16683.    {GET|PUT} [#]filenumber% [, [recordnumber&] ] [, [variable] ]
  16684.  
  16685.  When accessing a random file, "recordnumber&" represents the number of
  16686.  the record to be read or written. When accessing a binary file,
  16687.  "recordnumber&" represents the byte position of where the reading or
  16688.  writing starts.
  16689.  
  16690.  The online Help for BASIC PDS 7.00 and 7.10 correctly describes the
  16691.  record number as "recordnumber&". The following documentation,
  16692.  however, incorrectly describes the record number as "recordnumber%":
  16693.  
  16694.  1. Page 110 of the "Microsoft BASIC 7.0: Programmer's Guide" for
  16695.     7.00 and 7.10
  16696.  
  16697.  2. Pages 147 and 280 of the "Microsoft BASIC 7.O: Language Reference"
  16698.     manual for 7.00 and 7.10
  16699.  
  16700.  By specifying the recordnumber variable as "recordnumber&" instead of
  16701.  "recordnumber%", it is inferred that the record number variable may
  16702.  either be of type INTEGER or LONG INTEGER.
  16703.  
  16704.  Using recordnumber% would suggest that the largest possible record
  16705.  number to be 32,767. Since the largest possible record number is
  16706.  2,147,483,647, the record number should be described as recordnumber&.
  16707.  
  16708.  
  16709.  286. OPEN New Table with PROISAM Causes "Feature Unavailable"
  16710.  
  16711.  Product Version(s): 7.00 7.10
  16712.  Operating System:   MS-DOS
  16713.  Flags: ENDUSER | SR# S900312-94 docerr
  16714.  Last Modified: 15-JAN-1991    ArticleIdent: Q62772
  16715.  
  16716.  Page 234 of "Microsoft BASIC 7.0: Language Reference" (for versions
  16717.  7.00 and 7.10) incorrectly states that the error generated when
  16718.  attempting to OPEN a new ISAM table or database with the PROISAM TSR
  16719.  loaded will produce a "File not found" error message. The correct
  16720.  error message produced is actually "Feature Unavailable."
  16721.  
  16722.  This information applies to Microsoft BASIC Professional Development
  16723.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  16724.  
  16725.  Note: The PROISAM TSR (or library) allows existing databases and
  16726.  tables to be accessed, but does not allow dynamic allocation of
  16727.  databases and tables. The PROISAMD TSR (or library) is required to
  16728.  dynamically allocate databases and tables.
  16729.  
  16730.  
  16731.  287. Overflow Error OPENing ISAM File with TYPE > 255 Elements
  16732.  
  16733.  Product Version(s): 7.00 7.10
  16734.  Operating System:   MS-DOS
  16735.  Flags: ENDUSER | SR# S900518-75 buglist7.00 buglist7.10
  16736.  Last Modified:  6-AUG-1990    ArticleIdent: Q62773
  16737.  
  16738.  An "Overflow" error will occur when OPENing a file FOR ISAM with a
  16739.  TYPE containing a large number of elements. This number is 255 for
  16740.  INTEGERs, LONGs, and fixed-length STRINGs, and 239 for DOUBLEs and
  16741.  CURRENCYs. This problem occurs in both the QBX.EXE environment and
  16742.  compiled EXEs.
  16743.  
  16744.  To work around the problem, limit the number of elements in the main
  16745.  type by combining some elements in a nested type or arrays.
  16746.  
  16747.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  16748.  Professional Development System (PDS) versions 7.00 and 7.10 for
  16749.  MS-DOS. We are researching this problem and will post new information
  16750.  here as it becomes available.
  16751.  
  16752.  Code Example
  16753.  ------------
  16754.  
  16755.  The following program fragment (the majority of TYPE is left out for
  16756.  space reasons) demonstrates the problem. The "Overflow" error will
  16757.  occur on the OPEN statement:
  16758.  
  16759.  TYPE BigType
  16760.    I1 AS INTEGER
  16761.    I2 AS INTEGER
  16762.    I3 AS INTEGER
  16763.                            <... I4-I250>
  16764.    I251 AS INTEGER
  16765.    I252 AS INTEGER
  16766.    I253 AS INTEGER
  16767.    I254 AS INTEGER
  16768.    I255 AS INTEGER        '255 for INTEGER/LONG/STRING*n
  16769.  END TYPE                 '239 for DOUBLE/CURRENCY
  16770.  
  16771.  OPEN "BigType" FOR ISAM BigType "BigType" AS #1  'Overflow error
  16772.                                                   'here
  16773.  CLOSE
  16774.  
  16775.  To use the workaround listed above, the TYPE BigType should be made of
  16776.  nested types, such as the following:
  16777.  
  16778.  TYPE NestType
  16779.    A AS INTEGER
  16780.    B AS INTEGER
  16781.    C AS INTEGER
  16782.    D AS INTEGER
  16783.    E AS INTEGER
  16784.  END TYPE
  16785.  
  16786.  TYPE NewBigType
  16787.    I(1 TO 250) AS INTEGER
  16788.    N AS NestType
  16789.  END TYPE
  16790.  
  16791.  
  16792.  288. Using PC-DOS 3.00 and QBX.EXE Will Give SHELL Problems
  16793.  
  16794.  Product Version(s): 7.00 7.10
  16795.  Operating System:   MS-DOS
  16796.  Flags: ENDUSER | SR# S900522-12 buglist7.00 buglist7.10
  16797.  Last Modified:  6-AUG-1990    ArticleIdent: Q62774
  16798.  
  16799.  When using QuickBASIC Extended (QBX.EXE) version 7.00 or 7.10 under
  16800.  PC-DOS version 3.00, if you first generate a PC-DOS "Bad command or
  16801.  file name" error on a SHELL statement, then any subsequent uses of the
  16802.  SHELL statement with any parameter will result in the "Bad command or
  16803.  file name" error until you restart QBX.EXE. To work around this
  16804.  problem, you can either use QuickBASIC version 4.50, or upgrade to
  16805.  either MS-DOS or a newer version of PC-DOS, or compile the program and
  16806.  run it outside of the environment with the near strings option
  16807.  (without /Fs).
  16808.  
  16809.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  16810.  Professional Development System (PDS) versions 7.00 and 7.10 under
  16811.  PC-DOS 3.00. We are researching this problem and will post new
  16812.  information here as it becomes available.
  16813.  
  16814.  This problem does not occur in Microsoft QuickBASIC versions 4.00,
  16815.  4.00b, or 4.50, or in Microsoft BASIC Compiler versions 6.00 or 6.00b
  16816.  under PC-DOS.
  16817.  
  16818.  The following code example demonstrates the problem:
  16819.  
  16820.  Code Example
  16821.  ------------
  16822.  
  16823.     SHELL "Errorxyz"      ' This will cause the first "Bad command or
  16824.                           ' file name" error.
  16825.     SHELL "CLS"           ' This is supposed to work but it gives a "bad
  16826.                           ' command or file name" error
  16827.  
  16828.  
  16829.  289. FRE(-1) Decreases with Repeated Use of DEF FNa$ in QBX.EXE
  16830.  
  16831.  Product Version(s): 7.00
  16832.  Operating System:   MS-DOS
  16833.  Flags: ENDUSER | SR# S900520-2 buglist7.00 fixlist7.10
  16834.  Last Modified:  2-NOV-1990    ArticleIdent: Q62813
  16835.  
  16836.  Repeated use of a DEF FN function to return a string in the QBX.EXE
  16837.  environment causes far heap memory to decrease as shown in the
  16838.  following program. This does not occur with a compiled .EXE program or
  16839.  if a FUNCTION procedure is used in place of the DEF FN function.
  16840.  
  16841.  Microsoft has confirmed this to be a problem in the QBX.EXE
  16842.  environment of Microsoft BASIC Professional Development System (PDS)
  16843.  version 7.00 for MS-DOS. This problem was corrected in BASIC PDS 7.10.
  16844.  
  16845.  To work around the above problem, use a BASIC FUNCTION procedure in
  16846.  place of the DEF FN function.
  16847.  
  16848.  This problem does not occur with any version of Microsoft QuickBASIC
  16849.  (QB.EXE) or any version of Microsoft BASIC Compiler (BC.EXE).
  16850.  
  16851.  Microsoft QuickBASIC versions 4.00 and later and Microsoft BASIC
  16852.  Compiler versions 6.00 and later have a method of implementing
  16853.  functions that is much more straightforward than DEF FN. These
  16854.  products allow true FUNCTION procedures to be created, much like the
  16855.  functions available in Pascal and C. A BASIC FUNCTION...END FUNCTION
  16856.  block is a procedure that allows you to return a value to the calling
  16857.  subprogram, but in all other respects is the same as a SUB...END SUB
  16858.  subprogram procedure. Using a FUNCTION procedure instead of DEF FN
  16859.  avoids the DEF FN problem described in this article.
  16860.  
  16861.  The following code example demonstrates the problem when run in the
  16862.  QuickBASIC Extended environment (QBX.EXE) that comes with BASIC PDS
  16863.  7.00.
  16864.  
  16865.  Code Example
  16866.  ------------
  16867.  
  16868.  DEF FNa$ = "This is a test string."
  16869.  FOR i% = 1 TO 100
  16870.    PRINT FRE(-1)   ' Show available far heap.
  16871.    PRINT FNa$
  16872.  NEXT
  16873.  
  16874.  Output
  16875.  ------
  16876.  
  16877.   179376
  16878.  This is a test string.
  16879.   179344
  16880.  This is a test string.
  16881.   179328
  16882.  This is a test string.
  16883.   179296
  16884.  This is a test string.
  16885.  
  16886.  
  16887.  290. "Not Enough Memory on Exec" When Using RUN with ISAM File Open
  16888.  
  16889.  Product Version(s): 7.00
  16890.  Operating System:   MS-DOS
  16891.  Flags: ENDUSER | SR# S900525-29 buglist7.00 fixlist7.10
  16892.  Last Modified:  6-AUG-1990    ArticleIdent: Q62815
  16893.  
  16894.  From within the QBX.EXE environment or a compiled program, an attempt
  16895.  to execute a RUN statement while there are open ISAM files results in
  16896.  the run-time error R6007, "Not enough memory on EXEC." The RUN
  16897.  statement is documented as having the ability to close all files;
  16898.  therefore, this error should not occur.
  16899.  
  16900.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  16901.  Professional Development System (PDS) version 7.00 for MS-DOS. This
  16902.  problem was corrected in BASIC PDS version 7.10.
  16903.  
  16904.  To work around the problem in version 7.00, CLOSE all ISAM files
  16905.  before executing a RUN statement.
  16906.  
  16907.  The following code example demonstrates the problem:
  16908.  
  16909.  Code Example
  16910.  ------------
  16911.  
  16912.  TYPE testtype
  16913.    test AS INTEGER
  16914.  END TYPE
  16915.  OPEN "test.dat" FOR ISAM testtype "runexe" AS #1
  16916.  'CLOSE        'If this line is put in, the program will run correctly
  16917.  RUN "test"
  16918.  
  16919.  
  16920.  291. REPAIR.EXE Should Be ISAMREPR.EXE in BASIC 7.00 Error Guide
  16921.  
  16922.  Product Version(s): 7.00 7.10
  16923.  Operating System:   MS-DOS
  16924.  Flags: ENDUSER | docerr SR# S900601-15
  16925.  Last Modified:  8-JAN-1991    ArticleIdent: Q62818
  16926.  
  16927.  In the "Microsoft BASIC 7.0: Language Reference" manual for Microsoft
  16928.  BASIC Professional Development System (PDS) versions 7.00 and 7.10,
  16929.  the error "Database needs repair" at the top of Page 639 incorrectly
  16930.  refers to the file REPAIR.EXE for use in repairing ISAM files. The
  16931.  correct name for this file is ISAMREPR.EXE.
  16932.  
  16933.  The error message summary om Page 639 should be changed read as
  16934.  follows:
  16935.  
  16936.     An OPEN FOR ISAM statement attempted to open a file that is in
  16937.     need of repair. You may want to use the ISAMREPR.EXE utility
  16938.     to recover (restore physical integrity to) the database.
  16939.  
  16940.  
  16941.  292. In SUB, Variable-Length Near String Array Element Losing Value
  16942.  
  16943.  Product Version(s): 7.00   | 7.00
  16944.  Operating System:   MS-DOS | OS/2
  16945.  Flags: ENDUSER | SR# S900603-3 buglist7.00 fixlist7.10
  16946.  Last Modified:  2-NOV-1990    ArticleIdent: Q62820
  16947.  
  16948.  A program compiled with the Near Strings option (without BC /Fs) may
  16949.  lose the value of a variable-length string array element under the
  16950.  specific conditions described in this article.
  16951.  
  16952.  The same program will run correctly when run from the QBX.EXE
  16953.  environment or when compiled with the Far Strings option (with BC
  16954.  /Fs).
  16955.  
  16956.  Microsoft has confirmed this to be a problem with the BC.EXE 7.00
  16957.  compiler provided with Microsoft BASIC Professional Development System
  16958.  (PDS) version 7.00 for MS-DOS and MS OS/2. This problem was corrected
  16959.  in BASIC PDS 7.10.
  16960.  
  16961.  This problem does not occur in earlier versions of Microsoft BASIC
  16962.  Compiler (BC.EXE).
  16963.  
  16964.  Here is a description of the conditions under which the problem occurs
  16965.  (as shown in Examples 1 and 2):
  16966.  
  16967.  Two variable-length string arrays are dimensioned. Array "A" may be
  16968.  dimensioned either dynamically or statically. Array "B" must be
  16969.  dimensioned dynamically. Array "B" will lose a value even though the
  16970.  program never changes it. A string value is assigned to an element in
  16971.  array "B" and this array element is passed as a parameter to a SUB.
  16972.  Array "A" is passed to the same SUB either through a parameter list or
  16973.  by using SHARED in the DIM statement. Inside the SUB, an element in
  16974.  array "A" is directly assigned to a string value returned by the
  16975.  RTRIM$, LTRIM$, LEFT$, MID$, or RIGHT$ function. Array "B" is not
  16976.  assigned any values in the SUB. But when control is returned to the
  16977.  main-level code (or calling procedure), the string value that was
  16978.  assigned to an element in array "B" is lost.
  16979.  
  16980.  The following two examples exhibit the problem. Both examples pass an
  16981.  element in B$() as a parameter variable. In the first example, array
  16982.  A$() is declared globally in a DIM SHARED statement. In the second
  16983.  example, A$() is passed as a parameter to the SUB.
  16984.  
  16985.  Example 1
  16986.  ---------
  16987.  
  16988.  DECLARE SUB TheSub (temp$)
  16989.  REM $DYNAMIC
  16990.  DIM SHARED A$(1)
  16991.  DIM B$(1)
  16992.  B$(1) = "bas"
  16993.  PRINT B$(1)
  16994.  CALL TheSub(B$(1))
  16995.  PRINT B$(1)         'There is no longer anything in B$(1).
  16996.  END
  16997.  
  16998.  SUB TheSub (temp$)
  16999.       A$(1) = RTRIM$("   bob    ")
  17000.  END SUB
  17001.  
  17002.  Example 2
  17003.  ---------
  17004.  
  17005.  DECLARE SUB TheSub (temp1$(), temp2$)
  17006.  REM $DYNAMIC
  17007.  DIM A$(1), B$(1)
  17008.  B$(1) = "bas"
  17009.  PRINT B$(1)
  17010.  CALL TheSub(A$(), B$(1))
  17011.  PRINT B$(1)        'There is no longer anything in B$(1).
  17012.  END
  17013.  
  17014.  SUB TheSub (temp1$(), temp2$)
  17015.       temp1$(1) = RTRIM$("   bob    ")
  17016.  END SUB
  17017.  
  17018.  To work around the problem, alter the program with any one of the
  17019.  following choices:
  17020.  
  17021.  1. Compile with the Far Strings option (BC /Fs).
  17022.  
  17023.  2. Statically dimension the array that loses its value.
  17024.  
  17025.  3. Remove the RTRIM$ statement.
  17026.  
  17027.  4. Assign a temporary string variable to the string returned by
  17028.     RTRIM$, then assign this temporary variable to the desired element
  17029.     in array "B".
  17030.  
  17031.  The next program is an example of using workaround 4 described above:
  17032.  
  17033.  DECLARE SUB TheSub (temp$)
  17034.  REM $DYNAMIC
  17035.  DIM SHARED A$(1)
  17036.  DIM B$(1)
  17037.  B$(1) = "bas"
  17038.  PRINT B$(1)
  17039.  CALL TheSub(B$(1))
  17040.  PRINT B$(1)         'B$(1) now contains the correct value.
  17041.  END
  17042.  
  17043.  SUB TheSub (temp$)
  17044.       dummy$ = RTRIM$("   bob    ")  'Use a temporary string variable
  17045.       A$(1) = dummy$                 'to work around the problem.
  17046.  END SUB
  17047.  
  17048.  
  17049.  293. BOOKLOOK "...Forgot ISAM TSR" Despite PROISAM.EXE Being Loaded
  17050.  
  17051.  Product Version(s): 7.00
  17052.  Operating System:   MS-DOS
  17053.  Flags: ENDUSER | SR# S900531-18
  17054.  Last Modified: 20-JUN-1990    ArticleIdent: Q62829
  17055.  
  17056.  The BOOKLOOK sample program from Microsoft BASIC Professional
  17057.  Development System (PDS) version 7.00 displays the misleading error
  17058.  message, "You forgot to load the ISAM TSR program," when the file
  17059.  BOOKS.MDB is not in the current directory, even though PROISAM.EXE is
  17060.  loaded.
  17061.  
  17062.  To correct for this error, run BOOKLOOK from the directory that
  17063.  contains BOOKS.MDB, or run PROISAMD.EXE instead of PROISAM.EXE.
  17064.  
  17065.  This information applies to Microsoft BASIC Professional Development
  17066.  System (PDS) version 7.00.
  17067.  
  17068.  The message is shown this way because this is the message printed
  17069.  whenever a "Feature Unavailable" error (ERR=73) occurs in BOOKLOOK's
  17070.  error handler. BOOKLOOK is made to run with BOOKS.MDB already created;
  17071.  therefore, the only reason "Feature Unavailable" would occur in that
  17072.  case is if the PROISAM TSR is not loaded.
  17073.  
  17074.  PROISAM.EXE allows you to access existing ISAM files, but does not
  17075.  allow you to create files, tables, or indexes. To do this, you must
  17076.  use PROISAMD.EXE. This explains why loading PROISAMD instead of
  17077.  PROISAM corrects the error with BOOKLOOK.
  17078.  
  17079.  
  17080.  294. X=(-1*W)^2 Gives "Division by Zero" on 386 with 387; BASIC 7.1
  17081.  
  17082.  Product Version(s): 7.00 7.10 | 7.00 7.10
  17083.  Operating System:   MS-DOS    | OS/2
  17084.  Flags: ENDUSER | buglist7.00 buglist7.10
  17085.  Last Modified:  6-AUG-1990    ArticleIdent: Q62830
  17086.  
  17087.  Executing the following line of code on a 80386 machine equipped with
  17088.  an 80387 math coprocessor results in a "Division by zero" error:
  17089.  
  17090.     X = (-1 * W) ^ 2
  17091.  
  17092.  The "Division by zero" error occurs in both the QBX.EXE environment
  17093.  and within a compiled .EXE in Microsoft BASIC Professional Development
  17094.  System (PDS) versions 7.00 and 7.10. The error occurs only on 80386
  17095.  computers with 80387 coprocessors.
  17096.  
  17097.  Microsoft has confirmed this to be a problem with Microsoft BASIC
  17098.  Professional Development System (PDS) versions 7.00 and 7.10 for
  17099.  MS-DOS and MS OS/2. We are researching this problem and will post new
  17100.  information here as it becomes available. This problem does not occur
  17101.  with other Microsoft BASIC products.
  17102.  
  17103.  The following are two workarounds for the above problem:
  17104.  
  17105.  1. Use the DOS command SET NO87=NONE to disable BASIC's use of the 387
  17106.     coprocessor. The program will then execute correctly. Note that
  17107.     disabling BASIC's use of the coprocessor usually slows program
  17108.     execution.
  17109.  
  17110.  2. Change the line of code into two lines, using a temporary variable
  17111.     to hold the value of (-1 * W), as follows:
  17112.  
  17113.        TEMP = (-1 * W)
  17114.        X = TEMP ^ 2
  17115.  
  17116.  
  17117.  295. 7.00 CREATEINDEX Example Gives "No Current Record" at Run-Time
  17118.  
  17119.  Product Version(s): 7.00 7.10
  17120.  Operating System:   MS-DOS
  17121.  Flags: ENDUSER | docerr SR# S900606-48
  17122.  Last Modified:  8-JAN-1991    ArticleIdent: Q62832
  17123.  
  17124.  Running the sample program on Page 73 of the "Microsoft BASIC 7.0:
  17125.  Language Reference" manual returns a run-time error of 85, "no current
  17126.  record," on the RETRIEVE statement.
  17127.  
  17128.  The code should be changed as shown below for the program to run
  17129.  correctly.
  17130.  
  17131.  This information applies to Microsoft BASIC Professional Development
  17132.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  17133.  
  17134.  The sample program found on Page 73 uses a file called BOOKS.MDB, the
  17135.  sample ISAM file that SETUP copies to your disk. However, in this
  17136.  program, the user-defined type, BookRec, does not match the record
  17137.  structure used in BOOKS.MDB. Also the program specifies a table name
  17138.  that does not exist in BOOKS.MDB.
  17139.  
  17140.  The user-defined type, BookRec, should be defined as follows:
  17141.  
  17142.     TYPE BookRec
  17143.        IDNum AS DOUBLE
  17144.        Price AS CURRENCY
  17145.        Edition AS INTEGER
  17146.        Title AS STRING * 50
  17147.        Publisher AS STRING * 50
  17148.        Author AS STRING * 36
  17149.  
  17150.  In addition, the table name should be defined as "BookStock" instead
  17151.  of "BooksStock".
  17152.  
  17153.  The corrected program is as follows:
  17154.  
  17155.  DEFINT A-Z
  17156.  TYPE BookRec                   'altered user-defined type
  17157.     IDNum AS DOUBLE
  17158.     Price AS CURRENCY
  17159.     Edition AS INTEGER
  17160.     Title AS STRING * 50
  17161.     Publisher AS STRING * 50
  17162.     Author AS STRING * 36
  17163.  END TYPE
  17164.  
  17165.  DIM Library AS BookRec
  17166.  DIM msgtxt AS STRING
  17167.  
  17168.  CONST Database = "BOOKS.MDB"
  17169.  CONST TableName = "BookStock" 'TableName = BookStock (not BooksStock)
  17170.  TableNum = FREEFILE
  17171.  
  17172.  OPEN Database FOR ISAM BookRec TableName AS TableNum
  17173.  CREATEINDEX TableNum, "A", 0, "Author"
  17174.  CREATEINDEX TableNum, "I", 1, "IDNum"
  17175.  CREATEINDEX TableNum, "T", 0, "Title"
  17176.  CREATEINDEX TableNum, "C", 0, "Price"
  17177.  SETINDEX #1, "A"
  17178.  CLS : LOCATE 13, 30
  17179.  PRINT "choose a key:"
  17180.  PRINT SPC(9); "move to:"; TAB(49); " order by: X "
  17181.  PRINT : PRINT SPC(9); "F - first record"; TAB(49); "A - Author"
  17182.  PRINT : PRINT SPC(9); "L - last record"; TAB(49); "I - ID number"
  17183.  PRINT : PRINT SPC(9); "N - next record"; TAB(49); "T - Title"
  17184.  PRINT : PRINT SPC(9); "P - previous record"; TAB(49); "C - Cost"
  17185.  PRINT : PRINT SPC(9); "Q - Quit"; TAB(49); "X- no order"
  17186.  LOCATE 3, 1: PRINT TAB(37); Books; ""
  17187.  PRINT STRING$(80, "-");
  17188.  VIEW PRINT 5 TO 10
  17189.  
  17190.  MOVEFIRST TableNum
  17191.  DO
  17192.      CLS
  17193.      RETRIEVE TableNum, Library
  17194.      PRINT "Author:   "; Library.Author;
  17195.      PRINT TAB(49); "ID #"; Library.IDNum
  17196.      PRINT "Title:      "; Library.Title
  17197.      PRINT "Publisher: "; Library.Publisher
  17198.      PRINT "cost:     "; Library.Price
  17199.      PRINT SPC(30); msgtxt
  17200.      PRINT STRING$(64, "-")
  17201.      IF GETINDEX$(TableNum) = "" THEN
  17202.           PRINT STRING$(15, "-");
  17203.      ELSE
  17204.           PRINT "index in use: "; GETINDEX$(TableNum);
  17205.      END IF
  17206.  
  17207.       validkeys$ = "FLNPQATICX"
  17208.       DO
  17209.           keychoice$ = UCASE$(INKEY$)
  17210.       LOOP WHILE INSTR(validkeys$, keychoice$) = 0 OR keychoice$ = ""
  17211.       msgtxt = ""
  17212.  
  17213.       SELECT CASE keychoice$
  17214.       CASE "F"
  17215.           MOVEFIRST TableNum
  17216.       CASE "L"
  17217.           MOVELAST TableNum
  17218.       CASE "N"
  17219.           MOVENEXT TableNum
  17220.           IF EOF(TableNum) THEN
  17221.               MOVELAST TableNum
  17222.               BEEP: msgtxt = "** at last record **"
  17223.           END IF
  17224.       CASE "P"
  17225.           MOVEPREVIOUS TableNum
  17226.           IF BOF(TableNum) THEN
  17227.               MOVEFIRST TableNum
  17228.               BEEP: msgtxt = "** at first record **"
  17229.           END IF
  17230.      CASE "Q"
  17231.           EXIT DO
  17232.      CASE ELSE
  17233.           VIEW PRINT
  17234.           LOCATE 13, 59: PRINT keychoice$;
  17235.           VIEW PRINT 5 TO 10
  17236.           IF keychoice$ = "X" THEN keychoice$ = ""
  17237.           SETINDEX TableNum, keychoice$
  17238.           MOVEFIRST TableNum
  17239.       END SELECT
  17240.  LOOP
  17241.  
  17242.  VIEW PRINT
  17243.  DELETEINDEX TableNum, "A"
  17244.  DELETEINDEX TableNum, "I"
  17245.  DELETEINDEX TableNum, "T"
  17246.  DELETEINDEX TableNum, "C"
  17247.  CLOSE
  17248.  END
  17249.  
  17250.  
  17251.  296. No Array Bounds Checking for Arrays in TYPEs in BC 7.00 .EXE
  17252.  
  17253.  Product Version(s): 7.00   | 7.00
  17254.  Operating System:   MS-DOS | OS/2
  17255.  Flags: ENDUSER | docerr SR# S900521-23
  17256.  Last Modified: 12-JUN-1990    ArticleIdent: Q62833
  17257.  
  17258.  In Microsoft BASIC Professional Development System (PDS) version 7.00,
  17259.  the run-time error checking code inserted by the BC /D compiler switch
  17260.  does not perform array bounds checking for arrays embedded inside
  17261.  user-defined TYPEs. However, this checking is performed inside the
  17262.  QBX.EXE environment. This is not a problem with the BC.EXE compiler
  17263.  but a design limitation. The overhead required for the check would
  17264.  cause speed degradation and a size increase for an .EXE file.
  17265.  
  17266.  This information applies to Microsoft BASIC Professional Development
  17267.  System (PDS) version 7.00 for MS-DOS and MS OS/2.
  17268.  
  17269.  The BC /D compiler switch (Run-time error checking) inserts array
  17270.  bounds checking in a module. Whenever an access on an array is
  17271.  attempted with an illegal subscript, the message "Subscript out of
  17272.  range" is generated. Without /D, this type of error goes undetected
  17273.  under DOS and will most likely result in the corruption of other data.
  17274.  It can also cause corruption of code or possibly even parts of the
  17275.  operating system itself, which could cause unpredictable results,
  17276.  including hanging the machine. Under OS/2, an error of this type would
  17277.  cause a protection violation and abort the program. The /D switch
  17278.  performs array bounds checking on arrays that are NOT embedded in
  17279.  user-defined TYPEs, but won't for arrays that ARE embedded in types.
  17280.  However, in the QBX.EXE environment, the checking is done for all
  17281.  arrays.
  17282.  
  17283.  For example, the following program generates a "Subscript out of
  17284.  range" error in the QBX.EXE environment, but does not when compiled
  17285.  with the /D switch:
  17286.  
  17287.     TYPE aType
  17288.        Array (1 TO 100) AS INTEGER
  17289.     END TYPE
  17290.  
  17291.     DIM aVar as aType
  17292.  
  17293.     aVar.Array(1000) = 1000   '1000 as a subscript is out of range
  17294.  
  17295.  
  17296.  297. "Out of Stack Space" with ON ERROR, REDIM, GOSUB, Then ERASE
  17297.  
  17298.  Product Version(s): 7.00 7.10 | 7.00 7.10
  17299.  Operating System:   MS-DOS    | OS/2
  17300.  Flags: ENDUSER | buglist7.00 buglist7.10 SR# S900603-4
  17301.  Last Modified:  6-AUG-1990    ArticleIdent: Q62892
  17302.  
  17303.  When compiled with the Far Strings option (BC /FS) and run as a .EXE
  17304.  program, the program below results in the message "Out of stack space
  17305.  in line 4." This problem does not occur when the program is run in the
  17306.  QBX.EXE environment or when it is compiled with the Near Strings
  17307.  option and run. It also does not occur when lines 1 and 9 are removed,
  17308.  when line 4 is removed, or when the number of arrays erased is
  17309.  decreased by one or more.
  17310.  
  17311.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  17312.  Professional Development System (PDS) versions 7.00 and 7.10 for
  17313.  MS-DOS and MS OS/2. We are researching this problem and will post new
  17314.  information here as it becomes available.
  17315.  
  17316.  Code Example
  17317.  ------------
  17318.  
  17319.     1 ON ERROR GOTO 9
  17320.     2 FOR i% = 1 TO 100
  17321.     3   REDIM a$(1), b$(1), c$(1)
  17322.     4   GOSUB 8
  17323.     5   ERASE a$, b$, c$
  17324.     6 NEXT i%
  17325.     7 END
  17326.     8 RETURN
  17327.     9 RESUME
  17328.  
  17329.  
  17330.  298. BASIC 7.00 SETMEM Example Uses malloc/free; Should Be halloc
  17331.  
  17332.  Product Version(s): 7.00 7.10
  17333.  Operating System:   MS-DOS
  17334.  Flags: ENDUSER | SR# S900607-93 docerr
  17335.  Last Modified:  8-JAN-1991    ArticleIdent: Q63003
  17336.  
  17337.  The example for the SETMEM() function on Page 333 of the "Microsoft
  17338.  BASIC 7.0: Language Reference" manual (for 7.00 and 7.10) incorrectly
  17339.  uses the C malloc() and free() functions to allocate and free memory
  17340.  instead of the correct halloc() and hfree() functions.
  17341.  
  17342.  This information applies to Microsoft BASIC Professional Development
  17343.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  17344.  
  17345.  To be able to free memory for BASIC to reallocate, it is necessary to
  17346.  use the heap functions [halloc() and hfree()] instead of normal memory
  17347.  allocation functions. If SETMEM() is used to reallocate memory for
  17348.  BASIC after using free(), no memory will be reallocated. With hfree(),
  17349.  the memory will be returned for use with BASIC.
  17350.  
  17351.  For more information on using SETMEM() with C functions, query on the
  17352.  following keywords:
  17353.  
  17354.     SETMEM and halloc
  17355.  
  17356.  Code Example
  17357.  ------------
  17358.  
  17359.  The corrected C code for the SETMEM() example is as follows:
  17360.  
  17361.  void far cfunc(bytes)
  17362.  int bytes;
  17363.  {
  17364.      char *halloc();
  17365.      char *workspace;
  17366.  
  17367.      /* Allocate working memory (halloc) using amount BASIC freed. */
  17368.      workspace=halloc((unsigned) bytes, 1);
  17369.  
  17370.      /* Working space would be used here. */
  17371.  
  17372.      /* Free memory (hfree) before returning to BASIC */
  17373.      hfree(workspace);
  17374.  }
  17375.  
  17376.  Note: The C code must be compiled using the huge model (/AH).
  17377.  
  17378.  
  17379.  299. "Unknown Symbol" Setting Breakpoint on Label in CodeView 3.00
  17380.  
  17381.  Product Version(s): 6.00 6.00b 7.00 | 6.00 6.00b 7.00
  17382.  Operating System:   MS-DOS          | OS/2
  17383.  Flags: ENDUSER | SR# S900606-93 B_QuickBas S_CodeView
  17384.  Last Modified: 20-JUN-1990    ArticleIdent: Q63009
  17385.  
  17386.  When debugging a BASIC program in Microsoft CodeView, a breakpoint
  17387.  can be set on a BASIC label by typing the following command
  17388.  
  17389.     BP <label>
  17390.  
  17391.  where <label> is any valid BASIC label. In CodeView versions 2.x, this
  17392.  command works whether or not the program is started. In CodeView
  17393.  version 3.00, the program must have started executing before this
  17394.  command will work. If the program has not been started, CodeView 3.00
  17395.  generates the error message "Unknown symbol."
  17396.  
  17397.  This information applies to programs run under CV.EXE and CVP.EXE
  17398.  versions 2.x and 3.00 when compiled with the BC.EXE compiler that
  17399.  comes with QuickBASIC versions 4.00, 4.00b, and 4.50, with Microsoft
  17400.  BASIC Compiler versions 6.00 and 6.00b for MS-DOS and MS OS/2, or with
  17401.  Microsoft BASIC Professional Development System (PDS) version 7.00 for
  17402.  MS-DOS and MS OS/2.
  17403.  
  17404.  Breakpoints can also be set in four other ways. Each of the following
  17405.  methods can be used before the program is actually started:
  17406.  
  17407.  1. Use the following command
  17408.  
  17409.        bp .<line>
  17410.  
  17411.     where <line> is the line number that CodeView displays next to the
  17412.     label (not a BASIC line number). This works whether or not the
  17413.     program is started.
  17414.  
  17415.  2. Use the mouse to double-click the line you want to break on.
  17416.  
  17417.  3. Position the cursor on the line you want to break on and then
  17418.     choose Set Breakpoint from the Watch menu.
  17419.  
  17420.  4. Position the cursor on the line you want to break on and then press
  17421.     the F9 key.
  17422.  
  17423.  
  17424.  300. Cannot Display Array Pointer or Full BASIC Array with CodeView
  17425.  
  17426.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  17427.  Operating System:   MS-DOS               | OS/2
  17428.  Flags: ENDUSER | SR# S900606-86 B_QuickBas S_CodeView
  17429.  Last Modified:  5-SEP-1990    ArticleIdent: Q63010
  17430.  
  17431.  The BC.EXE compiler in QuickBASIC versions 4.00, 4.00b, and 4.50, in
  17432.  Microsoft BASIC Compiler versions 6.00 and 6.00b, and in Microsoft
  17433.  BASIC Professional Development System (PDS) versions 7.00 and 7.10 can
  17434.  create programs that will run under Microsoft CodeView versions 2.x
  17435.  and 3.00. However, arrays or arrays in TYPEd records give "?CANNOT
  17436.  DISPLAY" for the CodeView commands ?, ??, or w?. This is not a problem
  17437.  with either the BASIC compiler or CodeView, but represents a
  17438.  limitation of debugging BASIC programs in CodeView.
  17439.  
  17440.  This information applies to programs run under CV.EXE and CVP.EXE 2.x
  17441.  and 3.00 when compiled with the BC.EXE compiler that comes with
  17442.  QuickBASIC versions 4.00, 4.00b, and 4.50, Microsoft BASIC Compiler
  17443.  versions 6.00 and 6.00b for MS-DOS and MS OS/2, and Microsoft BASIC
  17444.  PDS versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  17445.  
  17446.  In CodeView, the ? command is used to display an expression. The ??
  17447.  command is used to graphically view a variable in a dialog box. ??
  17448.  will expand a variable, such as a TYPEd record, to show the fields and
  17449.  the value currently assigned to each field.
  17450.  
  17451.  This limitation also applies to the CodeView 3.00 command ??, where
  17452.  the graphical display (??) can expand the elements of an array. For
  17453.  example, an array in C (int intarray[10];) can be displayed as a far
  17454.  pointer with ? and expanded to its elements with ??. With CodeView 2.x
  17455.  and C version 5.10, the ?? command won't display the elements of a C
  17456.  array, but will display the far pointer value that is the array's
  17457.  address.
  17458.  
  17459.  
  17460.  301. LINK /F of Overlaid BRT70xx Program Causes "Invalid Runtime"
  17461.  
  17462.  Product Version(s): 7.00
  17463.  Operating System:   MS-DOS
  17464.  Flags: ENDUSER | SR# S900615-62 buglist7.00 fixlist7.10
  17465.  Last Modified:  6-AUG-1990    ArticleIdent: Q63040
  17466.  
  17467.  LINK-overlaid programs using the BRT70xxx.EXE run-time module from
  17468.  Microsoft BASIC Professional Development System (PDS) version 7.00
  17469.  should not be LINKed with the /F (/FARCALLTRANSLATION) option. When
  17470.  this is done, a CALL to an overlay causes an attempt to reload the
  17471.  run-time module. This results in an "Invalid runtime module" message
  17472.  and, in most cases, the machine hangs.
  17473.  
  17474.  To work around this problem, LINK without the /F option or compile
  17475.  for a stand-alone .EXE (with the BC /O option).
  17476.  
  17477.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  17478.  version 7.00. This problem does not occur in BASIC PDS 7.10.
  17479.  
  17480.  The /F (/FARCALLTRANSLATION) LINK option is described on Page 241 of
  17481.  the "Microsoft CodeView 2.3 and Utilities User's Guide" for Microsoft
  17482.  BASIC PDS version 7.00 for MS-DOS. Using this option may produce a
  17483.  slight gain in speed and size of executables by translating far calls
  17484.  to near calls. However, attempts to optimize overlaid calls cause a
  17485.  problem with the run-time module. Thus, /F should not be used with an
  17486.  overlaid program that is using the run-time module.
  17487.  
  17488.  Code Example
  17489.  ------------
  17490.  
  17491.  The following programs (which are separate .BAS source files)
  17492.  compose a simple overlaid program that demonstrates the problem:
  17493.  
  17494.  CALLOVL.BAS
  17495.  -----------
  17496.  
  17497.  INPUT "Call overlay (Y/N)? ",i$
  17498.  IF ((i$ = "Y") OR (i$ = "y")) THEN CALL test
  17499.  END
  17500.  
  17501.  OVL.BAS    **** NOTE: This is a file separate from the above file!
  17502.  -------
  17503.  
  17504.  SUB test
  17505.    PRINT "in overlay"
  17506.  END SUB
  17507.  
  17508.  The following are the compile and LINK lines to demonstrate the
  17509.  problem with the above separate modules:
  17510.  
  17511.     BC CALLOVL;
  17512.     BC OVL;
  17513.     LINK /F CALLOVL+(OVL);
  17514.  
  17515.  These programs can be run properly if either /O is added to each BC
  17516.  command line or the /F is omitted from the LINK line.
  17517.  
  17518.  
  17519.  302. Overlaid Modules Loaded into EM Only When 1st Overlay Called
  17520.  
  17521.  Product Version(s): 7.00 7.10
  17522.  Operating System:   MS-DOS
  17523.  Flags: ENDUSER | SR# S900608-158
  17524.  Last Modified:  5-SEP-1990    ArticleIdent: Q63161
  17525.  
  17526.  When using expanded memory with an overlaid program, the overlaid
  17527.  modules are not loaded when the EXE file is invoked. They remain on
  17528.  disk until the first overlay is called. When this occurs, all the
  17529.  overlaid modules are loaded from disk into expanded memory. From then
  17530.  on, the overlays are swapped to and from expanded memory and the disk
  17531.  is no longer needed for that purpose.
  17532.  
  17533.  This information applies to Microsoft BASIC Professional Development
  17534.  System (PDS) versions 7.00 and 7.10.
  17535.  
  17536.  For more information about using linker overlays in BASIC PDS 7.00 and
  17537.  7.10, search for a separate article in this Knowledge Base with the
  17538.  following words:
  17539.  
  17540.     LINK and overlays and expanded and memory and BASIC
  17541.  
  17542.  To demonstrate this characteristic of BASIC overlays, boot up with an
  17543.  Lotus/Intel/Microsoft (LIM) version 4.0 Expanded Memory Specification
  17544.  (EMS) device driver and compile and link the three modules below as
  17545.  follows:
  17546.  
  17547.     bc main;
  17548.     bc overlay1;
  17549.     bc overlay2;
  17550.  
  17551.     link main+(overlay1)+(overlay2);
  17552.  
  17553.  MAIN.BAS
  17554.  --------
  17555.  
  17556.     '* Note: The disk activity will be most obvious if this test
  17557.     '        is run on a floppy drive.
  17558.     PRINT "MAIN"
  17559.     PRINT "HIT ANY KEY TO LOAD OVERLAYS INTO EMS"
  17560.     SLEEP
  17561.     CALL ovl1
  17562.     PRINT "OVERLAYS LOADED"
  17563.     PRINT "HIT ANY KEY TO CALL SECOND OVERLAY"
  17564.     PRINT "THERE SHOULD BE NO DISK ACTIVITY IF YOU HAVE EMS"
  17565.     SLEEP
  17566.     CALL ovl2
  17567.     PRINT "HIT ANY KEY TO END THE PROGRAM"
  17568.     SLEEP
  17569.     END
  17570.  
  17571.  OVERLAY1.BAS
  17572.  ------------
  17573.  
  17574.     SUB ovl1
  17575.        PRINT "OVERLAY1"
  17576.     END SUB
  17577.  
  17578.  OVERLAY2.BAS
  17579.  ------------
  17580.  
  17581.     SUB ovl2
  17582.        PRINT "OVERLAY2"
  17583.     END SUB
  17584.  
  17585.  When run, the resulting EXE file (MAIN.EXE) produces the following
  17586.  output:
  17587.  
  17588.     MAIN
  17589.     OVERLAY1
  17590.     OVERLAY2
  17591.  
  17592.  However, before "OVERLAY1" is displayed, there will be disk activity
  17593.  while the code for overlay1 is loaded into the overlay area of
  17594.  conventional memory (for execution) and overlay2 is loaded into
  17595.  expanded memory. To see this clearly, run MAIN.EXE from a floppy
  17596.  drive. When overlay2 is called, there will be no disk activity because
  17597.  it will be swapped in from expanded memory.
  17598.  
  17599.  Note that this is not a problem with BASIC PDS 7.00 or 7.10, but a
  17600.  feature of the overlay manager. However, it can present a speed
  17601.  problem for applications that rely on the quickness of swapping from
  17602.  expanded memory for the first-called overlay. To work around this,
  17603.  make the first executable statement in your program a CALL to an
  17604.  additional overlay with no code in it. When it is called, all the
  17605.  other overlays will be loaded into expanded memory. The functionality
  17606.  and speed of the application will remain intact while the difference
  17607.  in EXE size and load time will be minimal.
  17608.  
  17609.  For example, the module MAIN.BAS above would be modified as follows:
  17610.  
  17611.     CALL loadovls
  17612.     PRINT "MAIN"
  17613.     CALL ovl1
  17614.     CALL ovl2
  17615.     END
  17616.  
  17617.  The subprogram "loadovls" (meaning "load overlays") would be coded as
  17618.  the following:
  17619.  
  17620.     SUB loadovls
  17621.     END SUB
  17622.  
  17623.  When loadovls is called, the code for overlay1 and overlay2 will be
  17624.  loaded into expanded memory. This eliminates the disk activity between
  17625.  the display of "MAIN" and "OVERLAY1".
  17626.  
  17627.  
  17628.  303. When Out of Memory in QBX 7.00, Instant Watch Reruns Program
  17629.  
  17630.  Product Version(s): 7.00 7.10
  17631.  Operating System:   MS-DOS
  17632.  Flags: ENDUSER | buglist7.00 buglist7.10 SR# S900606-88
  17633.  Last Modified:  6-AUG-1990    ArticleIdent: Q63195
  17634.  
  17635.  Trying to set an Instant Watch variable on a large variable-length
  17636.  string in QBX.EXE can cause QBX to restart the program from the
  17637.  beginning if the program is almost out of memory. When the program is
  17638.  almost out of memory, QBX fails to add the watch and instead reruns
  17639.  the program.
  17640.  
  17641.  Microsoft has confirmed this to be a problem with the QBX.EXE
  17642.  environment that comes with Microsoft BASIC Professional Development
  17643.  System (PDS) versions 7.00 and 7.10 for MS-DOS. We are researching
  17644.  this problem and will post new information here as it becomes
  17645.  available.
  17646.  
  17647.  To reproduce the problem, the following conditions must be duplicated:
  17648.  
  17649.  1. There must be less than 15K of memory free. Use PRINT FRE(-1) to
  17650.     show this.
  17651.  
  17652.  2. Create a large string, such as the following:
  17653.  
  17654.        a$=STRING$(10000,62)
  17655.  
  17656.  3. Stop the program just after the string is assigned. For instance,
  17657.     step through the program with the F8 key, or put a breakpoint on
  17658.     the line after you create the string.
  17659.  
  17660.  4. Move the cursor back up to the string variable.
  17661.  
  17662.  5. Press SHIFT+F9 to set an Instant Watch.
  17663.  
  17664.  6. If QBX allows you to set the watch, either decrease the amount of
  17665.     free memory, or keep setting Instant Watches on the same variable.
  17666.     Eventually, QBX will fail to add the watch, and will rerun the
  17667.     program from the beginning.
  17668.  
  17669.  Code Example
  17670.  ------------
  17671.  
  17672.  Use the above steps to reproduce the problem with the code below. The
  17673.  following code was used to reproduce this problem on a machine where
  17674.  CHKDSK.COM showed 508,200 bytes free:
  17675.  
  17676.     REM $DYNAMIC
  17677.     CLEAR
  17678.     REDIM array1(19000) AS DOUBLE
  17679.     PRINT
  17680.     a$ = STRING$(10000, 33)
  17681.     PRINT a$       ' Stop the program here. Move the cursor to a$.
  17682.     PRINT FRE(-1)  ' Press SHIFT+F9 several times.
  17683.     PRINT
  17684.     PRINT
  17685.     PRINT
  17686.     PRINT
  17687.     PRINT
  17688.     PRINT
  17689.  
  17690.  
  17691.  304. Using PWB with Both BASIC PDS 7.10 and C PDS 6.00
  17692.  
  17693.  Product Version(s): 7.10   | 7.10
  17694.  Operating System:   MS-DOS | OS/2
  17695.  Flags: ENDUSER | SR# S900618-153 S_C S_PWB
  17696.  Last Modified:  6-SEP-1990    ArticleIdent: Q63197
  17697.  
  17698.  The Programmer's WorkBench (PWB) is designed as a multilanguage,
  17699.  project-oriented development environment for MS-DOS and MS OS/2.
  17700.  
  17701.  The key to each language's interface into PWB is the .HLP files and
  17702.  the .MXT files for MS-DOS and the .PXT files for MS OS/2. The .HLP
  17703.  files are the help files for each language product. The .MXT and .PXT
  17704.  files are PWB extensions for each language that define menus and
  17705.  dialog boxes for each compiler. Thus, to use PWB with both BASIC and
  17706.  C, you must copy the PWBC.MXT file (for MS-DOS) or PWBC.PXT file (for
  17707.  MS OS/2) into the directory containing the BASIC PWB.EXE file, and SET
  17708.  the HELPFILES environment variable to find both the C and BASIC help
  17709.  files.
  17710.  
  17711.  This information applies to Microsoft BASIC Professional Development
  17712.  System (PDS) version 7.10 and to Microsoft C PDS version 6.00 for
  17713.  MS-DOS and MS OS/2.
  17714.  
  17715.  
  17716.  305. Main Module Must Be First BASIC File in Program List for PWB
  17717.  
  17718.  Product Version(s): 7.10   | 7.10
  17719.  Operating System:   MS-DOS | OS/2
  17720.  Flags: ENDUSER | SR# S900618-147 S_PWB PWB
  17721.  Last Modified:  5-SEP-1990    ArticleIdent: Q63198
  17722.  
  17723.  The main module in a multiple-module program must be listed as the
  17724.  first BASIC source file in the Program List for PWB.EXE (the
  17725.  Programmer's WorkBench) to properly make the EXE file. If a
  17726.  supporting module is listed first, its module-level code (virtually
  17727.  nonexistent in most cases) is treated as the main entry point. This
  17728.  produces an EXE that is approximately the correct size, but does
  17729.  nothing.
  17730.  
  17731.  To convert a given module in the Program List to the main module,
  17732.  choose that module in the Edit Program List dialog and choose the To
  17733.  Top Of List button.
  17734.  
  17735.  This information applies to Microsoft BASIC Professional Development
  17736.  System (PDS) version 7.10 for MS-DOS and MS OS/2.
  17737.  
  17738.  For example, to make a Program List containing everything necessary
  17739.  for the UIDEMO example program, UIDEMO.BAS must be listed at the
  17740.  beginning of the BASIC files list. The incorrect and correct orders
  17741.  are demonstrated below.
  17742.  
  17743.  The following order of files does NOT create a working UIDEMO.EXE:
  17744.  
  17745.     GENERAL.BAS
  17746.     MENU.BAS
  17747.     MOUSE.BAS
  17748.     UIDEMO.BAS
  17749.     WINDOW.BAS
  17750.     UIASM.OBJ
  17751.     QBX.LIB
  17752.  
  17753.  The above order does not work because GENERAL is taken as the main
  17754.  module. Since GENERAL.BAS has no executable statements at the module
  17755.  level, the program does nothing when run.
  17756.  
  17757.  The correct order must have UIDEMO.BAS first:
  17758.  
  17759.     UIDEMO.BAS
  17760.     GENERAL.BAS
  17761.     MENU.BAS
  17762.     MOUSE.BAS
  17763.     WINDOW.BAS
  17764.     UIASM.OBJ
  17765.     QBX.LIB
  17766.  
  17767.  
  17768.  306. BUILDRTM with PROISAM(D) Must Have OBJ and LIB in Export List
  17769.  
  17770.  Product Version(s): 7.00 7.10
  17771.  Operating System:   MS-DOS
  17772.  Flags: ENDUSER | SR# S900620-71
  17773.  Last Modified: 17-JAN-1991    ArticleIdent: Q63268
  17774.  
  17775.  To build ISAM support into a custom run-time module (instead of using
  17776.  ISAM from the separate TSR program), you must specify in BUILDRTM's
  17777.  Export List file both the object (.OBJ) and library (.LIB) forms of
  17778.  your chosen ISAM library (PROISAM or PROISAMD). If either the object
  17779.  or library form is left out of the Export List file, LINK.EXE flags
  17780.  numerous occurrences of L2025 ("Symbol defined more than once") and
  17781.  L2029 ("Unresolved external").
  17782.  
  17783.  This information applies to Microsoft BASIC Professional Development
  17784.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  17785.  
  17786.  The following Export List file (arbitrarily named ISAM.EXP) shows the
  17787.  files that need to be specified to put PROISAMD into a custom run-time
  17788.  module:
  17789.  
  17790.     # ISAM.EXP
  17791.     #OBJECTS
  17792.     PROISAMD.OBJ
  17793.     # (specify additional OBJs here)
  17794.     #LIBRARIES
  17795.     PROISAMD.LIB
  17796.  
  17797.  The command line to build the custom run-time module specified by the
  17798.  above Export List file is as follows:
  17799.  
  17800.     BUILDRTM /LR ISAMRUN ISAM.EXP
  17801.  
  17802.  This BUILDRTM command outputs three files: IMPORT.OBJ and ISAMRUN.LIB
  17803.  (used to resolve LINK references to your custom run-time module) and
  17804.  ISAMRUN.EXE (your custom run-time module).
  17805.  
  17806.  To LINK the above run-time module to a BASIC program, use the
  17807.  following LINK command:
  17808.  
  17809.     LINK IMPORT.OBJ+yourfile.OBJ,yourfile.EXE,,ISAMRUN.LIB;
  17810.  
  17811.  For more information about using BUILDRTM.EXE, see Chapter 21,
  17812.  "Building Custom Run-Time Modules," in the "Microsoft BASIC 7.0:
  17813.  Programmer's Guide" for 7.00 and 7.10.
  17814.  
  17815.  
  17816.  307. B_OVREMAP in 7.00 Programmer's Guide Should Be B_OVLREMAP
  17817.  
  17818.  Product Version(s): 7.00 7.10
  17819.  Operating System:   MS-DOS
  17820.  Flags: ENDUSER | SR# S900613-56 docerr
  17821.  Last Modified: 16-JAN-1991    ArticleIdent: Q63422
  17822.  
  17823.  Page 613 of "Microsoft BASIC 7.0: Programmer's Guide" (for versions
  17824.  7.00 and 7.10) incorrectly refers to the B_OVREMAP routine. This
  17825.  routine (contained in the BASIC run-time) is actually named
  17826.  B_OVLREMAP.
  17827.  
  17828.  This information applies to Microsoft BASIC Professional Development
  17829.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  17830.  
  17831.  The B_OVLREMAP routine is used to remap the overlays in expanded
  17832.  memory after the state has changed. To use this from a BASIC program,
  17833.  you must map the name to a usable SUB name using the ALIAS keyword in
  17834.  the DECLARE SUB line.
  17835.  
  17836.  Code Example
  17837.  ------------
  17838.  
  17839.  The following code example demonstrates the use of the B_OVLREMAP
  17840.  routine:
  17841.  
  17842.     DECLARE SUB OvlReMap ALIAS "B_OVLREMAP"
  17843.     SHELL             'Do something to expanded memory in the SHELL
  17844.     CALL OvlReMap     'Remap overlays in expanded memory after SHELL
  17845.     END
  17846.  
  17847.  
  17848.  308. How to Set Up Programmer's WorkBench (PWB) for BASIC PDS 7.10
  17849.  
  17850.  Product Version(s): 7.10   | 7.10
  17851.  Operating System:   MS-DOS | OS/2
  17852.  Flags: ENDUSER | SR# S900702-109 s_pwb
  17853.  Last Modified:  5-SEP-1990    ArticleIdent: Q63623
  17854.  
  17855.  The following information applies to Microsoft BASIC Professional
  17856.  Development System (PDS) version 7.10 for MS-DOS and MS OS/2.
  17857.  
  17858.  To successfully begin using the Programmer's WorkBench (PWB.EXE), you
  17859.  must make several changes in your environment, as follows:
  17860.  
  17861.  1. The file NEW-VARS.BAT (a batch file for MS-DOS) or NEW-VARS.CMD (a
  17862.     command file for MS OS/2) must be executed before using PWB.EXE.
  17863.     These files are located in the BC7\BIN directory (for MS-DOS) or
  17864.     BC7\BINP directory (for MS OS/2) if the default directory names
  17865.     were chosen during setup. The information in these files can be
  17866.     added directly to your AUTOEXEC.BAT (for MS-DOS) or CONFIG.SYS (for
  17867.     MS OS/2), as shown in the "More Information" section below.
  17868.  
  17869.  2. The file TOOLS.PRE must be renamed to TOOLS.INI or appended to an
  17870.     existing TOOLS.INI. The TOOLS.INI must be in the directory
  17871.     specified by the environment variable INIT. The TOOLS.PRE file is
  17872.     located in the BC7\BINP directory if the default directory names
  17873.     were chosen during setup.
  17874.  
  17875.  3. For MS OS/2, the LIBPATH environment variable must contain the
  17876.     directory where BASIC's run-time DLLs are stored. These files are
  17877.     located in the BC7\BINP directory if the default directory names
  17878.     were chosen during setup.
  17879.  
  17880.  4. To use Microsoft C with PWB.EXE in interlanguage calling, the file
  17881.     PWBC.MXT (for MS-DOS) or PWBC.PXT (for MS OS/2) must be unpacked
  17882.     and copied from the distribution disks to the directory containing
  17883.     PWB.EXE. PWB.EXE is located in the BC7\BIN directory (for MS-DOS)
  17884.     or the BC7\BINP directory (for MS OS/2) if the default directory
  17885.     names were chosen during setup. To find the disk PWBC.MXT or
  17886.     PWBC.PXT is located on, look in the PACKING.LST file on DISK 1 of
  17887.     the distribution disks.
  17888.  
  17889.  5. After any changes have been made to the AUTOEXEC.BAT file or
  17890.     CONFIG.SYS file, your machine must be rebooted.
  17891.  
  17892.  The following is more information about requirements 1 through 4
  17893.  above:
  17894.  
  17895.  1. The information in the NEW-VARS.BAT or NEW-VARS.CMD files can be
  17896.     added directly to your AUTOEXEC.BAT (for MS-DOS) or CONFIG.SYS (for
  17897.     MS OS/2).
  17898.  
  17899.     To avoid LINK and compile problems, make sure the directory for
  17900.     PWB.EXE comes first in your PATH.
  17901.  
  17902.     The following lines must be added to (or modified if the
  17903.     environment variables already exist) your AUTOEXEC.BAT file (for
  17904.     use with MS-DOS):
  17905.  
  17906.        set PATH=c:\bc7\bin;c:\bc7\binb;
  17907.        set LIB=c:\bc7\lib;
  17908.        set INCLUDE=c:\bc7\src;
  17909.        set HELPFILES=c:\bc7\help;
  17910.  
  17911.     The following lines must be added to (or modified if the
  17912.     environment variables already exist) your CONFIG.SYS file (for
  17913.     use with MS OS/2):
  17914.  
  17915.        set PATH=c:\bc7\binp;c:\bc7\binb;
  17916.        set LIB=c:\bc7\lib;
  17917.        set INCLUDE=c:\bc7\src;
  17918.        set HELPFILES=c:\bc7\help;
  17919.  
  17920.  2. The environment variable for INIT should resemble the following if
  17921.     your TOOLS.INI file is in the directory called INIT:
  17922.  
  17923.        SET INIT=C:\INIT;
  17924.  
  17925.     To append TOOLS.PRE to TOOLS.INI, use the following command:
  17926.  
  17927.        COPY TOOLS.INI + \BC7\BINB\TOOLS.PRE
  17928.  
  17929.  3. A sample LIBPATH after using the default setup for MS OS/2 and
  17930.     Microsoft BASIC PDS 7.10 is as follows:
  17931.  
  17932.        LIBPATH=C:\OS2\DLL;C:\;C:\BC7\BINP;
  17933.  
  17934.  4. To unpack the files PWBC.MXT and PWBC.PXT, the commands are as
  17935.     follows:
  17936.  
  17937.        UNPACK A:PWBC.MX$ PWBC.MXT
  17938.        UNPACK A:PWBC.PX$ PWBC.PXT
  17939.  
  17940.  
  17941.  309. "Permission Denied" If SHELL to 7.00 .EXE Using ISAM from TSR
  17942.  
  17943.  Product Version(s): 7.00 7.10
  17944.  Operating System:   MS-DOS
  17945.  Flags: ENDUSER | SR# S900702-42 buglist7.00 buglist7.10
  17946.  Last Modified:  2-NOV-1990    ArticleIdent: Q63782
  17947.  
  17948.  If you SHELL from one program that uses ISAM to another ISAM program
  17949.  that uses the PROISAM.EXE or PROISAMD.EXE terminate-and-stay-resident
  17950.  (TSR) program, a "Permission Denied" error occurs when the OPEN
  17951.  statement is executed in the child (SHELLed) process (see Example 2
  17952.  below). This problem does not occur when ISAM support is linked into
  17953.  the .EXE programs instead of using the TSR program.
  17954.  
  17955.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  17956.  Professional Development System (PDS) versions 7.00 and 7.10. We are
  17957.  researching this problem and will post new information here as it
  17958.  becomes available.
  17959.  
  17960.  To work around this problem, use a CHAIN statement instead of SHELL,
  17961.  or LINK ISAM support to your .EXE instead of using the ISAM TSR
  17962.  program.
  17963.  
  17964.  In addition, SHELLing to the ISAM utilities (ISAMIO.EXE, ISAMCVT.EXE,
  17965.  ISAMREPR.EXE, or ISAMPACK.EXE) may generate unusual error messages,
  17966.  because they are not designed to be SHELLed; this is not a software
  17967.  problem but is a design limitation. For example, ISAMPACK.EXE fails
  17968.  with the message "Unknown error number." A workaround is shown below
  17969.  in Example 1.
  17970.  
  17971.  Note that the SETUP.EXE program for BASIC PDS 7.00 and 7.10 lets you
  17972.  choose one of the following four ISAM support options for compiled
  17973.  .EXE programs:
  17974.  
  17975.  1. ISAM Routines in TSR
  17976.  2. ISAM Routines in LIB, Support Database Creation and Access
  17977.  3. ISAM Routines in LIB, Support Database Access Only
  17978.  4. No ISAM support
  17979.  
  17980.  Only Option 1 creates PROISAM.EXE and PROISAMD.EXE TSR programs that
  17981.  can be used with BASIC compiled .EXE programs. The TSR program created
  17982.  in Option 1 can also be used in QBX.EXE. Options 2 and 3 create
  17983.  PROISAM.EXE and PROISAMD.EXE TSR programs that CANNOT be used in
  17984.  compiled .EXE programs, and that can only be used by QBX.EXE and the
  17985.  ISAM utilities (ISAMIO.EXE, ISAMCVT.EXE, ISAMREPR.EXE, and
  17986.  ISAMPACK.EXE). Options 2 and 3 create .LIB libraries for linking ISAM
  17987.  support into your .EXE programs. The fourth SETUP option does not copy
  17988.  any ISAM-related files onto your computer.
  17989.  
  17990.  A problem occurs whenever a SHELLed (child) process attempts to access
  17991.  the PROISAM or PROISAMD TSR program. Specifically, the problem occurs
  17992.  when you SHELL to an ISAM utility (which requires the TSR program --
  17993.  see Example 1), or SHELL to a BASIC .EXE program that requires the
  17994.  ISAM TSR (see Example 2).
  17995.  
  17996.  Example 1
  17997.  ---------
  17998.  
  17999.  Because the ISAM utilities (ISAMIO.EXE, ISAMCVT.EXE, ISAMREPR.EXE, or
  18000.  ISAMPACK.EXE) require the ISAM TSR program, the best way to work
  18001.  around the SHELLing problem is to link the BASIC .EXE (the parent
  18002.  process that executes the SHELL) to the ISAM .LIB, and then SHELL to
  18003.  an MS-DOS batch (.BAT) file that loads the TSR program, executes the
  18004.  ISAM utility, and then unloads the TSR program. The following is an
  18005.  example of this type of batch file:
  18006.  
  18007.     REM  Start PACK.BAT
  18008.        PROISAMD
  18009.        ISAMPACK isamfile.dat
  18010.        PROISAMD /D
  18011.     REM  End PACK.BAT
  18012.  
  18013.  Example 2
  18014.  ---------
  18015.  
  18016.  The following program (when SHELLed to itself or any other program
  18017.  that OPENs any ISAM file) will cause a "Permission Denied" error in
  18018.  the SHELLed copy:
  18019.  
  18020.     ' ISAMTEST.BAS
  18021.     TYPE test
  18022.       x AS INTEGER
  18023.     END TYPE
  18024.     OPEN "test" FOR ISAM test "test" as #1
  18025.     CLOSE #1
  18026.     INPUT "Do you want to shell?", a$
  18027.     IF a$="Y" THEN SHELL "ISAMTEST"    ' Put the name of this .EXE here.
  18028.     END
  18029.  
  18030.  Compile and link this program as follows:
  18031.  
  18032.     BC ISAMTEST.BAS;   (BC compile options don't affect the problem)
  18033.     LINK ISAMTEST;
  18034.  
  18035.  To duplicate the problem, run the PROISAM.EXE or PROISAMD.EXE TSR
  18036.  program, then run the above program. To work around the problem, link
  18037.  ISAM support to the program instead of using the ISAM TSR program, or
  18038.  use CHAIN instead of SHELL.
  18039.  
  18040.  Note that if you chose the "ISAM routines in TSR" option during
  18041.  SETUP.EXE and also retained component files during SETUP.EXE, there is
  18042.  a special way to LINK ISAM support into your stand-alone .EXE program,
  18043.  as described in a separate article, which can be found by using the
  18044.  following query in this Knowledge Base:
  18045.  
  18046.     LINK and ISAM and component and even and SETUP and TSR
  18047.  
  18048.  
  18049.  310. In 7.00 UI Toolbox, WindowOpen Must Start at Row 3, Column 2
  18050.  
  18051.  Product Version(s): 7.00 7.10
  18052.  Operating System:   MS-DOS
  18053.  Flags: ENDUSER | SR# S900706-34
  18054.  Last Modified: 10-JAN-1991    ArticleIdent: Q63797
  18055.  
  18056.  When using the WindowOpen SUBprogram from the User Interface (UI)
  18057.  Toolbox in Microsoft BASIC Professional Development System (PDS)
  18058.  versions 7.00 and 7.10, coordinates for the upper left-hand window
  18059.  location must be below row 2 and to the right of column 1.
  18060.  
  18061.  The reason for this is that the coordinates that you are giving
  18062.  represent the location of the first printable text space on the
  18063.  screen, not the actual upper left-hand corner of the window.
  18064.  Therefore, there has to be room for the window border to be drawn
  18065.  around the box.
  18066.  
  18067.  If you try to display a window with an upper left-hand coordinate of 1
  18068.  for col1%, or 1 or 2 for row1%, no window will be displayed on the
  18069.  screen and no error will display.
  18070.  
  18071.  Code Example
  18072.  ------------
  18073.  
  18074.  'The main body of code consists of the initialization routines that
  18075.  'allow the use of the User Interface (UI) Toolbox. The $INCLUDE files
  18076.  'contain the necessary TYPE definitions and SUB declarations. The
  18077.  'COMMON SHARED statements contain the necessary global variables for
  18078.  'communicating with the UI Toolbox routines.
  18079.  
  18080.  REM $INCLUDE: 'window.bi'
  18081.  REM $INCLUDE: 'mouse.bi'
  18082.  REM $INCLUDE: 'menu.bi'
  18083.  REM $INCLUDE: 'general.bi'
  18084.  
  18085.  COMMON SHARED /uitools/ glomenu AS MenuMiscType
  18086.  COMMON SHARED /uitools/ glotitle() AS MenuTitleType
  18087.  COMMON SHARED /uitools/ gloitem() AS MenuItemType
  18088.  COMMON SHARED /uitools/ glowindow() AS windowtype
  18089.  COMMON SHARED /uitools/ globutton() AS buttontype
  18090.  COMMON SHARED /uitools/ gloedit() AS editfieldtype
  18091.  COMMON SHARED /uitools/ glostorage AS windowstoragetype
  18092.  COMMON SHARED /uitools/ glowindowstack() AS INTEGER
  18093.  COMMON SHARED /uitools/ globuffer$()
  18094.  
  18095.  DIM glotitle(MAXMENU) AS MenuTitleType
  18096.  DIM gloitem(MAXMENU, MAXITEM) AS MenuItemType
  18097.  DIM glowindow(MAXWINDOW) AS windowtype
  18098.  DIM globutton(MAXBUTTON) AS buttontype
  18099.  DIM gloedit(MAXEDITFIELD) AS editfieldtype
  18100.  DIM glowindowstack(MAXWINDOW) AS INTEGER
  18101.  DIM globuffer$(MAXWINDOW + 1, 2)
  18102.  
  18103.  CLS
  18104.  
  18105.  'Windowinit and Menuinit initialize all of the necessary
  18106.  'variables for use with the UI Toolbox routines.
  18107.  
  18108.  MenuInit
  18109.  windowinit
  18110.  
  18111.  'The following windowopen statement will not create a window on the
  18112.  'screen, because the second parameter must be greater than 2, and the
  18113.  'third parameter must be greater than 1:
  18114.  '             /----- 2nd parameter must be greater than 2.
  18115.  '             v
  18116.  windowopen 1, 2, 1, 20, 20, 15, 0, 15, 0, 6, 0, 0, 0, 0, 2, "test #1"
  18117.  '                ^----- 3rd parameter must be greater than 1.
  18118.  
  18119.  SLEEP
  18120.  'The following windowopen statement correctly opens a window
  18121.  'that will have the minimum possible upper left-hand corner
  18122.  'coordinates:
  18123.  
  18124.  windowopen 2, 3, 2, 10, 20, 15, 0, 15, 0, 6, 0, 0, 0, 0, 2, "test #2"
  18125.  
  18126.  
  18127.  311. 7.00 UI Toolbox MENU.BAS Correction, Narrow Menu Selectability
  18128.  
  18129.  Product Version(s): 7.00 7.10
  18130.  Operating System:   MS-DOS
  18131.  Flags: ENDUSER | buglist7.00 buglist7.10
  18132.  Last Modified:  2-NOV-1990    ArticleIdent: Q63799
  18133.  
  18134.  The User Interface (UI) Toolbox provided in Microsoft BASIC
  18135.  Professional Development System (PDS) versions 7.00 and 7.10
  18136.  incorrectly allows a mouse cursor to choose a menu option from outside
  18137.  the confines of a narrow pull-down menu.
  18138.  
  18139.  Microsoft has confirmed this to be a problem in Microsoft BASIC PDS
  18140.  versions 7.00 and 7.10 for MS-DOS. The correction is provided below.
  18141.  
  18142.  To correct this problem, the source code of MENU.BAS can be changed to
  18143.  correctly choose items in a narrow pull-down menu. Change the
  18144.  following IF statement found in the SUB MenuDo near the line label
  18145.  "menuDoShowPullDown:". (When you load MENU.BAS into the QBX.EXE
  18146.  editor, this label is at line number 650, and the IF statement is
  18147.  located at line 660.)
  18148.  
  18149.  Change the following line
  18150.  
  18151.       LEN(GloTitle(currMenu).text)
  18152.  to
  18153.       LEN(RTRIM$(GloTitle(currMenu).text))
  18154.  
  18155.  in both of the following places:
  18156.  
  18157.       IF GloTitle(currMenu).rColItem - GloTitle(currMenu).lColItem _
  18158.                 < LEN(GloTitle(currMenu).text) THEN
  18159.            GloTitle(currMenu).rColItem = GloTitle(currMenu).lColItem _
  18160.                 + LEN(GloTitle(currMenu).text)
  18161.       END IF
  18162.  
  18163.  Note: The underscore characters (_) above indicate line-continuation
  18164.  characters. The block IF statement actually appears as three lines in
  18165.  the original source code of MENU.BAS.
  18166.  
  18167.  The changed code is as follows:
  18168.  
  18169.       IF GloTitle(currMenu).rColItem - GloTitle(currMenu).lColItem _
  18170.                 < LEN(RTRIM$(GloTitle(currMenu).text)) THEN
  18171.            GloTitle(currMenu).rColItem = GloTitle(currMenu).lColItem _
  18172.                 + LEN(RTRIM$(GloTitle(currMenu).text)
  18173.       END IF
  18174.  
  18175.  To enable correct handling of narrow pull-down menus, this change
  18176.  should be made and the libraries rebuilt as follows:
  18177.  
  18178.       BC /X/FS MENU.BAS;
  18179.  
  18180.       LIB UITB -+MENU;     [Note: UITB.LIB is the library that
  18181.                                   GENERAL.BAS outlines how to build.]
  18182.  
  18183.       LINK /Q UITB.LIB,UITB.QLB,,QBXQLB.LIB;
  18184.  
  18185.  The correction in this article is the same as for a different symptom
  18186.  described in a separate article, where garbage characters appear after
  18187.  selecting a menu at or to the right of the 64th column. To find this
  18188.  and other problems with the UI Toolbox, query in this Knowledge Base
  18189.  on the following words:
  18190.  
  18191.     user and interface and toolbox and buglist7.00
  18192.  
  18193.  
  18194.  312. Illegal RESUME NEXT Hangs QBX After ON LOCAL ERROR RESUME NEXT
  18195.  
  18196.  Product Version(s): 7.00 7.10
  18197.  Operating System:   MS-DOS
  18198.  Flags: ENDUSER | SR# S900615-135 buglist7.00 buglist7.10
  18199.  Last Modified:  6-AUG-1990    ArticleIdent: Q63811
  18200.  
  18201.  QBX.EXE hangs if an illegal RESUME NEXT statement is encountered in an
  18202.  IF statement inside a SUB where the statement ON LOCAL ERROR RESUME
  18203.  NEXT is active. This problem does not occur in a compiled and linked
  18204.  .EXE program.
  18205.  
  18206.  Microsoft has confirmed this to be a problem with QBX.EXE in Microsoft
  18207.  BASIC Professional Development System (PDS) versions 7.00 and 7.10 for
  18208.  MS-DOS. We are researching this problem and will post new information
  18209.  here as it becomes available.
  18210.  
  18211.  The problem can be worked around by knowing and not programming
  18212.  illegal "RESUME without error" conditions.
  18213.  
  18214.  Instead of hanging the program below, the QBX environment should
  18215.  return an Error 20 ("RESUME without error"), which means that there is
  18216.  no active error-handling routine from which to RESUME. Error 20 should
  18217.  then have been automatically handled by the ON LOCAL ERROR RESUME NEXT
  18218.  statement (which does a valid RESUME NEXT).
  18219.  
  18220.  A RESUME NEXT statement by itself is only valid when it is within an
  18221.  error-handling routine that was an object of an ON [LOCAL] ERROR GOTO
  18222.  <linelabel> statement. When the program below is compiled and linked
  18223.  into an EXE, the .EXE does not hang, and it correctly returns and
  18224.  handles error 20.
  18225.  
  18226.  Code Example
  18227.  ------------
  18228.  
  18229.  The following code example hangs QBX.EXE on the indicated line. Note
  18230.  that this program shows illegal usage of the second RESUME NEXT, which
  18231.  should have produced error 20. When run as an .EXE program, this code
  18232.  successfully returns error 20 and handles the error correctly with the
  18233.  local error handler:
  18234.  
  18235.  CALL test
  18236.  SUB test
  18237.    ON LOCAL ERROR RESUME NEXT
  18238.    ERROR 1
  18239.    ' The following RESUME NEXT is a programming error:
  18240.    IF ERR = 1 THEN RESUME NEXT   '*** This line hangs in QBX.EXE
  18241.    ' The above statement correctly causes error 20 ("RESUME without
  18242.    ' error") in a .EXE program, and ERR now returns 20 and prints as
  18243.    ' follows:
  18244.    PRINT "This is next line after programming error 20, and ERR= "; ERR
  18245.    PRINT "Now ending subprogram"
  18246.  END SUB
  18247.  
  18248.  
  18249.  313. How to LINK PROISAMD.LIB to .EXE Even If SETUP "ISAM in TSR"
  18250.  
  18251.  Product Version(s): 7.00 7.10 | 7.10
  18252.  Operating System:   MS-DOS    | OS/2
  18253.  Flags: ENDUSER | SR# S900706-104
  18254.  Last Modified:  6-SEP-1990    ArticleIdent: Q63834
  18255.  
  18256.  The following technique gives you the setup configuration with the
  18257.  greatest flexibility of choice for ISAM support (as either a TSR
  18258.  [terminate-and-stay resident] program or linkable .LIB) in compiled
  18259.  .EXE programs.
  18260.  
  18261.  If you chose "ISAM Routines in TSR" (instead of "ISAM Routines in
  18262.  LIB") when you ran SETUP.EXE, then to make a standalone .EXE program
  18263.  (that uses ISAM) that does not require the PROISAMD.EXE or PROISAM.EXE
  18264.  TSR program, you must LINK with the PROISAMD.OBJ and PROISAMD.LIB
  18265.  component libraries in the linker's object list. This technique
  18266.  requires that you choose to retain component libraries when you run
  18267.  SETUP.EXE.
  18268.  
  18269.  This information applies to Microsoft BASIC Professional Development
  18270.  System (PDS) versions 7.00 and 7.10 under MS-DOS. This also applies to
  18271.  version 7.10 under MS OS/2.
  18272.  
  18273.  With BASIC PDS 7.00, there are four SETUP.EXE options for installing
  18274.  ISAM support for compiled .EXE programs:
  18275.  
  18276.  1. ISAM Routines in TSR
  18277.  2. ISAM Routines in LIB, Support Database Creation and Access
  18278.  3. ISAM Routines in LIB, Support Database Access Only
  18279.  4. No ISAM support
  18280.  
  18281.  Only Option 1 creates PROISAM.EXE and PROISAMD.EXE TSR programs that
  18282.  can be used with BASIC compiled .EXE programs. The TSR program created
  18283.  in Option 1 can also be used in QBX.EXE. Option 1 is the default since
  18284.  it consumes the least disk space.
  18285.  
  18286.  Options 2 and 3 create PROISAM.EXE and PROISAMD.EXE TSR programs that
  18287.  CANNOT be used in compiled .EXE programs and that can only be used by
  18288.  QBX.EXE and the ISAM utilities (ISAMIO.EXE, ISAMCVT.EXE, ISAMREPR.EXE,
  18289.  and ISAMPACK.EXE). If you choose Option 2 or 3 and you want ISAM
  18290.  support in your .EXE program, you must link to the ISAM .LIB files
  18291.  instead of using the TSR support for ISAM.
  18292.  
  18293.  SETUP Option 4 does not copy any ISAM-related files onto your
  18294.  computer.
  18295.  
  18296.  You may want to have the option of creating .EXE programs with full
  18297.  ISAM support provided either in the TSR program or linked from
  18298.  libraries. This can be accomplished by choosing Option 1 ("ISAM
  18299.  Routines in TSR") and LINKing with PROISAMD.OBJ and PROISAMD.LIB in
  18300.  the object list, as follows:
  18301.  
  18302.     LINK /NOE ISAMPROG.OBJ+PROISAMD.OBJ+PROISAMD.LIB;
  18303.  
  18304.  The following are some important notes about the above LINK command
  18305.  line:
  18306.  
  18307.  1. The NOExtended library search option (/NOE) is necessary to prevent
  18308.     "Symbol Defined More than Once (L2025)" errors.
  18309.  
  18310.  2. Both object (PROISAMD.OBJ) and library (PROISAMD.LIB) files are
  18311.     required to LINK properly.
  18312.  
  18313.  3. The PROISAMD.OBJ is normally deleted with component libraries by
  18314.     SETUP.EXE. You must choose to retain component libraries when you
  18315.     run SETUP.EXE to retain this necessary file.
  18316.  
  18317.  4. PROISAMD.LIB must be specified in the object list instead of the
  18318.     library list on the LINK command line, as shown. (When LINKing a
  18319.     library in the object list, all object files contained in that
  18320.     library are LINKed into the EXE, as opposed to only the routines
  18321.     that are not otherwise resolved.)
  18322.  
  18323.  5. ISAMPROG.BAS must be compiled with the BC /O (standalone) option.
  18324.     If you don't compile with BC /O, then the LINK error L2029
  18325.     "Unresolved external" error will occur for 'b$IsamRtmUsed' and
  18326.     'B$DOS3CHECK'.
  18327.  
  18328.  Code Example
  18329.  ------------
  18330.  
  18331.  The following code example would normally require the PROISAMD.EXE TSR
  18332.  program (when the "ISAM Routines in TSR" option is chosen during
  18333.  SETUP), but using the LINK line given below, the TSR program is not
  18334.  necessary.
  18335.  
  18336.  Compile and link as follows:
  18337.  
  18338.     BC ISAMPROG /O;
  18339.     LINK /NOE ISAMPROG.OBJ+PROISAMD.OBJ+PROISAMD.LIB;
  18340.  
  18341.  ' Name this source file as follows: ISAMPROG.BAS
  18342.  TYPE test
  18343.    x AS INTEGER
  18344.  END TYPE
  18345.  OPEN "ISAMFILE" FOR ISAM test "table" AS #1
  18346.  CLOSE #1
  18347.  END
  18348.  
  18349.  
  18350.  314. Incorrect SEEK in Example in BASIC 7.00 Language Reference
  18351.  
  18352.  Product Version(s): 7.00 7.10 | 7.00 7.10
  18353.  Operating System:   MS-DOS    | OS/2
  18354.  Flags: ENDUSER | SR# S900712-2 docerr
  18355.  Last Modified: 15-JAN-1991    ArticleIdent: Q63901
  18356.  
  18357.  On page 323 of the "Microsoft BASIC 7.0: Language Reference" manual,
  18358.  the example for the SEEK statement (on the 6th line from the bottom)
  18359.  incorrectly shows that the process for backing up a file is as
  18360.  follows:
  18361.  
  18362.     SEEK #1, SEEK(1) - LEN(RecordVar)
  18363.  
  18364.  This statement is the correct method for backing up one record
  18365.  position in a binary file. In a binary file, the SEEK function refers
  18366.  to a byte in the file. Therefore, to move forward or backward a
  18367.  record, you would increment or decrement by the number of bytes in
  18368.  each record of the file.
  18369.  
  18370.  However, because the file in the SEEK example on page 323 is a RANDOM
  18371.  access file, a SEEK function refers to each record in the file, not to
  18372.  each byte in the file. Thus, the statement should be corrected to read
  18373.  as follows:
  18374.  
  18375.     SEEK #1, SEEK(1) - 1
  18376.  
  18377.  This information applies to Microsoft BASIC Professional Development
  18378.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  18379.  
  18380.  
  18381.  315. How to Scroll Text in BASIC Protected Mode Program Using API
  18382.  
  18383.  Product Version(s): 6.00 6.00b 7.00 7.10
  18384.  Operating System:   OS/2
  18385.  Flags: ENDUSER | SR# S900710-57
  18386.  Last Modified: 17-JAN-1991    ArticleIdent: Q63956
  18387.  
  18388.  This article describes how protected mode BASIC programs compiled with
  18389.  Microsoft BASIC Compiler versions 6.00 and 6.00b or Microsoft BASIC
  18390.  Professional Development System (PDS) version 7.00 or 7.10 can scroll
  18391.  text on the screen by calling the OS/2 API functions VioScrollUp(),
  18392.  VioScrollDn(), VioScrollLf(), and VioScrollRt(). A full example of
  18393.  using these routines is provided below.
  18394.  
  18395.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  18396.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  18397.  System (PDS) versions 7.00 and 7.10 for MS OS/2.
  18398.  
  18399.  BASIC 6.00 and 6.00b and BASIC PDS 7.00 and 7.10 can directly call
  18400.  OS/2 API functions by linking with the appropriate library. This
  18401.  library is called DOSCALLS.LIB for BASIC 6.00 and 6.00b and OS2.LIB
  18402.  for BASIC PDS 7.00 and 7.10.
  18403.  
  18404.  The API functions VioScrollUp(), VioScrollDn(), VioScrollLf(), and
  18405.  VioScrollRt() all require the following parameters:
  18406.  
  18407.     Parameter   Description
  18408.     ---------   -----------
  18409.  
  18410.     WORD        y (row) coordinate of upper left corner
  18411.     WORD        x (column) coordinate of upper left corner
  18412.     WORD        y (row) coordinate of lower right corner
  18413.     WORD        x (column) coordinate of lower right corner
  18414.     WORD        Number of lines or columns to scroll
  18415.     PTR WORD    Contains character (lower byte) and attribute
  18416.                 (upper byte) used to fill blanked lines or columns
  18417.     WORD        Video handle (0 = default)
  18418.  
  18419.  The first four parameters specify the rectangle in which the scrolling
  18420.  is to take place. Any area outside this rectangle is not scrolled. The
  18421.  sixth parameter specifies the character and attribute to use for the
  18422.  new lines or columns created behind the scrolling text. Note that a
  18423.  WORD in BASIC is an INTEGER, and any parameters preceded by the word
  18424.  "PTR" must be passed using the SEG clause in the DECLARE statement;
  18425.  BYVAL is used otherwise. The default for BASIC is to pass by reference
  18426.  (not BYVAL).
  18427.  
  18428.  The following program (SCROLL.BAS) displays a message on the screen
  18429.  and allows you to scroll the message up, down, left, or right using
  18430.  the cursor keys. Note that this example uses only the cursor keys on
  18431.  the numeric keypad, not the extended cursor keys. Any part of the
  18432.  message that is scrolled off the screen is lost. Press the ESC key to
  18433.  terminate execution.
  18434.  
  18435.  To compile and link the program, enter the following lines at the OS/2
  18436.  command prompt:
  18437.  
  18438.     bc scroll /v ;
  18439.     link scroll;
  18440.  
  18441.  Code Example
  18442.  ------------
  18443.  
  18444.  'SCROLL.BAS
  18445.  DEFINT A-Z
  18446.  
  18447.  'Declarations for OS/2's Vio scroll functions.
  18448.  DECLARE FUNCTION VioScrollUp (BYVAL Y1      AS INTEGER,_
  18449.                                BYVAL X1      AS INTEGER,_
  18450.                                BYVAL Y2      AS INTEGER,_
  18451.                                BYVAL X2      AS INTEGER,_
  18452.                                BYVAL Lines   AS INTEGER,_
  18453.                                SEG   FillNew AS INTEGER,_
  18454.                                BYVAL Handle  AS INTEGER)
  18455.  
  18456.  DECLARE FUNCTION VioScrollLf (BYVAL Y1      AS INTEGER,_
  18457.                                BYVAL X1      AS INTEGER,_
  18458.                                BYVAL Y2      AS INTEGER,_
  18459.                                BYVAL X2      AS INTEGER,_
  18460.                                BYVAL Lines   AS INTEGER,_
  18461.                                SEG   FillNew AS INTEGER,_
  18462.                                BYVAL Handle  AS INTEGER)
  18463.  
  18464.  DECLARE FUNCTION VioScrollRt (BYVAL Y1      AS INTEGER,_
  18465.                                BYVAL X1      AS INTEGER,_
  18466.                                BYVAL Y2      AS INTEGER,_
  18467.                                BYVAL X2      AS INTEGER,_
  18468.                                BYVAL Lines   AS INTEGER,_
  18469.                                SEG   FillNew AS INTEGER,_
  18470.                                BYVAL Handle  AS INTEGER)
  18471.  
  18472.  DECLARE FUNCTION VioScrollDn (BYVAL Y1      AS INTEGER,_
  18473.                                BYVAL X1      AS INTEGER,_
  18474.                                BYVAL Y2      AS INTEGER,_
  18475.                                BYVAL X2      AS INTEGER,_
  18476.                                BYVAL Lines   AS INTEGER,_
  18477.                                SEG   FillNew AS INTEGER,_
  18478.                                BYVAL Handle  AS INTEGER)
  18479.  
  18480.  Y1 = 0    'Set the coordinates of the window scrolling area to define
  18481.  X1 = 0    'the whole screen (assuming 25 rows and 80 columns).
  18482.  Y2 = 24
  18483.  X2 = 79
  18484.  
  18485.  Lines    = 1       'Scroll one line at a time.
  18486.  FillNew  = 20010   'Fill the new lines/columns with yellow asterisks
  18487.                     'on a red background.
  18488.  Handle   = 0       'Specifies the default OS/2 screen group.
  18489.  
  18490.  CLS                 'Clear screen and display the message to scroll.
  18491.  LOCATE 12, 30
  18492.  PRINT "Use arrows on numeric keypad to scroll."
  18493.  PRINT "Hit Esc to quit."
  18494.  
  18495.  ON KEY(11) GOSUB UpArrow      'Setup event handlers for key trapping.
  18496.  ON KEY(12) GOSUB LeftArrow    'Keys 11-14 are the arrow keys on the
  18497.  ON KEY(13) GOSUB RightArrow   'numeric keypad.
  18498.  ON KEY(14) GOSUB DownArrow
  18499.  
  18500.  KEY(11) ON   'Turn key trapping on.
  18501.  KEY(12) ON
  18502.  KEY(13) ON
  18503.  KEY(14) ON
  18504.  
  18505.  DO UNTIL INKEY$ = CHR$(27)   'Loop until the ESC key is pressed.
  18506.  LOOP
  18507.  END
  18508.  
  18509.  'Event handlers for key traps.
  18510.  UpArrow:    E = VioScrollUp (Y1, X1, Y2, X2, Lines, FillNew, Handle)
  18511.              RETURN
  18512.  
  18513.  LeftArrow:  E = VioScrollLf (Y1, X1, Y2, X2, Lines, FillNew, Handle)
  18514.              RETURN
  18515.  
  18516.  RightArrow: E = VioScrollRt (Y1, X1, Y2, X2, Lines, FillNew, Handle)
  18517.              RETURN
  18518.  
  18519.  DownArrow:  E = VioScrollDn (Y1, X1, Y2, X2, Lines, FillNew, Handle)
  18520.              RETURN
  18521.  
  18522.  
  18523.  316. BEGINTRANS Example "Invalid Columnname" for Address
  18524.  
  18525.  Product Version(s): 7.00 7.10
  18526.  Operating System:   MS-DOS
  18527.  Flags: ENDUSER | SR# S900626-73 docerr
  18528.  Last Modified:  1-AUG-1990    ArticleIdent: Q64100
  18529.  
  18530.  The BEGINTRANS example on Pages 23-25 of the "Microsoft BASIC 7.0:
  18531.  Language Reference" manual for versions 7.00 and 7.10 incorrectly uses
  18532.  "Address" in the Borrower TYPE declaration when trying to OPEN the
  18533.  BOOKS.MDB sample database. The example should use "Street" instead.
  18534.  
  18535.  This information applies to Microsoft BASIC Professional Development
  18536.  System (PDS) versions 7.00 and 7.10.
  18537.  
  18538.  The BEGINTRANS example gives the error message "Invalid column name"
  18539.  because it tries to OPEN the BOOKS.MDB database (an ISAM file), which
  18540.  actually uses "Street" as a column name instead of "Address."
  18541.  
  18542.  The following lines of the code example should be changed as follows:
  18543.  
  18544.  Page 23
  18545.  -------
  18546.  
  18547.  The following line
  18548.  
  18549.     Address AS STRING * 50        'Address
  18550.  
  18551.  should read as follows:
  18552.  
  18553.     Street AS STRING * 50         'Street address
  18554.  
  18555.  Page 24
  18556.  -------
  18557.  
  18558.  The following line
  18559.  
  18560.     PRINT LEFT$(People.Address, 25); "  ";
  18561.  
  18562.  should read as follows:
  18563.  
  18564.       PRINT LEFT$(People.Street, 25); "  ";
  18565.  
  18566.  
  18567.  317. Description of Expanded Memory Switches for BASIC PDS 7.10
  18568.  
  18569.  Product Version(s): 7.00 7.10
  18570.  Operating System:   MS-DOS
  18571.  Flags: ENDUSER | SR# S900503-164
  18572.  Last Modified: 15-JAN-1991    ArticleIdent: Q64101
  18573.  
  18574.  This article describes the purpose and use of the switches that allow
  18575.  you to configure use of expanded memory (according to the LIM 4.0
  18576.  Expanded Memory Specification [EMS]) in BASIC PDS 7.00 and 7.10.
  18577.  Especially important is the description of the /Es switch and its
  18578.  relationship to the other expanded memory switches.
  18579.  
  18580.  This information applies to Microsoft BASIC Professional Development
  18581.  System versions 7.00 and 7.10 for MS-DOS.
  18582.  
  18583.  Saving and Restoring the Expanded Memory State
  18584.  ----------------------------------------------
  18585.  
  18586.  By default, QBX.EXE and programs compiled with BC.EXE 7.00 or 7.10
  18587.  will only perform the minimum saving and restoring of the expanded
  18588.  memory state necessary to allow the program to work properly. This
  18589.  assumes that no third-party code using expanded memory is present. To
  18590.  get more than this minimal amount of expanded memory saving/restoring,
  18591.  you must specify /Es upon loading QBX or when compiling programs with
  18592.  BC.EXE. This is by design. If BASIC always saved and restored the
  18593.  state of expanded memory, the save/restore operations would have a
  18594.  significant speed impact on ISAM and on Quick library (.QLB) calling.
  18595.  The purpose of the /Es switch is to allow programs to use third-party
  18596.  code that uses expanded memory. The trade-off is a degradation in
  18597.  speed.
  18598.  
  18599.  Table of Expanded Memory Switches and Where You Can Use Them
  18600.  ------------------------------------------------------------
  18601.  
  18602.     Use With    Switch Name    Switch Purpose
  18603.     --------    -----------    --------------
  18604.  
  18605.     QBX only    /Ea            Arrays > 512 bytes but < 16K in
  18606.                                expanded memory. Default: No arrays in
  18607.                                expanded memory.
  18608.  
  18609.     QBX only    /E:n           n = amount in kilobytes of expanded
  18610.                                memory QBX will use. 0 means QBX uses no
  18611.                                expanded memory. Default: Use all
  18612.                                available expanded memory.
  18613.  
  18614.     QBX and BC  /Es            Enable saving/restoring of expanded
  18615.                                memory state.
  18616.  
  18617.     PROISAM(D)  /Ie:n          Reserves n kilobytes of expanded memory
  18618.                                for other applications (such as QBX).
  18619.                                ISAM will only use 1.2 megabytes of
  18620.                                expanded memory maximum.
  18621.  
  18622.  Examples: Use of Switches, Their Effects, and How They Interact
  18623.  ---------------------------------------------------------------
  18624.  
  18625.  QBX /E:0
  18626.  --------
  18627.  
  18628.  - Causes QBX to disable use of expanded memory code storage.
  18629.  
  18630.  - If the program has ISAM using expanded memory, it is assumed there
  18631.    is no third-party code accessing expanded memory. With /E:0, the
  18632.    default for QBX is not to save/restore the expanded memory state on
  18633.    ISAM use. This maximizes the speed of ISAM performance.
  18634.  
  18635.  QBX /E:0 /Es
  18636.  ------------
  18637.  
  18638.  - Save/restore operations occur on any ISAM statements or QLB calls.
  18639.    You would use this combination if you are loading QLBs that use
  18640.    expanded memory and you are also using ISAM that is using expanded
  18641.    memory.
  18642.  
  18643.  QBX /E:N and N Is Nonzero
  18644.  -------------------------
  18645.  
  18646.  - The expanded memory state is not saved/restored on QLB calls.
  18647.  
  18648.  - Save/restore operations occur on ISAM calls when both QBX and ISAM
  18649.    are sharing expanded memory.
  18650.  
  18651.  - It is assumed there are no QLBs using expanded memory.
  18652.  
  18653.  QBX /Es or QBX /E:N /Es
  18654.  -----------------------
  18655.  
  18656.  - Forces save/restore operations on QLB calls and ISAM statements.
  18657.  
  18658.  - This would be used if you are using QBX and calling QLB routines that
  18659.    access expanded memory.
  18660.  
  18661.  BC with No Expanded Memory Management Switches, No Overlays, No ISAM
  18662.  --------------------------------------------------------------------
  18663.  
  18664.  - The expanded memory state is not saved/restored.
  18665.  
  18666.  - Third-party routines accessing expanded memory should work
  18667.    correctly.
  18668.  
  18669.  BC with Overlays That Will Load from Expanded Memory
  18670.  ----------------------------------------------------
  18671.  
  18672.  - Expanded memory will be used by compiled code in the overlays.
  18673.  
  18674.  - The default is to save/restore expanded memory on all ISAM
  18675.    statements in a program that uses overlays.
  18676.  
  18677.  - This could still cause problems if third-party library routines that
  18678.    use expanded memory are called.
  18679.  
  18680.  BC /Es with Overlays and ISAM
  18681.  -----------------------------
  18682.  
  18683.  - Expanded memory will be saved/restored on ISAM statements.
  18684.  
  18685.  - Always use /Es when making mixed-language calls to routines that use
  18686.    expanded memory as well.
  18687.  
  18688.  BC /Es Without Expanded Memory Overlays, but with ISAM
  18689.  ------------------------------------------------------
  18690.  
  18691.  - /Es always causes save/restore operations on ISAM statements when
  18692.    ISAM is using expanded memory.
  18693.  
  18694.  - You would use this switch if the program uses ISAM, ISAM is using
  18695.    expanded memory, and there are mixed-language CALLs to routines
  18696.    that use expanded memory.
  18697.  
  18698.    Note: /Es will not cause save/restore operations on ISAM statements
  18699.    if ISAM is NOT using expanded memory.
  18700.  
  18701.  
  18702.  318. BASIC 7.0 Documentation Correction for Compiling OS/2 Programs
  18703.  
  18704.  Product Version(s): 7.00 7.10
  18705.  Operating System:   OS/2
  18706.  Flags: ENDUSER | SR# S900719-162 docerr
  18707.  Last Modified:  1-AUG-1990    ArticleIdent: Q64102
  18708.  
  18709.  The second sentence in the "Compiling OS/2 Programs" section on Page
  18710.  527 of the "Microsoft BASIC 7.0: Programmer's Guide" manual for
  18711.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  18712.  and 7.10 incorrectly states the following:
  18713.  
  18714.     For protected-mode programs, make sure to specify the /LP option
  18715.     to LINK.
  18716.  
  18717.  This sentence should refer to the BASIC compiler (BC.EXE) instead of
  18718.  to the BASIC linker (LINK.EXE), as follows:
  18719.  
  18720.     For protected-mode programs, make sure to specify the /LP option
  18721.     to compile with BC.EXE.
  18722.  
  18723.  
  18724.  319. CURRENCY Variable of User-Defined TYPE Cannot Use @ Symbol
  18725.  
  18726.  Product Version(s): 7.00 7.10
  18727.  Operating System:   MS-DOS
  18728.  Flags: ENDUSER | SR# S900717-156 buglist7.00 buglist7.10
  18729.  Last Modified: 27-JUL-1990    ArticleIdent: Q64103
  18730.  
  18731.  A field in a user-defined TYPE ... END TYPE statement must be defined
  18732.  with the "AS VariableType" form. When accessing the variable in the
  18733.  program, however, the variable can be referred to with or without the
  18734.  appropriate type symbol (for example, % for integer, & for long,
  18735.  etc.). However, a variable of type CURRENCY defined in a user-defined
  18736.  TYPE cannot be referred to in this manner. If the currency symbol (the
  18737.  @ sign) is used when accessing the field, the error message "Equal
  18738.  sign missing" is returned by the BC.EXE compiler. No error occurs when
  18739.  this format is used in the QBX.EXE environment.
  18740.  
  18741.  Microsoft has confirmed this to be a problem with the BASIC compiler
  18742.  (BC.EXE) in Microsoft BASIC Professional Development System (PDS)
  18743.  versions 7.00 and 7.10 for MS-DOS and OS/2. We are researching this
  18744.  problem and will post new information here as it becomes available.
  18745.  
  18746.  To reproduce this problem, no special compiler directives are
  18747.  necessary. Use the following command to generate the error:
  18748.  
  18749.     BC BasicProgramName ;
  18750.  
  18751.  The compiler error and output are as follows:
  18752.  
  18753.      me(1).a@ = 12
  18754.             ^  Equal sign missing
  18755.  
  18756.  Sample Code
  18757.  -----------
  18758.  
  18759.  TYPE mytype
  18760.    a AS CURRENCY
  18761.    b AS INTEGER
  18762.    c AS LONG
  18763.    d AS SINGLE
  18764.    e AS DOUBLE
  18765.    f AS STRING * 20
  18766.  END TYPE
  18767.  
  18768.  DIM me AS mytype
  18769.  COMMON SHARED me() AS mytype
  18770.  
  18771.  REDIM me(10)  AS mytype
  18772.  me(1).a@ = 12     REM  Remark this line to avoid the compiler error
  18773.                    REM  or remove the currency symbol (@).
  18774.  me(1).b% = 12
  18775.  me(1).c& = 12
  18776.  me(1).d! = 12
  18777.  me(1).e# = 12
  18778.  me(1).f$ = "12"
  18779.  PRINT me(1).a, me(1).b, me(1).c
  18780.  PRINT me(1).d, me(1).e, me(1).f
  18781.  
  18782.  
  18783.  320. GET from COM1 or COM2 Fails to Get Correct Data -- Use INPUT$
  18784.  
  18785.  Product Version(s): 7.00 7.10 | 7.00 7.10
  18786.  Operating System:   MS-DOS    | OS/2
  18787.  Flags: ENDUSER | SR# S900710-87 buglist7.00 buglist7.10
  18788.  Last Modified:  1-AUG-1990    ArticleIdent: Q64108
  18789.  
  18790.  The GET statement fails to read the correct information from a
  18791.  communications port (COM1, COM2) with Microsoft BASIC Professional
  18792.  Development System (PDS) version 7.00. Characters are removed from the
  18793.  buffer, but the values read in are not the correct values sent across
  18794.  the port.
  18795.  
  18796.  To work around this problem, use the INPUT$ function to read the data
  18797.  from the COM port.
  18798.  
  18799.  Microsoft has confirmed this to be a problem with Microsoft BASIC PDS
  18800.  versions 7.00 and 7.10 for MS-DOS and OS/2. We are researching this
  18801.  problem and will post new information here as it becomes available.
  18802.  
  18803.  This problem does NOT occur in Microsoft QuickBASIC version 4.50 or
  18804.  earlier or in Microsoft BASIC Compiler version 6.00b or earlier.
  18805.  
  18806.  Code Example
  18807.  ------------
  18808.  
  18809.  The following program attempts to read characters from COM1 using both
  18810.  GET and INPUT$:
  18811.  
  18812.     DIM a AS STRING * 1, b AS STRING * 1
  18813.     OPEN "COM1:300,n,8,1" FOR RANDOM AS #1
  18814.     GET #1, , a
  18815.     b = INPUT$(1, 1)
  18816.     PRINT a, b
  18817.     END
  18818.  
  18819.  In QuickBASIC 4.50, both the GET and INPUT$ statements return the
  18820.  correct values, but in BASIC PDS 7.00 and 7.10, only INPUT$ returns
  18821.  the correct data while GET returns meaningless data.
  18822.  
  18823.  
  18824.  321. 7.0 Manual Correction for BASIC Calling C Passing a Far String
  18825.  
  18826.  Product Version(s): 7.00 7.10 | 7.00 7.10
  18827.  Operating System:   MS-DOS    | OS/2
  18828.  Flags: ENDUSER | SR# S900719-55 docerr
  18829.  Last Modified:  1-AUG-1990    ArticleIdent: Q64109
  18830.  
  18831.  Page 501 of the "Microsoft BASIC 7.0: Programmer's Guide" for versions
  18832.  7.00 and 7.10 shows an incorrect example of passing a far string to C.
  18833.  The error is in the BASIC code. The C code is correct.
  18834.  
  18835.  The BASIC code needs to be changed in the following two places on Page
  18836.  501:
  18837.  
  18838.  1. The incorrect fourth line of the example is as follows (where the
  18839.     underscore means to place the statement all on one line):
  18840.  
  18841.        DECLARE FUNCTION addstring$(SEG s1$,BYVAL_
  18842.                s1length,SEG s2$,BYVAL s2length)
  18843.  
  18844.     and should be changed to read as follows (where the underscore
  18845.     means to place the statement all on one line):
  18846.  
  18847.        DECLARE FUNCTION addstring$ CDECL_
  18848.               (BYVAL s1offset%, BYVAL s1segment%, BYVAL s1length%,_
  18849.                BYVAL s2offset%, BYVAL s2segment%, BYVAL s2length%)
  18850.  
  18851.     In other words, to create a C far pointer, you have to pass the
  18852.     segment followed by the offset and pass this BYVAL so it will be
  18853.     pushed on the stack.
  18854.  
  18855.  2. The incorrect tenth line is as follows:
  18856.  
  18857.        C$ = addstring$(A$, LEN(A$), B$, LEN(B$))
  18858.  
  18859.     and should be changed to read as follows (where the underscore
  18860.     means to place the statement all on one line):
  18861.  
  18862.        C$ = addstring$(SSEG(A$), SADD(A$), LEN(A$), SSEG(B$),_
  18863.                        SADD(B$), LEN(B$))
  18864.  
  18865.  This information applies to Microsoft BASIC Professional Development
  18866.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  18867.  
  18868.  For more information on passing parameters between BASIC and C, query
  18869.  in the Knowledge Base or in the Software/Data Library on the word
  18870.  BAS2C.
  18871.  
  18872.  
  18873.  322. PRINT USING Doesn't Work in UI Toolbox Window; Use FormatX$
  18874.  
  18875.  Product Version(s): 7.00 7.10
  18876.  Operating System:   MS-DOS
  18877.  Flags: ENDUSER | SR# S900717-4
  18878.  Last Modified: 27-JUL-1990    ArticleIdent: Q64185
  18879.  
  18880.  The WindowPrint subroutine included in the User Interface (UI) Toolbox
  18881.  allows you to print text strings inside a window that was defined with
  18882.  the WindowOpen UI subroutine. However, the WindowPrint subroutine does
  18883.  not allow you to print numbers or formatted numbers the same way a
  18884.  PRINT USING statement does. To print numbers or formatted numbers, you
  18885.  must first use the FormatX$ functions, available in the BASIC PDS
  18886.  Add-on Library DTFMTxx.LIB. The string of numbers formatted with
  18887.  FormatX$ can then be printed with the WindowPrint subroutine.
  18888.  
  18889.  This information applies to Microsoft BASIC Professional Development
  18890.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  18891.  
  18892.  The term FormatX$ actually refers to the functions FormatI$, FormatL$,
  18893.  FormatS$, FormatD$, and FormatC$. For more information on the FormatX$
  18894.  functions, query in this Knowledge Base on the word "FormatX$".
  18895.  
  18896.  To use the FormatX$ functions with the User Interface Toolbox in the
  18897.  QBX.EXE environment, you must first create a Quick library (a .QLB
  18898.  file) containing the code for both the User Interface routines and
  18899.  also the FormatX$ routines. Here are two methods to do this:
  18900.  
  18901.  Method 1
  18902.  --------
  18903.  
  18904.  To create the Quick library from provided .LIB libraries, combine the
  18905.  libraries into a new library as follows
  18906.  
  18907.     LIB UITFMT.LIB+UITBEFR.LIB ;
  18908.     LIB UITFMT.LIB+DTFMTER.LIB ;
  18909.  
  18910.  then create the new Quick library (UITFMT.QLB) as follows:
  18911.  
  18912.     LINK /Q UITFMT.LIB, UITFMT.QLB,,QBXQLB.LIB ;
  18913.  
  18914.  Note that the first LIB command line above creates UITFMT.LIB. LIB.EXE
  18915.  creates UITFMT.LIB automatically since UITFMT.LIB did not previously
  18916.  exist. The second LIB command line appends DTFMTER.LIB to UITFMT.LIB.
  18917.  
  18918.  To invoke QBX.EXE (the QuickBASIC Extended environment) with the
  18919.  UITFMT.QLB Quick library (created in Method 1 above), use the
  18920.  following command:
  18921.  
  18922.     QBX /L UITFMT.QLB
  18923.  
  18924.  Method 2
  18925.  --------
  18926.  
  18927.  To create the .QLB file from the original .OBJ files, use the
  18928.  following LINK command:
  18929.  
  18930.     LINK /q WINDOW.OBJ+MENU.OBJ+MOUSE.OBJ+GENERAL.OBJ+UIASM.OBJ+
  18931.                          QBX.LIB+DTFMTER.LIB,UIFMT.QLB,,QBXQLB.LIB;
  18932.  
  18933.  Note: In the preceding LINK line, you must use DTFMTER.LIB, where "E"
  18934.  stands for Emulator math package, and "R" stands for DOS real mode.
  18935.  Quick libraries used in QBX.EXE cannot be compiled for Alternate math
  18936.  or protected mode.
  18937.  
  18938.  To invoke QBX.EXE (QuickBASIC Extended) with the UIFMT.QLB Quick
  18939.  library (created in Method 2 above), use the following command:
  18940.  
  18941.     QBX /L UIFMT.QLB
  18942.  
  18943.  To use the UI Toolbox routines and the FormatX$ routines in an
  18944.  executable (.EXE) program, you must link to the UITFMT.LIB (created in
  18945.  Method 1 above) to your program, or separately link the DTFMTxx.LIB
  18946.  and UITBxxx.LIB libraries (shipped by Microsoft) into your program.
  18947.  
  18948.  The following code sample gives an example of using the FormatS$
  18949.  function to convert a single-precision number into a dollar amount,
  18950.  and then print the result in a UI Toolbox window:
  18951.  
  18952.  Code Sample
  18953.  -----------
  18954.  
  18955.  DEFINT A-Z
  18956.  REM $INCLUDE: 'window.bi'
  18957.  REM $INCLUDE: 'mouse.bi'
  18958.  REM $INCLUDE: 'menu.bi'
  18959.  REM $INCLUDE: 'general.bi'
  18960.  REM $INCLUDE: 'format.bi'
  18961.  
  18962.  COMMON SHARED /uitools/ glomenu AS menumisctype
  18963.  COMMON SHARED /uitools/ glotitle() AS menutitletype
  18964.  COMMON SHARED /uitools/ gloitem() AS menuitemtype
  18965.  COMMON SHARED /uitools/ glowindow() AS windowtype
  18966.  COMMON SHARED /uitools/ globutton() AS buttontype
  18967.  COMMON SHARED /uitools/ gloedit() AS editfieldtype
  18968.  COMMON SHARED /uitools/ glostorage AS windowstoragetype
  18969.  COMMON SHARED /uitools/ glowindowstack() AS INTEGER
  18970.  COMMON SHARED /uitools/ globuffer$()
  18971.  
  18972.  DIM glotitle(maxmenu) AS menutitletype
  18973.  DIM gloitem(maxmenu, maxitem) AS menuitemtype
  18974.  DIM glowindow(MAXWINDOW) AS windowtype
  18975.  DIM globutton(MAXBUTTON) AS buttontype
  18976.  DIM gloedit(MAXEDITFIELD) AS editfieldtype
  18977.  DIM glowindowstack(MAXWINDOW) AS INTEGER
  18978.  DIM globuffer$(MAXWINDOW + 1, 2)
  18979.  
  18980.  CLS
  18981.  MenuInit
  18982.  windowinit
  18983.  
  18984.  windowopen 1, 3, 3, 20, 40, 7, 0, 7, 0, 15, 0, 0, 0, 0, 1, "Format Example"
  18985.  ' Set the variable name:
  18986.  a! = 123.34
  18987.  
  18988.  ' Convert the variable to a string:
  18989.  b$ = STR$(a!)
  18990.  
  18991.  'convert the variable to a formatted string:
  18992.  x$ = formats$(a!, "$0000.00")
  18993.  
  18994.  ' Print out the results:
  18995.  
  18996.  windowprint 1, "The unformatted variable is:"
  18997.  windowprint 1, b$
  18998.  windowprint 1, "The formatted variable using the"
  18999.  windowprint 1, "form '$0000.00':"
  19000.  windowprint 1, x$
  19001.  
  19002.  
  19003.  323. How to Simulate Bound Executables with BASIC 6.00 - 7.10
  19004.  
  19005.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  19006.  Operating System:   MS-DOS               | OS/2
  19007.  Flags: ENDUSER | SR# S900724-5
  19008.  Last Modified: 27-JUL-1990    ArticleIdent: Q64210
  19009.  
  19010.  Although Microsoft BASIC Compiler versions 6.00 and 6.00b and
  19011.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  19012.  and 7.10 for MS-DOS and MS OS/2 can create protected and real mode
  19013.  programs, they cannot create bound programs. A bound program is one
  19014.  that can run both in protected mode and real mode (DOS). However,
  19015.  there is a way to simulate the functionality of a bound program by
  19016.  creating a real mode version of the program and then linking the
  19017.  protected mode version with a module-definition file containing the
  19018.  STUB statement. The procedure for doing this is described below.
  19019.  
  19020.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  19021.  6.00b for MS-DOS and MS OS/2 and Microsoft BASIC PDS versions 7.00 and
  19022.  7.10 for MS-DOS and MS OS/2.
  19023.  
  19024.  The STUB statement adds a DOS versions 3.x (real mode) executable file
  19025.  to the beginning of the protected mode program being created by
  19026.  LINK.EXE. The syntax of the STUB statement is the following:
  19027.  
  19028.     STUB 'filename'
  19029.  
  19030.  Here, filename is the name of a real mode executable file. This real
  19031.  mode stub is invoked whenever the program is executed under DOS 2.x or
  19032.  DOS 3.x (or the DOS compatibility box of OS/2). By default, the linker
  19033.  adds its own standard stub that terminates after displaying a message
  19034.  similar to the following:
  19035.  
  19036.     This program cannot run in DOS mode.
  19037.  
  19038.  You can use the STUB statement to replace this standard stub with a
  19039.  real mode program that exactly emulates the behavior of a protected
  19040.  mode version, thus simulating a bound executable.
  19041.  
  19042.  The following is an example of the steps necessary to do this. This
  19043.  example uses the following two BASIC source files:
  19044.  
  19045.     REALMODE.BAS
  19046.     ------------
  19047.  
  19048.     PRINT "This program has the same output in protected and real modes."
  19049.  
  19050.     PROTMODE.BAS
  19051.     ------------
  19052.  
  19053.     PRINT "This program has the same output in protected and real modes."
  19054.  
  19055.  Here are the steps:
  19056.  
  19057.  1. Create a real mode version of the program as you normally would.
  19058.     For our example, the following two commands accomplish this:
  19059.  
  19060.        bc /Lr realmode.bas;
  19061.        link realmode.obj;
  19062.  
  19063.  2. Create a module-definition file containing the STUB statement. You
  19064.     can do this with any text editor. Make sure the file is saved as an
  19065.     ASCII text file. For our example, the module-definition file
  19066.     (PROTMODE.DEF) would look like this:
  19067.  
  19068.        STUB 'REALMODE.EXE'
  19069.  
  19070.  3. Create the protected mode version of the program, linking with the
  19071.     module-definition file created in Step 2. Compile the program as
  19072.     you normally would, but when linking, include the name of the
  19073.     module-definition file in the fifth link parameter. The compile
  19074.     and link commands for our example would be as follows:
  19075.  
  19076.        bc /Lp protmode.bas;
  19077.        link protmode.obj,,,,protmode.def;
  19078.  
  19079.  When PROTMODE.EXE is run from a protected mode session, the following
  19080.  will be the output:
  19081.  
  19082.     This program has the same output in protected and real modes.
  19083.  
  19084.  When PROTMODE.EXE is run from a DOS (real mode) session, REALMODE.EXE
  19085.  will be executed instead of PROTMODE.EXE. Remember that REALMODE.EXE
  19086.  is appended to the beginning of PROTMODE.EXE, so it is not necessary
  19087.  to have a copy of REALMODE.EXE in the current directory. The output
  19088.  will be the same as if PROTMODE were run from a protected mode
  19089.  session:
  19090.  
  19091.     This program has the same output in protected and real modes.
  19092.  
  19093.  
  19094.  324. LINK "Stack Plus Data Exceed 64K"; 7.00 BC /Fs Forces /S
  19095.  
  19096.  Product Version(s): 7.00 7.10 | 7.00 7.10
  19097.  Operating System:   MS-DOS    | OS/2
  19098.  Flags: ENDUSER |
  19099.  Last Modified:  6-AUG-1990    ArticleIdent: Q64424
  19100.  
  19101.  In Microsoft BASIC Professional Development System (PDS) version 7.00
  19102.  for MS-DOS and MS OS/2, the BC /Fs (Far Strings) option forces the
  19103.  compiler to also perform a /S. If you use many quoted strings in your
  19104.  program, this BC /S option places extra overhead in the .OBJ file
  19105.  that could (in some cases) overload the linker and give a "Stack plus
  19106.  data exceed 64K" error (L2041) at LINK time. Compiling without /Fs
  19107.  (using near strings) will not force /S, and the program may then LINK
  19108.  without the L2041 error.
  19109.  
  19110.  BASIC PDS version 7.10 is enhanced so that the BC /Fs option no longer
  19111.  forces an automatic /S option. This enhancement can help avoid the
  19112.  "Stack plus data exceed 64K" error as in the above case when you need
  19113.  to compile with the /Fs option.
  19114.  
  19115.  BC /S Option
  19116.  ------------
  19117.  
  19118.  The BC /S option helps you only at compile time. You only need to use
  19119.  the BC /S option when you get an "Out of memory" error message at
  19120.  compile time due to too many quoted string constants in the source
  19121.  program. Compiling with BC /S increases DGROUP usage at link time, in
  19122.  some cases contributing to the cause of the linker error "Stack plus
  19123.  data exceed 64K." Compiling with BC /S normally does not affect the
  19124.  size or speed of the final linked .EXE program.
  19125.  
  19126.  BC /Fs Option
  19127.  -------------
  19128.  
  19129.  The BC /Fs (Far Strings) option gives you more space for
  19130.  variable-length string variables at the cost of increasing the size
  19131.  and slowing the speed of .EXE programs.
  19132.  
  19133.  
  19134.  325. ISAMIO.EXE /I Imports ASCII Text File into BASIC ISAM File
  19135.  
  19136.  Product Version(s): 7.00 7.10
  19137.  Operating System:   MS-DOS
  19138.  Flags: ENDUSER | SR# S900531-47
  19139.  Last Modified:  6-AUG-1990    ArticleIdent: Q64495
  19140.  
  19141.  You can convert an ASCII text file into a Microsoft BASIC Professional
  19142.  Development System (PDS) ISAM database table by using the ISAMIO.EXE
  19143.  utility with the /I (Import) option. This article describes how to use
  19144.  the ISAMIO /I option.
  19145.  
  19146.  This information applies to Microsoft BASIC Professional Development
  19147.  System (PDS) versions 7.00 and 7.10 under MS-DOS.
  19148.  
  19149.  The syntax for importing (converting) an ASCII file into an ISAM
  19150.  database using the ISAMIO utility is as follows:
  19151.  
  19152.     ISAMIO /I ASCIIFIL.TXT DATBASE.MDB TABLNAME SPECFIL.TXT [options]
  19153.  
  19154.  ASCIIFIL.TXT can have two formats. It can appear in a fixed-width
  19155.  format where certain data appears in fixed columns of the file. The
  19156.  ISAMIO /F option is required for a file of this type. The file can
  19157.  also be comma delimited with string data enclosed in double quotation
  19158.  marks. In this format, blank spaces should not be used between the
  19159.  fields and the commas. If blank spaces are inserted between the commas
  19160.  and the data, an "Unable to Parse column xx of line xx" error may
  19161.  occur.
  19162.  
  19163.  The DATBASE.MDB and TABLNAME are names of the ISAM database and table
  19164.  into which the ASCII file is to be imported. If DATBASE.MDB or
  19165.  TABLNAME doesn't already exist, PROISAMD support must be available to
  19166.  create them. A related ISAMIO.EXE error message is as follows:
  19167.  
  19168.     ISAM command is not available" (in 7.00 or 7.10)
  19169.  
  19170.  This error message displays when PROISAM capability is currently
  19171.  installed but PROISAMD capability is needed (to create a new ISAM
  19172.  database or table). To avoid this error, do one of the following:
  19173.  
  19174.  1. If you ran SETUP.EXE with the "ISAM Routines in TSR" option, load
  19175.     PROISAMD.EXE instead of PROISAM.EXE.
  19176.  
  19177.  2. If you ran SETUP with "ISAM Routines in LIB, Support Database
  19178.     Access Only" option, run SETUP again and choose "ISAM Routines in
  19179.     LIB, Support Database Creation and Access."
  19180.  
  19181.  If the database and table already exist and you use the ISAMIO /A
  19182.  (Append) option, you can use either PROISAM or PROISAMD.
  19183.  
  19184.  SPECFIL.TXT is the file that ISAMIO uses to specify the data type and
  19185.  size for each column of a table. Each line of the file relates to a
  19186.  column of the table. The format is as follows:
  19187.  
  19188.     [fixedwidthsize,][type,[size],[columnname]]
  19189.  
  19190.  The fields in SPECFIL.TXT can be separated by spaces or commas. The
  19191.  "fixedwidthsize" field is valid only if the /F option is used. It just
  19192.  specifies the size of the field to read from ASCIIFIL.TXT.
  19193.  
  19194.  The "type" field in SPECFIL.TXT is one of the indexable ISAM data
  19195.  TYPEs. In the case of arrays, user-defined TYPEs, and strings longer
  19196.  than 255 characters, the "type" field must be specified as binary. If
  19197.  the "type" field is specified as variabletext (vt) or variablestring
  19198.  (vs), the "size" field must appear. The "size" field for string data
  19199.  tells ISAMIO the size of the field to put the string data into. The
  19200.  "size" field can be smaller, which truncates input data, or larger,
  19201.  which allows a larger string to be input later. These two types are
  19202.  the same except that variabletext (vt) is case insensitive while
  19203.  variablestring (vs) is case sensitive. Note that BASIC PDS' use of
  19204.  string data is case insensitive (that is, all comparisons made are
  19205.  case insensitive). Therefore, even if variablestring is specified, it
  19206.  is converted to variabletext.
  19207.  
  19208.  The "columnname" field in SPECFIL.TXT is any valid ISAM column name,
  19209.  but it is ignored if the /C option is used.
  19210.  
  19211.  The ISAMIO options that you can use for importing a file (/I) are /C,
  19212.  /F, and /A. The following table describes these options:
  19213.  
  19214.  Option     Description
  19215.  ------     -----------
  19216.  
  19217.  /A         Tells ISAMIO that you are importing ASCIIFIL.TXT and
  19218.             appending it to an existing table (TABLNAME). If /A is
  19219.             specified, column names cannot appear in ASCIIFIL.TXT
  19220.             (the /C option), only data. If you use the /A and /C
  19221.             options together, the following error message displays:
  19222.  
  19223.                APPEND & COLUMN_NAMES conflicts
  19224.  
  19225.             The SPECFIL.TXT file cannot appear on a command line that
  19226.             contains the /A option. ISAMIO uses the format of the
  19227.             existing table that is being appended to. If SPECFIL.TXT
  19228.             is specified along with the /A option, the following error
  19229.             message displays:
  19230.  
  19231.                APPEND and specfile conflicts
  19232.  
  19233.             If the table does not exist within the specified database
  19234.             (DATBASE.MDB), ISAMIO displays the following error message:
  19235.  
  19236.                Can't Open Table "TABLNAME"
  19237.  
  19238.  /C         Tells ISAMIO that the ISAM table's column names should be
  19239.             taken from the first line of ASCIIFIL.TXT. These column
  19240.             names need to be separated by a space, comma, or any
  19241.             combination thereof. If a column name is not consistent
  19242.             with the ISAM naming convention, ISAM displays the error
  19243.             message "Invalid Name." If this option is not specified
  19244.             when importing a new table, ISAMIO looks at SPECFIL.TXT
  19245.             for the column names. If ISAMIO doesn't find a column name
  19246.             in SPECFIL.TXT, it displays an error message that tells
  19247.             you that you must specify a column name in SPECFIL.TXT.
  19248.  
  19249.  /F         Tells ISAMIO that the text to be imported is of a
  19250.             fixed-width format (already in columns of a certain
  19251.             length). The size of the fixed-width format must be
  19252.             specified in the first column of SPECFIL.TXT. If the /F
  19253.             option is not used, the data in the fields of ASCIIFIL.TXT
  19254.             are assumed to be delimited by commas, with string data
  19255.             enclosed in double quotation marks. If you use /F and one
  19256.             of the fields is shorter than the specified length, you
  19257.             will receive the error message "Unable to parse column xx
  19258.             of line xx," where "column" refers to the column of a
  19259.             table.
  19260.  
  19261.  Depending on how you ran SETUP.EXE, the ISAMIO.EXE utility will be
  19262.  built either to run as a stand-alone program or to require the
  19263.  terminate-and-stay-resident (TSR) form of ISAM. A separate article,
  19264.  found by querying in this Knowledge Base on the following words,
  19265.  discusses this topic:
  19266.  
  19267.     SETUP and builds and ISAMIO
  19268.  
  19269.  When you run ISAMIO and receive one of the following error messages,
  19270.  you must install the PROISAM.EXE or PROISAMD.EXE TSR program if you
  19271.  are running MS-DOS; if you are running OS/2, you must put PROISAM.DLL
  19272.  or PROISAMD.DLL in your LIBPATH:
  19273.  
  19274.     ISAMIO: ISAM TSR is not loaded" (in 7.00 under MS-DOS)
  19275.     ISAMIO : error: ISAM DLL not found" (in 7.10 under MS-DOS or OS/2)
  19276.  
  19277.  The following are some examples of importing different ASCII files:
  19278.  
  19279.  Example 1
  19280.  ---------
  19281.  
  19282.  The contents of ASCIIFIL.TXT are as follows:
  19283.  
  19284.     CustomerName  Address  CustomerNumber
  19285.     Huck Finn   1606 Crest Dr. 3490
  19286.     Joe Henry   893 S. Scenic   5620
  19287.     Billy Bob   143 Maple St    0894
  19288.  
  19289.  The contents of SPECFIL.TXT are as follows (where BASIC PDS ISAM treats
  19290.  vt and vs the same way):
  19291.  
  19292.     12,vt,20
  19293.     16,vs,16
  19294.     4,integer
  19295.  
  19296.  Invoke ISAMIO.EXE in MS-DOS as follows:
  19297.  
  19298.     ISAMIO /I ASCIIFIL.TXT CUSTOMER.MDB TABLE1 SPECFIL.TXT /C/F
  19299.  
  19300.  Example 2
  19301.  ---------
  19302.  
  19303.  The contents of ASCIIFIL.TXT are as follows:
  19304.  
  19305.     "Huck Finn","1606 Crest Dr.",3490
  19306.     "Joe Henry","893 S. Scenic",5620
  19307.     "Billy Bob","143 Maple St",0894
  19308.  
  19309.  The contents of SPECFIL.TXT are as follows:
  19310.  
  19311.     12,vt,20,CustomerName
  19312.     16,vs,16,Address
  19313.     4,integer,CustomerNumber
  19314.  
  19315.  Invoke ISAMIO.EXE in MS-DOS as follows:
  19316.  
  19317.     ISAMIO /I ASCIIFIL.TXT CUSTOMER.MDB TABLE2 SPECFIL.TXT
  19318.  
  19319.  Example 3:  Appending a File to an Existing ISAM Table
  19320.  ------------------------------------------------------
  19321.  
  19322.  The following example shows how to append an ASCII file to an existing
  19323.  ISAM table:
  19324.  
  19325.  The contents of APENDFIL.TXT are as follows:
  19326.  
  19327.     "John Doe","1387 Main Blvd.",2490
  19328.  
  19329.  Note that a SPECFIL.TXT file is not used when appending a file to the
  19330.  ISAM table. Invoke ISAMIO.EXE as follows:
  19331.  
  19332.     ISAMIO /I APENDFIL.TXT CUSTOMER.MDB TABLE2 /A
  19333.  
  19334.  For more information on how to use ISAMIO, see Pages 389-391, Chapter
  19335.  10, "ISAM Utilities," of the "Microsoft BASIC 7.0: Programmer's Guide"
  19336.  for versions 7.00 and 7.10.
  19337.  
  19338.  
  19339.  326. SETUP Builds ISAMIO, ISAMCVT, ISAMPACK as Stand Alone or Not
  19340.  
  19341.  Product Version(s): 7.00 7.10
  19342.  Operating System:   MS-DOS
  19343.  Flags: ENDUSER |
  19344.  Last Modified:  3-AUG-1990    ArticleIdent: Q64496
  19345.  
  19346.  Depending on how you run SETUP.EXE, the ISAM utilities ISAMIO.EXE,
  19347.  ISAMCVT.EXE, and ISAMPACK.EXE are built either to run as stand-alone
  19348.  programs or to require the terminate-and-stay-resident (TSR) form of
  19349.  ISAM.
  19350.  
  19351.  SETUP always installs the ISAMREPR.EXE (ISAM repair) utility to run as
  19352.  a stand-alone program.
  19353.  
  19354.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  19355.  and 7.10 provides the following four SETUP.EXE options for installing
  19356.  ISAM support for DOS (or OS/2 real mode):
  19357.  
  19358.  1. ISAM Routines in TSR
  19359.  2. ISAM Routines in LIB, Support Database Creation and Access
  19360.  3. ISAM Routines in LIB, Support Database Access Only
  19361.  4. No ISAM support
  19362.  
  19363.  SETUP Option 1 builds ISAMIO.EXE, ISAMCVT.EXE, or ISAMPACK.EXE
  19364.  utilities that require the TSR form of ISAM (PROISAM.EXE or
  19365.  PROISAMD.EXE). Option 1 is the default because it consumes the least
  19366.  disk space.
  19367.  
  19368.  SETUP Options 2 and 3 create stand-alone ISAM utilities (ISAMIO.EXE,
  19369.  ISAMCVT.EXE, ISAMREPR.EXE, and ISAMPACK.EXE), which do not require the
  19370.  presence of the ISAM TSR programs (PROISAM.EXE or PROISAMD.EXE). If
  19371.  you choose Option 3 instead of 2, the ISAM utilities will not be able
  19372.  to create or delete any ISAM databases or tables, they will just be
  19373.  able to add and delete records for existing databases or tables.
  19374.  
  19375.  SETUP Option 4 does not copy any ISAM utilities, TSR programs, or any
  19376.  other ISAM-related files onto your computer.
  19377.  
  19378.  Because BASIC PDS 7.10 introduces ISAM support under OS/2 protected
  19379.  mode, it provides the following two additional SETUP options:
  19380.  
  19381.  1. ISAM Routines in DLL
  19382.  2. No ISAM Support
  19383.  
  19384.  The protected mode ISAM SETUP choices (above) do not affect how
  19385.  ISAMIO.EXE, ISAMCVT.EXE, ISAMREPR.EXE, or ISAMPACK.EXE are built,
  19386.  since these ISAM utilities run only under MS-DOS (and not under OS/2).
  19387.  
  19388.  Reference:
  19389.  
  19390.  For more information, see Pages 389-399, Chapter 10, "ISAM Utilities,"
  19391.  of the "Microsoft BASIC 7.0: Programmer's Guide" for versions 7.00 and
  19392.  7.10.
  19393.  
  19394.  
  19395.  327. How to Use Named, Shared Memory Segments in OS/2 BASIC Program
  19396.  
  19397.  Product Version(s): 6.00 6.00b 7.00 7.10
  19398.  Operating System:   OS/2
  19399.  Flags: ENDUSER | SR# S900730-92
  19400.  Last Modified: 17-AUG-1990    ArticleIdent: Q64589
  19401.  
  19402.  Microsoft BASIC Compiler versions 6.00 and 6.00b and Microsoft BASIC
  19403.  Professional Development System (PDS) versions 7.00 and 7.10 can
  19404.  create OS/2 protected mode programs that use named, shared memory
  19405.  segments. Named, shared memory segments are areas of memory used for
  19406.  interprocess communications (IPC). Their use involves calling three
  19407.  different OS/2 API functions. Below are two sample BASIC programs that
  19408.  demonstrate the use of named, shared memory segments.
  19409.  
  19410.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  19411.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  19412.  System (PDS) versions 7.00 and 7.10 for MS OS/2.
  19413.  
  19414.  Named, shared memory segments can be used to communicate between
  19415.  processes. Their names have the following form:
  19416.  
  19417.     \SHAREMEM\name.ext
  19418.  
  19419.  ".ext" is optional. The size of the segment can be up to 65,536 bytes.
  19420.  After the segment is allocated, it can be read from and written to
  19421.  using PEEK and POKE, which examine and set (respectively) a 1-byte
  19422.  address location. Typically, one process (called the "creator") will
  19423.  allocate the segment and other programs (called "obtainers") will
  19424.  obtain the address (selector) to it. The minimum OS/2 API functions
  19425.  that need to be called to use named, shared memory segments are the
  19426.  following:
  19427.  
  19428.  For the Creator
  19429.  ---------------
  19430.  
  19431.  Function       Description
  19432.  --------       -----------
  19433.  
  19434.  DosAllocShrSeg()   Allocates a named, shared memory segment of up to
  19435.                     65,536 bytes and returns a selector for it.
  19436.  
  19437.  For the Obtainers
  19438.  -----------------
  19439.  
  19440.  Function       Description
  19441.  --------       -----------
  19442.  
  19443.  DosGetShrSeg()     Obtains a selector to a named, shared memory segment
  19444.                     that was allocated by DosAllocShrSeg().
  19445.  
  19446.  For Both the Creator and Obtainers
  19447.  ----------------------------------
  19448.  
  19449.  Function       Description
  19450.  --------       -----------
  19451.  
  19452.  DosFreeSeg()       Releases the selector to the segment. When all
  19453.                     selectors by all processes have been released, the
  19454.                     segment is reclaimed by OS/2.
  19455.  
  19456.  For more information on named, shared memory segments and other IPC
  19457.  methods, see Chapter 13, "Interprocess Communication," of "Advanced
  19458.  OS/2 Programming" by Ray Duncan (Microsoft Press, 1989).
  19459.  
  19460.  The following are two sample programs that demonstrate the use of
  19461.  named, shared memory segments. To compile the programs, enter the
  19462.  following commands at the OS/2 command prompt:
  19463.  
  19464.     bc creator;
  19465.     bc obtainer;
  19466.  
  19467.  How the programs are linked depends on which version of BASIC is being
  19468.  used. This is because in BASIC 6.00 and 6.00b, the name of the OS/2
  19469.  API functions import library is DOSCALLS.LIB. In BASIC PDS 7.00 and
  19470.  7.10, the name is OS2.LIB. The link lines are as follows:
  19471.  
  19472.  For BASIC 6.00 and 6.00b:  link creator,,,doscalls;
  19473.                             link obtainer,,,doscalls;
  19474.  
  19475.  For BASIC PDS 7.00 and 7.10:  link creator,,,os2;
  19476.                                link obtainer,,,os2;
  19477.  
  19478.  CREATOR.BAS
  19479.  -----------
  19480.  
  19481.  'CREATOR.BAS allocates a named, shared segment and writes the letters
  19482.  'of the alphabet to bytes 0 through 25 of the segment. It then waits
  19483.  'until byte 0 of the segment becomes 255 before releasing its selector
  19484.  'and terminating.
  19485.  DECLARE FUNCTION DosAllocShrSeg% (BYVAL SegmentSize%,
  19486.                                    BYVAL NameSegment%,_
  19487.                                    BYVAL NameOffset%, SEG Selector%)
  19488.  DECLARE FUNCTION DosFreeSeg%     (BYVAL Selector%)
  19489.  
  19490.  'Attempt to allocate the segment.
  19491.  SegmentName$ = "\SHAREMEM\SPIKE" + CHR$(0)
  19492.  ErrorCode%   = DosAllocShrSeg% (26, VARSEG(SegmentName$),_
  19493.                                  SADD(SegmentName$), Selector%)
  19494.  
  19495.  'Check if an error occurred.  If not, make the segment current.
  19496.  IF ErrorCode% <> 0 THEN
  19497.     PRINT "Error";ErrorCode%;" allocating segment"
  19498.     BEEP
  19499.     END
  19500.  ELSE
  19501.     DEF SEG = Selector%
  19502.  END IF
  19503.  
  19504.  FOR ASCII% = 65 TO 90         'Write the letters A through Z to bytes
  19505.     POKE ASCII% - 65, ASCII%   '0 through 25 of the segment.
  19506.  NEXT ASCII%
  19507.  
  19508.  PRINT "Waiting for data to be read..."   'When OBTAINER.BAS is done
  19509.  DO UNTIL PEEK(0) = 255                   'reading, it will put a 255
  19510.  LOOP                                     'in byte 0 of the segment.
  19511.  
  19512.  ErrorCode% = DosFreeSeg% (Selector%)   'Free the segment selector.
  19513.  END
  19514.  
  19515.  OBTAINER.BAS
  19516.  ------------
  19517.  
  19518.  'OBTAINER.BAS obtains a selector to the segment created by
  19519.  'CREATOR.BAS and reads bytes 0 through 25, display their contents. It
  19520.  'then POKEs a 255 into byte 0 of the segment so CREATOR.BAS will
  19521.  'terminate. Lastly, it releases its selector to the segment and
  19522.  'terminates itself.
  19523.  DECLARE FUNCTION DosGetShrSeg% (BYVAL NameSegment%,
  19524.                                  BYVAL NameOffset%, SEG Selector%)
  19525.  DECLARE FUNCTION DosFreeSeg%   (BYVAL Selector%)
  19526.  
  19527.  'Attempt to get a selector for the segment.
  19528.  SegmentName$ = "\SHAREMEM\SPIKE" + CHR$(0)
  19529.  ErrorCode%   = DosGetShrSeg% (VARSEG(SegmentName$),_
  19530.                                SADD(SegmentName$), Selector%)
  19531.  
  19532.  'Check if an error occurred.  If not, make the segment current.
  19533.  IF ErrorCode% <> 0 THEN
  19534.     PRINT "Error";ErrorCode%;" getting segment"
  19535.     BEEP
  19536.     END
  19537.  ELSE
  19538.     DEF SEG = Selector%
  19539.  END IF
  19540.  
  19541.  FOR Offset% = 0 TO 25
  19542.     PRINT CHR$(PEEK(Offset%));" ";   'Display bytes 0 to 25 of the
  19543.  NEXT Offset%                        'named, shared memory segment.
  19544.  
  19545.  POKE 0, 255                            'Signal CREATOR.BAS to end and
  19546.  ErrorCode% = DosFreeSeg% (Selector%)   'release the segment selector.
  19547.  END
  19548.  
  19549.  
  19550.  328. EMS40.SYS Is Valid LIM 4.0 Driver for EM Use in BASIC PDS
  19551.  
  19552.  Product Version(s): 7.00 7.10
  19553.  Operating System:   MS-DOS
  19554.  Flags: ENDUSER | SR# S900717-157 EMS40
  19555.  Last Modified:  5-SEP-1990    ArticleIdent: Q64591
  19556.  
  19557.  EMS40.SYS is a device driver that emulates the Lotus/Intel/Microsoft
  19558.  (LIM) Expanded Memory Specification (EMS) version 4.0. This software
  19559.  permits AT-class machines with extended memory to adapt their extended
  19560.  memory (defined by XMS) to expanded memory (defined by EMS). This
  19561.  driver is compatible with Microsoft BASIC Professional Development
  19562.  System (PDS) versions 7.00 and 7.10 and can map BASIC PDS source code
  19563.  segments less than 16K in size to the expanded memory of the machine.
  19564.  
  19565.  EMS40.SYS is freeware and it is available for downloading from the PC
  19566.  MagNet bulletin board. Although the source code is also available on
  19567.  MagNet, EMS40.SYS is already compiled and ready to use. Much of the
  19568.  information in this article comes from the "readme" file also
  19569.  available on MagNet.
  19570.  
  19571.  EMS40.SYS can be installed as a driver specified in your CONFIG.SYS
  19572.  file with the syntax shown below. The drive and path should be
  19573.  specified so the system can find the driver during machine boot-up.
  19574.  Once installed, EMS40.SYS cannot be removed from memory without
  19575.  rebooting the computer.
  19576.  
  19577.     DEVICE=[LogicalDriveName:\][path\]EMS40.SYS [xxx]
  19578.  
  19579.  The optional "xxx" parameter allows you to specify the amount of
  19580.  extended memory in kilobytes (K) to be used as expanded memory by
  19581.  EMS40.SYS. If the "xxx" parameter is omitted, the default value is
  19582.  384K. By setting "xxx: to a smaller value than that of the extended
  19583.  memory installed, space can be reserved for extended memory programs,
  19584.  such as HIMEM.SYS.
  19585.  
  19586.  EMS40.SYS maps extended memory into four contiguous 16K pages in
  19587.  conventional DOS memory and permits access to memory in situations
  19588.  that otherwise could result in a "Memory Full" error. EMS40.SYS is not
  19589.  as fast as a dedicated LIM 4.0 EMS board and driver, but it implements
  19590.  (within the limitations of software emulation) all 28 functions
  19591.  specified in the LIM 4.0 EMS. It does not attempt, however, to emulate
  19592.  the DMA functions included in Function 28, Alternate Map Register Set.
  19593.  
  19594.  
  19595.  329. QBX.EXE Color Loss & Hang on VGA on Tecmar BIOS 1.02; 1.11 OK
  19596.  
  19597.  Product Version(s): 7.00 7.10
  19598.  Operating System:   MS-DOS
  19599.  Flags: ENDUSER | B_QuickBAS
  19600.  Last Modified: 17-OCT-1990    ArticleIdent: Q64899
  19601.  
  19602.  Several customers have reported that when running QBX.EXE from
  19603.  Microsoft BASIC Professional Development System (PDS) version 7.00 or
  19604.  7.10 on a machine with a Tecmar ROM BIOS version 1.02 or 1.04, if a
  19605.  VGA screen is being used, the environment loses color and the system
  19606.  eventually hangs or reboots itself.
  19607.  
  19608.  Tecmar is researching this problem and will provide a free upgrade to
  19609.  Tecmar ROM BIOS version 1.11. To obtain this free upgrade, call Tecmar
  19610.  technical support at (800) 344-4463.
  19611.  
  19612.  This information applies to Microsoft BASIC Professional Development
  19613.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  19614.  
  19615.  
  19616.  330. An Alternative If ISAMCVT Fails on IBM BASIC 2.0 ISAM Database
  19617.  
  19618.  Product Version(s): 7.00 7.10
  19619.  Operating System:   MS-DOS
  19620.  Flags: ENDUSER | SR# S900801-41
  19621.  Last Modified:  5-SEP-1990    ArticleIdent: Q64934
  19622.  
  19623.  ISAMCVT.EXE is a utility provided with Microsoft BASIC Professional
  19624.  Development System (PDS) versions 7.00 and 7.10 for the purpose of
  19625.  converting files created with other database-management systems,
  19626.  including IBM BASIC Compiler version 2.00, to the Microsoft ISAM
  19627.  format.
  19628.  
  19629.  You can also convert the database using the REBUILD.EXE utility
  19630.  provided in IBM BASIC Compiler version 2.00. IBM's REBUILD can be used
  19631.  to strip the header information off the IBM ISAM data (.DAT) file. The
  19632.  file can then be read in as a random access file and written out to a
  19633.  Microsoft BASIC PDS 7.00 or 7.10 ISAM database.
  19634.  
  19635.  This information applies to Microsoft BASIC Professional Development
  19636.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  19637.  
  19638.  For more information on the ISAMCVT.EXE utility, see Pages 391-393 of
  19639.  the "Microsoft BASIC 7.0: Programmer's Guide" for versions 7.00 and
  19640.  7.10.
  19641.  
  19642.  This article contains the sample program CONVERT.BAS, which reads,
  19643.  with random access, the file created by the REBUILD utility with the
  19644.  /S option and writes the information out to a Microsoft BASIC PDS 7.00
  19645.  or 7.10 ISAM database. Please note that this process does not save
  19646.  indexes, so they will have to be rebuilt.
  19647.  
  19648.  When an IBM BASIC 2.00 ISAM file is created, two files are actually
  19649.  created: an index file with a .KEY extension, and a data file with the
  19650.  .DAT extension. The .DAT file has a structure very similar to a random
  19651.  access file except for the additional header information, known as the
  19652.  "data dictionary." The data dictionary can be removed by using the
  19653.  REBUILD utility with the /S option. The syntax is as follows:
  19654.  
  19655.     REBUILD SOURCE.DAT, TARGET.DAT /S;
  19656.  
  19657.  The "Single-key" switch (/S) tells REBUILD to copy the source file
  19658.  (the BASIC 2.00 data file) into the target file, removing the data
  19659.  dictionary and any free space. No key file is built. The format of the
  19660.  target file is a random access file with an additional 3-byte field
  19661.  added to the beginning of each record. When reading the random file
  19662.  into a BASIC 7.00 or 7.10 program, the TYPE...END TYPE statement must
  19663.  be formatted the same way as the corresponding FIELD statement used in
  19664.  the IBM BASIC 2.00 program, with the additional 3-byte field at the
  19665.  beginning of each record. For example:
  19666.  
  19667.  Used in BASIC 2.00 Program       Corresponding BASIC 7.00, 7.10 Declaration
  19668.  --------------------------       ------------------------------------------
  19669.  
  19670.      FIELD #1, _                    TYPE BASIC20Rec
  19671.       25 as Name$, _                      Basic2Index AS STRING * 3
  19672.       30 as Address$, _                   Name AS STRING * 25
  19673.       4 as Zip$, _                        Address AS STRING * 30
  19674.       1 as Sex$, _                        Zip AS STRING * 4
  19675.       2 as Age$, _                        Sex AS STRING * 1
  19676.       4 as Income$                        Age AS STRING * 2
  19677.                                           Income AS STRING * 4
  19678.                                     END TYPE
  19679.  
  19680.  Now you need to set up a TYPE...END TYPE statement to write the
  19681.  appropriate information to an ISAM database or to another random
  19682.  access file. This is to mask the BASIC 2.00 index off from the record.
  19683.  You will have to dimension a variable or array of each type and assign
  19684.  each of the individual fields, ignoring the 3-byte Basic2Index field.
  19685.  For example:
  19686.  
  19687.       TYPE BASIC70Rec
  19688.             Name AS STRING * 25
  19689.             Address AS STRING * 30
  19690.             Zip AS DOUBLE        '7.00/7.10 ISAM doesn't support SINGLE
  19691.             Sex AS STRING * 1
  19692.             Age AS INTEGER
  19693.             Income AS DOUBLE     '7.00/7.10 ISAM doesn't support SINGLE
  19694.       END TYPE
  19695.  
  19696.       DIM OldRec AS BASIC20Rec
  19697.       DIM NewRec AS BASIC70Rec
  19698.                 .
  19699.                 .
  19700.                 .
  19701.       NewRec.Name = OldRec.Name
  19702.       NewRec.Address = OldRec.Address
  19703.       NewRec.Zip = CVS(OldRec.Zip)
  19704.       NewRec.Sex = OldRec.Sex
  19705.       NewRec.Age = CVI(OldRec.Age)
  19706.       NewRec.Income = CVS(OldRec.Income)
  19707.  
  19708.  Note that if floating-point values in records were written to the
  19709.  file, you will need to convert them by invoking the QBX environment
  19710.  with the /MBF option. This is because IBM BASIC Compiler 2.00 uses the
  19711.  Microsoft Binary Format (MBF) for floating-point numbers, and
  19712.  Microsoft BASIC PDS 7.00 and 7.10 use the IEEE format. For example:
  19713.  
  19714.     QBX /MBF
  19715.  
  19716.  For more information on the ISAM utilities, query in this Knowledge
  19717.  Base on the following words:
  19718.  
  19719.     ISAM and BASIC and UTILITY
  19720.  
  19721.  Code Example
  19722.  ------------
  19723.  
  19724.  'Below is CONVERT.BAS, the sample program that converts the sample ISAM
  19725.  'file "MAIL.DAT" found on the IBM BASIC Compiler 2.00 disks. MAIL.DAT
  19726.  'is rebuilt to the file "MAIL2.DAT" when the following command is typed
  19727.  'at the DOS prompt:
  19728.  '
  19729.  '   REBUILD MAIL.DAT, MAIL2.DAT /S;
  19730.  '
  19731.  'The file is then read as a random file and each record is inserted
  19732.  'into the database "CUSTOMER.MDB". For this example, invoke QBX.EXE
  19733.  'with the /MBF option and load the PROISAMD.EXE TSR program.
  19734.  
  19735.  DEFINT A-Z
  19736.  
  19737.  '  Record description of data file MAIL2.DAT after REBUILD utility is
  19738.  '  used:
  19739.  
  19740.  TYPE BASIC2Rec
  19741.       Basic2Index AS STRING * 3  'This is the 3-byte index from REBUILD
  19742.       Name AS STRING * 25        'First and last name
  19743.       Address AS STRING * 30     'Address
  19744.       Zip AS STRING * 4          'Zip, SINGLE written to file using
  19745.                                  'MKS$
  19746.       Sex AS STRING * 1          'Sex
  19747.       Age AS STRING * 2          'Age, INTEGER written to file using
  19748.                                  'MKI$
  19749.       Income AS STRING * 4       'Income, SINGLE written to file using
  19750.                                  'MKS$
  19751.  END TYPE
  19752.  
  19753.  TYPE BASIC7Rec
  19754.        Name AS STRING * 25      'First and last name
  19755.        Address AS STRING * 30   'Address
  19756.        Zip AS DOUBLE            'Zip, note the conversion process below
  19757.        Sex AS STRING * 1        'Sex
  19758.        Age AS INTEGER           'Age, note the conversion process below
  19759.        Income AS DOUBLE         'Income, note the conversion process
  19760.                                 'below
  19761.  END TYPE
  19762.  
  19763.  DIM OldCust AS BASIC2Rec
  19764.  DIM NewCust AS BASIC7Rec
  19765.  
  19766.  OPEN "MAIL2.DAT" FOR RANDOM AS #1 LEN = LEN(OldCust)
  19767.  OPEN "CUSTOMER.MDB" FOR ISAM BASIC7Rec "TABLE1" AS #2
  19768.  CLS
  19769.  i = 0
  19770.  DO WHILE NOT EOF(1)
  19771.   i = i + 1
  19772.   GET #1, i, OldCust           'Get the old record
  19773.  
  19774.       'Assign the corresponding fields, ignoring the 3-byte index:
  19775.  
  19776.   NewCust.Name = OldCust.Name
  19777.   NewCust.Address = OldCust.Address
  19778.   NewCust.Zip = CVS(OldCust.Zip)        'Convert MBF to SINGLE
  19779.                                         'and assign into DOUBLE
  19780.   NewCust.Sex = OldCust.Sex
  19781.   NewCust.Age = CVI(OldCust.Age)        'Convert MBF to INTEGER
  19782.   NewCust.Income = CVS(OldCust.Income)  'Convert MBF to SINGLE
  19783.                                         'and assign to DOUBLE
  19784.  
  19785.       'Insert the array element into the ISAM database:
  19786.  
  19787.   INSERT #2, NewCust
  19788.  
  19789.  LOOP
  19790.  
  19791.  PRINT "The file is loaded into the database"   'tell user that the
  19792.                                                 'file is loaded
  19793.  PRINT "Number of records read: "; i; "  hit key to continue"
  19794.  SLEEP
  19795.  
  19796.  SETINDEX #2
  19797.  MOVEFIRST #2                'Print out the database, to verify that
  19798.  DO WHILE NOT EOF(2)         'the information is there.
  19799.        RETRIEVE #2, NewCust
  19800.  
  19801.        PRINT
  19802.        PRINT NewCust.Name
  19803.        PRINT NewCust.Address
  19804.        PRINT NewCust.Zip
  19805.        PRINT NewCust.Sex
  19806.        PRINT NewCust.Age
  19807.        PRINT NewCust.Income
  19808.        MOVENEXT #2
  19809.  LOOP
  19810.  
  19811.  
  19812.  331. ISAM Benchmark of PDS 7.10 Versus 7.00, FoxPro, and Btrieve
  19813.  
  19814.  Product Version(s): 7.00 7.10
  19815.  Operating System:   MS-DOS
  19816.  Flags: ENDUSER | fast faster slow slower quick
  19817.  Last Modified:  5-DEC-1990    ArticleIdent: Q64979
  19818.  
  19819.  The following article gives a benchmark comparison of ISAM file speed
  19820.  in Microsoft BASIC Professional Development System (PDS) version 7.10
  19821.  versus the following products: BASIC PDS version 7.00, Fox Software's
  19822.  FoxPro version 1.0, and Novell's Btrieve version 5.0c.
  19823.  
  19824.  These performance comparisons are taken from the Microsoft press
  19825.  release document (for BASIC PDS 7.10) dated July 24, 1990.
  19826.  
  19827.  ISAM DATABASE SPEED COMPARISONS
  19828.  -------------------------------
  19829.  
  19830.  The benchmark suites used by Microsoft for performance testing and
  19831.  comparison are similar to those used by Software Digest at National
  19832.  Software Testing Laboratories (NSTL) for benchmarking of relational
  19833.  databases. All benchmark tests below were performed on a COMPAQ 386
  19834.  20e with a 110 MB hard disk and 640K of conventional memory under
  19835.  MS-DOS.
  19836.  
  19837.  The following four files ("tables" in BASIC PDS) were used: two files
  19838.  (tables) with three indexed columns and 1000 records; one file (table)
  19839.  with three indexed columns and 10000 records; and one file (table)
  19840.  with two indexed columns and 10000 records. Each record (in each
  19841.  file/table) contained 10 text columns plus one integer column, for a
  19842.  total of 122 characters per record. The total database size for the
  19843.  four files (tables) was 6 megabytes in both BASIC PDS and Novell
  19844.  Btrieve. A disk unfragmentation utility was run to compact the
  19845.  databases before performing the benchmarks.
  19846.  
  19847.  BASIC PDS 7.10 Versus 7.00
  19848.  --------------------------
  19849.  
  19850.  All tests ran using 64K of ISAM buffer space.
  19851.  
  19852.                                                         PDS 7.10 Improvement
  19853.  Item                               PDS 7.00  PDS 7.10  Percent over PDS 7.00
  19854.  ----                               --------  --------  ---------------------
  19855.  
  19856.  Average Individual Record Search   1.4        1.3         8%
  19857.  Group Record Search On Index       6.3        5.6        13%
  19858.  Group Record Search w/o an Index  14          9.9        41%
  19859.  Subtotal 100 Groups/Short Field   34.8       20.7        68%
  19860.  Two-File Join with Subtotals     203.2      131.4        55%
  19861.  3-File Join w/ Hi Record Return  220.9      173.7        27%
  19862.  Three-File Join with Subtotaling 154.1       62.1       148%
  19863.  4-File Join w/ Lo Record Return   82.8       39.9       108%
  19864.  Two-File, Many to Many Join        5.6        3.1        81%
  19865.  
  19866.  Mean Speed Improvement of 61 percent BASIC PDS 7.10 over PDS 7.00
  19867.  
  19868.  Microsoft BASIC PDS 7.10 Versus FoxPro 1.0 (from Fox Software)
  19869.  --------------------------------------------------------------
  19870.  
  19871.  These tests ran using maximum buffer space available in 640K
  19872.  conventional memory.
  19873.  
  19874.                                                           PDS 7.10 over
  19875.  Item                               FoxPro 1.0  PDS 7.10  FoxPro, in Percent
  19876.  ----                               ----------  --------  ------------------
  19877.  
  19878.  Average Individual Record Search   1.5          1.3        15%
  19879.  Group Record Search On Index       4            4.4        -9%
  19880.  Group Record Search w/o Index      7.5          9         -17%
  19881.  Subtotal 100 Groups/Short Field   22.1         20.2         9%
  19882.  Two-File Join with Subtotals      34.3         30.8        11%
  19883.  3-File Join with Hi Record Return 72.1         46.4        55%
  19884.  Three-File Join with Subtotaling  44.9         34.2        31%
  19885.  4-File Join with Lo Record Return 30.3         32.1        -6%
  19886.  Two-File, Many to Many Join        4.7          3.1        52%
  19887.  
  19888.  Mean Speed Improvement of 16 percent BASIC PDS 7.10 over FoxPro
  19889.  
  19890.  BASIC PDS 7.10 Versus Novell's Btrieve 5.0c
  19891.  -------------------------------------------
  19892.  
  19893.  These tests were run using a maximum buffer space of 64K in Btrieve.
  19894.  
  19895.                                                         PDS 7.10 over
  19896.  Item                           Btrieve 5.0c  PDS 7.10  Btrieve, in Percent
  19897.  ----                           ------------  --------  -------------------
  19898.  
  19899.  Average Individual Record Search    0.8       1.3       -38%
  19900.  Group Record Search On Index        4.3       5.6       -23%
  19901.  Group Record Search w/o an Index   19.9       9.9       101%
  19902.  Subtotal 100 Groups/Short Field    64.3      20.7       211%
  19903.  Two-File Join with Subtotals      400       131.4       204%
  19904.  3-File Join w/ Hi Record Return   288       173.7        66%
  19905.  Three-File Join with Subtotaling  235.9      62.1       280%
  19906.  4-File Join w/ Lo Record Return   110        39.9       176%
  19907.  Two-File, Many to Many Join        15.3       3.1       394%
  19908.  
  19909.  Mean Speed Improvement of 152 percent BASIC PDS 7.10 over Btrieve
  19910.  
  19911.  
  19912.  332. QBX.EXE "Out of Data Space" for Variable-Length String Array
  19913.  
  19914.  Product Version(s): 7.00 7.10 | 7.00 7.10
  19915.  Operating System:   MS-DOS    | OS/2
  19916.  Flags: ENDUSER |
  19917.  Last Modified:  4-SEP-1990    ArticleIdent: Q65034
  19918.  
  19919.  The 4-byte string descriptor for each variable-length string resides
  19920.  in DGROUP (the 64K near heap) regardless of the compiler string option
  19921.  (near or far).
  19922.  
  19923.  When using the far strings option (BC /Fs option, or running within
  19924.  QBX.EXE), only the contents (not the 4-byte descriptors) of the
  19925.  variable-length string are stored in the far segments. Large string
  19926.  arrays (near or far) can quickly fill up DGROUP with string
  19927.  descriptors, as shown in the examples below.
  19928.  
  19929.  This article illustrates how you can get both "Out of Data Space" and
  19930.  "Out of Memory" messages in QBX.EXE using an empty variable-length
  19931.  string array (dynamic or static) that fills up DGROUP with 4-byte
  19932.  string descriptors.
  19933.  
  19934.  This article also illustrates how, from a compiled .EXE program, you
  19935.  can get an "Out of String Space" message at run time when allocating
  19936.  dynamic variable-length string arrays and how you can get a "LINK :
  19937.  Fatal error L2041: Stack plus data exceed 64K" message at LINK time
  19938.  when allocating static variable-length string arrays, due to filling
  19939.  up DGROUP with 4-byte string descriptors.
  19940.  
  19941.  This information applies to Microsoft BASIC Professional Development
  19942.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  19943.  
  19944.  Code Example 1 (Static Array)
  19945.  -----------------------------
  19946.  
  19947.  This example shows size limits using a static array of variable-length
  19948.  strings.
  19949.  
  19950.  This DIM gives "Out of Data Space" followed by "Out of Memory" in
  19951.  QBX.EXE before the PRINT can be executed. The string descriptors (4
  19952.  bytes per string-array element) are using up all the memory in DGROUP.
  19953.  
  19954.     PRINT "This never prints in QBX.EXE"
  19955.     DIM b$(12000)    ' Note:  DIM b$(11000) works without error.
  19956.  
  19957.  If you compile this program with BC /Fs to a .EXE program, you can
  19958.  specify up to about DIM b$(14000) without error. DIM b$(15000) gives
  19959.  the LINK.EXE error "LINK : Fatal error L2041: Stack plus data exceed
  19960.  64K" because DGROUP is filled up with string descriptors.
  19961.  
  19962.  Code Example 2 (dynamic array)
  19963.  ------------------------------
  19964.  
  19965.  This example shows size limits using a dynamic array of
  19966.  variable-length strings.
  19967.  
  19968.  The following program gives "Out of Data Space" followed by "Out of
  19969.  Memory" at run time in QBX.EXE when the program reaches REDIM
  19970.  A$(12000). From a compiled .EXE program, an "Out of String Space"
  19971.  message occurs at REDIM A$(16000) or larger, again because DGROUP is
  19972.  filled up with string descriptors.
  19973.  
  19974.  Note that each string element has 2 additional bytes of overhead per
  19975.  element in the far heap segment (even for this array that is empty of
  19976.  any string contents).
  19977.  
  19978.  CLS
  19979.  FOR j = 5 TO 16
  19980.  REDIM a$(j * 1000)
  19981.  PRINT "DIM a$("; j * 1000; ")"; " Far string segment usage="; FRE(a$)
  19982.  ' STACK returns the space available in DGROUP:
  19983.  PRINT "DGROUP available="; STACK
  19984.  NEXT
  19985.  
  19986.  References:
  19987.  
  19988.  See Pages 719-720, "Variable Storage and Memory Use," and also Chapter
  19989.  11, "Advanced String Storage," in the "Microsoft BASIC 7.0:
  19990.  Programmer's Guide" for BASIC PDS versions 7.00 and 7.10.
  19991.  
  19992.  
  19993.  333. "Error During Run-Time Initialization" Mixing Near/Far Strings
  19994.  
  19995.  Product Version(s): 7.00 7.10
  19996.  Operating System:   MS-DOS
  19997.  Flags: ENDUSER |
  19998.  Last Modified:  4-SEP-1990    ArticleIdent: Q65082
  19999.  
  20000.  When you link separate modules together to make an .EXE program, all
  20001.  the modules must have been compiled with the same string option (near
  20002.  or far strings).
  20003.  
  20004.  If you LINK modules or libraries together and some were compiled with
  20005.  and some without the BC /Fs (far strings) option, the .EXE program can
  20006.  hang in version 7.00, or can give the following error message at run
  20007.  time in version 7.10:
  20008.  
  20009.     Error during run-time initialization
  20010.  
  20011.  This information applies to Microsoft BASIC Professional Development
  20012.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  20013.  
  20014.  Combining string options can cause unpredictable results in the .EXE
  20015.  program at run time. After the possible hang in 7.00, a warm boot
  20016.  (CTRL+ALT+DEL) may not work. To reboot, you may have to turn the
  20017.  computer off, then back on.
  20018.  
  20019.  To avoid this problem, only LINK routines that were compiled with the
  20020.  same string option (BC /Fs or no /Fs).
  20021.  
  20022.  Also, remember that the QBX.EXE environment of BASIC PDS 7.00 and 7.10
  20023.  only supports far strings, not near strings. In other words, all BASIC
  20024.  object modules linked into a Quick library (.QLB file) for use in
  20025.  QBX.EXE must be compiled with the BC /Fs option.
  20026.  
  20027.  What Are Far Strings?
  20028.  ---------------------
  20029.  
  20030.  The contents of far strings are stored in the far heap, and the
  20031.  contents of near strings are stored in near heap (the 64K DGROUP
  20032.  segment).
  20033.  
  20034.  Note that the BC /Fs (far strings) option affects only the storage
  20035.  location of variable-length string variables. The far strings option
  20036.  does NOT affect fixed-length string variables. (Also, fixed-length
  20037.  strings do NOT have a string descriptor.)
  20038.  
  20039.  Every variable-length string variable (or array element) has a 4-byte
  20040.  string descriptor. The 4-byte string descriptor for each
  20041.  variable-length string always resides in DGROUP (the 64K near heap)
  20042.  regardless of the compiler string option (near or far).
  20043.  
  20044.  References:
  20045.  
  20046.  See Pages 719-720, "Variable Storage and Memory Use," and also
  20047.  Chapter 11, "Advanced String Storage," in the "Microsoft BASIC 7.0:
  20048.  Programmer's Guide" for BASIC PDS versions 7.00 and 7.10.
  20049.  
  20050.  Code Example 1
  20051.  --------------
  20052.  
  20053.  Compile the following program with the BC /Fs option, as follows:
  20054.  
  20055.     BC TEST1/Fs;
  20056.  
  20057.  REM  TEST1.BAS
  20058.  CALL TEST
  20059.  
  20060.  Compile the following program with BC and no options, as follows:
  20061.  
  20062.     BC TEST2;
  20063.  
  20064.  REM  TEST2.BAS
  20065.  SUB TEST STATIC
  20066.  PRINT "This is a test"
  20067.  END SUB
  20068.  
  20069.  Link as follows:  LINK TEST1+TEST2;
  20070.  
  20071.  Now run TEST1.EXE. If compiled in BASIC 7.00, the program may display
  20072.  random garbage on the screen and hang. If compiled in BASIC 7.10, the
  20073.  program will give the error message "Error during run-time
  20074.  initialization."
  20075.  
  20076.  Code Example 2
  20077.  --------------
  20078.  
  20079.  Compiling and linking any program in BASIC PDS 7.10 as follows gives
  20080.  "Error during run-time initialization" when you run the BASFILE.EXE
  20081.  program:
  20082.  
  20083.     BC /Fs basfile.BAS;
  20084.     LINK basfile.OBJ,,,BRT71ENR.LIB;
  20085.  
  20086.  Note that "ENR" in BRT71ENR.LIB refers to "E" for IEEE math, "N" for
  20087.  near strings, and "R" for MS-DOS (real) mode.
  20088.  
  20089.  
  20090.  334. QBX Incorrectly Initializes Array in TYPE with OPTION BASE 1
  20091.  
  20092.  Product Version(s): 7.00 7.10
  20093.  Operating System:   MS-DOS
  20094.  Flags: ENDUSER | buglist7.00 buglist7.10 SR# S900205-152
  20095.  Last Modified:  4-SEP-1990    ArticleIdent: Q65083
  20096.  
  20097.  QBX.EXE may not correctly initialize programs with OPTION BASE 1 and
  20098.  arrays in user-defined TYPEs during their initial loading. The array
  20099.  in the type is treated as a zero-based array instead of a one-based
  20100.  array. This problem is corrected by saving the file or editing either
  20101.  the OPTION BASE 1 line or the TYPE statement. This behavior does not
  20102.  occur when the program is compiled with BC.EXE.
  20103.  
  20104.  Microsoft has confirmed this to be a problem with the QBX.EXE
  20105.  environment of Microsoft BASIC Professional Development System (PDS)
  20106.  versions 7.00 and 7.10 for MS-DOS. We are researching this problem and
  20107.  will post new information here as it becomes available.
  20108.  
  20109.  Code Example
  20110.  ------------
  20111.  
  20112.  The following code example will give incorrect results (a length of 3
  20113.  and a lower bound of 0) on the initial run of the program, but after
  20114.  saving the file (without reloading), or after editing either of the
  20115.  indicated lines, the program runs correctly (giving a length of 2 and
  20116.  a lower bound of 1):
  20117.  
  20118.     OPTION BASE 1                      'Editing here corrects error
  20119.     TYPE ArrayType
  20120.          Array(2) AS STRING * 1        'Editing here also corrects
  20121.     END TYPE
  20122.     DIM varArrayType AS ArrayType
  20123.     PRINT LEN(varArrayType)               'Should be 2 (incorrectly 3)
  20124.     PRINT LBOUND(varArrayType.Array)      'Should be 1 (incorrectly 0)
  20125.     END
  20126.  
  20127.  
  20128.  335. OS/2 BASIC Program to Get Machine Configuration; DosDevConfig
  20129.  
  20130.  Product Version(s): 6.00 6.00b 7.00 7.10
  20131.  Operating System:   OS/2
  20132.  Flags: ENDUSER | SR# S900820-52
  20133.  Last Modified:  4-SEP-1990    ArticleIdent: Q65103
  20134.  
  20135.  A protected mode BASIC program can call the OS/2 API function
  20136.  DosDevConfig() to find out machine-configuration information, such as
  20137.  how many printers are attached, how many serial ports and floppy disk
  20138.  drives are available, whether or not a math coprocessor is present,
  20139.  and the type of primary display adapter (monochrome or color). Below
  20140.  is a sample program demonstrating this.
  20141.  
  20142.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  20143.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  20144.  System (PDS) versions 7.00 and 7.10 for MS OS/2.
  20145.  
  20146.  DosDevConfig() takes the following parameters:
  20147.  
  20148.     Parameter   Description
  20149.     ---------   -----------
  20150.  
  20151.     PTR BYTE    Receives machine information
  20152.  
  20153.     WORD        Type of information needed
  20154.                 0 = Number of printers attached
  20155.                 1 = Number of serial ports available
  20156.                 2 = Number of floppy disk drives available
  20157.                 3 = Check math coprocessor (returns 1 = present, 0 = not)
  20158.                 4 = PC Submodel type
  20159.                 5 = PC model type
  20160.                 6 = Primary display adapter type (returns 0 = monochrome,
  20161.                     1 = color)
  20162.  
  20163.     WORD        Reserved by OS/2, must be set to 0
  20164.  
  20165.  BASIC 6.00 and 6.00b and BASIC PDS 7.00 and 7.10 can directly call
  20166.  OS/2 API functions by linking with the DOSCALLS.LIB (for 6.00 and
  20167.  6.00b) or OS2.LIB (for 7.00 and 7.10) libraries. Note that a BYTE in
  20168.  BASIC has a type of STRING * 1, and a WORD has a type of INTEGER.
  20169.  Also, data items preceded by PTR can be passed using the SEG keyword
  20170.  in the DECLARE statement; otherwise, BYVAL is used.
  20171.  
  20172.  For more information on DosDevConfig(), see Pages 509-510 of "Advanced
  20173.  OS/2 Programming" by Ray Duncan (Microsoft Press, 1989).
  20174.  
  20175.  The following sample program (MACHINFO.BAS) displays configuration
  20176.  information about the machin, namely, how many printers are attached,
  20177.  how many serial ports and floppy disk drives are available, whether or
  20178.  not a math coprocessor is present, and the type of primary display
  20179.  adapter (monochrome or color). Note that a printer does not have to be
  20180.  online to be "attached."
  20181.  
  20182.  To compile the program, enter the following at the OS/2 command
  20183.  prompt:
  20184.  
  20185.     bc machinfo;
  20186.  
  20187.  The LINK command line for BASIC 6.00 and 6.00b is as follows:
  20188.  
  20189.     link /nop machinfo,,,doscalls;
  20190.  
  20191.  The LINK command line for BASIC PDS 7.00 and 7.10 is as follows:
  20192.  
  20193.     link /nop machinfo,,,os2;
  20194.  
  20195.  MACHINFO.BAS
  20196.  ------------
  20197.  
  20198.  DEFINT A-Z
  20199.  
  20200.  TYPE InfoType
  20201.     Info AS STRING * 1
  20202.  END TYPE
  20203.  
  20204.  DECLARE FUNCTION DosDevConfig% (SEG InfoVar AS InfoType,_
  20205.                                  BYVAL InfoNeeded%, BYVAL Reserved%)
  20206.  
  20207.  DIM InfoVar AS InfoType   'Will receive configuration information.
  20208.  
  20209.  'Get number of printers attached.
  20210.  ErrorCode% = DosDevConfig% (InfoVar, 0, 0)
  20211.  PRINT "There are" CVI(InfoVar.Info + CHR$(0)) " printers attached."
  20212.  
  20213.  'Get number of serial ports available.
  20214.  ErrorCode% = DosDevConfig% (InfoVar, 1, 0)
  20215.  PRINT CVI(InfoVar.Info + CHR$(0)) " serial ports are available."
  20216.  
  20217.  'Get number of floppy disk drives available.
  20218.  ErrorCode% = DosDevConfig% (InfoVar, 2, 0)
  20219.  PRINT CVI(InfoVar.Info + CHR$(0)) " disk drives are available."
  20220.  
  20221.  'Check if math coprocessor is available.
  20222.  ErrorCode% = DosDevConfig% (InfoVar, 3, 0)
  20223.  IF InfoVar.Info = CHR$(1) THEN
  20224.     PRINT "A math coprocessor is present."
  20225.  ELSE
  20226.     PRINT "A math coprocessor is not present."
  20227.  END IF
  20228.  
  20229.  'Get the type of primary display adapter (color or mono).
  20230.  ErrorCode% = DosDevConfig% (InfoVar, 6, 0)
  20231.  IF InfoVar.Info = CHR$(1) THEN
  20232.     PRINT "The primary display adapter is color."
  20233.  ELSE
  20234.     PRINT "The primary display adapter is monochrome."
  20235.  END IF
  20236.  
  20237.  END
  20238.  
  20239.  
  20240.  336. How to Call VioPopUp() from a Protected Mode BASIC Program
  20241.  
  20242.  Product Version(s): 6.00 6.00b 7.00 7.10
  20243.  Operating System:   OS/2
  20244.  Flags: ENDUSER | SR# S900812-3
  20245.  Last Modified:  4-SEP-1990    ArticleIdent: Q65105
  20246.  
  20247.  A protected mode BASIC program that is running in a background session
  20248.  can temporarily seize control of the screen and interact with the
  20249.  user, regardless of which session is currently in the foreground. This
  20250.  is accomplished by calling the OS/2 API function VioPopUp(). Below is
  20251.  a sample program that demonstrates how to do this.
  20252.  
  20253.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  20254.  6.00b for MS OS/2 and to Microsoft BASIC Professional Development
  20255.  System (PDS) versions 7.00 and 7.10 for MS OS/2.
  20256.  
  20257.  VioPopUp() takes two parameters:
  20258.  
  20259.     Parameter   Description
  20260.     ---------   -----------
  20261.  
  20262.     PTR WORD    Contains option flags for pop-up
  20263.         WORD    Video handle (0 = default)
  20264.  
  20265.  If bit 0 of the first parameter is set, VioPopUp() will wait until a
  20266.  pop-up is available. If bit 0 is cleared, VioPopUp() will return
  20267.  immediately with an error if a pop-up is not available.
  20268.  
  20269.  If bit 1 of the first parameter is set, the pop-up will be
  20270.  transparent. This means that if the display is already in a text mode,
  20271.  no mode change will occur and the screen contents and cursor position
  20272.  will not be disturbed. Also session switching will be disabled. If the
  20273.  display is not in a text mode, the pop-up will have no special effect
  20274.  on any other process.
  20275.  
  20276.  If bit 1 of the first parameter is cleared, the pop-up will be
  20277.  nontransparent. This means that the display will be put into an
  20278.  80-by-25 text mode, the screen cleared, and the cursor placed into the
  20279.  upper-left corner. Also, session switching will be disabled.
  20280.  
  20281.  During a pop-up, all other processes run normally except that they
  20282.  can't interact with the user or modify the physical display. Any
  20283.  attempt to perform these actions is blocked until the process in
  20284.  pop-up mode calls the API function VioEndPopUp(). When this happens,
  20285.  the pop-up process reverts to the background, the process that was in
  20286.  the foreground when the pop-up occurred regains its status, and the
  20287.  physical display is restored.
  20288.  
  20289.  Microsoft BASIC 6.00 and 6.00b and Microsoft BASIC PDS 7.00 and 7.10
  20290.  can directly call OS/2 API functions by linking with the DOSCALLS.LIB
  20291.  (for 6.00 and 6.00b) or OS2.LIB (for 7.00 and 7.10) libraries. Note
  20292.  that a WORD in BASIC has a type of INTEGER. Also, data items preceded
  20293.  by PTR can be passed using the SEG clause in the DECLARE statement of
  20294.  the function; otherwise, BYVAL is used.
  20295.  
  20296.  For more information about VioPopUp() and VioEndPopUp(), see Pages
  20297.  113-115 of "Advanced OS/2 Programming" by Ray Duncan (Microsoft Press,
  20298.  1989).
  20299.  
  20300.  The following sample program generates a pop-up, displays a message
  20301.  while in the pop-up, and then ends the pop-up. Before doing so, it
  20302.  lets the user choose the type of pop-up (transparent or
  20303.  nontransparent) and then emits five delayed beeps to allow the user to
  20304.  switch sessions.
  20305.  
  20306.  To compile the program, enter the following at the OS/2 command prompt:
  20307.  
  20308.     bc popup;
  20309.  
  20310.  The command line for linking the program with BASIC 6.00 or 6.00b is
  20311.  as follows:
  20312.  
  20313.     link /nop popup,,,doscalls;
  20314.  
  20315.  The command line for linking the program with BASIC PDS 7.00 or 7.10
  20316.  is as follows:
  20317.  
  20318.     link /nop popup,,,os2;
  20319.  
  20320.  POPUP.BAS
  20321.  ---------
  20322.  
  20323.  DECLARE FUNCTION VioPopUp%    (SEG Flags%, BYVAL Handle%)
  20324.  DECLARE FUNCTION VioEndPopUp% (BYVAL Handle%)
  20325.  
  20326.  'Loop until the user chooses a valid option.
  20327.  DO UNTIL (Flags% = 1) OR (Flags% = 3)
  20328.  
  20329.     'Prompt the user for an option.
  20330.     INPUT "Transparent (1) or Nontransparent (2) pop-up"; Flags%
  20331.  
  20332.     'Setting bit 0 tells OS/2 to wait until a pop-up is available.
  20333.     'Bit 1 is set for transparent mode, cleared for nontransparent.
  20334.     SELECT CASE Flags%
  20335.     CASE 1
  20336.        Flags% = 3
  20337.     CASE 2
  20338.        Flags% = 1
  20339.     CASE ELSE
  20340.        PRINT "Invalid option!"
  20341.        BEEP
  20342.     END SELECT
  20343.  
  20344.  LOOP
  20345.  
  20346.  FOR I% = 1 TO 5   'Delay so user has time to switch sessions.
  20347.     BEEP
  20348.     SLEEP 1
  20349.  NEXT I%
  20350.  
  20351.  ErrorCode% = VioPopUp% (Flags%, 0)   'Start the pop-up.
  20352.  
  20353.  COLOR 13, 1                          'Display a colored message on the
  20354.  LOCATE 12, 36                        'the screen.
  20355.  PRINT "Surprise!"
  20356.  
  20357.  LOCATE 25, 35
  20358.  PRINT "Hit any key";                 'Wait until a key is pressed.
  20359.  WHILE INKEY$ = ""
  20360.  WEND
  20361.  
  20362.  ErrorCode% = VioEndPopUp% (0)        'End the pop-up and the program.
  20363.  END
  20364.  
  20365.  
  20366.  337. "Out of Stack Space" Using RETURN <linenumber> for SUB Event
  20367.  
  20368.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  20369.  Operating System:   MS-DOS               | OS/2
  20370.  Flags: ENDUSER | B_QuickBas
  20371.  Last Modified:  4-SEP-1990    ArticleIdent: Q65177
  20372.  
  20373.  If an event occurs in a procedure (SUB or FUNCTION), then returning
  20374.  from event-handling with the RETURN <linenumber> statement always
  20375.  leaves unrecoverable information on the stack, which can lead to the
  20376.  error message "Out of Stack Space" after many trapped events.
  20377.  
  20378.  This behavior is a result of violating the following design rule: to
  20379.  correctly restore (pop) the stack after handling an event, you must
  20380.  always return to the procedure level where the event occurred. This
  20381.  applies to all events trapped with the ON <event> GOSUB statement
  20382.  (where <event> includes COM, KEY, PEN, PLAY, TIMER, STRIG, and
  20383.  others).
  20384.  
  20385.  RETURN <linenumber> or <linelabel> is only designed to return from
  20386.  events that occur at the module-level (main-level) code. This
  20387.  correctly pops the stack.
  20388.  
  20389.  You must use RETURN without the <linenumber> or <linelabel> option if
  20390.  you want to RETURN to a SUB or FUNCTION procedure where an event was
  20391.  trapped. This correctly pops the stack.
  20392.  
  20393.  This information applies to Microsoft BASIC Professional Development
  20394.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2; to
  20395.  Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS and MS
  20396.  OS/2; and to Microsoft QuickBASIC versions 1.00, 1.01, 1.02, 2.00,
  20397.  2.01, 3.00, 4.00, 4.00b, and 4.50 for MS-DOS.
  20398.  
  20399.  To demonstrate the "Out of stack space" message, run the following
  20400.  program and hold down the ESC key, which will be trapped in a loop
  20401.  until the error occurs. The "Out of stack space" error occurs because
  20402.  this program incorrectly allows events in the SUB to be handled by the
  20403.  RETURN <linelabel> instead of an ordinary RETURN.
  20404.  
  20405.  Code Example
  20406.  ------------
  20407.  
  20408.  DECLARE SUB test ()
  20409.  ' This is an example where the RETURN <linenumber>
  20410.  ' statement gives you "Out of Stack Space" (after about 53 ESC key
  20411.  ' trap iterations in QBX.EXE, or 118 if compiled in BC.EXE) when the
  20412.  ' event (pressing the ESC key) is trapped in a SUB procedure.
  20413.  KEY 15, CHR$(0) + CHR$(1)    ' Trap ESC key
  20414.  ON KEY(15) GOSUB escape
  20415.  KEY(15) ON
  20416.  PRINT "now in main"
  20417.  again:
  20418.    CALL test
  20419.    PRINT "Done"
  20420.  END
  20421.  escape:
  20422.    j = j + 1
  20423.  ' The FRE(-2) function returns a value decreased at each iteration by
  20424.  ' the number of bytes of stack (associated with the SUBprogram) that
  20425.  ' were lost:
  20426.    PRINT j; "ESC key was pressed. Continue in main. FRE(-2)="; FRE(-2)
  20427.    KEY(15) ON   ' <-- Must say KEY(15) ON here or else the
  20428.                 '   RETURN <linelabel> statement will leave the
  20429.                 '   ON KEY(15) GOSUB trap still active, which does an
  20430.                 '   implied KEY(15) STOP. If the key had been trapped
  20431.                 '   in the main program, then RETURN <linelabel> would
  20432.                 '   work normally, and you wouldn't have to use
  20433.                 '   KEY(15) ON here.
  20434.    RETURN again
  20435.  
  20436.  SUB test STATIC
  20437.  PRINT "Now in SUB"
  20438.  WHILE INKEY$ = "": WEND
  20439.  PRINT "You pressed some key other than ESC."
  20440.  END SUB
  20441.  
  20442.  References:
  20443.  
  20444.  The following is taken from Page 296 (under the "RETURN Statement") of
  20445.  "Microsoft BASIC 7.0: Language Reference" for versions 7.00 and 7.10:
  20446.  
  20447.     RETURN with a line label or line number can return control to a
  20448.     statement in the module-level code only, not in procedure-level
  20449.     code.
  20450.  
  20451.  The following is taken from Page 227 (under the heading "ON event
  20452.  Statement") of "Microsoft BASIC 7.0: Language Reference" for versions
  20453.  7.00 and 7.10:
  20454.  
  20455.     The RETURN linenumber or RETURN linelabel forms of RETURN can be
  20456.     used to return to a specific line from the trapping routine. Use
  20457.     this type of return with care, however, because any GOSUB, WHILE,
  20458.     or FOR statements active at the time of the trap remain active.
  20459.     BASIC may generate error messages such as NEXT without FOR. In
  20460.     addition, if an event occurs in a procedure, a RETURN linenumber or
  20461.     RETURN linelabel statement cannot get back into the procedure
  20462.     because the line number or label must be in the module-level code.
  20463.  
  20464.  The above information is accurate, but it should be added that if an
  20465.  event occurs in a procedure (SUB or FUNCTION), then returning from
  20466.  event-handling with the RETURN <linenumber> statement leaves
  20467.  unrecoverable information on the stack, which eventually leads to the
  20468.  error message "Out of Stack Space" after many trapped events.
  20469.  
  20470.  
  20471.  338. "Redo from Start" for Correct INPUT in QB and BASIC PDS
  20472.  
  20473.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  20474.  Operating System:   MS-DOS               | OS/2
  20475.  Flags: ENDUSER | B_QuickBas buglist6.00 buglist6.00b buglist7.00 buglist7.10
  20476.  Last Modified:  4-SEP-1990    ArticleIdent: Q65194
  20477.  
  20478.  Normally, the INPUT statement correctly gives a "Redo from start"
  20479.  message if you mistakenly type a string as input when a number is
  20480.  expected. However, the INPUT statement incorrectly gives the error
  20481.  message "Redo from start" when all of the following conditions
  20482.  coincide:
  20483.  
  20484.  1. The program is using the INPUT "prompt", <variable list> form of
  20485.     the INPUT statement.
  20486.  
  20487.  2. The variable being INPUT is a single-precision element of a
  20488.     $DYNAMIC array.
  20489.  
  20490.  3. The program does NOT contain error trapping, was NOT compiled
  20491.     with BC /X, and does NOT have line numbers.
  20492.  
  20493.  The INPUT statement will also incorrectly display a question mark (?)
  20494.  prompt under the above conditions. The problem occurs in executable
  20495.  (.EXE) programs compiled with BC.EXE, but does not occur in the QB.EXE
  20496.  or QBX.EXE environment.
  20497.  
  20498.  Microsoft has confirmed this to be a problem with QuickBASIC versions
  20499.  4.00, 4.00b, and 4.50 (buglist4.00, buglist4.00b, buglist4.50); with
  20500.  Microsoft BASIC Compiler versions 6.00 and 6.00b; and with Microsoft
  20501.  BASIC Professional Development System (PDS) versions 7.00 and 7.10 for
  20502.  MS-DOS and MS OS/2. We are researching this problem and will post new
  20503.  information here as it becomes available.
  20504.  
  20505.  This problem can be easily worked around in any one of the following
  20506.  ways:
  20507.  
  20508.  1. Compile the program with BC /X.
  20509.  
  20510.  2. Include ON ERROR GOTO error-trapping in the program.
  20511.  
  20512.  3. Include a line number on the line where the INPUT occurs.
  20513.  
  20514.  4. Use the following format to prompt the user:
  20515.  
  20516.        PRINT "prompt message";
  20517.        INPUT "", <variable list>
  20518.  
  20519.  5. Use a static array instead of a dynamic array.
  20520.  
  20521.  Code Example:
  20522.  ------------
  20523.  
  20524.  The example below demonstrates this problem. Compile and link the
  20525.  program as follows:
  20526.  
  20527.     BC INPUT.BAS ;
  20528.     LINK INPUT ;
  20529.  
  20530.  When you run this program and correctly enter a number (such as 3.21
  20531.  or 0) or press ENTER alone, the program incorrectly gives a "Redo from
  20532.  start" message. You must press CTRL+C or CTRL+BREAK to stop the
  20533.  program.
  20534.  
  20535.     ' $DYNAMIC
  20536.     DIM z(4)
  20537.     i% = 1
  20538.     z(i%) = 0
  20539.     INPUT "Input a real number: ", z(i%)
  20540.     END
  20541.  
  20542.  
  20543.  339. Must Use BYVAL at Both Ends When CALLing 7.10 SUB or FUNCTION
  20544.  
  20545.  Product Version(s): 7.10   | 7.10
  20546.  Operating System:   MS-DOS | OS/2
  20547.  Flags: ENDUSER | SR# S900820-85
  20548.  Last Modified:  4-SEP-1990    ArticleIdent: Q65287
  20549.  
  20550.  When passing parameters by value to a BASIC SUBprogram or FUNCTION
  20551.  procedure, you must use the BYVAL attribute from both the calling end
  20552.  and the receiving end.
  20553.  
  20554.  By itself, using BYVAL in the SUB or FUNCTION statement (at the
  20555.  receiving end) isn't enough to tell the SUB or FUNCTION to pass by
  20556.  value. If you don't also use the BYVAL attribute in the CALL statement
  20557.  or the DECLARE statement, then by default BASIC will pass by reference
  20558.  and push only the address of the variable on the stack. If you
  20559.  mistakenly use BYVAL only at the calling end or only at the receiving
  20560.  end, then an incorrect value will be passed.
  20561.  
  20562.  This information only applies to Microsoft BASIC Professional
  20563.  Development System (PDS) version 7.10, since passing parameters to
  20564.  BASIC SUBprograms and FUNCTIONS with the BYVAL attribute was first
  20565.  introduced version 7.10.
  20566.  
  20567.  Note for Versions Earlier Than 7.10: In Microsoft BASIC PDS version
  20568.  7.00, in Microsoft BASIC Compiler versions 6.00 and 6.00b, and in
  20569.  QuickBASIC versions 4.00, 4.00b, and 4.50, you could not DECLARE or
  20570.  CALL a BASIC routine with parameters having the BYVAL attribute, since
  20571.  BYVAL could be used only for parameters of non-BASIC routines (such as
  20572.  C or Macro Assembler).
  20573.  
  20574.  NOTE: If you create a program in an editor outside the QBX.EXE
  20575.  environment without DECLARE statements at the top of the program,
  20576.  DECLARE statements will not automatically be added to your code. As a
  20577.  result, a SUB statement that contains a formal parameter with the
  20578.  BYVAL attribute (at the receiving end) will have no BYVAL declaration
  20579.  at the calling end. Instead of specifying BYVAL in a DECLARE
  20580.  statement, you can specify BYVAL in the CALL statement.
  20581.  
  20582.  Code Example: Incorrect Way to Pass by Value
  20583.  --------------------------------------------
  20584.  
  20585.  The program below, written in an editor outside of the QBX.EXE
  20586.  environment, will pass the offset of the variable A& to the
  20587.  SUBprogram, although the SUBprogram is expecting the actual value
  20588.  contained in A&. This happens because each end of the call to the
  20589.  SUBprogram acts blindly on the information that it has. The call to
  20590.  TestPass blindly assumes that it is passing a value by reference,
  20591.  which is the default. It therefore passes the offset (in this case
  20592.  3030) of the variable A& to the SUBprogram TestPass. The SUBprogram
  20593.  TestPass is expecting to receive the value of the variable A&, as is
  20594.  dictated by the BYVAL attribute in the SUB statement. The program
  20595.  therefore prints 3030 (the offset) on the screen, instead of the
  20596.  constant 2 (the value).
  20597.  
  20598.  CALL TestPass (2&)  'Notice no declaration of BYVAL in CALL or
  20599.                      'DECLARE, so default is pass (send) by reference.
  20600.  SUB TestPass(BYVAL A&)  'BYVAL in SUB says to pass (receive) by value.
  20601.      B& = A&
  20602.      PRINT A&        ' Prints 3030, the offset of A&.
  20603.  END SUB
  20604.  
  20605.  Correct Way to Pass by Value, Using BYVAL in DECLARE and SUB
  20606.  ------------------------------------------------------------
  20607.  
  20608.  DECLARE SUB TestPass(BYVAL A&)
  20609.  ' BYVAL in the above DECLARE means to pass (send) by value.
  20610.  CALL TestPass (2&)
  20611.  SUB TestPass(BYVAL A&)  'BYVAL in SUB means pass (receive) by value.
  20612.      B& = A&
  20613.      PRINT A&      ' prints 2, the value (contents) of A&
  20614.  END SUB
  20615.  
  20616.  Another Correct Way to Pass by Value, Using BYVAL in CALL and SUB
  20617.  -----------------------------------------------------------------
  20618.  
  20619.  CALL TestPass (BYVAL 2&)  'BYVAL in CALL means pass (send) by value.
  20620.  SUB TestPass(BYVAL A&)    'BYVAL in SUB means pass (receive) by value.
  20621.      B& = A&
  20622.      PRINT A&      ' prints 2, the value (contents) of A&
  20623.  END SUB
  20624.  
  20625.  References
  20626.  ----------
  20627.  
  20628.  The following is taken from the README.DOC file for BASIC 7.10:
  20629.  
  20630.     In version 7.10, BASIC supports the use of the BYVAL keyword
  20631.     in CALL, DECLARE, SUB, and FUNCTION statements for BASIC
  20632.     procedures. You can use BYVAL to pass parameters by value
  20633.     rather than by reference (the default). It is no longer
  20634.     necessary to enclose parameters in parentheses to emulate
  20635.     passing by value. For more information and an example of using
  20636.     BYVAL in BASIC procedures, see the online Help for the DECLARE
  20637.     statement (BASIC procedures). For specifics on using BYVAL with
  20638.     CALL, see the online Help for the CALL statement (BASIC
  20639.     procedures).
  20640.  
  20641.  
  20642.  340. BASIC Program to Read COBOL BCD (COMP-3) Numbers
  20643.  
  20644.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  20645.  Operating System:   MS-DOS               | OS/2
  20646.  Flags: ENDUSER | SR# S900828-36 B_COBOL
  20647.  Last Modified:  2-JAN-1991    ArticleIdent: Q65323
  20648.  
  20649.  Below is a BASIC program that reads a data file created by Microsoft
  20650.  COBOL containing binary-coded-decimal (COMP-3) numbers. This is
  20651.  accomplished by reading in the file one byte at a time, interpreting
  20652.  those bytes according to the binary-coded-decimal (BCD) format, and
  20653.  performing calculations based on those interpretations to generate
  20654.  equivalent BASIC double-precision floating-point numbers.
  20655.  
  20656.  This information applies to Microsoft QuickBASIC versions 4.00, 4.00b,
  20657.  and 4.50 for MS-DOS; to Microsoft BASIC Compiler versions 6.00 and
  20658.  6.00b for MS-DOS and MS OS/2; and to Microsoft BASIC Professional
  20659.  Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS
  20660.  OS/2.
  20661.  
  20662.  The information about binary-coded-decimal numbers and the COMP-3
  20663.  format applies to Microsoft COBOL Compiler versions 3.00 and 3.00a for
  20664.  MS-DOS and MS OS/2, and to Microsoft COBOL Professional Development
  20665.  System version 4.00 for MS-DOS and MS OS/2.
  20666.  
  20667.  Microsoft COBOL 3.00, 3.00a, and 4.00 support a data type commonly
  20668.  referred to as binary-coded-decimal (BCD) format. The syntactical name
  20669.  for this data type in COBOL is COMP-3.
  20670.  
  20671.  The bytes used to store a COMP-3 number can contain two base-10 digits
  20672.  each. The high nibble (4 bits) stores one digit of the number and the
  20673.  low nibble (4 bits) stores the next digit to the right. That is, the
  20674.  high nibble stores a digit whose place in the number has a power of 10
  20675.  that is one greater than that of the digit in the low nibble.
  20676.  Moreover, the first byte used to store the number will contain the
  20677.  digit with the highest power of 10; subsequent bytes will hold digits
  20678.  that have successively lesser powers of 10. (Note: There are two
  20679.  nibbles in every byte.)
  20680.  
  20681.  A special case is made for the last byte, where the high nibble stores
  20682.  the last digit in the number, and the low nibble stores the sign of
  20683.  the number. The low nibble will contain 15 if the number is unsigned,
  20684.  12 for positive, and 13 for negative. Also, if the number of nibbles
  20685.  needed for digits plus the sign nibble will not fill a whole number of
  20686.  bytes, the high nibble of the byte storing the first digit is set to
  20687.  0.
  20688.  
  20689.  As an example, here is a binary representation of how the number 69
  20690.  (signed positive) would be stored:
  20691.  
  20692.     +---------- First Byte ---------+--------- Second Byte ---------+
  20693.     |                               |                               |
  20694.     +- High Nibble -+- Low Nibble --+- High Nibble -+- Low Nibble --+
  20695.     |               |               |               |               |
  20696.     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  20697.     | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
  20698.     +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  20699.     |               |               |               |               |
  20700.     +------ 0 ------+------ 6 ------+------ 9 ------+-- Positive ---+
  20701.  
  20702.  Below is a BASIC program (BCDTODBL.BAS) that converts the COMP-3
  20703.  numbers in a COBOL data file to BASIC's double-precision numbers. The
  20704.  program reads in each byte of the file sequentially, interpreting it
  20705.  as either a pair of digits or a digit and a sign. The program knows
  20706.  that it has read all the digits in a number when the low nibble of the
  20707.  last byte read contains a sign value (12, 13, or 15). When this
  20708.  happens, the program circulates through all the digits accumulated for
  20709.  the number and multiplies each by its associated power of 10. The
  20710.  result of this iterative calculation is assigned to a double-precision
  20711.  floating-point number. Finally, one more calculation is performed on
  20712.  the number so that it will contain the amount of decimal places
  20713.  specified by the user.
  20714.  
  20715.  Following the BASIC program is a COBOL program (WRITEBCD.CBL) that
  20716.  creates a file containing a user-specified amount of COMP-3 signed
  20717.  numbers. To compile and link the program in COBOL 3.00 or 3.00a, enter
  20718.  the following commands from the DOS or OS/2 prompt:
  20719.  
  20720.     cobol writebcd;
  20721.     link writebcd;
  20722.  
  20723.  The compile lines for COBOL Professional Development System (PDS)
  20724.  version 4.00 are as follows:
  20725.  
  20726.     cobol writebcd;
  20727.     link writebcd,,,coblib cobapi;
  20728.  
  20729.  The BASIC program can be run or compiled from within the QB.EXE or
  20730.  QBX.EXE environments. See your BASIC documentation for information on
  20731.  using the QB.EXE or QBX.EXE environments.
  20732.  
  20733.  BCDTODBL.BAS
  20734.  ------------
  20735.  
  20736.  DIM Digits%(15)       'Holds the digits for each number (max = 16).
  20737.  DIM BASICeqv#(1000)   'Holds the BASIC equivalent of each COMP-3 number.
  20738.  
  20739.  'Clear the screen, get the filename and the amount of decimal places
  20740.  'desired for each number, and open the file for sequential input:
  20741.  CLS
  20742.  INPUT "Enter the COBOL data file name: ", FileName$
  20743.  INPUT "Enter the number of decimal places desired: ", Decimal%
  20744.  OPEN FileName$ FOR INPUT AS #1
  20745.  
  20746.  DO UNTIL EOF(1)   'Loop until the end of the file is reached.
  20747.     Byte$ = INPUT$(1, 1)   'Read in a byte.
  20748.     IF Byte$ = CHR$(0) THEN  'Check if byte is 0 (ASC won't work on 0).
  20749.        Digits%(HighPower%) = 0       'Make next two digits 0. Increment
  20750.        Digits%(HighPower% + 1) = 0   'the high power to reflect the
  20751.        HighPower% = HighPower% + 2   'number of digits in the number
  20752.                                      'plus 1.
  20753.     ELSE
  20754.        HighNibble% = ASC(Byte$) \ 16      'Extract the high and low
  20755.        LowNibble% = ASC(Byte$) AND &HF    'nibbles from the byte. The
  20756.        Digits%(HighPower%) = HighNibble%  'high nibble will always be a
  20757.                                           'digit.
  20758.        IF LowNibble% <= 9 THEN                   'If low nibble is a
  20759.                                                  'digit, assign it and
  20760.           Digits%(HighPower% + 1) = LowNibble%   'increment the high
  20761.           HighPower% = HighPower% + 2            'power accordingly.
  20762.        ELSE
  20763.           HighPower% = HighPower% + 1 'Low nibble was not a digit but a
  20764.           Digit% = 0                  '+ or - signals end of number.
  20765.  
  20766.           'Start at the highest power of 10 for the number and multiply
  20767.           'each digit by the power of 10 place it occupies.
  20768.           FOR Power% = (HighPower% - 1) TO 0 STEP -1
  20769.           BASICeqv#(E%)=BASICeqv#(E%) + (Digits%(Digit%) * (10^Power%))
  20770.           Digit% = Digit% + 1
  20771.           NEXT
  20772.  
  20773.           'If the sign read was negative, make the number negative.
  20774.           IF LowNibble% = 13 THEN
  20775.              BASICeqv#(E%) = BASICeqv#(E%) - (2 * BASICeqv#(E%))
  20776.           END IF
  20777.  
  20778.           'Give the number the desired amount of decimal places, print
  20779.           'the number, increment E% to point to the next number to be
  20780.           'converted, and reinitialize the highest power.
  20781.           BASICeqv#(E%) = BASICeqv#(E%) / (10 ^ Decimal%)
  20782.           PRINT BASICeqv#(E%)
  20783.           E% = E% + 1
  20784.           HighPower% = 0
  20785.        END IF
  20786.     END IF
  20787.  LOOP
  20788.  CLOSE   'Close the COBOL data file, and end.
  20789.  
  20790.  WRITEBCD.CBL
  20791.  ------------
  20792.  
  20793.        $SET ANS85
  20794.         IDENTIFICATION DIVISION.
  20795.         PROGRAM-ID.  WriteBCD.
  20796.  
  20797.         ENVIRONMENT DIVISION.
  20798.         INPUT-OUTPUT SECTION.
  20799.         FILE-CONTROL.
  20800.             SELECT BCDFile ASSIGN TO "BCD.DAT".
  20801.  
  20802.         DATA DIVISION.
  20803.         FILE SECTION.
  20804.         FD BCDFile.
  20805.         01 BCDNumber      PIC S9(5) COMP-3.
  20806.  
  20807.         WORKING-STORAGE SECTION.
  20808.        *   Holds the number of COMP-3 items to write to the file.
  20809.         01 TotalNumbers   PIC 99 COMP-5.
  20810.  
  20811.         PROCEDURE DIVISION.
  20812.  
  20813.        *   Get the number of COMP-3 items to write to file.
  20814.            DISPLAY "Enter the number of items to write:".
  20815.            ACCEPT TotalNumbers.
  20816.  
  20817.        *   Open the COMP-3 file for sequential output and write each
  20818.        *   number out to the file as the user enters it.
  20819.            OPEN OUTPUT BCDFile.
  20820.            PERFORM TotalNumbers TIMES
  20821.               ACCEPT BCDNumber
  20822.               WRITE BCDNumber
  20823.            END-PERFORM.
  20824.  
  20825.        *   Close the COMP-3 file and end.
  20826.            CLOSE BCDFile.
  20827.  
  20828.  
  20829.  341. EOF in 7.00 Returns "Nonzero" for TRUE, But 4.50 Returns -1
  20830.  
  20831.  Product Version(s): 7.00 7.10 | 7.00 7.10
  20832.  Operating System:   MS-DOS    | OS/2
  20833.  Flags: ENDUSER | SR# S900822-29 B_QuickBas
  20834.  Last Modified:  4-SEP-1990    ArticleIdent: Q65396
  20835.  
  20836.  The EOF function has changed slightly from QuickBASIC versions 4.50
  20837.  and earlier to Microsoft BASIC Professional Development System (PDS)
  20838.  versions 7.00 and later. In QuickBASIC, the EOF function will return 0
  20839.  (zero) for FALSE and -1 for TRUE. In BASIC PDS 7.00, EOF still returns
  20840.  0 for FALSE, but it returns "nonzero" for TRUE. This means that EOF
  20841.  will return a positive or negative number other than 0 if the end of
  20842.  the file has been reached or if you are at the "end" of an ISAM table.
  20843.  Previous QuickBASIC programs that hard coded a check for -1 will have
  20844.  to be changed to check for a nonzero value. Since 0 is equivalent to
  20845.  FALSE and nonzero evaluates to TRUE in BASIC, this is an easy change
  20846.  to make. For instance, you do not need to check "IF EOF = -1 THEN
  20847.  GOSUB foo"; instead, you can use "IF EOF THEN GOSUB foo". This second
  20848.  check will work in any version of Microsoft BASIC.
  20849.  
  20850.  This information applies to Microsoft BASIC Professional Development
  20851.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2. This
  20852.  article documents a change from Microsoft QuickBASIC 1.00, 1.01, 1.02,
  20853.  2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50 for MS-DOS, and from Microsoft
  20854.  BASIC Compiler versions 6.00 and 6.00b for MS-DOS and MS OS/2.
  20855.  
  20856.  
  20857.  342. BC /R Makes UBOUND and LBOUND Incorrect for Multi-DIM Array
  20858.  
  20859.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  20860.  Operating System:   MS-DOS               | OS/2
  20861.  Flags: ENDUSER | B_QuickBas buglist6.00 buglist6.00b buglist7.00 buglist7.10
  20862.  Last Modified:  4-SEP-1990    ArticleIdent: Q65402
  20863.  
  20864.  The UBOUND and LBOUND functions return the upper and lower bounds of
  20865.  an array. However, if a program is compiled using the BC /R compiler
  20866.  option, which stores multidimensional arrays in row major order, the
  20867.  UBOUND and LBOUND functions return incorrect dimension bounds for
  20868.  multidimensional arrays.
  20869.  
  20870.  Microsoft has confirmed this to be a problem with the BC /R option in
  20871.  QuickBASIC versions 4.00, 4.00b, and 4.50 (buglist4.00, buglist4.00b,
  20872.  buglist4.50) for MS-DOS; in Microsoft BASIC Compiler versions 6.00 and
  20873.  6.00b for MS-DOS and MS OS/2; and in Microsoft BASIC Professional
  20874.  Development System (PDS) versions 7.00 and 7.10 for MS-DOS and OS/2.
  20875.  Microsoft is researching this problem and will post new information
  20876.  here as it becomes available.
  20877.  
  20878.  Note that by default (without the /R option), BC.EXE stores arrays in
  20879.  column major order, and the UBOUND and LBOUND functions return correct
  20880.  values. Note also that the /R switch cannot be used within QBX.EXE;
  20881.  therefore, QBX.EXE can only store arrays in column major order. UBOUND
  20882.  and LBOUND work correctly in QBX.EXE.
  20883.  
  20884.  For more information on using the BC /R compiler switch, query in this
  20885.  Knowledge Base on the following words:
  20886.  
  20887.     MULTIDIMENSIONAL AND COLUMN AND ROW AND MAJOR
  20888.  
  20889.  Although the array is stored differently in memory by the /R compiler
  20890.  option, the upper and lower bounds of each dimension do not change.
  20891.  Therefore the values returned by UBOUND and LBOUND for a given
  20892.  dimension are supposed to be the same compiling with or without BC /R.
  20893.  
  20894.  When a program is compiled with the BC /R switch, the UBOUND and
  20895.  LBOUND (for a given dimension) incorrectly return the bounds for the
  20896.  opposite dimension. For example, in a two-dimensional array, if you
  20897.  request the UBOUND and LBOUND values for the first dimension, the
  20898.  values returned will incorrectly be those of the second dimension.
  20899.  Requesting the UBOUND and LBOUND values for the second dimension
  20900.  incorrectly gives you the bounds for the first dimension.
  20901.  
  20902.  In an odd-dimensioned array, UBOUND and LBOUND return correct bounds
  20903.  for the middle dimension, but incorrect bounds for all other
  20904.  dimensions when compiled BC /R. For example, in a three-dimensional
  20905.  array, UBOUND and LBOUND for the first dimension incorrectly return
  20906.  bounds for the third dimension; UBOUND and LBOUND for the third
  20907.  dimension incorrectly return bounds for the first dimension; but
  20908.  UBOUND and LBOUND for the second dimension correctly return bounds for
  20909.  the second dimension.
  20910.  
  20911.  Code Example
  20912.  ------------
  20913.  
  20914.  The following program example demonstrates the problem:
  20915.  
  20916.  DIM A(-1 TO 1, -2 TO 2)     ' DIMensions A() as a 2-dimensional array.
  20917.     ' Print lower and upper bound of first dimension:
  20918.  PRINT LBOUND(A, 1), UBOUND(A, 1)
  20919.     ' Print lower and upper bound of second dimension:
  20920.  PRINT LBOUND(A, 2), UBOUND(A, 2)
  20921.  
  20922.  Output when compiled without BC /R (correct):
  20923.  
  20924.     -1      1
  20925.     -2      2
  20926.  
  20927.  Output when compiled with BC /R (incorrect):
  20928.  
  20929.     -2      2
  20930.     -1      1
  20931.  
  20932.  
  20933.  343. LINK Creating Temporary File Can Hang on 3Com 3+ Open Network
  20934.  
  20935.  Product Version(s): 7.10
  20936.  Operating System:   MS-DOS
  20937.  Flags: ENDUSER | SR# S900824-163 B_QuickBas
  20938.  Last Modified:  4-SEP-1990    ArticleIdent: Q65403
  20939.  
  20940.  A customer reported that when using LINK.EXE version 5.10 (the linker
  20941.  that comes with Microsoft BASIC Professional Development System [PDS]
  20942.  version 7.10) on a workstation running on a 3Com 3+ Open network, the
  20943.  computer may hang if the linker needs to generate a .TMP file.
  20944.  
  20945.  If you set the TMP environment variable to a directory on the
  20946.  workstation's own hard drive, the linker should function correctly.
  20947.  
  20948.  This information applies to Microsoft BASIC PDS version 7.10 and
  20949.  LINK.EXE version 5.10. The problem does not occur when using Microsoft
  20950.  BASIC PDS version 7.00 and LINK.EXE version 5.05.
  20951.  
  20952.  Please note that Microsoft BASIC PDS 7.10 is designed to support only
  20953.  the IBM PC-NET and MS-NET compatible networks.
  20954.  
  20955.  When the linker does not have enough room to work correctly in memory,
  20956.  it will write a temporary file to disk and display the message:
  20957.  
  20958.     Temporary file .\xxxxxxxx has been created
  20959.  
  20960.  This customer reported that without a TMP environment variable set,
  20961.  the linker attempted to write the temporary file on the server
  20962.  machine, which hung his computer. After he added the TMP environment
  20963.  variable and assigned it a path to a directory on the workstation's
  20964.  own hard drive, the computer did not hang. The TMP environment
  20965.  variable can be set by either typing a line such as the following at
  20966.  the DOS prompt or by putting it into your AUTOEXEC.BAT file:
  20967.  
  20968.     TMP=C:\directory name
  20969.  
  20970.  The problem only occurred when the workstation was running under DOS.
  20971.  While running under OS/2 version 1.20, the problem did not occur.
  20972.  
  20973.  The customer encountered this problem on a workstation with the
  20974.  following configuration:
  20975.  
  20976.     386 Clone
  20977.     3Com 3+ Open Network version 1.1e
  20978.     DOS 4.01
  20979.  
  20980.  
  20981.  344. Solve BASIC 6.0 "Unresolved External" with OS/2's DOSCALLS.LIB
  20982.  
  20983.  Product Version(s): 6.00 6.00b
  20984.  Operating System:   OS/2
  20985.  Flags: ENDUSER | SR# S900821-150
  20986.  Last Modified:  4-SEP-1990    ArticleIdent: Q65404
  20987.  
  20988.  When you are creating Microsoft BASIC Compiler versions 6.00 and 6.00b
  20989.  protected mode programs that make calls to OS/2 API functions, the
  20990.  DOSCALLS.LIB library must be linked in. This library allows the linker
  20991.  to resolve external references to the API functions.
  20992.  
  20993.  However, the DOSCALLS.LIB that comes with BASIC will not allow the
  20994.  linker to resolve references to all of the API functions. This version
  20995.  of DOSCALLS.LIB was designed to support only a subset of them. The
  20996.  linker can use the DOSCALLS.LIB that comes with OS/2 to resolve those
  20997.  external references to API functions that are not supported by the
  20998.  BASIC version of DOSCALLS.LIB.
  20999.  
  21000.  This information applies to Microsoft BASIC Compiler versions 6.00 and
  21001.  6.00b for MS OS/2.
  21002.  
  21003.  If an API function is not supported by the BASIC version of
  21004.  DOSCALLS.LIB, the linker will generate an "Unresolved external" error
  21005.  if it finds a call to it in an object file. To remedy the situation,
  21006.  the program must be linked with the OS/2 version of DOSCALLS.LIB. This
  21007.  version of DOSCALLS.LIB is usually placed in the main OS/2 directory
  21008.  (C:\OS2, for example) by the OS/2 installation program.
  21009.  
  21010.  Note that Microsoft BASIC Professional Development System versions
  21011.  7.00 and 7.10 for MS OS/2 use a library named OS2.LIB (instead of
  21012.  DOSCALLS.LIB) to resolve external references to API functions. OS2.LIB
  21013.  provides support for all API functions, so linking with the OS/2
  21014.  version of DOSCALLS.LIB should never be necessary in BASIC PDS 7.00
  21015.  and 7.10.
  21016.  
  21017.  
  21018.  345. 7.10 Memory Lost If Reassign $DYNAMIC String Array to STRING$
  21019.  
  21020.  Product Version(s): 7.00 7.10 | 7.00 7.10
  21021.  Operating System:   MS-DOS    | OS/2
  21022.  Flags: ENDUSER | SR# S900816-176 buglist7.00 buglist7.10
  21023.  Last Modified: 26-DEC-1990    ArticleIdent: Q65478
  21024.  
  21025.  In a compiled .EXE file, assigning a $DYNAMIC variable-length-string
  21026.  array element directly to a BASIC intrinsic string function (such as
  21027.  STRING$) creates an internal temporary string that may fail to be
  21028.  deallocated. Repetitive reassignments can cause "Out of String Space"
  21029.  or "Out of Memory" errors. This article documents this problem with
  21030.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  21031.  and 7.10 and shows two examples of the problem.
  21032.  
  21033.  Microsoft has confirmed this to be a problem with BASIC PDS versions
  21034.  7.00 and 7.10 for MS-DOS and MS OS/2. This problem does not occur in
  21035.  the QBX.EXE environment, or in earlier versions of Microsoft BASIC
  21036.  Compiler or QuickBASIC. We are researching this problem and will post
  21037.  new information here as it becomes available.
  21038.  
  21039.  The problem can occur for dynamic variable-length-string array element
  21040.  assignments of the form A$(x)=STRING$(n). But this form of assignment
  21041.  may not give the problem in some cases, such as in Code Example 1
  21042.  where A$(x)=STRING$(n) appears within a FOR...NEXT loop.
  21043.  
  21044.  Any one of the following code modifications works around the problem:
  21045.  
  21046.  1. Use a $STATIC array instead of a $DYNAMIC array,
  21047.  
  21048.  -or-
  21049.  
  21050.  2. First assign a temporary variable such as temp$ to the BASIC
  21051.     string function (STRING$), then assign the array element to temp$:
  21052.  
  21053.     temp$=STRING$(12000)
  21054.     A$(1)=temp$
  21055.     temp$=""
  21056.  
  21057.  -or-
  21058.  
  21059.  3. Use the CLEAR statement to erase the memory wasted by the
  21060.     internal temporary string (but CLEAR also erases all other
  21061.     variables).
  21062.  
  21063.  -or-
  21064.  
  21065.  4. In some cases, surrounding the assignment with a FOR...NEXT
  21066.     structure may eliminate the problem, such as in Code Example 1.
  21067.  
  21068.  This problem is not affected by any compiler options that limit
  21069.  optimizations (BC /D, /X, etc.). The problem occurs with both near and
  21070.  far strings (BC /Fs, /Fn).
  21071.  
  21072.  Code Example 1
  21073.  --------------
  21074.  
  21075.  The following code example shows one case (in a FOR...NEXT block) that
  21076.  reclaims memory properly and three cases that fail to return the
  21077.  string memory. In the cases that fail, the a$()=SPACE$() statement
  21078.  fails to release an amount of string space equal to the length of the
  21079.  string assigned (due to an internal unreleased temporary string).
  21080.  Repeated assignments will decrease string memory until string memory
  21081.  eventually runs out.
  21082.  
  21083.  Compile and LINK as follows (compile and LINK options do not affect
  21084.  the problem):
  21085.  
  21086.     BC STRING;
  21087.     LINK STRING;
  21088.  
  21089.  REM $DYNAMIC
  21090.  CLS
  21091.  DIM a$(10)
  21092.    PRINT "FRE(a$(1)) at start of program: ", FRE(a$(1))
  21093.  
  21094.    PRINT "Case #1: memory recovered if string deallocated in FOR loop."
  21095.    PRINT "For loop works fine -- memory restored"
  21096.    FOR i% = 12000 TO 0 STEP -12000
  21097.      a$(1) = SPACE$(i%)
  21098.      PRINT "Free during FOR loop: ", FRE(a$(1))
  21099.    NEXT
  21100.  
  21101.    PRINT "Case #2: Prompt user for size of string."
  21102.    INPUT "Input big number (try 12000):", big%
  21103.    a$(1) = SPACE$(big%)   'Both A$(1) & internal string consume memory:
  21104.    PRINT "FRE(a$(1)) after allocation: ", FRE(a$(1))
  21105.    INPUT "Input a small number (0):", small%
  21106.    a$(1) = SPACE$(small%) 'Internal temporary string still wastes memory:
  21107.    PRINT "FRE(a$(1)) after deallocation: ", FRE(a$(1))
  21108.  
  21109.    PRINT
  21110.    PRINT "Case #3. String of 12000 bytes assigned."
  21111.    big% = 12000
  21112.    a$(1) = SPACE$(big%)
  21113.    PRINT "FRE(a$(1)) after allocation: ", FRE(a$(1))
  21114.    small% = 0
  21115.    a$(1) = SPACE$(small%)
  21116.    PRINT "FRE(a$(1)) after deallocation: ", FRE(a$(1))
  21117.  
  21118.    PRINT "Case #4: Another string of 12000 bytes assigned."
  21119.    a$(1) = SPACE$(12000)
  21120.    PRINT "FRE(a$(1)) after allocation: ", FRE(a$(1))
  21121.    a$(1) = SPACE$(0)
  21122.    PRINT "FRE(a$(1)) after deallocation: ", FRE(a$(1))
  21123.  END
  21124.  
  21125.  Code Example 2
  21126.  --------------
  21127.  
  21128.  The program below shows that the problem also occurs in $DYNAMIC
  21129.  arrays in SUBprograms.
  21130.  
  21131.  Compile and link as follows:
  21132.  
  21133.     BC STRING2.BAS ;
  21134.     LINK STRING2 ;
  21135.  
  21136.  DECLARE SUB sub1 ()
  21137.  CALL sub1
  21138.  END
  21139.  SUB sub1
  21140.    DIM s(2) AS STRING   'This array is dynamic, since SUB is non-STATIC
  21141.    PRINT "FRE before string allocation: "; FRE(s(0))
  21142.    s(1) = STRING$(1000, 255)
  21143.    PRINT "FRE after string allocation: "; FRE(s(1))
  21144.    s(1) = ""
  21145.    PRINT "FRE after string deallocation: "; FRE(s(2))
  21146.  END SUB
  21147.  
  21148.  
  21149.  346. BASIC PDS 7.00 and 7.10 Cannot Use IOCTL and Far Strings
  21150.  
  21151.  Product Version(s): m7.00 7.10
  21152.  Operating System:   MS-DOS
  21153.  Flags: ENDUSER | SR# S900904-34
  21154.  Last Modified:  6-SEP-1990    ArticleIdent: Q65480
  21155.  
  21156.  Some customers have reported that the IOCTL$ function and IOCTL
  21157.  statement do not work with far strings (BC /Fs) in Microsoft BASIC
  21158.  Professional Development System (PDS) versions 7.00 and 7.10.
  21159.  Microsoft has not confirmed this to be a problem.
  21160.  
  21161.  This information applies to Microsoft BASIC Professional Development
  21162.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  21163.  
  21164.  The IOCTL$ function and IOCTL statement allow BASIC programs to
  21165.  interact with MS-DOS character device drivers that can give and
  21166.  receive control data strings. Not all character device drivers support
  21167.  IOCTL control data strings. For instance, ANSI.SYS, which replaces the
  21168.  standard CON device driver in DOS, is a character device driver, but
  21169.  it cannot receive or send control data strings.
  21170.  
  21171.  For more information on MS-DOS device drivers, device driver classes,
  21172.  character device drivers, and how IOCTL works, see "Advanced MS-DOS
  21173.  Programming" by Ray Duncan (published by Microsoft Press).
  21174.  
  21175.  Note that the IOCTL$ function and IOCTL statement cannot be used under
  21176.  MS OS/2. You can, however, make equivalent OS/2 API function calls to
  21177.  interact with OS/2 character device drivers.
  21178.  
  21179.  
  21180.  347. "Invalid Column" If CREATEINDEX on Field of Nested User TYPE
  21181.  
  21182.  Product Version(s): 7.00 7.10 | 7.10
  21183.  Operating System:   MS-DOS    | OS/2
  21184.  Flags: ENDUSER | SR# S900822-21 docerr
  21185.  Last Modified: 21-SEP-1990    ArticleIdent: Q65506
  21186.  
  21187.  In Microsoft BASIC ISAM, you cannot create an index on a user-defined
  21188.  TYPE, nor can you create an index on a field of a nested user-defined
  21189.  TYPE.
  21190.  
  21191.  This information applies to Microsoft BASIC Professional Development
  21192.  System (PDS) versions 7.00 and 7.10 under MS-DOS and version 7.10
  21193.  under OS/2.
  21194.  
  21195.  Page 333 of the "Microsoft BASIC 7.0: Programmer's Guide" and Page 72
  21196.  of the "Microsoft BASIC 7.0: Language Reference" manual for versions
  21197.  7.00 and 7.10 correctly state that an index cannot be created on an
  21198.  aggregate data type such as a user-defined TYPE. However, they fail to
  21199.  state that you cannot create an index on a field of that nested
  21200.  user-defined TYPE.
  21201.  
  21202.  For example, in the following TYPE...END TYPE declaration, you can
  21203.  create an index on the field "CustomerName" but not on the
  21204.  user-defined TYPE "CompanyInfo" or on the field of the nested
  21205.  user-defined TYPE "CompanyID". If you try to create an index on these
  21206.  fields, an "Invalid Column" error is generated on the CREATEINDEX
  21207.  statement.
  21208.  
  21209.     TYPE CompanyRec
  21210.               CompanyID AS INTEGER
  21211.     END TYPE
  21212.  
  21213.     TYPE CustomerRec
  21214.               CustomerName AS STRING * 20
  21215.               CompanyInfo AS CompanyRec
  21216.     END TYPE
  21217.  
  21218.  
  21219.  348. BASIC OS/2 Routines to Replace UIASM.ASM for UI ToolBox
  21220.  
  21221.  Product Version(s): 7.00 7.10
  21222.  Operating System:   OS/2
  21223.  Flags: ENDUSER | SR# S900821-212
  21224.  Last Modified: 21-SEP-1990    ArticleIdent: Q65515
  21225.  
  21226.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  21227.  and 7.10 provide sample User Interface (UI) Toolbox code written
  21228.  mostly in BASIC, with a few sections written in assembler. The code is
  21229.  written specifically for MS-DOS and does not support OS/2 unless the
  21230.  code is modified.
  21231.  
  21232.  The UI Toolbox uses three assembler routines to provide direct video
  21233.  access to get a window (GetCopyBox), put a window (PutCopyBox), and
  21234.  change the attributes of a window (AttrBox). These routines are
  21235.  located in the UIASM.ASM source file. These three routines do not work
  21236.  under OS/2 unless you modify them for OS/2 IOPL (Input Output
  21237.  Privileges) support, or rewrite them in BASIC using OS/2 Video I/O
  21238.  (VIO) API calls.
  21239.  
  21240.  The following code example provides one way to replace these three
  21241.  assembler routines with BASIC code utilizing the OS/2 VIO API Calls.
  21242.  
  21243.  Since this code is written in BASIC, you will need to compile these
  21244.  routines with the same options you use on the modules that call them.
  21245.  These compiler options include near/far strings, protected mode, and
  21246.  alternate/emulation math.
  21247.  
  21248.  GetCopyBox, PutCopyBox, AttrBox are currently written in assembly
  21249.  language (in UIASM.ASM on the 7.00 and 7.10 release disk) for greater
  21250.  speed. The UIASM.BAS program below contains the equivalent BASIC
  21251.  routines using OS/2 VIO API calls. Since the code is written in BASIC,
  21252.  the speed may be notably slower compared to straight assembler code.
  21253.  Also, the multitasking nature of OS/2 adds overhead compared to
  21254.  running the same program under MS-DOS.
  21255.  
  21256.  GetCopyBOX and PutCopyBox uses the MID$() statement and function to
  21257.  modify the Screen Buffer variable to store and restore the screen
  21258.  contents. An "Illegal Function Call" error may occur at run time if
  21259.  the size of the window is zero (0) bytes.
  21260.  
  21261.  UIASM.BAS
  21262.  ---------
  21263.  
  21264.  '| The module below contains the following three BASIC procedures:
  21265.  '|
  21266.  '|  DECLARE SUB GetCopyBox (ULRow%, ULCow%, LRRow%, LRCol%, buffer$)
  21267.  '|  GetCopyBox -- Gets screen box info and places the info into a
  21268.  '|                string variable.
  21269.  '|
  21270.  '|  DECLARE SUB PutCopyBox (ULRow%, ULCow%, buffer$)
  21271.  '|  PutCopyBox -- Puts screen box info back on the screen from a
  21272.  '|                string variable.
  21273.  '|
  21274.  '|  DECLARE SUB AttrBox (ULRow%, ULCow%, LRRow%, LRCol%, NewAttr%)
  21275.  '|  AttrBox -- Changes the color attributes of all characters within
  21276.  '|             a box.
  21277.  '|
  21278.  '| In the above parameter lists, the beginning two characters specify the
  21279.  '| portion of the rectangle of the box being referred to, as follows:
  21280.  '|      UL = Upper-left corner of the rectangle/box
  21281.  '|      LR = Lower-right corner of the rectangle/box
  21282.  '
  21283.  ' Below are DECLARE Statements for the OS/2 VIO (Video I/O) routines:
  21284.  DECLARE FUNCTION VioReadCellStr% ( BYVAL    CellAdd&,      _
  21285.                                     SEG      NumCells%,     _
  21286.                                     BYVAL    SRow%,         _
  21287.                                     BYVAL    SCol%,         _
  21288.                                     BYVAL    VidHandle%  )
  21289.  DECLARE FUNCTION VioWrtCellStr%  ( BYVAL    CellAdd&,      _
  21290.                                     BYVAL    NumCells%,     _
  21291.                                     BYVAL    SRow%,         _
  21292.                                     BYVAL    SCol%,         _
  21293.                                     BYVAL    VidHandle%  )
  21294.  SUB GetCopyBox (ULRow%, ULCol%, LRRow%, LRCol%, ScreenBuffer$)
  21295.      '| Subtract 1 from all screen coordinates to reflect the difference
  21296.      '| between BASIC's screen BASE 1 and the VIO API BASE 0.
  21297.      '| We also make a copy of the variables, since we do not force the
  21298.      '| caller to use BYVAL or by reference calling convention.
  21299.      '|    UL = Upper-left corner of the rectangle/box
  21300.      '|    LR = Lower-right corner of the rectangle/box
  21301.      URow% = ULRow% - 1
  21302.      UCol% = ULCol% - 1
  21303.      LRow% = LRRow% - 1
  21304.      LCol% = LRCol% - 1
  21305.      '| Find width and height of the Box
  21306.      BoxHeigth% = LRow% - URow% + 1
  21307.      BoxWidth% = LCol% - UCol% + 1
  21308.      '| Calculate the actual width of the line before the FOR-loop
  21309.      '| thus performing the operation once. We need a copy of the
  21310.      '| results, since the function call changes the value of
  21311.      '| parameter passed to it.
  21312.      ActualWidth% = BoxWidth% * 2
  21313.      OldBoxWidth% = ActualWidth%
  21314.      FOR i% = URow% to LRow%
  21315.          Work$ = Space$ (ActualWidth%)
  21316.          '| Read one line from the Box of BoxWidth% long into
  21317.          '| a Work String. The format of the string is
  21318.          '| character + attribute (every two bytes make a cell)
  21319.          VIORt% = VioReadCellStr ( SSEGADD (Work$), _
  21320.                                    ActualWidth%,    _
  21321.                                    i%,              _
  21322.                                    UCol%,           _
  21323.                                    VideoHandle%  )
  21324.          '| VioReadCellStr changes the value "ActualWidth%" to reflect
  21325.          '| how many characters were actually placed into the buffer.
  21326.          '| We reset the value after every call, so we don't lose one
  21327.          '| character and attribute each time through the FOR-Loop.
  21328.          ActualWidth% = OldBoxWidth%
  21329.          '| We calculate the offset into the string where we
  21330.          '| will place the line of text.
  21331.          ScrnOff% = ActualWidth% * (i% - URow%) + 3
  21332.          '| By using the MID$ statement, we can place the information
  21333.          '| over the existing information with little work on our part.
  21334.          Mid$ (ScreenBuffer$, ScrnOff%, Len (Work$) ) = Work$
  21335.      Next i%
  21336.      '| Store the Width and Height of the BOX in the first
  21337.      '| two characters of the buffer. The Height will be on the
  21338.      '| BASE of ONE, and PutCopyBox will convert it to a BASE zero.
  21339.      Mid$(ScreenBuffer$, 1, 1) = chr$(BoxWidth%)
  21340.      Mid$(ScreenBuffer$, 2, 1) = chr$(BoxHeigth%)
  21341.  END SUB
  21342.  
  21343.  SUB PutCopyBox (ULRow%, ULCol%, ScreenBuffer$)
  21344.      '| Subtract 1 from all screen coordinates to reflect the difference
  21345.      '| between BASIC's screen BASE 1 and the VIO API BASE 0.
  21346.      '| We also make a copy of the variables, since we do not force the
  21347.      '| caller to use the BYVAL or by reference calling convention.
  21348.      '|    UL = Upper-left corner of the rectangle/box
  21349.      '|    LR = Lower-right corner of the rectangle/box
  21350.      URow% = ULRow% - 1
  21351.      UCol% = ULCol% - 1
  21352.      '| The first two bytes are the Width and Height used by GetCopyBox.
  21353.      '| Where the Height is from BASE 1 rather then ZERO
  21354.      BoxWidth%  = ASC(Mid$ (ScreenBuffer$, 1, 1))
  21355.      BoxHeigth% = ASC(Mid$ (ScreenBuffer$, 2, 1)) - 1
  21356.      '| We calculate the actual width of the line before the loop,
  21357.      '| rather than inside the loop.
  21358.      ActualWidth% = BoxWidth% * 2
  21359.      FOR i% = 0 to BoxHeigth%
  21360.          '| Calculate the offset into the string for each line of the box.
  21361.          ScrnOff% = ActualWidth% * i% + 3
  21362.          '| The actual row on the screen that we are printing to:
  21363.          NewRow% = URow% + i%
  21364.          '| We extract a line of text with the attributes in a
  21365.          '| similar manner to how we placed them in the string:
  21366.          Work$ = Mid$ (ScreenBuffer$, ScrnOff%, ActualWidth%)
  21367.          '| Write the line of text and attributes to the screen:
  21368.          VIORt% = VioWrtCellStr ( SSEGADD (Work$),  _
  21369.                                   ActualWidth%      _
  21370.                                   NewRow%,          _
  21371.                                   UCol%,            _
  21372.                                   VideoHandle%   )
  21373.      Next i%
  21374.  END SUB
  21375.  
  21376.  SUB AttrBox (ULRow%, ULCol%, LRRow%, LRCol%, NewAttr%)
  21377.      '| Subtract 1 from all screen coordinates to reflect the difference
  21378.      '| between BASIC's screen BASE 1 and the VIO API BASE 0.
  21379.      '| We also make a copy of the variables, since we do not force the
  21380.      '| caller to use the BYVAL or by reference calling convention.
  21381.      '|    UL = Upper-left corner of the rectangle/box
  21382.      '|    LR = Lower-right corner of the rectangle/box
  21383.      URow% = ULRow% - 1
  21384.      UCol% = ULCol% - 1
  21385.      LRow% = LRRow% - 1
  21386.      LCol% = LRCol% - 1
  21387.      '| Find width and height of the Box:
  21388.      BoxHeigth% = LRow% - URow% + 1
  21389.      BoxWidth% = LCol% - UCol% + 1
  21390.      '| Calculate the actual width of the line before the FOR-loop,
  21391.      '| thus performing the operation once. We need a copy of the
  21392.      '| results, since the function call changes the value of
  21393.      '| parameter passed to it.
  21394.      ActualWidth% = BoxWidth% * 2
  21395.      OldBoxWidth% = ActualWidth%
  21396.      FOR i% = URow% to LRow%
  21397.          Work$ = Space$ (ActualWidth%)
  21398.          '| Read one line from the Box of BoxWidth% long into
  21399.          '| a Work String. The format of the string is
  21400.          '| character + attribute (every two bytes make a cell)
  21401.          VIORt% = VioReadCellStr ( SSEGADD (Work$), _
  21402.                                    ActualWidth%,    _
  21403.                                    i%,              _
  21404.                                    UCol%,           _
  21405.                                    VideoHandle%   )
  21406.          '| VioReadCellStr changes the value "ActualWidth%" to reflect
  21407.          '| how many characters were actually placed into the buffer.
  21408.          '| We reset the value after every call, so we don't lose one
  21409.          '| character and attribute each time through the FOR-Loop.
  21410.          ActualWidth% = OldBoxWidth%
  21411.          For j% = 2 to ActualWidth% STEP 2
  21412.              Mid$(Work$, j%, 1) = chr$ (NewAttr%)
  21413.          Next j%
  21414.          VIORt% = VioWrtCellStr ( SSEGADD (Work$), _
  21415.                                   ActualWidth%,    _
  21416.                                   i%,              _
  21417.                                   UCol%,           _
  21418.                                   VideoHandle%   )
  21419.      Next i%
  21420.  END SUB
  21421.  
  21422.  
  21423.  
  21424.  349. PDS 7.10 Can Now Buffer COM1 or COM2 Input Data During a SHELL
  21425.  
  21426.  Product Version(s): 7.10   | 7.10
  21427.  Operating System:   MS-DOS | OS/2
  21428.  Flags: ENDUSER | SR# S900904-18 B_QuickBas
  21429.  Last Modified: 21-SEP-1990    ArticleIdent: Q65548
  21430.  
  21431.  In most versions of Microsoft BASIC Compiler and QuickBASIC, during a
  21432.  SHELL, data coming in through the communications port is not buffered
  21433.  and is lost. A new feature of Microsoft BASIC Professional Development
  21434.  System (PDS) version 7.10 allows programs compiled with the BC /O
  21435.  (stand-alone) option to continue to buffer communications input during
  21436.  a SHELL. However, programs that use the run-time module with BASIC PDS
  21437.  7.10 still cannot handle COM1 or COM2 input during a SHELL.
  21438.  
  21439.  This information applies to Microsoft BASIC PDS 7.10 for MS-DOS and MS
  21440.  OS/2. The above feature is not available in the following products:
  21441.  Microsoft QuickBASIC versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00,
  21442.  4.00, 4.00b, and 4.50 for MS-DOS; Microsoft BASIC Compiler versions
  21443.  6.00 and 6.00b for MS-DOS and MS OS/2; and Microsoft BASIC PDS version
  21444.  7.00 for MS-DOS and MS OS/2.
  21445.  
  21446.  This feature is available only when you compile with BC /O. The /O
  21447.  compiler switch causes the program to be completely stand alone, which
  21448.  means it will run without the run-time module. This feature is not
  21449.  available with the run-time module because the run-time module is
  21450.  taken out of memory during a SHELL and reloaded when the SHELL is
  21451.  exited. Since the code for communications support is contained in the
  21452.  run-time module, it is not available during the SHELL. Therefore, the
  21453.  program cannot continue to buffer the communications data because the
  21454.  code that supports communications has been removed from memory. With a
  21455.  stand-alone program, the code for communications support is directly
  21456.  linked to the program and stays in memory, thus allowing the program
  21457.  to continue to buffer communications data during a SHELL.
  21458.  
  21459.  
  21460.  350. Disappearing SUB Statement When Editing in QB.EXE/QBX.EXE
  21461.  
  21462.  Product Version(s): 7.00 7.10
  21463.  Operating System:   MS-DOS
  21464.  Flags: ENDUSER | SR# S900830-44 buglist7.00 buglist7.10 B_QuickBAS
  21465.  Last Modified: 21-SEP-1990    ArticleIdent: Q65549
  21466.  
  21467.  While programming inside the QB.EXE or QBX.EXE environment, a SUB
  21468.  statement may temporarily disappear when specific steps are performed.
  21469.  These steps involve a combination of deleting the comment line above a
  21470.  SUB...END SUB, moving the cursor with the DOWN ARROW key, and using
  21471.  the TAB key. The steps below demonstrate the problem.
  21472.  
  21473.  Microsoft has confirmed this to be a problem in the QB.EXE environment
  21474.  of Microsoft QuickBASIC version 4.50 (buglist4.50) for MS-DOS and in
  21475.  the QBX.EXE environment of Microsoft BASIC Professional Development
  21476.  System (PDS) versions 7.00 and 7.10 for MS-DOS. We are researching
  21477.  this problem and will post new information here as it becomes
  21478.  available. This particular problem (using the exact steps below) does
  21479.  not occur in earlier versions.
  21480.  
  21481.  To reproduce this problem, create a SUB containing the following code:
  21482.  
  21483.     '
  21484.     SUB DeleteMe
  21485.         PRINT "dummy line"
  21486.     END SUB
  21487.  
  21488.  Do the following on the code above:
  21489.  
  21490.  1. Move the cursor to the first line and delete the comment.
  21491.  
  21492.  2. Press the DOWN ARROW key to attempt to move the cursor to the next
  21493.     line.
  21494.  
  21495.  3. The following error message box will pop up:
  21496.  
  21497.        Blank lines not allowed before SUB/FUNCTION line. Is remark OK?
  21498.  
  21499.     Press the ENTER key, which will accept the message and delete the
  21500.     blank line.
  21501.  
  21502.  4. Press the DOWN ARROW key again to move the cursor to the next line.
  21503.     If you are using the QB.EXE program that comes with Microsoft
  21504.     QuickBASIC version 4.50, the line that says "SUB DeleteMe" will be
  21505.     deleted. If you are using the QBX.EXE program that comes with BASIC
  21506.     PDS version 7.00 or 7.10, continue to Step 5 to reproduce the
  21507.     problem.
  21508.  
  21509.  5. After using the DOWN ARROW key to move the cursor to any line of
  21510.     code in the SUB, press the TAB key and that line will be replaced
  21511.     with the line "SUB DeleteMe".
  21512.  
  21513.  6. If you press the DOWN ARROW key again, the original line will
  21514.     reappear.
  21515.  
  21516.  Note: If the text is not returned, you may be able to recover the text
  21517.  in BASIC PDS versions 7.00 and 7.10 by choosing the Undo command from
  21518.  the Edit menu to reverse the previous edit. The Undo command reverses
  21519.  up to 20 previous edits.
  21520.  
  21521.  
  21522.  351. SHELL "CHDIR", "Input Path for Run-Time Module" if No BC /O
  21523.  
  21524.  Product Version(s): 7.00 7.10
  21525.  Operating System:   MS-DOS
  21526.  Flags: ENDUSER | SR# S900823-137 buglist7.00 buglist7.10 B_QuickBas
  21527.  Last Modified: 14-DEC-1990    ArticleIdent: Q65550
  21528.  
  21529.  A SHELL statement that changes the current directory or drive (using
  21530.  DOS's CHDIR command) will display the following message when returning
  21531.  control to the BASIC program if the program is compiled to require the
  21532.  BASIC run-time module (compiled without BC /O):
  21533.  
  21534.     Input path for run-time module brt7nxxx.EXE [or brun4n.EXE,
  21535.                                                  or brun6nxx.EXE]
  21536.  
  21537.  This problem occurs only when you run the .EXE from its own directory,
  21538.  and BASIC's run-time module is also in that current directory. The
  21539.  problem does not occur if the .EXE or the run-time module is in a
  21540.  non-current directory (that is along the DOS PATH).
  21541.  
  21542.  Microsoft has confirmed this to be a problem in the Microsoft BASIC
  21543.  Professional Development System (PDS) versions 7.00 and 7.10 for
  21544.  MS-DOS; in Microsoft QuickBASIC versions 4.00, 4.00b, and 4.50
  21545.  (buglist4.00, buglist4.00b, buglist4.50) for MS-DOS; and in Microsoft
  21546.  BASIC Compiler versions 6.00 and 6.00b (buglist6.00, buglist6.00b) for
  21547.  MS-DOS. We are researching this problem and will post new information
  21548.  here as it becomes available.
  21549.  
  21550.  This problem does not occur in an OS/2 protected-mode program (in
  21551.  BASIC 6.00, 6.00b, 7.00, or 7.10).
  21552.  
  21553.  Any one of the following works around the problem:
  21554.  
  21555.  1. Create a stand-alone (BC /O) .EXE file.
  21556.  
  21557.  2. Run your compiled .EXE while a different directory is the current
  21558.     directory. For example, if your PROG.EXE program is in the
  21559.     directory C:\DIR1, then log on to any other directory and run
  21560.     C:\DIR1\PROG or take advantage of the DOS PATH to find PROG.EXE.
  21561.     (This problem occurs only when the current directory is the same
  21562.     directory as where both the PROG.EXE program and the BASIC run-time
  21563.     module sit.)
  21564.  
  21565.  Code Example
  21566.  ------------
  21567.  
  21568.  The code example below duplicates the problem. Compile as follows:
  21569.  
  21570.     BC TEST.BAS;
  21571.     LINK TEST;
  21572.  
  21573.  To duplicate the problem, put both the TEST.EXE program and the BASIC
  21574.  run-time module (BRT7nxxx.EXE or BRUN4n.EXE or BRUN6nxx.EXE) into a
  21575.  subdirectory, make that subdirectory the current directory, then run
  21576.  TEST.EXE.
  21577.  
  21578.     ' TEST.BAS
  21579.     SHELL "CHDIR \"
  21580.     PRINT "TEST"
  21581.  
  21582.  
  21583.  352. Correction to DIR$ Example In "BASIC 7.0: Language Reference"
  21584.  
  21585.  Product Version(s): 7.00 7.10 | 7.00 7.10
  21586.  Operating System:   MS-DOS    | OS/2
  21587.  Flags: ENDUSER | SR# S900909-1 docerr
  21588.  Last Modified: 21-SEP-1990    ArticleIdent: Q65597
  21589.  
  21590.  The DIR$ function example on Page 107 of the "Microsoft BASIC 7.0:
  21591.  Language Reference" manual contains an error. To correct the problem,
  21592.  the variable "FileCount" in the last line in the following code
  21593.  fragment should be changed to "FileCount&" to match the other
  21594.  references to it in the example:
  21595.  
  21596.     IF LEN(DIR$(filespec$)) = 0 THEN
  21597.        FileCount& = 0
  21598.     ELSE
  21599.        FileCount = 1
  21600.  
  21601.  The corrected code is as follows:
  21602.  
  21603.     IF LEN(DIR$(filespec$)) = 0 THEN
  21604.        FileCount& = 0
  21605.     ELSE
  21606.        FileCount& = 1
  21607.  
  21608.  This information applies to Microsoft BASIC Professional Development
  21609.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  21610.  
  21611.  
  21612.  353. Differences/Enhancements from BASIC PDS 7.00 to 7.10
  21613.  
  21614.  Product Version(s): 7.00 7.10 | 7.00 7.10
  21615.  Operating System:   MS-DOS
  21616.  Flags: ENDUSER | SR# S900730-152
  21617.  Last Modified: 21-SEP-1990    ArticleIdent: Q65598
  21618.  
  21619.  In August 1990, Microsoft released the Microsoft BASIC Professional
  21620.  Development System (PDS) version 7.10 for MS-DOS and MS OS/2 systems.
  21621.  This article documents those features that were added to BASIC PDS
  21622.  7.10 that are not supported in BASIC PDS 7.00. The lists below are
  21623.  titled "Language Enhancements," "New Utilities and Utility
  21624.  Improvements," and "Software Corrections."
  21625.  
  21626.  This information applies to Microsoft BASIC Professional Development
  21627.  System version 7.10 for MS-DOS and MS OS/2.
  21628.  
  21629.  Language Enhancements
  21630.  ---------------------
  21631.  
  21632.  1. REDIM PRESERVE changes the upper bounds (top-right dimension) of an
  21633.     $DYNAMIC array and preserves the data in the array. Previous
  21634.     versions of BASIC initialized the array to zeroes or null strings
  21635.     on a REDIM.
  21636.  
  21637.  2. It is now possible to pass fixed-length-string arrays as parameters
  21638.     to SUB and FUNCTION procedures.
  21639.  
  21640.  3. A CALL by value using BYVAL for BASIC SUB and FUNCTION subprograms
  21641.     is now possible. Previously, BASIC only supported CALL by value
  21642.     using BYVAL when calling a non-BASIC language such as C. The BYVAL
  21643.     attribute for passed parameters is now allowed when calling a BASIC
  21644.     SUB or FUNCTION.
  21645.  
  21646.  4. ISAM is now supported under OS/2. ISAM in PDS 7.10 can be used in
  21647.     OS/2 protected mode. (Note that ISAM in PDS 7.10 is still
  21648.     single-user ISAM as in 7.00.)
  21649.  
  21650.  5. ISAM support in 7.10 operates up to 50% faster than in 7.00,
  21651.     depending on the program.
  21652.  
  21653.  6. Communications input is buffered during a SHELL if the program was
  21654.     compiled with BC /O (stand alone) option. All previous versions of
  21655.     BASIC disabled communications support and buffering of communications
  21656.     data during a SHELL. BASIC PDS 7.10 does not, however, buffer
  21657.     communications data during a SHELL if you are using the run-time
  21658.     module (BRT71xxx.EXE).
  21659.  
  21660.  7. Compatibility with Microsoft C version 6.00 for interlanguage
  21661.     calling. BASIC PDS 7.10 now allows interlanguage calling to
  21662.     functions created with Microsoft C Compiler version 6.00. (BASIC
  21663.     PDS 7.00 only allowed calling to Microsoft C Compiler version 5.10
  21664.     functions.)
  21665.  
  21666.  New Utilities and Utility Improvements
  21667.  --------------------------------------
  21668.  
  21669.  1. QBX.EXE improvement: The 7.10 QuickBASIC extended (QBX.EXE)
  21670.     environment uses expanded memory more efficiently than 7.00. In
  21671.     BASIC PDS 7.00, each subprogram from 1K to 16K in size uses a full
  21672.     16K of expanded memory. In BASIC PDS 7.10, subprograms smaller than
  21673.     16K will use expanded memory in 1K chunks. In 7.10, if a subprogram
  21674.     is 2K in size, it will use only 2K of expanded memory. (Subprograms
  21675.     larger than 16K are stored in conventional memory in both 7.00 and
  21676.     7.10.)
  21677.  
  21678.  2. Programmer's WorkBench (PWB), a new utility: The Programmer's
  21679.     WorkBench is the integrated development environment that is
  21680.     provided with Microsoft's newest "high-end" language products. It
  21681.     integrates the following features:
  21682.  
  21683.     - Keyboard-driven or mouse-driven control of the WorkBench through
  21684.       use of menus and scroll bars.
  21685.  
  21686.     - Other utilities can be launched from PWB such as NMAKE or
  21687.       CodeView.
  21688.  
  21689.     - Context sensitive online Help.
  21690.  
  21691.     - Multiple windows allow managing multiple files for large
  21692.       projects.
  21693.  
  21694.     - Multiple-language development within PWB.
  21695.  
  21696.     - Supports development under both DOS and OS/2.
  21697.  
  21698.     - Customizable program editor.
  21699.  
  21700.     - PWB is a combination of Microsoft's Quick environments (such as
  21701.       QuickBASIC and QuickC) and the Microsoft Editor, providing easier
  21702.       learning for anyone familiar with those environments. However,
  21703.       PWB offers many features over and above the Quick environments
  21704.       and the earlier Microsoft Editor.
  21705.  
  21706.  3. Source Browser: Source Browser is a powerful cross-referencing tool
  21707.     that can be launched from within PWB.
  21708.  
  21709.  4. CodeView 3.10 debugger is included.
  21710.  
  21711.  5. NMAKE facility: A superset of the earlier Microsoft MAKE facility.
  21712.     PWB saves you the inconvenience of remembering makefile syntax by
  21713.     building and maintaining makefiles for you.
  21714.  
  21715.  6. QuickHelp: QuickHelp allows you to access online documentation
  21716.     without running QBX.EXE or PWB.EXE. QuickHelp can be run from the
  21717.     DOS or OS/2 command line and can also be installed as a keyboard
  21718.     monitor under OS/2. Any Help files with the correct format can be
  21719.     used with QuickHelp.
  21720.  
  21721.  7. QBX.EXE improvement: In the QBX environment under the Run menu, the
  21722.     Make .EXE File command now lets you set any BC.EXE compiler option
  21723.     in the "Additional Options:" field.
  21724.  
  21725.  Software Corrections
  21726.  --------------------
  21727.  
  21728.  For a list of known problems with BASIC PDS 7.00 (or QuickBASIC 4.50)
  21729.  that are corrected in BASIC PDS 7.10, query in this Knowledge Base on
  21730.  the word "fixlist7.10".
  21731.  
  21732.  
  21733.  354. ERROR ERR May Cause "Illegal Function Call" in QBX.EXE 7.00
  21734.  
  21735.  Product Version(s): 7.00   | 7.00
  21736.  Operating System:   MS-DOS | OS/2
  21737.  Flags: ENDUSER | SR# S900827-59 buglist7.00 fixlist7.10
  21738.  Last Modified: 20-SEP-1990    ArticleIdent: Q65640
  21739.  
  21740.  In a multiple-module program in which each of the modules contains an
  21741.  active error handler, executing the statement ERROR ERR within an
  21742.  error handler of any support module will normally pass control back to
  21743.  the next active error handler in the CALL tree. If an active error
  21744.  handler is not found, the program will terminate.
  21745.  
  21746.  Within the QBX.EXE environment of Microsoft BASIC Professional
  21747.  Development System (PDS) version 7.00, using ERROR ERR in a
  21748.  module-level error handler will incorrectly generate either "Illegal
  21749.  function call" or "Device I/O error". This problem does not occur when
  21750.  the same program is compiled using BC.EXE.
  21751.  
  21752.  Microsoft has confirmed this to be a problem in only the QBX.EXE
  21753.  environment of BASIC PDS 7.00 for MS-DOS. This problem was corrected
  21754.  in BASIC PDS version 7.10.
  21755.  
  21756.  When the following program is run in QBX.EXE version 7.00, an "Illegal
  21757.  Function Call" or "Device I/O error" results. When the program is
  21758.  compiled using BC.EXE, it will compile and run without error.
  21759.  
  21760.  MOD1.BAS
  21761.  --------
  21762.  
  21763.     '=================This is Module 1==========================
  21764.     DECLARE SUB mod2sub1 ()        'this sub is in Mod2
  21765.     ON ERROR GOTO MainErr          'Main error Handler
  21766.     CLS
  21767.     CALL mod2sub1                  'Calls the sub in Mod2
  21768.     END
  21769.     MainErr:
  21770.        PRINT "main error "; ERR    'prints the Error number
  21771.        END
  21772.  
  21773.  MOD2.BAS
  21774.  --------
  21775.  
  21776.     '===================This is Module 2========================
  21777.     Mod2ErrorHandler:            'This error handler is at the
  21778.        PRINT "Mod2 Error "       'Module level in Mod2.
  21779.        ERROR ERR                 'This causes the error again.
  21780.        RESUME NEXT
  21781.     SUB mod2sub1
  21782.        ON ERROR GOTO Mod2ErrorHandler  'Goto err handler in Mod2
  21783.        ERROR 5                         'Cause an Error 5
  21784.     END SUB
  21785.  
  21786.  Workaround for MOD2.BAS
  21787.  -----------------------
  21788.  
  21789.  To work around the problem, convert the module-level error handler (in
  21790.  the MOD2.BAS support module) into a local error handler, as follows:
  21791.  
  21792.     SUB Mod2Sub1
  21793.          ON LOCAL ERROR GOTO Mod2ErrorHandler
  21794.          ERROR 5
  21795.          EXIT SUB
  21796.          Mod2ErrorHandler:
  21797.              PRINT "Mod2 Error "
  21798.              ERROR ERR           'Forces the error again.
  21799.              RESUME NEXT
  21800.     END SUB
  21801.  
  21802.  
  21803.  355. BASIC 7.00 QBX.EXE: PAINT Statement Uses Far Heap
  21804.  
  21805.  Product Version(s): 7.00
  21806.  Operating System:   MS-DOS
  21807.  Flags: ENDUSER | SR# S900920-17 buglist7.00 fixlist7.10
  21808.  Last Modified: 18-OCT-1990    ArticleIdent: Q65831
  21809.  
  21810.  In the QBX.EXE environment of Microsoft BASIC Professional Development
  21811.  System (PDS) version 7.00, the PAINT statement allocates an area of
  21812.  memory in the far heap that cannot be deallocated.
  21813.  
  21814.  Microsoft has confirmed this to be a problem in the QBX.EXE
  21815.  environment of Microsoft BASIC PDS version 7.00 for MS-DOS. This
  21816.  problem was corrected in the QBX.EXE environment of Microsoft BASIC
  21817.  PDS version 7.10 for MS-DOS.
  21818.  
  21819.  The following code example demonstrates the problem. When run inside
  21820.  the QBX.EXE environment of version 7.00, the values returned by the
  21821.  FRE(-1) function are different. The problem does not appear in a
  21822.  compiled .EXE program.
  21823.  
  21824.  Code Example
  21825.  ------------
  21826.  
  21827.     CLS
  21828.     SCREEN 1
  21829.     CIRCLE (190, 100), 100, 1, , , .3  'Draw an ellipse
  21830.     PRINT FRE(-1)                      'Print far heap memory available
  21831.     PAINT (190, 100), 2, 1             'Fill in the ellipse
  21832.     PRINT FRE(-1)   'This FRE(-1) value is different than previous FRE(-1)
  21833.  
  21834.  
  21835.  356. How to Pass a BASIC COMMON Block to a FORTRAN 5.00 Subroutine
  21836.  
  21837.  Product Version(s): 7.00 7.10 | 7.00 7.10
  21838.  Operating System:   MS-DOS | OS/2
  21839.  Flags: ENDUSER | SR# S900810-80 H_Fortran B_QuickBas
  21840.  Last Modified: 22-OCT-1990    ArticleIdent: Q65884
  21841.  
  21842.  This article explains how to pass a BASIC COMMON block to a FORTRAN
  21843.  version 5.00 subroutine.
  21844.  
  21845.  This information applies to Microsoft QuickBASIC version 4.50, to
  21846.  Microsoft BASIC Professional Development System (PDS) version 7.00 for
  21847.  MS-DOS and MS OS/2, and to Microsoft FORTRAN Compiler version 5.00.
  21848.  This information does not apply to earlier versions of these products
  21849.  (due to incompatibilities).
  21850.  
  21851.  To program interlanguage calling between FORTRAN 5.00 and BASIC PDS
  21852.  version 7.10, you must obtain the following application note from
  21853.  Microsoft Product Support:
  21854.  
  21855.     "How to Link BASIC PDS 7.10 with C 5.10, FORTRAN 5.00, or Pascal
  21856.      4.00." (application note number BB0345)
  21857.  
  21858.  (The FORTRAN 5.00 run-time libraries must be rebuilt as shown in this
  21859.  application note to be compatible with the BASIC PDS 7.10 run-time
  21860.  libraries.)
  21861.  
  21862.  The technique illustrated below shows how to pass a named BASIC COMMON
  21863.  block to a FORTRAN subroutine. This technique will not work with
  21864.  unnamed BASIC COMMON blocks. This technique will work only with
  21865.  FORTRAN version 5.00 because you must use a FORTRAN STRUCTURE...END
  21866.  STRUCTURE data type, which is not supported in earlier versions of
  21867.  FORTRAN.
  21868.  
  21869.  The strategy is to pass the segment and offset of the first variable
  21870.  in the named BASIC COMMON block as a parameter in the call to the
  21871.  FORTRAN subroutine. The FORTRAN subroutine should set up a
  21872.  STRUCTURE...END STRUCTURE type variable with the same format as the
  21873.  BASIC COMMON block. The FORTRAN subroutine must receive this STRUCTURE
  21874.  type variable as a formal parameter.
  21875.  
  21876.  Code Example
  21877.  ------------
  21878.  
  21879.  Below is the BASIC program BASCOMMN.BAS that sets up the named COMMON
  21880.  block, initializes the values, and calls the FORTRAN subroutine:
  21881.  
  21882.     'BASCOMMN.BAS **********************************************
  21883.     DECLARE SUB FORSUB (BYVAL segment%, BYVAL offset%)
  21884.     COMMON SHARED /Example/ a%, b&, c!, d#
  21885.     CLS
  21886.     a% = 10
  21887.     b& = 2000
  21888.     c! = 30.3
  21889.     d# = 40.125
  21890.     PRINT
  21891.     PRINT "Hit any key to call the FORTRAN subroutine"
  21892.     SLEEP
  21893.     CALL FORSUB(VARSEG(a%), VARPTR(a%))
  21894.     LOCATE 8, 1: PRINT "back in basic"
  21895.     END
  21896.  
  21897.  Below is the FORTRAN program FORCOMMN.FOR, which contains the
  21898.  subroutine Forub(). It sets up a STRUCTURE type variable similar to
  21899.  the corresponding named BASIC COMMON block, and prints out the values:
  21900.  
  21901.  C FORCOMMN.FOR   **********************************************
  21902.        SUBROUTINE FORSUB( VAR )
  21903.        STRUCTURE /BASCOMMON/
  21904.            INTEGER*2 A
  21905.            INTEGER*4 B
  21906.            REAL*4    C
  21907.            DOUBLE PRECISION D
  21908.        END STRUCTURE
  21909.        RECORD /BASCOMMON/ VAR
  21910.        PRINT *, VAR.A
  21911.        PRINT *, VAR.B
  21912.        PRINT *, VAR.C
  21913.        PRINT *, VAR.D
  21914.        END
  21915.  
  21916.  Below is the BASIC code for NEARHEAP.BAS, which allocates near heap
  21917.  space for the FORTRAN subroutine. If you are working inside the
  21918.  QuickBASIC QB.EXE or QBX.EXE environment, compile this routine and put
  21919.  it into a Quick library along with the FORTRAN program. If you are
  21920.  compiling and linking into an .EXE program, put these lines in the
  21921.  source code of the BASIC program or in a separate BASIC .OBJ module in
  21922.  a .LIB library.
  21923.  
  21924.     ' NEARHEAP.BAS **********************************************
  21925.     DIM Heap%(2048)
  21926.     COMMON SHARED /NMALLOC/ Heap%()
  21927.  
  21928.  Compile the FORTRAN program as follows:
  21929.  
  21930.     FL /c /AM FORCOMMN.FOR
  21931.  
  21932.  To work inside the QuickBASIC 4.50 QB.EXE environment, build the
  21933.  libraries as follows:
  21934.  
  21935.     BC NEARHEAP.BAS;
  21936.     LIB FORCOMMN.LIB+NEARHEAP+FORCOMMN;
  21937.     LINK /Q FORCOMMN.LIB, FORCOMMN.QLB,,BQLB45.LIB MLIBFER.LIB;
  21938.  
  21939.  To compile and link from DOS, build the libraries the same way and
  21940.  compile and link BASCOMMN.BAS as follows:
  21941.  
  21942.     BC BASCOMMN;
  21943.     LINK /NOE BASCOMMN+FORCOMMN.LIB,,,BRUN45.LIB+MLIBFER.LIB ;
  21944.  
  21945.  To work inside the BASIC PDS 7.00 QBX.EXE environment, build the
  21946.  libraries as follows
  21947.  
  21948.     BC /Fs/FPi NEARHEAP;
  21949.     LIB FORCOMMN.LIB+NEARHEAP+FORCOMMN;
  21950.     LINK /Q FORCOMMN.LIB, FORCOMMN.QLB,,QBXQLB.LIB MLIBFER.LIB ;
  21951.  
  21952.  and compile and link from DOS as follows:
  21953.  
  21954.     BC /Fs/FPi BASCOMMN;
  21955.     LINK /NOE BASCOMMN+FORCOMMN.LIB,,,BRT70EFR+MLIBFER.LIB ;
  21956.  
  21957.  The output from the program is as follows:
  21958.  
  21959.     Hit any key to call the Fortran subroutine
  21960.                  10
  21961.                2000
  21962.               30.300000
  21963.               40.125000000000000
  21964.  
  21965.     Back in BASIC
  21966.  
  21967.  
  21968.  357. Interrupt to Get QB/QBX Invocation Command Line; vs. COMMAND$
  21969.  
  21970.  Product Version(s): 6.00 6.00b 7.00 7.10
  21971.  Operating System:   MS-DOS
  21972.  Flags: ENDUSER | SR# S900925-39 B_QuickBas
  21973.  Last Modified: 19-OCT-1990    ArticleIdent: Q65923
  21974.  
  21975.  Below is an example of how to do a DOS interrupt to obtain the
  21976.  command-line arguments used to invoked a QuickBASIC program. The
  21977.  sample program works in the QB.EXE/QBX.EXE environment and in an .EXE
  21978.  program. This program can be used to obtain the name of the Quick
  21979.  library that QB or QBX was invoked with.
  21980.  
  21981.  The program returns the complete command line entered (if any) after
  21982.  your .EXE or QB/QBX program name. The BASIC language offers the
  21983.  COMMAND$ function to do the same thing, but COMMAND$ returns nothing
  21984.  in the QB.EXE/QBX.EXE environment.
  21985.  
  21986.  This sample code applies to Microsoft QuickBASIC versions 4.00, 4.00b,
  21987.  and 4.50; to Microsoft BASIC Compiler versions 6.00 and 6.00b for
  21988.  MS-DOS; and to Microsoft BASIC PDS versions 7.00 and 7.10 for MS-DOS.
  21989.  (The code will also run under the DOS 3.x box in MS OS/2's real mode,
  21990.  but will not run under MS OS/2's protected mode.)
  21991.  
  21992.  The following program uses DOS interrupt 21 hex, with function 62 hex,
  21993.  to find the segment address of the program segment prefix (PSP). Based
  21994.  on this information, the program then uses the PEEK function to read
  21995.  the command line from memory. The Arguments$ function in the example
  21996.  returns a string containing all command-line arguments.
  21997.  
  21998.  The program arguments are located at an offset of &H80 (80 hex) from
  21999.  the PSP. The first byte at this offset is the number of characters in
  22000.  the command tail, followed by a string of ASCII characters terminated
  22001.  by a carriage return; the carriage return is not included in the
  22002.  count.
  22003.  
  22004.  For more information about MS-DOS interrupts, please refer to the
  22005.  following excellent book:
  22006.  
  22007.     "Advanced MS-DOS Programming, Second Edition", by Ray Duncan,
  22008.      published by Microsoft Press (1988).
  22009.  
  22010.  Sample Code
  22011.  -----------
  22012.  
  22013.  To use this sample code, QuickBASIC must be started with the /L option
  22014.  to load the default Quick library, QB.QLB or QBX.QLB, which contains
  22015.  the necessary INTERRUPT routine. (In QuickBASIC 4.x or BASIC compiler
  22016.  6.00x, the default Quick library is QB.QLB; in BASIC PDS 7.00 and
  22017.  7.10, it is QBX.QLB). Name the following program TEST.BAS:
  22018.  
  22019.  ' $INCLUDE: 'qb.bi'
  22020.  ' In QuickBASIC 4.x or BASIC compiler 6.00x, use the above include;
  22021.  ' but in BASIC PDS 7.00 and 7.10, change the above to use 'QBX.BI'
  22022.  DECLARE FUNCTION Arguments$ ()
  22023.  args$ = Arguments$
  22024.  PRINT args$
  22025.  END
  22026.  
  22027.  FUNCTION Arguments$
  22028.  DIM regs AS RegType
  22029.  regs.ax = &H6200
  22030.  CALL INTERRUPT(&H21, regs, regs)   ' Get the address of the PSP
  22031.  DEF SEG = regs.bx                  ' Set the current segment
  22032.  count = PEEK(&H80)                 ' Get the number of characters
  22033.  a$ = ""
  22034.  FOR a = 2 TO count                 ' Read the arguments from memory
  22035.       a$ = a$ + CHR$(PEEK(&H80 + a))
  22036.  NEXT
  22037.  Arguments$ = a$                    ' Return the arguments to program
  22038.  END FUNCTION
  22039.  
  22040.  If you invoked this program with
  22041.  
  22042.     QB TEST/L QB.QLB
  22043.        or
  22044.     QBX TEST/L QBX.QLB
  22045.  
  22046.  the program will print the following:
  22047.  
  22048.     TEST/L QB.QLB
  22049.        or
  22050.     TEST/L QBX.QLB
  22051.  
  22052.  If you invoked this program from an .EXE program (such as TEST.EXE) as
  22053.  follows
  22054.  
  22055.     TEST ARG1 ARG2
  22056.  
  22057.  then the program will print the following:
  22058.  
  22059.     ARG1 ARG2
  22060.  
  22061.  
  22062.  358. Using OS/2 API Calls for Keyboard Input from BASIC PDS
  22063.  
  22064.  Product Version(s): 7.00 7.10
  22065.  Operating System:   OS/2
  22066.  Flags: ENDUSER | SR# S900831-121
  22067.  Last Modified: 19-OCT-1990    ArticleIdent: Q65925
  22068.  
  22069.  This article contains a sample BASIC module, which calls the OS/2 API
  22070.  functions to perform a simple keyboard input routine in protected
  22071.  mode.
  22072.  
  22073.  This information applies to Microsoft BASIC compiler versions 6.00 and
  22074.  6.00b for MS OS/2 (for protected mode only) and Microsoft BASIC
  22075.  Professional Development System (PDS) versions 7.00 and 7.10 for MS
  22076.  OS/2 (for protected mode only).
  22077.  
  22078.  For more information on the OS/2 keyboard input functions, please
  22079.  refer to the "Microsoft OS/2 Programmer's Reference" Volume 3, Pages
  22080.  164-180, published by Microsoft Press (1989).
  22081.  
  22082.  OS/2 protected mode allows for multiple logical keyboard buffers to be
  22083.  set up and used by a process. When a logical keyboard buffer is
  22084.  opened, it does not receive any characters until that buffer is given
  22085.  the focus by the KbdGetFocus function. When a keyboard buffer has the
  22086.  focus, it receives all characters that are typed in through the
  22087.  keyboard.
  22088.  
  22089.  The largest string that can be typed in is determined by the buffer
  22090.  that the program sets up; in this example, the buffer is set to 40.
  22091.  Any extra characters are ignored until the BACKSPACE, DEL, or arrow
  22092.  keys are pressed.
  22093.  
  22094.  This sample program uses the KbdOpen and KbdGetFocus function to open
  22095.  a logical keyboard. It then uses the KbdGetStatus and KbdSetStatus
  22096.  functions to preserve the status of the keyboard and then to modify
  22097.  the status, forcing the CAPSLOCK key on. It also uses the
  22098.  VioSetCurType function to set the display of the cursor (by default
  22099.  there is no cursor).
  22100.  
  22101.  To run the program in OS/2 protected mode, the program should be
  22102.  compiled and linked as follows:
  22103.  
  22104.       BC /Lp OS2KEY;
  22105.       LINK OS2KEY,,,BRT71ENP.LIB+OS2.LIB;
  22106.  
  22107.  OS2KEY.BAS
  22108.  ----------
  22109.  
  22110.  'This sample program OS2KEY.BAS uses OS/2 keyboard input routines.
  22111.  'Wait flags for keyboard input and status check:
  22112.  CONST IOWAIT     = 0
  22113.  CONST IONOWAIT   = 1
  22114.  'Constant declarations for KdbInfo.fsMask:
  22115.  CONST KEYBOARDECHOON            = &H0001
  22116.  CONST KEYBOARDECHOOFF           = &H0002
  22117.  CONST KEYBOARDBINARYMODE        = &H0004
  22118.  CONST KEYBOARDASCIIMODE         = &H0008
  22119.  CONST KEYBOARDMODIFYSTATE       = &H0010
  22120.  CONST KEYBOARDMODIFYINTERIM     = &H0020
  22121.  CONST KEYBOARDMODIFYTURNAROUND  = &H0040
  22122.  CONST KEYBOARD2BTURNAROUND      = &H0080
  22123.  CONST KEYBOARDSHIFTREPORT       = &H0100
  22124.  'Constant declarations for Keyboard flags:
  22125.  CONST RIGHTSHIFT    = &H0001
  22126.  CONST LEFTSHIFT     = &H0002
  22127.  CONST CONTROL       = &H0004
  22128.  CONST ALT           = &H0008
  22129.  CONST SCROLLLOCKON  = &H0010
  22130.  CONST NUMLOCKON     = &H0020
  22131.  CONST CAPSLOCKON    = &H0040
  22132.  CONST INSERTON      = &H0080
  22133.  CONST LEFTCONTROL   = &H0100
  22134.  CONST LEFTALT       = &H0200
  22135.  CONST RIGHTCONTROL  = &H0400
  22136.  CONST RIGHTALT      = &H0800
  22137.  CONST SCROLLLOCK    = &H1000
  22138.  CONST NUMLOCK       = &H2000
  22139.  CONST CAPSLOCK      = &H4000
  22140.  CONST SYSREQ        = &H8000
  22141.  TYPE KbdInfoType    'KbdInfo structure
  22142.      cb           AS INTEGER
  22143.      fsMask       AS INTEGER
  22144.      chTurnAround AS INTEGER
  22145.      fsInterim    AS INTEGER
  22146.      fsState      AS INTEGER
  22147.  END TYPE
  22148.  TYPE StringInBufType    'StringInBuf structure
  22149.      cb    AS INTEGER
  22150.      cchIn AS INTEGER
  22151.  END TYPE
  22152.  TYPE StringBufType    'Fixed length string to receive input characters
  22153.      Chars AS STRING * 40   'BASIC doesn't allow passing fixed length
  22154.  END TYPE                   'strings, so use a user-defined type of
  22155.                             'a fixed length string.
  22156.  TYPE VioCursorInfoType   'Type that holds the cursor attributes
  22157.      yStart AS INTEGER
  22158.      cEnd   AS INTEGER
  22159.      cx     AS INTEGER
  22160.      attr   AS INTEGER
  22161.  END TYPE
  22162.  'The fundamental OS/2 Keyboard functions
  22163.  DECLARE FUNCTION KbdOpen% (SEG hkbd%)
  22164.  DECLARE FUNCTION KbdClose% (BYVAL hkbd%)
  22165.  DECLARE FUNCTION KbdGetStatus% (SEG KbdInfo AS KbdInfoType, BYVAL hkbd%)
  22166.  DECLARE FUNCTION KbdSetStatus% (SEG KbdInfo AS KbdInfoType, BYVAL hkbd%)
  22167.  DECLARE FUNCTION KbdGetFocus% (BYVAL fWait%, BYVAL hkbd%)
  22168.  DECLARE FUNCTION KbdFreeFocus% (BYVAL hkbd%)
  22169.  DECLARE FUNCTION KbdStringIn% (SEG chBuffer AS StringBufType, _
  22170.          SEG StringInBuf AS StringInBufType, BYVAL fWait%, BYVAL hkbd%)
  22171.  DECLARE FUNCTION VioSetCurType% (SEG VioCursorInfo AS _
  22172.                                   VioCursorInfoType, BYVAL hvio%)
  22173.  'Dimension the structured variables
  22174.  DIM KbdInfo AS KbdInfoType
  22175.  DIM PrevkbdInfo AS KbdInfoType
  22176.  DIM StringInBuf AS StringInBufType
  22177.  DIM chBuffer AS StringBufType
  22178.  DIM VioCursorInfo AS VioCursorInfoType
  22179.  CLS
  22180.  ReturnVal% = KbdOpen%(hkbd%)             'Open a logical Keyboard
  22181.  IF ReturnVal% = 0 THEN
  22182.   PRINT "Opened logical keyboard"
  22183.   PRINT "Getting the focus: ";
  22184.   ReturnVal% = KbdGetFocus%(IONOWAIT, hkbd%)   'Make it the one to
  22185.                                                'receive keyboard
  22186.   IF ReturnVal% = 0 THEN                       'input
  22187.      PRINT "we have the focus"
  22188.      'Save the previous state of the keyboard, so it can be reset:
  22189.      PRINT "Saving the previous state of the input mode"
  22190.      PRINT "Getting the status and checking for echo mode, input mode"
  22191.      PrevkbdInfo.cb = LEN(KbdInfo)
  22192.      ReturnVal% = KbdGetStatus%(PrevkbdInfo, hkbd%)
  22193.      IF RetrunVal% = 0 THEN
  22194.        'Check echo mode:
  22195.        IF (PrevkbdInfo.fsMask AND KEYBOARDECHOON) THEN
  22196.         PRINT "Echo on, ";
  22197.        ELSE
  22198.         PRINT "Echo off, ";
  22199.        END IF
  22200.        'Check input mode:
  22201.        IF (PrevkbdInfo.fsMask AND KEYBOARDASCIIMODE) THEN  '
  22202.         PRINT "Ascii mode"
  22203.        ELSE
  22204.         PRINT "Binary Mode"
  22205.        END IF
  22206.        'Set the cursor type: size, and attribute:
  22207.        VioCursorInfo.yStart = 12    'beginning scan line for cursor
  22208.                                     'starting from top position
  22209.        VioCursorInfo.cEnd = 13      'ending scan line, zero-based
  22210.        VioCursorInfo.cx = 0         'default width, one character
  22211.        VioCursorInfo.attr = 0       'normal attribute, &hffff is hidden
  22212.        hvio% = 0                    'video handle
  22213.        ReturnVal% = VioSetCurType%(VioCursorInfo, hvio%)
  22214.        IF ReturnVal% = 0 THEN
  22215.         PRINT "Cursor is the normal TWO scan lines tall"
  22216.        END IF
  22217.  
  22218.        'Initialize KbdInfo to the new status:
  22219.        PRINT "Setting the CAPSLOCK on"
  22220.        KbdInfo.cb = LEN(KbdInfo)
  22221.        KbdInfo.chTurnAround = PrevkbdInfo.chTurnAround
  22222.        KbdInfo.fsInterim = PrevkbdInfo.fsInterim
  22223.        KbdInfo.fsMask = (PrevkbdInfo.fsMask OR _    'Turn on the modify
  22224.                          KEYBOARDMODIFYSTATE)       'state
  22225.        KbdInfo.fsState = (PrevkbdInfo.fsState OR _  'force caps lock on
  22226.                           CAPSLOCKON)
  22227.        ReturnVal% = KbdSetStatus%(KbdInfo, hkbd%)   'Set the status
  22228.        IF ReturnVal% = 0 THEN
  22229.         PRINT "Caps lock should be on"
  22230.         PRINT "Input some characters: ";
  22231.         StringInBuf.cb = LEN(chBuffer)
  22232.         'Input the string:
  22233.         RetrunVal% = KbdStringIn%(chBuffer, StringInBuf, IOWAIT, hkbd%)
  22234.  
  22235.       'During input, OS/2 does not advance the cursor, to prevent
  22236.       'writing over what was typed, use a LOCATE statement, or a double
  22237.       'PRINT to advance the cursor position
  22238.         PRINT : PRINT "This is what you typed: "; chBuffer.Chars
  22239.         SLEEP (3)                       'Sleep for three seconds
  22240.        ELSE
  22241.         PRINT "Caps on failed"
  22242.        END IF
  22243.        'Start cleaning up, restore the status, free focus, and close
  22244.        'keyboard:
  22245.        PRINT "Restoring the status"
  22246.        RetrunVal% = KbdSetStatus%(PrevKbdInfo, hkbd%)
  22247.        IF RetrunVal% = 0 THEN
  22248.         PRINT "Status Returned"
  22249.        ELSE
  22250.         PRINT "Status Could Not Be Restored
  22251.        END IF
  22252.  
  22253.        'Free the focus and close the logical keyboard
  22254.        PRINT "Freeing the focus and closing keyboard"
  22255.        ReturnVal% = KbdFreeFocus%(hkbd%)
  22256.        IF ReturnVal% = 0 THEN
  22257.         ReturnVal% = KbdClose%(hkbd%)
  22258.         IF ReturnVal% = 0 THEN
  22259.           PRINT "Keyboard closed"
  22260.         ELSE
  22261.           PRINT "Keyboard could not be closed, Error= "; ReturnVal%
  22262.         END IF
  22263.        ELSE
  22264.         PRINT "Focus could not be freed: "; ReturnVal%
  22265.        END IF
  22266.      ELSE
  22267.       PRINT "Get status failed: "; RetrunVal%
  22268.      END IF
  22269.   ELSE
  22270.      PRINT "ERROR on Focus, ReturnVal% = "; ReturnVal%
  22271.   END IF
  22272.  ELSE
  22273.      PRINT "Logical keyboard could not be opened"
  22274.  END IF
  22275.  END
  22276.  
  22277.  
  22278.  359. How PutCopyBox Determines Window Size in 7.00/7.10 UI ToolBox
  22279.  
  22280.  Product Version(s): 7.00 7.10
  22281.  Operating System:   MS-DOS
  22282.  Flags: ENDUSER | SR# S900924-84
  22283.  Last Modified:  8-NOV-1990    ArticleIdent: Q65926
  22284.  
  22285.  The User-Interface (UI) ToolBox uses three assembler routines to "Get
  22286.  a window from the screen" (GetCopyBox), "Put a window to the screen"
  22287.  (PutCopyBox), and "Change the attributes of a window" (AttrBox). The
  22288.  source code for these three assembler routines are located in the
  22289.  UIASM.ASM file.
  22290.  
  22291.  GetCopyBox and PutCopyBox are complimentary routines, except for the
  22292.  parameters that they use. GetCopyBox needs five parameters; four to
  22293.  define the rectangle of the window and one for the string to store the
  22294.  information. PutCopyBox uses only three parameters; two for the
  22295.  upper-left corner and one for the string where the information will
  22296.  come from.
  22297.  
  22298.  PutCopyBox determines the size of the rectangle by the window width
  22299.  and window height stored in the first four bytes of the string.
  22300.  GetCopyBox stores this information in the string as the first four
  22301.  bytes, then places the contents of the window following the height and
  22302.  width of the window.
  22303.  
  22304.  The window width is the first two bytes and the window height is the
  22305.  next two bytes.
  22306.  
  22307.  This information applies to Microsoft BASIC Professional Development
  22308.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  22309.  
  22310.  The following is an extraction of code from UIASM.ASM used by the UI
  22311.  ToolBox routines to preserve and restore a window on the screen.
  22312.  
  22313.  The sections of code listed below that refer to "si,offset" are moving
  22314.  the data from memory to the string. The references to "di,offset" are
  22315.  moving the data from the string to memory.
  22316.  
  22317.  Sample Code
  22318.  -----------
  22319.  
  22320.  get_setstr:
  22321.          mov     al,x1
  22322.          sub     al,x0                   ;find width of box
  22323.          mov     bwidth,al               ;and save
  22324.          add     al,1                    ;add one to width
  22325.          mov     ah,0                    ;to find # words to move
  22326.          mov     movword,ax              ;MovWord = (width+1)
  22327.          mov     al,y1
  22328.          sub     al,y0                   ;find height of box
  22329.          mov     height,al               ;and save
  22330.          mov     es,strdseg
  22331.          mov     di,strdoff              ;string is the destination
  22332.  
  22333.          ; Place the Windows Width in the first word of the string
  22334.          ; The first and second bytes of the string
  22335.  
  22336.          mov     si,offset bwidth        ;point to width
  22337.          movsb                           ;put width in string
  22338.  
  22339.          ; Place the Windows Height in the second word of the string
  22340.          ; The third and fourth bytes of the string
  22341.  
  22342.          mov     si,offset height
  22343.          movsb                           ;and the height, too
  22344.  
  22345.  put_setstr:
  22346.          push    ds
  22347.          pop     es                      ;equate ES to DS
  22348.  
  22349.          mov     si,strdoff              ;point DS:SI to string mem
  22350.          push    ds
  22351.          mov     ds,strdseg
  22352.  
  22353.          ; Get the Windows Width from the string
  22354.  
  22355.          mov     di,offset bwidth
  22356.          movsb                           ;get width
  22357.  
  22358.          ; Get the Windows Height from the string
  22359.  
  22360.          mov     di,offset height
  22361.          movsb                           ;and height out of string
  22362.  
  22363.          pop     ds
  22364.  
  22365.  
  22366.  360. ISAMIO /E Cannot Extract Aggregate Types from ISAM Database
  22367.  
  22368.  Product Version(s): 7.00 7.10 | 7.10
  22369.  Operating System:   MS-DOS    | OS/2
  22370.  Flags: ENDUSER | SR# S901001-69
  22371.  Last Modified: 18-OCT-1990    ArticleIdent: Q66139
  22372.  
  22373.  The ISAMIO.EXE utility can extract the data from an ISAM table into an
  22374.  ASCII text file by using the /E switch. However, the ISAMIO.EXE
  22375.  utility cannot completely extract aggregate items in a table.
  22376.  Aggregate items are items in the TYPE record that are not simple
  22377.  types. Simple types are INTEGER, LONG, CURRENCY, DOUBLE, and STRING.
  22378.  Aggregate types are items such as nested TYPEs or an array in the
  22379.  TYPE. This is not a problem with the ISAMIO.EXE utility, but is a
  22380.  result of the way in which the ISAM engine stores aggregate types in
  22381.  the table and in the data dictionary. This article also describes two
  22382.  ways to view a database's data dictionary.
  22383.  
  22384.  This information applies to Microsoft BASIC Professional Development
  22385.  System (PDS) version 7.00 for MS-DOS and version 7.10 for MS-DOS and
  22386.  MS OS/2.
  22387.  
  22388.  This behavior of ISAMIO results from the way in which the ISAM engine
  22389.  stores an aggregate item in the database. For an aggregate type, it
  22390.  calculates the size of the whole aggregate item, and then inserts an
  22391.  entry in the data dictionary describing it as a binary object of that
  22392.  many bytes. For example, consider the following TYPE:
  22393.  
  22394.  TYPE nested ' This gets nested in the TYPE below.
  22395.      junk1 AS DOUBLE
  22396.      junk2 AS STRING * 7
  22397.  END TYPE
  22398.  
  22399.  TYPE record
  22400.     key1 AS STRING * 20
  22401.     key2 AS nested
  22402.     key3 AS INTEGER
  22403.     key4(5) AS INTEGER
  22404.     key5 AS LONG
  22405.     key6(4)  AS DOUBLE
  22406.     key7 AS DOUBLE
  22407.     key8 AS CURRENCY
  22408.  END TYPE
  22409.  
  22410.  If you create a table in a database with this TYPE, the ISAM engine
  22411.  will put entries in the data dictionary saying that key2, key4, and
  22412.  key6 are "binary" objects of a certain size. Thus, when ISAMIO later
  22413.  tries to extract these items, it cannot determine what their original
  22414.  data types were; it only knows how big they were. Therefore, ISAMIO
  22415.  extracts these binary objects as a string (usually full of graphics
  22416.  characters).
  22417.  
  22418.  You can show what is in a database's data dictionary in two ways, as
  22419.  described in the following:
  22420.  
  22421.  1. ISAMIO can access the data dictionary. When you run ISAMIO to
  22422.     extract a database as a text file, you can specify a <specfile>
  22423.     parameter. For example, to extract the table called "test" in a
  22424.     database called "test.mdb" made with the above TYPEs, you use the
  22425.     following line:
  22426.  
  22427.        ISAMIO /E data.txt test.mdb test specfile.txt /C
  22428.  
  22429.     After this, DATA.TXT contains the output data. While it's
  22430.     extracting, ISAMIO takes the information in the data dictionary and
  22431.     builds "SPECFILE.TXT". Note that SPECFILE.TXT doesn't have to exist
  22432.     before you run ISAMIO. After running ISAMIO, this specfile will
  22433.     describe the data items in the ASCII text file just created. For
  22434.     instance, for the TYPE example above, the specfile created is as
  22435.     follows:
  22436.  
  22437.        variabletext,20,key1
  22438.        binary,,key2
  22439.        integer,,key3
  22440.        binary,,key4
  22441.        long,,key5
  22442.        binary,,key6
  22443.        double,,key7
  22444.        currency,,key8
  22445.  
  22446.     This clearly shows key2, key4, and key4 are seen as binary objects
  22447.     by ISAMIO.EXE.
  22448.  
  22449.  2. The second way to examine the data dictionary is to run the
  22450.     ISAMPACK.EXE utility. If you redirect the output from ISAMPACK into
  22451.     a file, you will have a record of the database's contents. For
  22452.     instance, use the following:
  22453.  
  22454.        ISAMPACK test.mdb > report.dat
  22455.  
  22456.     This creates a file called REPORT.DAT, which (among other things)
  22457.     has a description of the structure of each table in the database.
  22458.     The structure of the tables is determined by what is in the data
  22459.     dictionary. For the table discussed above, a part of REPORT.DAT
  22460.     will contain the following:
  22461.  
  22462.        Column Name               Column Type         Maximum Size
  22463.        -----------               -----------         ------------
  22464.  
  22465.        key1                      VarText             20
  22466.        key2                      Binary              64K
  22467.        key3                      Integer             2
  22468.        key4                      Binary              64K
  22469.        key5                      Long                4
  22470.        key6                      Binary              64K
  22471.        key7                      Double              8
  22472.        key8                      Currency            8
  22473.  
  22474.     Again, this shows that the data dictionary describes aggregate
  22475.     objects as being "binary".
  22476.  
  22477.  Code Example
  22478.  ------------
  22479.  
  22480.  To build the code example described above, you can use the following
  22481.  program. To run this program in QBX.EXE, you must first load the
  22482.  PROISAMD.EXE TSR. To compile and run the program, use the following:
  22483.  
  22484.     BC test.bas ;
  22485.     LINK test ;
  22486.  
  22487.  DEFINT A-Z
  22488.  TYPE nested
  22489.      junk1 AS DOUBLE
  22490.      junk2 AS STRING * 7
  22491.  END TYPE
  22492.  
  22493.  TYPE record
  22494.     key1 AS STRING * 20
  22495.     key2 AS nested
  22496.     key3 AS INTEGER
  22497.     key4(5) AS INTEGER
  22498.     key5 AS LONG
  22499.     key6(4)  AS DOUBLE
  22500.     key7 AS DOUBLE
  22501.     key8 AS CURRENCY
  22502.  END TYPE
  22503.  
  22504.  DIM Record1 AS record, Record2 AS record, Record3 AS record
  22505.  ' Code part.
  22506.  
  22507.  OPEN "test.mdb" FOR ISAM record "test" AS #1
  22508.  'SETINDEX #1, "testindex"
  22509.  
  22510.  FOR i = 1 TO 20
  22511.     PRINT "***********************************"
  22512.     PRINT "*       Get a new record          *"
  22513.     PRINT "***********************************"
  22514.  
  22515.     INPUT "Input a STRING * 20: ", Record1.key1
  22516.     INPUT "Input a DOUBLE: ", Record1.key2.junk1
  22517.     INPUT "Input a STRING * 7: ", Record1.key2.junk2
  22518.     INPUT "Input an INTEGER: ", Record1.key3
  22519.     FOR j = 1 TO 5
  22520.       INPUT "Input an INTEGER: ", Record1.key4(j)
  22521.     NEXT
  22522.     INPUT "Input a LONG: ", Record1.key5
  22523.     FOR j = 1 TO 4
  22524.       INPUT "Input an INTEGER: ", Record1.key6(j)
  22525.     NEXT
  22526.     INPUT "Input a DOUBLE: ", Record1.key7
  22527.     INPUT "Input a CURRENCY: ", curr1
  22528.     INSERT #1, Record1
  22529.  NEXT
  22530.  CLOSE
  22531.  END
  22532.  
  22533.  
  22534.  361. How to Change User Interface Global CONSTants in GENERAL.BI
  22535.  
  22536.  Product Version(s): 7.00 7.10
  22537.  Operating System:   MS-DOS
  22538.  Flags: ENDUSER | SR# S900313-103
  22539.  Last Modified: 18-OCT-1990    ArticleIdent: Q66140
  22540.  
  22541.  The GENERAL.BI $INCLUDE file in the User Interface (UI) Toolbox, which
  22542.  comes with Microsoft BASIC Professional Development System (PDS)
  22543.  versions 7.00 and 7.10, contains several global constants (defined
  22544.  with CONST) that dictate how the Toolbox FUNCTIONs and SUBs will
  22545.  behave. When one of these CONSTants is changed, the entire Toolbox
  22546.  usually must be recompiled and linked, all libraries must be rebuilt,
  22547.  and the quick libraries must be rebuilt. This article gives
  22548.  instructions for this process.
  22549.  
  22550.  This information applies to Microsoft BASIC PDS versions 7.00 and 7.10
  22551.  for MS-DOS.
  22552.  
  22553.  To change the constants in the UI $INCLUDE files, follow these steps:
  22554.  
  22555.  1. Load the file GENERAL.BI into any editor (such as QBX.EXE).
  22556.  
  22557.  2. Move the cursor down to the Global Constants section.
  22558.  
  22559.  3. Change the CONSTant.
  22560.  
  22561.  4. Save the GENERAL.BI file.
  22562.  
  22563.  5. If you are loading the entire source code for the Toolbox into the
  22564.     QBX.EXE editor, then you can just load and run the current program
  22565.     and the changes will take effect.
  22566.  
  22567.  Most people use the Toolbox in the form of a compiled library or Quick
  22568.  library. To enable these changes to take effect in your Quick library
  22569.  or library, you must recompile and create both UITBEFR.QLB and
  22570.  UITBxxx.LIB. The "xxx" depends on what compiler options you use to
  22571.  create your final .EXE application and what compiler options you use
  22572.  to create the Toolbox.
  22573.  
  22574.  Within the QBX.EXE environment, you must use UITBEFR.QLB (which
  22575.  supports the emulator library, far strings, and real-mode). Therefore,
  22576.  a full example is provided here of altering UITBEFR.LIB and
  22577.  UITBEFR.QLB. To re-create these files, use the following commands (as
  22578.  shown in the form of an MS-DOS batch file to make rebuilding the
  22579.  libraries easier):
  22580.  
  22581.     REM  Recompile the four BASIC modules which make the Toolboxes
  22582.     REM  Note that the .OBJ names below MUST be used:
  22583.     BC /x /Fs /Lr /FPi GENERAL.BAS, GENEREFR.OBJ;
  22584.     BC /x /Fs /Lr /FPi MOUSE.BAS,   MOUSEEFR.OBJ;
  22585.     BC /x /Fs /Lr /FPi MENU.BAS,    MENUEFR.OBJ ;
  22586.     BC /x /Fs /Lr /FPi WINDOW.BAS,  WINDOEFR.OBJ;
  22587.  
  22588.     REM  Replace the existing modules in the UITBEFR.LIB. Note that
  22589.     REM  the following command should be on just one DOS command line:
  22590.   LIB UITBEFR.LIB -+GENEREFR.OBJ -+ MOUSEEFR.OBJ -+MENUEFR.OBJ -+WINDOEFR.OBJ;
  22591.  
  22592.     REM  Don't forget to save the old version of your library in case
  22593.     REM  an error occurs:
  22594.     RENAME UITBEFR.QLB UITBEFR.BAK
  22595.  
  22596.     REM  Link the new Quick library:
  22597.     LINK /q UITBEFR.LIB, UITBEFR.QLB,,QBXQLB.LIB;
  22598.  
  22599.  If you want to modify any of the other UITBxxx.LIB libraries, then the
  22600.  BC compile and LIB commands given above can easily be modified to work
  22601.  properly with all of these other libraries.
  22602.  
  22603.  The global constants that can be changed in GENERAL.BI are: FALSE,
  22604.  TRUE, MINROW, MAXROW, MINCOL, MAXCOL, MAXMENU, MAXITEM, MAXWINDOW,
  22605.  MAXBUTTON, MAXEDITFIELD, and MAXHOTSPOT. For a description of these
  22606.  constants, see page 533 of the "Microsoft BASIC 7.0: BASIC Language
  22607.  Reference."
  22608.  
  22609.  
  22610.  362. Problems May Occur When Passing the Same Array Element Twice
  22611.  
  22612.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  22613.  Operating System:   MS-DOS               | OS/2
  22614.  Flags: ENDUSER | SR# S901018-67 B_QuickBAS
  22615.  Last Modified: 12-NOV-1990    ArticleIdent: Q66455
  22616.  
  22617.  The following program may give unexpected results when the same array
  22618.  element is passed twice to the subprogram. The problem results from a
  22619.  form of variable aliasing, where the same memory location is
  22620.  referenced by two different variables.
  22621.  
  22622.  To avoid aliasing problems, never pass the same variable twice in a
  22623.  given parameter list.
  22624.  
  22625.  Passing the same array element twice in the same parameter list can
  22626.  give incorrect or unexpected results regardless of array type or
  22627.  dynamic or static array allocation. The results may also vary between
  22628.  compiler versions. A customer reported that the program below gave the
  22629.  results that he wanted in QuickBASIC 4.00, but not in Microsoft BASIC
  22630.  Professional Development System (PDS) version 7.10; Microsoft has not
  22631.  confirmed this report.
  22632.  
  22633.  This behavior results from the fact the BASIC often requires a far
  22634.  pointer to access arrays, but parameters need to be passed as near
  22635.  pointers. On a CALL, BASIC sets aside a temporary location holding the
  22636.  array element and then passes a pointer to the temporary area.
  22637.  
  22638.  There are two options in this sort of situation: Recode the subprogram
  22639.  so that it is not necessary to pass the array element twice, or assign
  22640.  one of the parameters to a temporary variable and then pass the
  22641.  temporary variable.
  22642.  
  22643.  References:
  22644.  
  22645.  For a similar article on variable aliasing when a parameter is both
  22646.  SHARED and passed as a parameter to a subprogram, query in this
  22647.  Knowledge Base on the following words:
  22648.  
  22649.     DYNAMIC and ARRAY and ALIASES
  22650.  
  22651.  A variable should not be passed twice in the list of arguments passed
  22652.  to a procedure; otherwise, variable-aliasing problems will occur. This
  22653.  restriction is documented under "The Problem of Variable Aliasing" on
  22654.  Page 64 in the "Microsoft BASIC 7.0: Programmer's Guide" for BASIC PDS
  22655.  versions 7.00 and 7.10, on Page 68 of the "Microsoft QuickBASIC 4.5:
  22656.  Programming in BASIC" manual, and on Page 78 of the "Microsoft
  22657.  QuickBASIC 4.0: Programming in BASIC: Selected Topics" manual for
  22658.  QuickBASIC versions 4.00 and 4.00b.
  22659.  
  22660.  Code Example
  22661.  ------------
  22662.  
  22663.     DECLARE SUB MakeUpper(instring AS STRING, outstring AS STRING)
  22664.     DIM a$(15)
  22665.     a$(4)="abcdefg"
  22666.     CALL MakeUpper(a$(4), a$(4))
  22667.     PRINT a$(4)
  22668.     END
  22669.  
  22670.     SUB MakeUpper(instring AS STRING, outstring AS STRING)
  22671.       outstring = UCASE$(instring)
  22672.     END SUB
  22673.  
  22674.  
  22675.  363. BASIC PDS Reply Letters: Appnotes BB0354, BB0355, BB0356
  22676.  
  22677.  Product Version(s): 7.00 7.10 | 7.00 7.10
  22678.  Operating System:   MS-DOS    | OS/2
  22679.  Flags: ENDUSER | policy appnote BB0354 BB0355 BB0356
  22680.  Last Modified: 14-NOV-1990    ArticleIdent: Q66490
  22681.  
  22682.  Below are the three form letters that Microsoft sends in response to
  22683.  unsolicited letters from customers who have Microsoft BASIC
  22684.  Professional Development System (PDS) version 7.00 or 7.10 for MS-DOS
  22685.  and MS OS/2:
  22686.  
  22687.     Appnote Number        Description
  22688.     --------------        -----------
  22689.  
  22690.     BB0354                BASIC PDS Question Reply Letter
  22691.     BB0355                BASIC PDS Suggestion Reply Letter
  22692.     BB0356                BASIC PDS Problem/Docerr Reply Letter
  22693.  
  22694.  These form letters are sent out from Microsoft Product Support
  22695.  Services (PSS) as application notes.
  22696.  
  22697.  Note: Page 1 of 2 is shown below for each reply letter. Page 2 of 2,
  22698.  the "Product Assistance Checklist," is the same for each reply letter
  22699.  and is shown in a separate article that can be found by querying for
  22700.  the following words:
  22701.  
  22702.     product and assistance and checklist
  22703.  
  22704.  BB0354: BASIC PDS Question Reply Letter
  22705.  ---------------------------------------
  22706.  
  22707.  Dear BASIC Professional Development System Customer:
  22708.  
  22709.  Thank you for your letter concerning the BASIC Professional
  22710.  Development System (PDS). Although we are unable to respond to your
  22711.  technical questions by letter, we do forward your letters to our BASIC
  22712.  PDS development team. This procedure provides developers with customer
  22713.  feedback, which will in turn make Microsoft's products even better.
  22714.  Now that we can no longer respond to letters (unless solicited by
  22715.  Microsoft), we are providing the following new service:
  22716.  
  22717.  Our toll-line number, (206) 637-7096, is available Monday through
  22718.  Friday (except holidays), 8 AM to 5 PM Pacific Standard Time, and is
  22719.  designed to answer questions about set up and installation procedures,
  22720.  problem reports, and documentation errors. We also address most
  22721.  programming, code debugging, and problem solving issues.
  22722.  
  22723.  We are also offering a 900-number service to provide a higher quality
  22724.  of service, extended hours, and a shorter waiting time. To access
  22725.  "OnCall(TM) for BASIC," call (900) 896-9999. The cost is $2 per
  22726.  minute, and the service is available Monday through Friday from 6 AM
  22727.  to 6 PM Pacific Standard Time. To obtain the best possible service, we
  22728.  recommend you be at your computer and have your BASIC Professional
  22729.  Development System reference manuals and disks handy when you call.
  22730.  
  22731.  There are many supplemental sources of information relating to the
  22732.  BASIC languages, including reference guides and books published by
  22733.  Microsoft Press, or you can contact our "OnCall for BASIC" service at
  22734.  (900) 896-9999. Support is also available electronically through
  22735.  Microsoft OnLine and CompuServe. One of the features of these services
  22736.  is to provide access to the Microsoft Knowledge Base. The Microsoft
  22737.  Knowledge Base contains the latest technical information about
  22738.  Microsoft language products. For more information about Microsoft
  22739.  OnLine, which is designed for software developers, call (800)
  22740.  443-4672. For more information about CompuServe, which is the largest
  22741.  general online information service for personal computer users, call
  22742.  (800) 848-8199.
  22743.  
  22744.  Sincerely,
  22745.  
  22746.  Blain Barton
  22747.  BASIC Languages Team Manager
  22748.  Product Support Services
  22749.  BB0354
  22750.  
  22751.  BB0355: BASIC PDS Suggestion Reply Letter
  22752.  -----------------------------------------
  22753.  
  22754.  Dear BASIC Professional Development System Customer:
  22755.  
  22756.  Thank you for your letter and suggestion concerning our BASIC
  22757.  Professional Development System (PDS). Although we are unable to
  22758.  respond to your technical questions by letter, we do forward your
  22759.  letters to our BASIC PDS development team. This procedure provides
  22760.  developers with customer feedback, which will in turn make Microsoft's
  22761.  products even better. Now that we can no longer respond to letters
  22762.  (unless solicited by Microsoft), we are providing the following new
  22763.  service:
  22764.  
  22765.  Our toll-line number, (206) 637-7096, is available Monday through
  22766.  Friday (except holidays), 8 AM to 5 PM Pacific Standard Time, and is
  22767.  designed to answer questions about set up and installation procedures,
  22768.  problem reports, and documentation errors. We also address most
  22769.  programming, code debugging, and problem solving issues.
  22770.  
  22771.  We are also offering a 900-number service to provide a higher quality
  22772.  of service, extended hours, and a shorter waiting time. To access
  22773.  "OnCall(TM) for BASIC," call (900) 896-9999. The cost is $2 per
  22774.  minute, and the service is available Monday through Friday from 6 AM
  22775.  to 6 PM Pacific Standard Time. To obtain the best possible service, we
  22776.  recommend you be at your computer and have your BASIC Professional
  22777.  Development System reference manuals and disks handy when you call.
  22778.  
  22779.  There are many supplemental sources of information relating to the
  22780.  BASIC languages, including reference guides and books published by
  22781.  Microsoft Press, or you can contact our "OnCall for BASIC" service at
  22782.  (900) 896-9999. Support is also available electronically through
  22783.  Microsoft OnLine and CompuServe. One of the features of these services
  22784.  is to provide access to the Microsoft Knowledge Base. The Microsoft
  22785.  Knowledge Base contains the latest technical information about
  22786.  Microsoft language products. For more information about Microsoft
  22787.  OnLine, which is designed for software developers, call (800)
  22788.  443-4672. For more information about CompuServe, which is the largest
  22789.  general online information service for personal computer users, call
  22790.  (800) 848-8199.
  22791.  
  22792.  Sincerely,
  22793.  
  22794.  Blain Barton
  22795.  BASIC Languages Team Manager
  22796.  Product Support Services
  22797.  BB0355
  22798.  
  22799.  BB0356: BASIC PDS Problem/Docerr Reply Letter
  22800.  ---------------------------------------------
  22801.  
  22802.  Dear BASIC Professional Development System Customer:
  22803.  
  22804.  Thank you for your letter concerning your BASIC Professional
  22805.  Development System (PDS) problem and/or documentation error. Although
  22806.  we are unable to respond to your technical questions by letter, we do
  22807.  forward your letters to our BASIC PDS development team. This procedure
  22808.  provides developers with customer feedback, which will in turn make
  22809.  Microsoft's products even better. Now that we can no longer respond to
  22810.  letters (unless solicited by Microsoft), we are providing the
  22811.  following new service:
  22812.  
  22813.  Our toll-line number, (206) 637-7096, is available Monday through
  22814.  Friday (except holidays), 8 AM to 5 PM Pacific Standard Time, and is
  22815.  designed to answer questions about set up and installation procedures,
  22816.  problem reports, and documentation errors. We also address most
  22817.  programming, code debugging, and problem solving issues.
  22818.  
  22819.  We are also offering a 900-number service to provide a higher quality
  22820.  of service, extended hours, and a shorter waiting time. To access
  22821.  "OnCall(TM) for BASIC," call (900) 896-9999. The cost is $2 per
  22822.  minute, and the service is available Monday through Friday from 6 AM
  22823.  to 6 PM Pacific Standard Time. To obtain the best possible service, we
  22824.  recommend you be at your computer and have your BASIC Professional
  22825.  Development System reference manuals and disks handy when you call.
  22826.  
  22827.  There are many supplemental sources of information relating to the
  22828.  BASIC languages, including reference guides and books published by
  22829.  Microsoft Press, or you can contact our "OnCall for BASIC" service at
  22830.  (900) 896-9999. Support is also available electronically through
  22831.  Microsoft OnLine and CompuServe. One of the features of these services
  22832.  is to provide access to the Microsoft Knowledge Base. The Microsoft
  22833.  Knowledge Base contains the latest technical information about
  22834.  Microsoft language products. For more information about Microsoft
  22835.  OnLine, which is designed for software developers, call (800)
  22836.  443-4672. For more information about CompuServe, which is the largest
  22837.  general online information service for personal computer users, call
  22838.  (800) 848-8199.
  22839.  
  22840.  Sincerely,
  22841.  
  22842.  Blain Barton
  22843.  BASIC Languages Team Manager
  22844.  Product Support Services
  22845.  BB0356
  22846.  
  22847.  
  22848.  364. "Illegal Function Call" Using Coprocessor in BASIC 7.10
  22849.  
  22850.  Product Version(s): 7.00 7.10 | 7.00 7.10
  22851.  Operating System:   MS-DOS    | OS/2
  22852.  Flags: ENDUSER | SR# S901018-77 buglist7.00 buglist7.10
  22853.  Last Modified: 12-NOV-1990    ArticleIdent: Q66560
  22854.  
  22855.  The following program gives an "Illegal Function Call" error when run
  22856.  as a .EXE program using a math coprocessor; however, it works
  22857.  correctly in the QBX.EXE environment or with the coprocessor disabled.
  22858.  
  22859.  Microsoft has confirmed this to be a problem in Microsoft BASIC
  22860.  Professional Development System (PDS) versions 7.00 and 7.10 for
  22861.  MS-DOS and MS OS/2. We are researching this problem and will post new
  22862.  information here as it becomes available.
  22863.  
  22864.  Workaround
  22865.  ----------
  22866.  
  22867.  To work around this problem, do one of the following:
  22868.  
  22869.  1. Break the complex equation into smaller parts that are evaluated
  22870.     separately.
  22871.  
  22872.  -or-
  22873.  
  22874.  2. Turn off use of the coprocessor with SET NO87="message" at the DOS
  22875.     prompt.
  22876.  
  22877.  -or-
  22878.  
  22879.  3. Compile using the alternate math (/FPa) option.
  22880.  
  22881.  Code Example
  22882.  ------------
  22883.  
  22884.  a = .475
  22885.  b = 75
  22886.  c = 62
  22887.  d = .007
  22888.  e = 22
  22889.  f = (b * e ^ 2 / d) * SQR(1 / ((2 * b * c * a) ^ 2 + (b ^ 2 - c ^ 2))
  22890.  
  22891.  Simplifying the equation eliminates the problem. For example, removing
  22892.  the (b * e ^ 2 / d) factor eliminates the error.
  22893.  
  22894.  
  22895.  365. ALT+240 Hangs QBX.EXE or QB.EXE with Phoenix BIOS
  22896.  
  22897.  Product Version(s): 7.00 7.10
  22898.  Operating System:   MS-DOS
  22899.  Flags: ENDUSER | SR# S901025-47 B_QuickBas
  22900.  Last Modified: 12-NOV-1990    ArticleIdent: Q66591
  22901.  
  22902.  The extended ASCII characters can be typed into a BASIC program using
  22903.  the combination of the ALT key plus the three digits that correspond
  22904.  to the character. However, in Microsoft QuickBASIC version 4.50 and
  22905.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  22906.  and 7.10, typing ALT+240 can hang the QB.EXE and QBX.EXE environments
  22907.  temporarily. This problem has been reproduced on a Wyse 386 with a
  22908.  Phoenix BIOS version 3.53. Pressing CTRL+BREAK will get you out of the
  22909.  hang.
  22910.  
  22911.  To work around the problem, use the PRINT CHR$(240) statement instead.
  22912.  
  22913.  This problem also occurs in a WYSE 286, running Phoenix 286 ROM BIOS
  22914.  version 2.72, and has been reported with a clone computer running
  22915.  Phoenix ROM BIOS version 3.07.
  22916.  
  22917.  For a related article concerning how to enter extended ASCII and
  22918.  control characters into QB.EXE and QBX.EXE, search in this Knowledge
  22919.  Base for the following words:
  22920.  
  22921.     extended and ASCII and ALT and 240 and 255
  22922.  
  22923.  
  22924.  366. ALERT Function in BASIC 7.10 UI Toolbox Destroys TEXT$
  22925.  
  22926.  Product Version(s): 7.00 7.10
  22927.  Operating System:   MS-DOS
  22928.  Flags: ENDUSER | SR# S901030-181 buglist7.00 buglist7.10
  22929.  Last Modified: 14-NOV-1990    ArticleIdent: Q66690
  22930.  
  22931.  The ALERT function in the User Interface (UI) Toolbox destroys the
  22932.  string sent to it in the TEXT$ field of the function call.
  22933.  
  22934.  Microsoft has confirmed this problem in Microsoft BASIC Professional
  22935.  Development System (PDS) versions 7.00 and 7.10 for MS-DOS. Suggested
  22936.  workarounds for this problem are shown below.
  22937.  
  22938.  Workarounds
  22939.  -----------
  22940.  
  22941.  Any one of the following workarounds will correct the problem but
  22942.  choices 1 and 2 may be easiest because they don't require recompiling
  22943.  WINDOW.BAS or building new UI Toolbox support libraries:
  22944.  
  22945.  1. Enclose the TEXT$ parameter in parentheses. For example, the
  22946.     following statement
  22947.  
  22948.        Alert(4, a$, 6, 20, 15, 60, "OK", "CANCEL", "")
  22949.  
  22950.     should be changed to the following:
  22951.  
  22952.        Alert(4, (a$), 6, 20, 15, 60, "OK", "CANCEL", "")
  22953.  
  22954.  2. Make a copy of the string before calling the ALERT function, as
  22955.     follows:
  22956.  
  22957.        temp$ = a$
  22958.        ALERT(4, a$, 6, 20, 15, 60, "OK", "CANCEL", "")
  22959.        a$ = temp$
  22960.  
  22961.  3. Modify the ALERT function in WINDOW.BAS as follows:
  22962.  
  22963.        a. Right after the line that says
  22964.  
  22965.              FUNCTION Alert (style, text$...
  22966.  
  22967.           put the following statement:
  22968.  
  22969.              TempText$ = test$
  22970.  
  22971.         b. Right before the END FUNCTION at the bottom of the function,
  22972.            put the following statement:
  22973.  
  22974.               test$ = TempText$
  22975.  
  22976.     You should then make a new Quick library (.QLB) and a new LINK
  22977.     library (.LIB) that use the new version of ALERT, as shown in the
  22978.     following:
  22979.  
  22980.        BC /X/FS GENERAL.BAS;
  22981.        BC /X/FS WINDOW.BAS;
  22982.        BC /X/FS MOUSE.BAS;
  22983.        BC /X/FS MENU.BAS
  22984.        LIB UITB+GENERAL+WINDOW+MOUSE+MENU+UIASM+QBX.LIB;
  22985.        LINK /Q UITB.LIB, UITB.QLB, , QBXQLB.LIB;
  22986.  
  22987.     Invoke QBX.EXE using the new UITB.QLB Quick library, as follows:
  22988.  
  22989.        QBX /L UITB
  22990.  
  22991.  
  22992.  367. No "Block IF Without END IF" Using IF...THEN REM in QB/QBX.EXE
  22993.  
  22994.  Product Version(s): 6.00 6.00b 7.00 7.10 | 7.00 7.10
  22995.  Operating System:   MS-DOS               | OS/2
  22996.  Flags: ENDUSER | B_QUICKBAS buglist6.00 buglist6.00b buglist7.00 buglist7.10
  22997.  Last Modified: 14-NOV-1990    ArticleIdent: Q66691
  22998.  
  22999.  In compiled BASICs that support block IF statements, the following
  23000.  statement correctly implies a block IF ... END IF statement, instead
  23001.  of a single-line IF statement syntax (whereas GW-BASIC correctly
  23002.  treats this as a single-line IF because GW-BASIC has no block IF
  23003.  syntax):
  23004.  
  23005.     IF expression THEN ' Comment
  23006.  
  23007.  However, using a THEN REM statement, as follows, poses a problem:
  23008.  
  23009.     IF expression THEN REM Comment
  23010.  
  23011.  The problem is that the QBX.EXE (or QB.EXE) environment interprets
  23012.  THEN REM as indicating a single-line IF statement, whereas BC.EXE
  23013.  compiler interprets THEN REM as indicating a block IF.
  23014.  
  23015.  This inconsistency applies to Microsoft QuickBASIC versions 4.00,
  23016.  4.00b, 4.50 (buglist4.00, buglist4.00b, buglist4.50) for MS-DOS; to
  23017.  Microsoft BASIC Compiler versions 6.00 and 6.00b for MS-DOS and MS
  23018.  OS/2; and to Microsoft BASIC Professional Development System (PDS)
  23019.  versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  23020.  
  23021.  When compiling the code example below, BC.EXE gives a "Block IF
  23022.  without END IF" error but the QBX.EXE or QB.EXE environment doesn't
  23023.  give an error, and interprets the IF ... THEN REM statement as a
  23024.  single-line IF statement. If an END IF statement is put at the end of
  23025.  the code, the code example will compile with no error in BC.EXE but
  23026.  the QBX.EXE or QB.EXE environment will give an "END IF without block
  23027.  IF" error.
  23028.  
  23029.  The problem is caused by the REM statement on the IF line. In the
  23030.  QBX.EXE or QB.EXE environment, this case is interpreted as a
  23031.  single-line (non-block) IF. The BC.EXE compiler, however, strips off
  23032.  the REMark and interprets the line as the start of a block IF
  23033.  statement.
  23034.  
  23035.  Microsoft is researching which consistent syntax requirement should be
  23036.  adopted for IF ... THEN REM and will post new information here as it
  23037.  becomes available.
  23038.  
  23039.  Code Example
  23040.  ------------
  23041.  
  23042.  IF a = 3 THEN REM  Gives "Block IF without END IF" in BC.EXE
  23043.  a = 5
  23044.  
  23045.  To a avoid this problem, a remark should never be placed after a THEN
  23046.  statement. For example, the following code example avoids this problem
  23047.  by putting the remark on a separate line:
  23048.  
  23049.  REM   This remark doesn't cause a problem.
  23050.  IF a = 3 THEN
  23051.  a = 5
  23052.  END IF
  23053.  
  23054.  
  23055.  368. How to Re-create BASIC Help Files Using HELPMAKE.EXE
  23056.  
  23057.  Product Version(s): 7.00 7.10
  23058.  Operating System:   MS-DOS
  23059.  Flags: ENDUSER | SR# S901105-139
  23060.  Last Modified:  8-NOV-1990    ArticleIdent: Q66771
  23061.  
  23062.  HELPMAKE.EXE is designed to allow you to decode/encode the Help files
  23063.  included with BASIC PDS, and to create your own Help files for use
  23064.  with BASIC, QuickHelp, and other products that use these files.
  23065.  
  23066.  This information applies to Microsoft BASIC Professional Development
  23067.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  23068.  
  23069.  To decode a BASIC Help file, use the following command:
  23070.  
  23071.     HELPMAKE /D <HelpFileName> /O<OutputFile>
  23072.  
  23073.  You may now modify (customize) the decoded Help file.
  23074.  
  23075.  To re-encode the Help file after you have edited it, use the following
  23076.  command:
  23077.  
  23078.     HELPMAKE /E <SourceFile> /A: /T /W78 /O<HelpFileName>
  23079.  
  23080.  The options on the above encode line are explained below:
  23081.  
  23082.    /E   Encode the file. /E with no value gives the maximum
  23083.         compression. /E may optionally be followed by a value
  23084.         specifying the amount of compression to use:
  23085.  
  23086.             0 - No Compression
  23087.             1 - Run-length compression
  23088.             2 - Keyword compression
  23089.             4 - Extended keyword compression
  23090.             8 - Huffman compression
  23091.  
  23092.         These values may be added together to combine compression
  23093.         types. For example, /E5 will generate Run-length and Extended
  23094.         keyword compression.
  23095.  
  23096.    /A:  Specifies a colon as the control character. This is the default
  23097.         value so it may be omitted.
  23098.  
  23099.    /T   Translates dot commands. This is required to re-encode the
  23100.         BASIC Help files.
  23101.  
  23102.    /W78 Specifies the width of the resulting Help file. BASIC uses a
  23103.         width of 78 characters. The default is 76 so this option must
  23104.         be included.
  23105.  
  23106.  For a more detailed discussion of HELPMAKE, refer to Chapter 11 of
  23107.  "Microsoft BASIC 7.0: Programmer's Guide" for versions 7.00 and 7.10.
  23108.  
  23109.  
  23110.  369. Far FIELD Variable Assigned to Itself Doesn't UnFIELD in PDS
  23111.  
  23112.  Product Version(s): 7.00 7.10 | 7.00 7.10
  23113.  Operating System:   MS-DOS    | OS/2
  23114.  Flags: ENDUSER | SR# S901114-86
  23115.  Last Modified:  5-DEC-1990    ArticleIdent: Q67107
  23116.  
  23117.  When using far strings in the example below, BASIC Professional
  23118.  Development System (PDS) doesn't unFIELD a FIELDed variable when that
  23119.  variable is assigned to itself. The variable does get unFIELDed if the
  23120.  program is compiled with near strings or compiled in earlier versions
  23121.  of BASIC, or if the variable is assigned to a new value.
  23122.  
  23123.  This information applies to Microsoft BASIC PDS versions 7.00 and 7.10
  23124.  for MS-DOS and MS OS/2.
  23125.  
  23126.  This behavioral inconsistency emphasizes the point that you should
  23127.  never make your program depend on a variable being unFIELDed. You
  23128.  should set the contents of a FIELDed variable only with the LSET or
  23129.  RSET statement; never assign values to FIELDed variables with LET or
  23130.  direct assignment.
  23131.  
  23132.  If you want to use and reassign a variable without affecting the
  23133.  FIELDed buffer, copy the FIELDed variable to a permanent variable that
  23134.  is not used in a FIELD statement. Better yet, for easier programming,
  23135.  Microsoft recommends using user-defined TYPE variables instead of
  23136.  FIELD statements for defining random-access file records.
  23137.  
  23138.  Reference:
  23139.  
  23140.  The following is taken from the FIELD statement description on page
  23141.  131 of the "Microsoft BASIC 7.0: Language Reference" manual for
  23142.  versions 7.00 and 7.10:
  23143.  
  23144.     Do not use a variable name defined as a field in an INPUT or
  23145.     assignment statement if you want the variable to remain in a field.
  23146.     Once a variable name is a field, it points to the correct place in
  23147.     the random-access file buffer. If a subsequent INPUT or assignment
  23148.     statement with that variable name is executed, the variable's
  23149.     pointer no longer refers to the random-access record buffer, but to
  23150.     string space.
  23151.  
  23152.  The example below describes a specific exception to the last sentence,
  23153.  where the variable still points to the random-access record buffer and
  23154.  not to a new location in string space.
  23155.  
  23156.  Code Example
  23157.  ------------
  23158.  
  23159.  First, create a text file "data.dat" that contains the following
  23160.  data on one line:
  23161.  
  23162.     abcd defg hijk lmno pqrs tuvw xyz1 2345 6789
  23163.  
  23164.  Then run the following program in QBX.EXE, or as an .EXE compiled with
  23165.  BC /Fs (the far variable-length strings option):
  23166.  
  23167.  DEFSTR A-Z
  23168.  OPEN "data.dat" FOR RANDOM AS #1 LEN = 15
  23169.  FIELD #1, 5 AS a, 5 AS b, 5 AS c
  23170.  GET #1   ' Get first 15 bytes.
  23171.   PRINT a; b; c
  23172.  GET #1   ' Get next 15 bytes.
  23173.  a = a
  23174.   PRINT a; b; c
  23175.  GET #1   ' Get next 15 bytes.
  23176.   PRINT a; b; c
  23177.  CLOSE #1
  23178.  
  23179.  With far strings, the above example will give an output of the
  23180.  following:
  23181.  
  23182.     abcd defg hijk
  23183.     lmno pqrs tuvw
  23184.     xyz1 2345 6789
  23185.  
  23186.  The above output shows that the variable "a" was retained as a FIELDed
  23187.  variable. Adding a null string, for example < a = a + "" >, also does
  23188.  not cause the variable to be unFIELDed.
  23189.  
  23190.  However, if the line < a = a > is changed to < a = "test" >, then the
  23191.  variable "a" becomes unFIELDed, and the output will be as follows:
  23192.  
  23193.     abcd defg hijk
  23194.     test pqrs tuvw
  23195.     test 2345 6789
  23196.  
  23197.  The variable is only unFIELDed when it is changed.
  23198.  
  23199.  
  23200.  370. OS/2 "Path/File Access Error" Instead of "Permission Denied"
  23201.  
  23202.  Product Version(s): 6.00 6.00b 7.00 7.10
  23203.  Operating System:   OS/2
  23204.  Flags: ENDUSER | SR# S901024-38 buglist6.00 buglist6.00b buglist7.00 buglist7
  23205.  Last Modified:  5-DEC-1990    ArticleIdent: Q67206
  23206.  
  23207.  When attempting to open a file under multiple OS/2 processes or in an
  23208.  OS/2 networking environment, a BASIC program will incorrectly generate
  23209.  the error message "Path/File access error" (error code 75) when
  23210.  attempting to open a locked file. The error message it should generate
  23211.  is "Permission denied" (error code 70). This problem does not occur in
  23212.  a DOS networking environment, such as when accessing files on a server
  23213.  from a DOS LANMAN workstation. Under these conditions, the BASIC
  23214.  program generates the correct error message, "Permission denied."
  23215.  
  23216.  This problem occurs in Microsoft BASIC Compiler versions 6.00 and
  23217.  6.00b for MS OS/2, and in Microsoft BASIC PDS (Professional
  23218.  Development System) versions 7.00 and 7.10 for MS OS/2. Microsoft is
  23219.  researching this problem and will post new information here as it
  23220.  becomes available.
  23221.  
  23222.  The following test program demonstrates the problem. To reproduce the
  23223.  problem, compile and run the program in an OS/2 session. Then switch
  23224.  to a new session and run the same program again. The file should be
  23225.  locked for writes; the second program is supposed to terminate with a
  23226.  "Permission denied" error, but instead, displays "Path/file access
  23227.  error."
  23228.  
  23229.  Code Example
  23230.  ------------
  23231.  
  23232.  OPEN "TESTFILE" FOR APPEND LOCK WRITE AS #1
  23233.  PRINT #1, "Hello"
  23234.  WHILE INKEY <> "q": WEND
  23235.  
  23236.  
  23237.  371. "Bad Record Number" Using Network Printer in OS/2, LANMAN 2.00
  23238.  
  23239.  Product Version(s): 6.00 6.00b 7.00 7.10
  23240.  Operating System:   OS/2
  23241.  Flags: ENDUSER | buglist6.00 buglist6.00b buglist7.00 buglist7.10
  23242.  Last Modified:  5-DEC-1990    ArticleIdent: Q67313
  23243.  
  23244.  When the DOS device "LPT1" or "LPT2" is OPENed to print over a
  23245.  Microsoft LANMAN version 2.00 network printer under OS/2, the error
  23246.  "Bad record number in line <nn> in module <module name> at address
  23247.  xxxx:xxxx" will occur when the device is closed. This error does not
  23248.  occur when printing to a local printer or to a LANMAN 2.00 network
  23249.  printer under DOS.
  23250.  
  23251.  Microsoft has confirmed this problem in programs compiled in Microsoft
  23252.  BASIC Compiler versions 6.00 and 6.00b for MS OS/2 and in Microsoft
  23253.  BASIC PDS (Professional Development System) versions 7.00 and 7.10 for
  23254.  MS OS/2. Microsoft is researching this problem and will post new
  23255.  information here as it becomes available.
  23256.  
  23257.  The following code segment demonstrates the "Bad record number" error
  23258.  when compiled and run under OS/2 with logical device "LPT1:" connected
  23259.  to a Microsoft LANMAN 2.00 network.
  23260.  
  23261.  Note: The code example will compile and run without error when run
  23262.  under DOS or if the logical device LPT1: refers to a local printer.
  23263.  
  23264.     OPEN "LPT1" FOR OUTPUT AS #1
  23265.     PRINT "Hello world"
  23266.     CLOSE #1
  23267.  
  23268.  To work around the problem, open the BASIC logical device "LPTn:"
  23269.  instead of the DOS "LPTn" device. The following code example will
  23270.  compile and run without error when run under DOS or OS/2, and printing
  23271.  to a local or network printer device:
  23272.  
  23273.     OPEN "LPT1:" FOR OUTPUT AS #1
  23274.     PRINT "Hello world"
  23275.     CLOSE #1
  23276.  
  23277.  Note: There is a problem when the BASIC device "LPTn:" is opened
  23278.  across two CHAINed programs. For more information, please query on the
  23279.  following words:
  23280.  
  23281.     CHAIN and device and I/O and LPT1 and LPRINT
  23282.  
  23283.  
  23284.  372. BC.EXE "Out of Memory" with Numeric Array Elements and SWAP
  23285.  
  23286.  Product Version(s): 7.00 7.10 | 7.00 7.10
  23287.  Operating System:   MS-DOS    | OS/2
  23288.  Flags: ENDUSER | buglist7.00 buglist7.10
  23289.  Last Modified:  5-DEC-1990    ArticleIdent: Q67314
  23290.  
  23291.  Compiling the following code segment with the BC.EXE compiler gives a
  23292.  "BC : Out of memory" error. The problem will occur for any simple
  23293.  mathematical operation (addition, subtraction, multiplication, or
  23294.  division) performed on the two static-array elements appearing in the
  23295.  assignment statement below. The problem does not occur in the QBX.EXE
  23296.  environment.
  23297.  
  23298.     DIM d#(1), e#(1), b!(1), c&(1)
  23299.     n = 1
  23300.     a% = b!(n) + c&(n)
  23301.     SWAP d#(n), e#(n)
  23302.  
  23303.  Microsoft has confirmed this to be a problem in BC.EXE in Microsoft
  23304.  BASIC Profession Development System (PDS) versions 7.00 and 7.10 for
  23305.  MS-DOS and MS OS/2. We are researching this problem and will post new
  23306.  information here as it becomes available.
  23307.  
  23308.  You can work around the problem in any one of the following ways:
  23309.  
  23310.  1. Compile the program with the BC /D option to produce debug code.
  23311.  
  23312.  2. Use the CINT or CLNG function to convert the first array element in
  23313.     the mathematical expression to an integer type. The example above
  23314.     will compile without error if the assignment statement is changed
  23315.     as follows:
  23316.  
  23317.        a%= CINT(b!(n)) + c&(n)
  23318.  
  23319.  3. Save one of the variables being swapped to a temporary variable and
  23320.     use the temporary variable as an argument to the SWAP statement.
  23321.     The example above will compile without error if the SWAP statement
  23322.     is changed as follows:
  23323.  
  23324.        f# = d#(n)
  23325.        SWAP f#,e#(n)
  23326.  
  23327.  4. Use dynamic arrays (instead of static arrays) by adding
  23328.     REM $DYNAMIC to the top of the program.
  23329.  
  23330.  The problem occurs when all of the following conditions occur
  23331.  simultaneously (as shown in the first code example):
  23332.  
  23333.  1. An integer variable (INTEGER or LONG type) is assigned to the
  23334.     addition, multiplication, division, or subtraction of two numeric
  23335.     static-array elements.
  23336.  
  23337.  2. The first array element in the mathematical expression is of type
  23338.     SINGLE.
  23339.  
  23340.  3. The second array element in the mathematical expression is of type
  23341.     LONG.
  23342.  
  23343.  4. A SWAP of two array elements of any numeric type occurs after the
  23344.     assignment statement.
  23345.  
  23346.  5. The code is compiled using BC.EXE
  23347.  
  23348.  
  23349.  373. In QBX 7.10, F8 Step then Editing Active Statement Can Fail
  23350.  
  23351.  Product Version(s): 7.10
  23352.  Operating System:   MS-DOS
  23353.  Flags: ENDUSER | buglist7.10
  23354.  Last Modified:  5-DEC-1990    ArticleIdent: Q67363
  23355.  
  23356.  When you single step (F8) through a program in the QBX.EXE version
  23357.  7.10 environment, editing the active (highlighted) statement can give
  23358.  unexpected results under certain circumstances. For example, if you
  23359.  attempt to split the active line in two by pressing the ENTER key, the
  23360.  next line may duplicate the current line. Sometimes the first line
  23361.  splits correctly but the next line becomes an altered version of the
  23362.  first line. Note that pressing "ALT+BACKSPACE" will usually undo the
  23363.  editing problem.
  23364.  
  23365.  Microsoft has confirmed this to be a problem with the QuickBASIC
  23366.  extended environment (QBX.EXE) that comes with Microsoft BASIC
  23367.  Professional Development System (PDS) version 7.10 for MS-DOS. We are
  23368.  researching this problem and will post new information here as it
  23369.  becomes available.
  23370.  
  23371.  This problem can occur on any statement where a variable is first
  23372.  declared, including the following statements: COMMON SHARED, DIM
  23373.  SHARED, REDIM, FOR, WHILE, DO...LOOP, or IF. When creating the problem
  23374.  with FOR, WHILE, DO...LOOP, or IF statements, you must actually try
  23375.  and divide the BASIC reserved word (for example, put the cursor in the
  23376.  middle of WHILE and press ENTER).
  23377.  
  23378.  To reproduce the problem, perform the following steps:
  23379.  
  23380.  1. Add the line below to the beginning of an empty program window:
  23381.  
  23382.        COMMON SHARED A, B
  23383.  
  23384.  2. Make the line the current executing line by single stepping with
  23385.     the F8 key until that line is highlighted.
  23386.  
  23387.  3. Now put the cursor anywhere before the "B" (for example, put the
  23388.     cursor on the "A") and press ENTER.
  23389.  
  23390.  4. A dialog box will appear saying "You will have to restart your
  23391.     program after this edit. Proceed anyway?" Press ENTER.
  23392.  
  23393.  5. Your source code will now resemble the following:
  23394.  
  23395.        COMMON SHARED A
  23396.        COMMON SHARED A, B
  23397.  
  23398.  To reproduce the problem with an assignment statement, enter the
  23399.  single BASIC line of code "x = a + b + c" and follow the steps above.
  23400.  When the line is highlighted, place the cursor on the variable "a" and
  23401.  press ENTER. This will not duplicate the current line but will cause
  23402.  the "+" to be deleted between a and b.
  23403.  
  23404.  
  23405.  374. QBX.EXE "EMS Corrupt" Using Expanded Memory in Windows 3.00
  23406.  
  23407.  Product Version(s): 7.00 7.10
  23408.  Operating System:   MS-DOS
  23409.  Flags: ENDUSER |
  23410.  Last Modified:  9-JAN-1991    ArticleIdent: Q67364
  23411.  
  23412.  When trying to utilize expanded memory, QBX.EXE (from Microsoft BASIC
  23413.  PDS versions 7.00 and 7.10) will have problems running under Microsoft
  23414.  Windows version 3.00 enhanced mode if Windows 3.00 has not set the
  23415.  starting page-frame address for expanded memory. QBX.EXE will try to
  23416.  use expanded memory if it is available, unless the QBX /E:0 switch is
  23417.  used.
  23418.  
  23419.  For QBX.EXE to successfully use expanded memory, Windows needs to
  23420.  create a consecutive 64K page-frame area in the High Memory Area
  23421.  (HMA), C000 hex to EFFF hex. If this memory area is not available for
  23422.  use by QBX.EXE 7.00, QBX.EXE will give an "EMS corrupt" error message
  23423.  and return to the DOS window, or if run from an application icon, will
  23424.  return back to the Program Manager. QBX.EXE version 7.10 will fail to
  23425.  make use of expanded memory and will not give an error message.
  23426.  
  23427.  If QBX.EXE fails when trying to use expanded memory, the EMMExclude
  23428.  setting in the [386enh] section of your Windows SYSTEM.INI file may
  23429.  need to be changed. EMMExclude is needed to keep Windows from using
  23430.  the same memory as another device that Windows cannot detect, such as
  23431.  a network card, video card, or parts of BIOS for certain machines. To
  23432.  enable QBX.EXE to work correctly, use the EMMExclude setting for the
  23433.  minimum amount of memory, and try to move the address space used by
  23434.  network and video cards to consecutive addresses starting at C000 hex.
  23435.  Also, if there is an area of memory that you know is NOT in use, then
  23436.  the EMMInclude or EMMPageFrame setting can be used to tell Windows
  23437.  that this area is available for use.
  23438.  
  23439.  This information applies to Microsoft BASIC Professional Development
  23440.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  23441.  
  23442.  (For more information, see the application note "Memory Management
  23443.  Under Windows 3.00," which is available from the Windows Applications
  23444.  Support Group at Microsoft Product Support Services.)
  23445.  
  23446.  Windows 3.00 attempts to determine what other devices are using the
  23447.  address space C000 to EFFF hex before creating the page frame area.
  23448.  Sometimes Windows will not detect that another process is using a
  23449.  section of memory and will try to use that section of memory for
  23450.  itself. The following are symptoms that this may be happening:
  23451.  hanging; Windows immediately returning to the MS-DOS prompt after
  23452.  displaying the Windows logo; or video problems such as garbage on the
  23453.  screen or flashing colors. In this situation, the command EMMExclude
  23454.  is used to prevent Windows from conflicting with other devices.
  23455.  
  23456.  Also, in some situations Windows will sometimes mistakenly think that
  23457.  a section of memory is in use and will avoid creating the page frame
  23458.  area there. To make sure that Windows uses an area of memory, you can
  23459.  use the EMMInclude command. Also, the EMMPageFrame command can be used
  23460.  to specify the specific area for the expanded memory page frame.
  23461.  EMMPageFrame will only work if Windows thinks that area is available.
  23462.  
  23463.  The following memory map shows the common usage of each area of memory
  23464.  from A000 to EFFF hex:
  23465.  
  23466.  Address    Used By                  Common Usage
  23467.  -------    -------                  ------------
  23468.  
  23469.  A000-BFFF  Display adapter reserve  EGA and VGA use all, CGA and MDA
  23470.                                      use a portion.
  23471.  
  23472.  C000-DFFF  ROM expansion            Used for I/O channel BIOS.
  23473.  
  23474.                                      C000-C3FF: EGA BIOS.
  23475.                                      C000-DFFF: many VGA cards use the
  23476.                                      whole range.
  23477.                                      C600-C63F: PGA communications area.
  23478.                                      C800-CBFF: hard disk BIOS.
  23479.                                      D000-DFFF: unused.
  23480.                                      C800-DFFF: commonly used by
  23481.                                      network cards.
  23482.  
  23483.  E000-EFFF  Expansion of system      Used by many ATs and PS/2s but
  23484.             ROM                      not used by other computers.
  23485.  
  23486.  For example, if you have video card A, which requires address space
  23487.  C000 to C7FF hex, and network card B, which requires C800 to D7FF hex,
  23488.  use the following EMMExclude command:
  23489.  
  23490.     EMMExclude=C000-D7FF
  23491.  
  23492.  This should provide enough space for QBX.EXE to use expanded memory.
  23493.  
  23494.  If it is not possible to move the required HMA for the given
  23495.  applications to consecutive addresses, then you can give multiple
  23496.  EMMExclude commands. For example, if you have an IBM PS/2 that uses
  23497.  E000-EFFF hex for parts of its BIOS area that cannot be moved, and a
  23498.  network card that can use addresses C000 to CFFF or C7FF to D7FF, then
  23499.  you need to use the following EMMExclude commands:
  23500.  
  23501.     [386enh]
  23502.     EMMExclude= C000-CFFF
  23503.     EMMExclude= E000-EFFF
  23504.  
  23505.  The lower memory area for the network card should be chosen to limit
  23506.  memory fragmentation in the High Memory Area. If you know you are not
  23507.  using the area C800-DFFF and Windows still does not create a page
  23508.  swapping area, then use the EMMInclude command to force Windows to try
  23509.  and use that area of memory. The EMMInclude command overrides the
  23510.  EMMExclude command for the parts of memory that the two statements may
  23511.  have in common:
  23512.  
  23513.     [386enh]
  23514.     EMMInclude= C800-DFFF
  23515.     EMMExclude= C000-CFFF
  23516.     EMMExclude= E000-EFFF
  23517.  
  23518.  Instead of using the EMMInclude command, the EMMPageFrame command can
  23519.  be used to tell Windows exactly where to start the page frame area if
  23520.  Windows believes that the specified area is available for use:
  23521.  
  23522.     [386enh]
  23523.     EMMPageFrame=C800
  23524.     EMMExclude= C000-CFFF
  23525.     EMMExclude= E000-EFFF
  23526.  
  23527.  Making Windows create a page swapping area may not be possible with
  23528.  some machine configurations. If the above clues do not help create a
  23529.  page frame area, then the Windows Applications Unit of Microsoft
  23530.  Product Support Services may have more information about your
  23531.  particular machine configuration and may be able to help you further.
  23532.  
  23533.  Code Example
  23534.  ------------
  23535.  
  23536.  The following BASIC PDS program will tell you at what address, if any,
  23537.  a page frame has been set. By compiling as shown and running the
  23538.  program in the Windows DOS box, you can determine if and where Windows
  23539.  is creating the expanded memory page frame.
  23540.  
  23541.  To make a stand-alone executable program out of the following code
  23542.  sample, perform the following steps from the DOS prompt:
  23543.  
  23544.     BC emspage.bas /o;
  23545.     LINK emspage.obj,,,QBX.LIB;
  23546.  
  23547.  'This is the sample program emspage.bas
  23548.  REM $INCLUDE: 'QBX.BI'
  23549.  DIM inregs AS regtype
  23550.  DIM outregs AS regtype
  23551.  inregs.ax = &H4100
  23552.  CALL interrupt(&H67, inregs, outregs)
  23553.  IF (outregs.ax AND &HFF00) = 0 THEN
  23554.     PRINT "PAGE FRAME ADDRESS: "; HEX$(outregs.bx)
  23555.  ELSE
  23556.     PRINT "PAGE FRAME ADDRESS: NONE "
  23557.  END IF
  23558.  
  23559.  
  23560.  375. Recursive CALL in 7.0 .EXE Forgets Parent's Passed Near String
  23561.  
  23562.  Product Version(s): 7.00   | 7.00
  23563.  Operating System:   MS-DOS | OS/2
  23564.  Flags: ENDUSER | SR# S901116-127 buglist7.00 fixlist7.10
  23565.  Last Modified:  5-DEC-1990    ArticleIdent: Q67372
  23566.  
  23567.  When the first layer (first call) of a recursive procedure passes a
  23568.  near string to the next layer of recursion, the value of the initial
  23569.  string passed by the parent recursive layer is forgotten within the
  23570.  parent SUB after returning from subsequent recursive layers of the
  23571.  routine. This problem does not occur if you compile with far strings
  23572.  (BC /Fs).
  23573.  
  23574.  This problem applies to Microsoft BASIC Professional Development
  23575.  System (PDS) version 7.00 for MS-DOS and MS OS/2. This problem has
  23576.  been corrected in BASIC PDS version 7.10.
  23577.  
  23578.  The code below demonstrates the problem when passing a near string in
  23579.  a recursive subprogram CALL. You can work around the problem by
  23580.  compiling with far strings.
  23581.  
  23582.  CLS
  23583.  CALL RecCall("A")
  23584.  END
  23585.  
  23586.  SUB RecCall (Text AS STRING)
  23587.     PRINT Text; "<"
  23588.     IF Text <> "B" THEN
  23589.        CALL RecCall (CHR$(ASC(Text) + 1))
  23590.        'Could use CALL ReCall("B") with same problem
  23591.     END IF
  23592.     PRINT Text; "<"
  23593.  END SUB
  23594.  
  23595.     Compiled with   Interpreted in QBX.EXE
  23596.     Near String     or Compiled with Far
  23597.     (Problem)       String Option (No Problem)
  23598.     -------------   --------------------------
  23599.        >A               >A
  23600.        >B               >B
  23601.        >B               >B
  23602.        >                >A
  23603.  
  23604.  
  23605.  376. CIRCLE(x,y),rad,,-0.1,0 Draws Only the Radius in BASIC
  23606.  
  23607.  Product Version(s): 6.00 6.00b 7.00 7.10
  23608.  Operating System:   MS-DOS
  23609.  Flags: ENDUSER | B_MQuickB B_QuickBas
  23610.  Last Modified: 17-JAN-1991    ArticleIdent: Q67374
  23611.  
  23612.  This article describes a problem with the CIRCLE statement. The CIRCLE
  23613.  command takes the following parameters:
  23614.  
  23615.     CIRCLE[STEP](x,y),radius!,,start!,stop!
  23616.  
  23617.  If you specify start! and stop!, with start! slightly larger than
  23618.  stop!, then the CIRCLE command should draw an almost complete circle.
  23619.  However, if the difference between start! and stop! is very small,
  23620.  CIRCLE may draw only a point or radius, instead of an almost complete
  23621.  circle. This problem happens in both the interpreter environment and
  23622.  in compiled programs.
  23623.  
  23624.  Microsoft has confirmed this to be a problem in Microsoft QuickBASIC
  23625.  version 1.00 (buglist1.00) for Apple Macintosh systems; in Microsoft
  23626.  QuickBASIC versions 4.00, 4.00b, and 4.50 (buglist4.00, buglist4.00b,
  23627.  buglist4.50) for MS-DOS; in Microsoft BASIC Compiler versions 6.00 and
  23628.  6.00b (buglist6.00, buglist6.00b) for MS-DOS and MS OS/2; and in
  23629.  Microsoft BASIC Professional System (PDS) versions 7.00 and 7.10
  23630.  (buglist7.00, buglist7.10) for MS-DOS and OS/2. We are researching
  23631.  this problem and will post new information here as it becomes
  23632.  available.
  23633.  
  23634.  Changing the size of radius changes the requirement for the distance
  23635.  between start! and stop! necessary to reproduce the problem. When
  23636.  start! is near zero, leaving off the stop! will produce different
  23637.  results than if stop! is specified. Use the following code examples
  23638.  to reproduce the problems described above.
  23639.  
  23640.  Code Examples
  23641.  -------------
  23642.  
  23643.  ' When start! or stop! is negative, CIRCLE draws a radius and
  23644.  ' treats the angle as positive. Without the negative sign, no
  23645.  ' radius is drawn.
  23646.  '
  23647.  SCREEN 12  'Problem occurs in any graphics screen mode.
  23648.  10 CIRCLE (50, 50), 50, , -.01         'Works correctly.
  23649.  20 CIRCLE (50, 150), 50, , -.01, 0     'Should be same as line
  23650.                                         '10 but draws only the radius.
  23651.  30 CIRCLE (50, 250), 50, , -.011, 0    'Slightly larger difference
  23652.                                         'from start & stop works.
  23653.  40 CIRCLE (420, 240), 200, , -.01, 0   'This works with same end/start
  23654.                                         'as line 20 but has larger
  23655.                                         'radius
  23656.  
  23657.  On the Apple Macintosh, use the following code:
  23658.  
  23659.  CIRCLE (50, 50) 10, ,-0.001, 0
  23660.  
  23661.  
  23662.  377. OPEN "SCRN:" or "CONS:" Wrong Output in QBX.EXE When Step (F8)
  23663.  
  23664.  Product Version(s): 7.00 7.10
  23665.  Operating System:   MS-DOS
  23666.  Flags: ENDUSER | SR# S901109-37 buglist7.00 buglist7.10
  23667.  Last Modified:  5-DEC-1990    ArticleIdent: Q67378
  23668.  
  23669.  When you single step (F8) through a program that redirects screen
  23670.  output to either of the DOS standard devices "SCRN:" or "CONS:", the
  23671.  output will incorrectly flash momentarily on the QBX.EXE programming
  23672.  environment, instead of going to the output window.
  23673.  
  23674.  This problem occurs in the editing environment (QBX.EXE) of Microsoft
  23675.  BASIC Professional Development System (PDS) versions 7.00 and 7.10.
  23676.  This problem does not occur in the Microsoft QuickBASIC environment
  23677.  (QB.EXE) shipped with QuickBASIC version 4.00, 4.00b, and 4.50.
  23678.  Microsoft is researching this problem and will post new information
  23679.  here as it becomes available.
  23680.  
  23681.  The following short program demonstrates the problem:
  23682.  
  23683.  OPEN "SCRN:" FOR OUTPUT AS #1   ' "CONS:" also shows problem.
  23684.  FOR i = 1 TO 10
  23685.          PRINT #1, i
  23686.  NEXT i
  23687.  
  23688.  Single step through this program in the QBX.EXE 7.00 or 7.10
  23689.  environment by repeatedly pressing the F8 key. The output will
  23690.  momentarily flash on the environment screen; no text will be displayed
  23691.  on the output screen. Note that just running the program (F5) will
  23692.  correctly print to the output screen.
  23693.  
  23694.  
  23695.  378. "BASIC 7.0: Programmer's Guide" Correction for ISAMCVT.EXE
  23696.  
  23697.  Product Version(s): 7.00 7.10
  23698.  Operating System:   MS-DOS
  23699.  Flags: ENDUSER | docerr SR# S900918-59
  23700.  Last Modified:  5-DEC-1990    ArticleIdent: Q67449
  23701.  
  23702.  The ISAMCVT utility shipped with Microsoft BASIC PDS (Professional
  23703.  Development System) versions 7.00 and 7.10 requires a "specfile" when
  23704.  converting MS/ISAM files (created by IBM BASIC Compiler version 2.00)
  23705.  that have been rebuilt without a data dictionary. Page 391 of the
  23706.  "Microsoft BASIC 7.0: Programmer's Guide" for versions 7.00 and 7.10
  23707.  omits the "specfile" field in its example of the ISAMCVT.EXE
  23708.  command-line syntax, when in fact, the "specfile" may be necessary if
  23709.  no data dictionary is present in the MS/ISAM file.
  23710.  
  23711.  Page 392 of the same manual incorrectly states that the "specfile" is
  23712.  required for converting MS/ISAM files; it should say that the
  23713.  "specfile" is required only when no data dictionary is present in the
  23714.  file. MS/ISAM database files usually contain a data dictionary, and
  23715.  only if a database is rebuilt without a data dictionary is "specfile"
  23716.  required. Therefore, the command-line syntaxes on page 391 should be
  23717.  changed as follows:
  23718.  
  23719.  For db/LIB
  23720.  ----------
  23721.  
  23722.     ISAMCVT /D filename tablename databasename
  23723.  
  23724.  For MS/ISAM
  23725.  -----------
  23726.  
  23727.     ISAMCVT /M filename tablename databasename [specfile]
  23728.  
  23729.  For Btrieve
  23730.  -----------
  23731.  
  23732.     ISAMCVT /B filename tablename databasename specfile
  23733.  
  23734.  
  23735.  379. Use hmamin Not tsrmin on Page 86 "BASIC 7.1: Getting Started"
  23736.  
  23737.  Product Version(s): 7.10
  23738.  Operating System:   MS-DOS
  23739.  Flags: ENDUSER | SR# S901031-88 docerr
  23740.  Last Modified: 12-DEC-1990    ArticleIdent: Q67589
  23741.  
  23742.  On page 86 of the "Microsoft BASIC 7.1: Getting Started" manual, the
  23743.  first sentence of the second paragraph under the "Extended Memory"
  23744.  section has a typographical error. The word "tsrmin" should be changed
  23745.  to read "hmamin".
  23746.  
  23747.  The corrected sentence should read as follows:
  23748.  
  23749.     When using the HIMEM.SYS device driver, you should set hmamin to 63
  23750.     (64512 bytes) to ensure that QBX has access to the high-memory
  23751.     area.
  23752.  
  23753.  This information applies to Microsoft Professional Development System
  23754.  (PDS) version 7.10 for MS-DOS.
  23755.  
  23756.  
  23757.  380. UI Toolbox: "Subscript Out of Range" or Hang on WindowDo Call
  23758.  
  23759.  Product Version(s): 7.00 7.10
  23760.  Operating System:   MS-DOS
  23761.  Flags: ENDUSER | buglist7.00 buglist7.10
  23762.  Last Modified: 14-DEC-1990    ArticleIdent: Q67697
  23763.  
  23764.  If more than 20 buttons and edit fields are opened simultaneously
  23765.  within a single window, a "Subscript out of range" error will occur on
  23766.  a call to the SUB procedure WindowDo at run time. In some instances, a
  23767.  call to WindowDo may lead to a "String space corrupt" error message or
  23768.  cause the computer to hang.
  23769.  
  23770.  Microsoft has confirmed this to be a problem with the User Interface
  23771.  (UI) Toolbox provided with Microsoft BASIC Professional Development
  23772.  System (PDS) versions 7.00 and 7.10. The correction for this problem
  23773.  is provided further below.
  23774.  
  23775.  This information applies to BASIC PDS versions 7.00 and 7.10 for
  23776.  MS-DOS.
  23777.  
  23778.  To avoid the problem, change the default value of the constant
  23779.  MAXHOTSPOT, which appears in the file, GENERAL.BI. Two other constants
  23780.  MAXBUTTON and MAXEDITFIELD, which appear in GENERAL.BI, set the
  23781.  maximum number of buttons and edit fields allowed. The value of
  23782.  MAXHOTSPOT should be changed from its current setting of 20 to the sum
  23783.  of these two constants. The default setting for MAXBUTTON is 50, and
  23784.  the default setting for MAXEDITFIELD is 20. MAXHOTSPOT should be
  23785.  changed to 70.
  23786.  
  23787.  If a call to the SUB program WindowDo leads to a computer hang or a
  23788.  "String space corrupt" error message, Microsoft suggests changing the
  23789.  constants as described in the above paragraph and rebuilding the UI
  23790.  Toolbox default libraries, UITBEFR.LIB and UITBEFR.QLB. A computer
  23791.  hang or "String space corrupt" error message usually occurs when the
  23792.  default libraries have been modified and the modules that make up the
  23793.  UI Toolbox have not been compiled with the /D option. The /D option
  23794.  enforces array bounds checking on arrays. Using the /D compile option
  23795.  will help to avoid a computer hang or a "String space corrupt" error
  23796.  message at run time.
  23797.  
  23798.  The following assumes that you are using the default LINK library
  23799.  UITBEFR.LIB and the Quick library UITBEFR.QLB built during set up of
  23800.  BASIC PDS.
  23801.  
  23802.  Once the modifications to GENERAL.BI have been made, update the
  23803.  library UITBEFR.LIB and re-create the default Quick library
  23804.  UITBEFR.QLB. Below are the steps necessary to update the .LIB file and
  23805.  re-create the .QLB file.
  23806.  
  23807.  Because the files GENERAL.BAS, MENU.BAS, MOUSE.BAS, and WINDOW.BAS all
  23808.  require GENERAL.BI, they must be recompiled from DOS as follows:
  23809.  
  23810.          BC GENERAL.BAS /FS/X/D;
  23811.          BC MENU.BAS /FS/X/D;
  23812.          BC MOUSE.BAS /FS/X/D;
  23813.          BC WINDOW.BAS /FS/X/D;
  23814.  
  23815.  Enter the following command line from DOS to modify the library,
  23816.  UITBEFR.LIB:
  23817.  
  23818.          LIB UITBEFR.LIB-+GENERAL.OBJ-+MENU.OBJ-+MOUSE.OBJ-+WINDOW.OBJ
  23819.  
  23820.  Enter the following from DOS to re-create the Quick library,
  23821.  UITBEFR.QLB:
  23822.  
  23823.          LINK /Q UITBEFR.LIB,,,QBXQLB.LIB;
  23824.  
  23825.  
  23826.  381. VAL() Fails When BASIC 7.10 NOFLTIN.OBJ Stub File Is Linked
  23827.  
  23828.  Product Version(s): 7.10   | 7.10
  23829.  Operating System:   MS-DOS | OS/2
  23830.  Flags: ENDUSER | buglist7.10
  23831.  Last Modified:  2-JAN-1991    ArticleIdent: Q67886
  23832.  
  23833.  Any argument passed to the VAL() function makes VAL() return zero or
  23834.  incorrect results in a program linked with the NOFLTIN.OBJ file from
  23835.  BASIC PDS version 7.10.
  23836.  
  23837.  Microsoft has confirmed this to be a problem with Microsoft BASIC
  23838.  Professional System (PDS) version 7.10 for MS-DOS and MS OS/2. We are
  23839.  researching this problem and will post new information here as it
  23840.  becomes available. (This problem does not occur in BASIC PDS 7.00.)
  23841.  
  23842.  The code example below prints an incorrect result for VAL() at run
  23843.  time when linked with the BASIC 7.10 stub file NOFLTIN.OBJ.
  23844.  
  23845.  ' File name: STUB.BAS
  23846.  d$ = "5"
  23847.  PRINT VAL(D$)   ' Is supposed to print "5".
  23848.  
  23849.  Compile and link with the following command lines:
  23850.  
  23851.     BC STUB.BAS /O;
  23852.     LINK /NOE STUB.OBJ+NOFLTIN.OBJ;
  23853.  
  23854.  
  23855.  382. "Illegal Function Call," Negative Number to Fractional Power
  23856.  
  23857.  Product Version(s): 1.00a 1.00b | 6.00 6.00b 7.00 7.10
  23858.  Operating System:   MACINTOSH   | MS-DOS
  23859.  Flags: ENDUSER | B_QuickBas B_GWBasicI
  23860.  Last Modified:  2-JAN-1991    ArticleIdent: Q67887
  23861.  
  23862.  Raising a negative number to a fractional power gives an "Illegal
  23863.  function call" in BASIC because the result will be a complex number,
  23864.  which is not supported in BASIC. (A complex number is of the form
  23865.  x+y*i where x is the real component and y is the imaginary component;
  23866.  i is the square root of -1.)
  23867.  
  23868.  Note: -5^(-Y) is not the same as X^(-Y) when X = -5 because -5^(-Y) is
  23869.  actually parsed as -(5^(-Y)). In other words, the exponentiation
  23870.  operator (^) has greater precedence than the subtraction (-) operator.
  23871.  
  23872.  This information applies to most versions of Microsoft BASIC,
  23873.  including the following:
  23874.  
  23875.  1. Microsoft QuickBASIC version 1.00 for the Apple Macintosh.
  23876.  2. Microsoft BASIC Compiler version 1.00 for the Apple Macintosh.
  23877.  3. Microsoft BASIC Interpreter versions 1.00, 1.01, 2.00, 2.10, and
  23878.     3.00 for the Apple Macintosh.
  23879.  4. Microsoft QuickBASIC versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00,
  23880.     4.00, 4.00b, 4.50 for MS-DOS.
  23881.  5. Microsoft BASIC Compiler versions 5.35 and 5.36 for MS-DOS.
  23882.  6. Microsoft BASIC Compiler versions 6.00 and 6.00b for MS OS/2 and
  23883.     MS-DOS.
  23884.  7. Microsoft BASIC Professional Development System (PDS) versions 7.00
  23885.     and 7.10 for MS-DOS and MS OS/2.
  23886.  8. Microsoft GW-BASIC Interpreter versions 3.20, 3.22, 3.23 for
  23887.     MS-DOS.
  23888.  
  23889.  The first PRINT statement below gives "Illegal function call." Many
  23890.  programmers will try debugging this code by substituting an actual
  23891.  constant for X, and the PRINT will seem to give the correct result.
  23892.  However, upon close examination of the precedence of operators, it
  23893.  will be apparent that the exponential symbol takes precedence over the
  23894.  minus sign. The expression 5^(-1/6) is parsed first and then the
  23895.  negation of this expression is performed. The third PRINT demonstrates
  23896.  what is actually happening in the first PRINT statement:
  23897.  
  23898.  X = -5
  23899.  PRINT X ^ (-1 / 6)       ' generates "Illegal function call"
  23900.  PRINT -5 ^ (-1 / 6)      ' same as PRINT -(5 ^ (-1 / 6)); no error
  23901.  PRINT (-5) ^ (-1 / 6)    ' generates "Illegal function call"
  23902.  
  23903.  To avoid the "Illegal function call" message, raise the absolute value
  23904.  (ABS) of X to the fractional power. If you do this when X is a
  23905.  negative number, please remember that you must multiply by i (the
  23906.  square root of -1) to get the true mathematical result. Because the
  23907.  square root of -1 cannot be represented in BASIC, you must keep track
  23908.  of imaginary number results yourself using a flag variable or warning
  23909.  message, for example:
  23910.  
  23911.     X=-5
  23912.     PRINT ABS(X) ^ (-1 / 6)
  23913.     IF SGN(X) < 0 THEN
  23914.        PRINT "Warning: the resulting root is an imaginary number. This"
  23915.        PRINT "root should be multiplied by i, the square root of -1."
  23916.     END IF
  23917.  
  23918.  
  23919.  383. LOCK May Fail to Properly Return Error After CHAIN Under OS/2
  23920.  
  23921.  Product Version(s): 7.00 7.10
  23922.  Operating System:   OS/2
  23923.  Flags: ENDUSER | SR# S901205-16 buglist7.00 buglist7.10
  23924.  Last Modified:  9-JAN-1991    ArticleIdent: Q68021
  23925.  
  23926.  Under MS OS/2, the following program demonstrates how a LOCK statement
  23927.  can fail to properly give a "Permission Denied" error for a locked
  23928.  record in a file kept open across a CHAIN. This problem does not occur
  23929.  under MS-DOS.
  23930.  
  23931.  Microsoft has confirmed this to be a problem with Microsoft BASIC
  23932.  Professional Development System (PDS) versions 7.00 and 7.10 for MS
  23933.  OS/2. We are researching this problem and will post new information
  23934.  here as it becomes available.
  23935.  
  23936.  Code Samples
  23937.  ------------
  23938.  
  23939.  TEST01.BAS
  23940.  ----------
  23941.  
  23942.  10 ON ERROR GOTO 70
  23943.  20 OPEN "pippo" FOR RANDOM ACCESS READ WRITE SHARED AS #1 LEN=128
  23944.  30 LOCK 1, 1
  23945.  40 CHAIN "TEST02"
  23946.  70 PRINT ERR; ERL
  23947.  80 END
  23948.  
  23949.  TEST02.BAS
  23950.  ----------
  23951.  
  23952.  10 ON ERROR GOTO 70
  23953.  20 LOCK 1, 1
  23954.  30 END
  23955.  70 PRINT ERR; ERL
  23956.  80 END
  23957.  
  23958.  Compile and link the above programs as follows:
  23959.  
  23960.    BC /X/LP test01;
  23961.    LINK test01;
  23962.    BC /X/LP test02;
  23963.    LINK test02;
  23964.  
  23965.  Under MS-DOS, the second (CHAINed) program correctly returns a
  23966.  "Permission Denied" error (error code 70) for the LOCK statement;
  23967.  however, under OS/2, this program fails to give an error.
  23968.  
  23969.  
  23970.  384. BC "Internal Error" with Array of TYPE Using Array of STRING*1
  23971.  
  23972.  Product Version(s): 7.00 7.10 | 7.00 7.10
  23973.  Operating System:   MS-DOS    | OS/2
  23974.  Flags: ENDUSER | SR# S901222-1 buglist7.00 buglist7.10
  23975.  Last Modified:  9-JAN-1991    ArticleIdent: Q68023
  23976.  
  23977.  The following code example demonstrates a problem using an array of
  23978.  user-defined TYPE variables that contain an array of fixed-length
  23979.  strings of length one. The BC.EXE compiler incorrectly gives the
  23980.  message "BC : Internal Error near XXXX" when compiling this example.
  23981.  The QBX.EXE environment compiles the same example without error.
  23982.  
  23983.  This problem applies to Microsoft BASIC Professional Development
  23984.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2. We are
  23985.  researching this problem and will post new information here as it
  23986.  becomes available.
  23987.  
  23988.  Code Sample
  23989.  -----------
  23990.  
  23991.  '$DYNAMIC
  23992.  TYPE rectype
  23993.    a(10) AS STRING * 1
  23994.  END TYPE
  23995.  DIM b(10) AS rectype
  23996.  byte% = 0
  23997.  10 b(1).a(byte%) = "a"
  23998.  
  23999.  Save the file as TEST.BAS and then attempt to compile with BC.EXE
  24000.  using the following command line:
  24001.  
  24002.     BC TEST;
  24003.  
  24004.  The compiler will issue the "Internal Error" message.
  24005.  
  24006.  The error occurs only if ALL the following conditions are met:
  24007.  
  24008.  1. The array b() is dynamic.
  24009.  
  24010.  2. The second array element in line 10 is referenced with a
  24011.     variable.
  24012.  
  24013.  3. The fixed-length string in the TYPE is of length one (STRING * 1).
  24014.  
  24015.  4. The program is compiled without run-time error checking (without
  24016.     the BC /D option).
  24017.  
  24018.  To work around this problem, just counteract any one of the above
  24019.  conditions, using one of the following four suggested workarounds:
  24020.  
  24021.  1. Make the array b() static. For example, if you add the '$STATIC
  24022.     metacommand before the DIM as follows, the program will compile
  24023.     correctly:
  24024.  
  24025.        '$STATIC
  24026.        DIM b(10) AS rectype
  24027.        '$DYNAMIC
  24028.  
  24029.  2. Reference the second element in line 10 with a constant instead of
  24030.     a variable.
  24031.  
  24032.  3. Use STRING * 2 or a longer length.
  24033.  
  24034.  4. Compile with the BC /D option.
  24035.  
  24036.  
  24037.  385. BC.EXE "AS Missing" in TYPE Using Space Between Array and ()
  24038.  
  24039.  Product Version(s): 7.00 7.10 | 7.00 7.10
  24040.  Operating System:   MS-DOS    | OS/2
  24041.  Flags: ENDUSER | SR# S901121-21 buglist7.00 buglist7.10
  24042.  Last Modified:  9-JAN-1991    ArticleIdent: Q68024
  24043.  
  24044.  The BC.EXE compiler gives the error "AS Missing" on an array in a TYPE
  24045.  statement if you mistakenly leave a space between the last letter in
  24046.  the array name and the left parenthesis. (This misleading error
  24047.  message will occur only if you create the program in an editor other
  24048.  than QBX.EXE. The problem doesn't occur when you save the program in
  24049.  QBX.EXE because QBX.EXE automatically removes the offending space
  24050.  character.)
  24051.  
  24052.  Microsoft has confirmed this to be a problem with the Microsoft BASIC
  24053.  Professional Development System versions 7.00 and 7.10 for MS-DOS and
  24054.  MS OS/2. We are researching this problem and will new information here
  24055.  as it becomes available.
  24056.  
  24057.  Workaround
  24058.  ----------
  24059.  
  24060.  To work around the problem in any editor other than QBX.EXE, remove
  24061.  the offending space character.
  24062.  
  24063.  To reproduce this problem, enter the following code example into any
  24064.  text editor other than QBX.EXE. (Note that if you load this program
  24065.  into the QBX.EXE environment, the space between the array name and the
  24066.  "(" character will automatically be removed.)
  24067.  
  24068.  TYPE t1
  24069.    s (1 TO 45) AS SINGLE
  24070.  END TYPE
  24071.  
  24072.  The BC.EXE compiler produces the following output when compiling this
  24073.  code:
  24074.  
  24075.  Microsoft (R) BASIC Compiler Version 7.10
  24076.  Copyright (C) Microsoft Corporation 1982-1990. All rights reserved.
  24077.   0030   0006       s (1 TO 45)  AS SINGLE
  24078.                       ^ AS missing
  24079.                       ^ Skipping forward to END TYPE statement
  24080.  
  24081.  45962 Bytes Available
  24082.  45853 Bytes Free
  24083.  
  24084.      0 Warning Error(s)
  24085.      2 Severe  Error(s)
  24086.  
  24087.  
  24088.  386. "Feature Removed" Using WIDTH "LPT1:",wdth% and BC /Fs in 7.00
  24089.  
  24090.  Product Version(s): 7.00   | 7.00
  24091.  Operating System:   MS-DOS | OS/2
  24092.  Flags: ENDUSER | SR# S901220-9 buglist7.00 fixlist7.10
  24093.  Last Modified:  9-JAN-1991    ArticleIdent: Q68025
  24094.  
  24095.  Compiled with the far strings (BC /Fs) option, the following statement
  24096.  incorrectly gives the error message "Feature removed":
  24097.  
  24098.     WIDTH "LPT1:",137
  24099.  
  24100.  This statement works correctly within the QBX.EXE environment.
  24101.  
  24102.  Microsoft has confirmed this to be a problem in BASIC Professional
  24103.  System (PDS) versions 7.00 for MS-DOS. This problem was corrected in
  24104.  BASIC PDS version 7.10.
  24105.  
  24106.  Enter the following program and name it SAMPLE.BAS:
  24107.  
  24108.     wdth% = 137
  24109.     WIDTH "LPT1:",wdth%
  24110.  
  24111.  Compile the program with the following options:
  24112.  
  24113.     BC SAMPLE.BAS /D/O/Fs/Lr/FPi/T/C:512;
  24114.     LINK SAMPLE.OBJ;
  24115.  
  24116.  Now, run SAMPLE.EXE to demonstrate the error message "Feature removed
  24117.  in line No line number in module <name>".
  24118.  
  24119.  To work around the problem, compile without the far strings option
  24120.  (without /Fs), or upgrade to version 7.10, or change the program to
  24121.  read as follows:
  24122.  
  24123.     WIDTH LPRINT wdth%
  24124.  
  24125.  
  24126.  387. QBX.EXE, PWB.EXE Help Files "Not Found," Conflict Under OS/2
  24127.  
  24128.  Product Version(s): 7.10
  24129.  Operating System:   OS/2
  24130.  Flags: ENDUSER | SR# S901116-141 S_PWB
  24131.  Last Modified:  9-JAN-1991    ArticleIdent: Q68027
  24132.  
  24133.  If you are running under OS/2 and you have QuickBASIC Extended
  24134.  (QBX.EXE from Microsoft BASIC Professional Development System) version
  24135.  7.10 running in the DOS box, as well as Programmer's WorkBench
  24136.  (PWB.EXE) in an OS/2 window, you may be unable to access BASIC help
  24137.  files from QBX.EXE.
  24138.  
  24139.  The error message
  24140.  
  24141.     File <HelpFile>.HLP not found -
  24142.     Correct your help path in options + set paths
  24143.  
  24144.  will appear in QBX.EXE when you attempt to use the online help if
  24145.  PWB.EXE is already using the same help files. Ending the PWB session
  24146.  will allow QBX.EXE to use the BASIC help files.
  24147.  
  24148.  Note: PWB does not need to have open the same help screen as QBX.EXE
  24149.  for this error to occur.
  24150.  
  24151.  Microsoft has confirmed this to be a problem in BASIC Professional
  24152.  Development System (PDS) version 7.10 for MS OS/2. A workaround is
  24153.  given below.
  24154.  
  24155.  If you have PWB configured to use the BASIC help files, then while
  24156.  running it in protected mode, the BASIC help files cannot be accessed
  24157.  from QBX.EXE. It does not matter in what order you start the programs;
  24158.  PWB.EXE can access the help files, and QBX.EXE cannot.
  24159.  
  24160.  The following error message is misleading:
  24161.  
  24162.     File <HelpFile>.HLP not found - ...
  24163.  
  24164.  In the test performed, the help file existed, the HELPFILES
  24165.  environment variable was set correctly, and the help files path under
  24166.  the Options menu within QBX.EXE was set correctly.
  24167.  
  24168.  Workaround
  24169.  ----------
  24170.  
  24171.  Make two copies of the help files on your hard drive and set the help
  24172.  files path in PWB.EXE and QBX.EXE, each to a different set of help
  24173.  files. Make sure that the help files are not in the same directory as
  24174.  either PWB.EXE or QBX.EXE. In this situation, the two programs will
  24175.  not conflict with one another.
  24176.  
  24177.  
  24178.  388. 7.10 "Subscript Out of Range," WindowDo with No Open Windows
  24179.  
  24180.  Product Version(s): 7.00 7.10
  24181.  Operating System:   MS-DOS
  24182.  Flags: ENDUSER | SR# S901228-57
  24183.  Last Modified: 17-JAN-1991    ArticleIdent: Q68123
  24184.  
  24185.  If a WindowDo statement is executed before any windows are opened, a
  24186.  "Subscript out of range" error will occur. This article explains why
  24187.  the error happens and gives two ways of correcting the error.
  24188.  
  24189.  This information applies to the User Interface (UI) ToolBox provided
  24190.  with Microsoft BASIC Professional Development System (PDS) versions
  24191.  7.00 and 7.10 for MS-DOS.
  24192.  
  24193.  The problem is caused by WindowInit incorrectly initializing the
  24194.  variable GloStorage.currMenu to -1 instead of 0 (zero). WindowDo
  24195.  checks to see if currMenu is 0 (zero) to determine if there are no
  24196.  open windows, and WindowDo generates the error when it tries to access
  24197.  window number -1.
  24198.  
  24199.  To work around this problem, do one of the following:
  24200.  
  24201.  1. Open a window and then immediately close it. This will set currMenu
  24202.     back to 0 (zero). For example:
  24203.  
  24204.        WindowInit
  24205.        WindowOpen 1,6,5,12,25,0,7,0,7,15,FALSE,FALSE,FALSE,FALSE,0,""
  24206.        WindowClose 1
  24207.        WindowDo 0,0
  24208.  
  24209.  2. To correct the problem permanently, modify WINDOW.BAS:
  24210.  
  24211.     a. Load the WINDOW.BAS module into QBX.EXE.
  24212.  
  24213.     b. Push F2 to view the subprograms and then move to WindowInit.
  24214.  
  24215.     c. Locate the line that reads "GloStorage.currMenu = -1", and change
  24216.        it to "GloStorage.currMenu = 0".
  24217.  
  24218.     d. Save the new copy of WINDOW.BAS. Then follow the instructions at
  24219.        the beginning of GENERAL.BAS to create a new LINK library (.LIB)
  24220.        and Quick library (.QLB).
  24221.  
  24222.  Code Sample
  24223.  -----------
  24224.  
  24225.  When the following program is run in the QBX.EXE environment, it will
  24226.  generate a "Subscript out of range in Quick library module: WINDOW"
  24227.  error.
  24228.  
  24229.  ' QBX must be started with "QBX /L UITBEFR" to load the UI ToolBox
  24230.  ' Quick library
  24231.  
  24232.  '$INCLUDE: 'general.bi'
  24233.  '$INCLUDE: 'mouse.bi'
  24234.  '$INCLUDE: 'menu.bi'
  24235.  '$INCLUDE: 'window.bi'
  24236.  COMMON SHARED /uitools/ GloMenu           AS MenuMiscType
  24237.  COMMON SHARED /uitools/ GloTitle()        AS MenuTitleType
  24238.  COMMON SHARED /uitools/ GloItem()         AS MenuItemType
  24239.  COMMON SHARED /uitools/ GloWindow()       AS windowType
  24240.  COMMON SHARED /uitools/ GloButton()       AS buttonType
  24241.  COMMON SHARED /uitools/ GloEdit()         AS EditFieldType
  24242.  COMMON SHARED /uitools/ GloStorage        AS WindowStorageType
  24243.  COMMON SHARED /uitools/ GloWindowStack()  AS INTEGER
  24244.  COMMON SHARED /uitools/ GloBuffer$()
  24245.  DIM GloTitle(MAXMENU)           AS MenuTitleType
  24246.  DIM GloItem(MAXMENU, MAXITEM)   AS MenuItemType
  24247.  DIM GloWindow(MAXWINDOW)        AS windowType
  24248.  DIM GloButton(MAXBUTTON)        AS buttonType
  24249.  DIM GloEdit(MAXEDITFIELD)       AS EditFieldType
  24250.  DIM GloWindowStack(MAXWINDOW)   AS INTEGER
  24251.  DIM GloBuffer$(MAXWINDOW + 1, 2)
  24252.  WindowInit
  24253.  WindowDo 0,0
  24254.  END
  24255.  
  24256.  
  24257.  389. BASIC 7.10 LINK "L4051 Cannot Find Library" If Using 7.00 .LIB
  24258.  
  24259.  Product Version(s): 7.10   | 7.10
  24260.  Operating System:   MS-DOS | OS/2
  24261.  Flags: ENDUSER | SR# S901113-69 LINK.EXE 4051
  24262.  Last Modified: 15-JAN-1991    ArticleIdent: Q68158
  24263.  
  24264.  If you get the linker warning message "L4051 : BCL70xxx.LIB : cannot
  24265.  find library" while linking a program in BASIC PDS version 7.10, the
  24266.  problem may be that you are linking to a .LIB library you created with
  24267.  BASIC PDS 7.00. This will happen even if BASIC PDS version 7.00 has
  24268.  been deleted from your hard disk. If you created your own .LIB library
  24269.  in 7.00 and then link it to your BASIC 7.10 module, then you will need
  24270.  to recompile the BASIC routines in the .LIB using BASIC version 7.10
  24271.  and rebuild the .LIB library (using the LIB.EXE Library Manager).
  24272.  
  24273.  The L4051 error can also occur because of an incorrectly set LIB path.
  24274.  Type "SET" at the DOS command line to be sure that the LIB environment
  24275.  variable points to the BASIC 7.10 libraries. You can set the LIB path
  24276.  (automatically at boot time) in your AUTOEXEC.BAT batch file as
  24277.  follows:
  24278.  
  24279.     SET LIB=C:\BC71\LIB
  24280.  
  24281.  This information applies to Microsoft BASIC Professional Development
  24282.  System (PDS) version 7.10 for MS-DOS and MS OS/2.
  24283.  
  24284.  To duplicate the "L4051 : cannot find library" warning, build a
  24285.  library from the following code using BASIC version 7.00:
  24286.  
  24287.  'test.bas
  24288.  'demo file built with BASIC PDS 7.00
  24289.  SUB Pds70sub
  24290.  print "this is from the library built with PDS 7.00"
  24291.  END SUB
  24292.  
  24293.  Compile and build the library as follows in BASIC version 7.00:
  24294.  
  24295.     BC /O /Fs test ;
  24296.     LIB mylib + test ;        [builds MYLIB.LIB]
  24297.     LINK /Q mylib.lib,mylib.qlb,,qbxqlb.lib ;    [links MYLIB.QLB]
  24298.  
  24299.  Then create a module to CALL the above SUBprogram Pds70sub from the
  24300.  library MYLIB:
  24301.  
  24302.  'main.bas
  24303.  'This module calls the SUBprogram in a library created with PDS 7.00
  24304.  print "this is the calling module"
  24305.  call pds70sub
  24306.  
  24307.  Compile and link as follows in BASIC version 7.10:
  24308.  
  24309.     BC /O /Fs main ;
  24310.     LINK main,,,BCL71EFR.LIB + MYLIB.LIB ;
  24311.  
  24312.  Now you should receive the warning message:
  24313.  
  24314.     LINK : warning L4051 : BCL70EFR.lib : cannot find library
  24315.     Enter new file spec:
  24316.  
  24317.  To correct the problem, recompile, relink, and rebuild the library
  24318.  MYLIB using BASIC PDS version 7.10.
  24319.  
  24320.  
  24321.  390. StringAssign of Zero-Length (Null) String Fails; BASIC 7.10
  24322.  
  24323.  Product Version(s): 7.00 7.10 | 7.00 7.10
  24324.  Operating System:   MS-DOS    | OS/2
  24325.  Flags: ENDUSER | SR# S901016-16 S_C S_QuickC
  24326.  Last Modified: 15-JAN-1991    ArticleIdent: Q68225
  24327.  
  24328.  There is no way to use the StringAssign routine to create a
  24329.  zero-length string. For example, the following gives unpredictable
  24330.  (bad) results, and should not be done:
  24331.  
  24332.     StringAssign(NULL,0,basicstring,0)
  24333.     // (The NULL pointer is defined in STDIO.H in Microsoft C.)
  24334.  
  24335.  This statement is NOT the same as the BASIC statement A$ = "". This
  24336.  article explains this limitation of the StringAssign routine, and
  24337.  gives the correct method to create a null BASIC string by using
  24338.  StringRelease.
  24339.  
  24340.  This information applies to Microsoft BASIC Professional Development
  24341.  System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  24342.  
  24343.  The StringAssign routine lets you transfer far or near string data
  24344.  from one language's memory space to another, using the following C
  24345.  syntax:
  24346.  
  24347.     StringAssign(sourceaddress&,sourcelength%,destaddress&,destlength%)
  24348.  
  24349.  StringAssign expects to receive a far pointer (sourceaddress&) either
  24350.  to a valid BASIC string descriptor or to the beginning of some string
  24351.  text. If the length of the source string (sourcelength%) is 0 (zero),
  24352.  StringAssign assumes that sourceaddress& is a pointer to a valid BASIC
  24353.  string descriptor. StringAssign then dereferences the descriptor and
  24354.  assigns the value to the destaddress& supplied.
  24355.  
  24356.  Each programmer is responsible for making sure that the pointer passed
  24357.  to StringAssign is valid. StringAssign doesn't validate the pointers.
  24358.  Thus, to pass the NULL pointer is an error. If the address passed does
  24359.  not point to a string descriptor, then the results will be
  24360.  unpredictable.
  24361.  
  24362.  Note: Someone might want to do this to set a BASIC variable-length
  24363.  string to the empty or null string from some other language. The
  24364.  intention is to simulate the following line of BASIC code:
  24365.  
  24366.      A$ = ""
  24367.  
  24368.  To assign a null string, you can use the StringRelease routine.
  24369.  StringRelease isn't exactly the same as A$="", but it does result in a
  24370.  string descriptor that will be treated as a null string. It deletes
  24371.  the string data associated with the string descriptor and zeros the
  24372.  string descriptor. A string descriptor that contains 0 (zero) as the
  24373.  length and 0 (zero) as the offset is the same as an uninitialized
  24374.  string, which is treated as null. This method should work around the
  24375.  limitation of StringAssign described above.
  24376.  
  24377.  Code Example
  24378.  ------------
  24379.  
  24380.  The following is an example of this workaround in Microsoft C and
  24381.  BASIC. To compile and link the program, you can use the following
  24382.  compile and link lines:
  24383.  
  24384.     bc test1.bas /Fs /o /Zi ;
  24385.     cl /c /AL /Zi test2.c ;
  24386.     link /NOE /NOD /CO test1 test2,,,bcl71efr.LIB llibcer.lib;
  24387.  
  24388.  Note that the following program prompts you for input. If you input a
  24389.  string, then the C function will StringAssign the string. However, if
  24390.  you literally type "null" (with no quotation marks), then the function
  24391.  will use StringRelease to null the string.
  24392.  
  24393.  Test1.BAS -- BASIC Routine
  24394.  --------------------------
  24395.  
  24396.  DECLARE SUB cfunc CDECL (a$)
  24397.  CLS
  24398.  locate 10, 1
  24399.  print "Before call to cfunc"
  24400.  a$ = "This is a test"
  24401.  print "A$ = ", a$
  24402.  PRINT "Len A$: "; LEN(a$)
  24403.  print
  24404.  CALL cfunc(a$)    ' CALL the C function
  24405.  print "After call to cfunc"
  24406.  print "A$ = ", a$
  24407.  PRINT "Len A$: "; LEN(a$)
  24408.  print
  24409.  
  24410.  Test2.C -- C Routine
  24411.  --------------------
  24412.  
  24413.  #include <stdio.h>
  24414.  #include <stdlib.h>
  24415.  extern void far pascal StringAssign(char far *,int,char far *, int);
  24416.  extern void far pascal StringRelease(char far *);
  24417.  void cfunc(BasicString)
  24418.       char far * BasicString;
  24419.  {
  24420.      char name[80] ;
  24421.      char NullStr[] = "";
  24422.      printf("Input name[]: ");
  24423.      scanf("%s",name);
  24424.      if(stricmp(name,"null") == 0) {
  24425.        name[0] = '\x00'; // Set it to null
  24426.      }
  24427.      if ((name == NULL) | (name[0] == '\x00')) {
  24428.         StringRelease(BasicString);
  24429.      } else {
  24430.          StringAssign(name, strlen(name), BasicString,0);
  24431.      }
  24432.  }
  24433.  
  24434.  
  24435.  391. Can't Use LINK Overlays in a BASIC OS/2 Dual-Mode Application
  24436.  
  24437.  Product Version(s): 7.00 7.10 | 7.00 7.10
  24438.  Operating System:   MS-DOS    | OS/2
  24439.  Flags: ENDUSER | SR# S900920-70
  24440.  Last Modified: 29-JAN-1991    ArticleIdent: Q68236
  24441.  
  24442.  Dual-mode applications are programs that can run under both OS/2 and
  24443.  DOS. You can use the Microsoft BASIC PDS 7.00 or 7.10 to create a
  24444.  dual-mode application; however, you cannot use BASIC to create a
  24445.  dual-mode application that also uses LINKed overlays for the DOS part
  24446.  of the program.
  24447.  
  24448.  This information applies to Microsoft BASIC Professional Development
  24449.  System 7.00 and 7.10 for MS-DOS and MS OS/2.
  24450.  
  24451.  A dual-mode application is not the same as a bound application under
  24452.  OS/2. A dual-mode application is actually two programs, one DOS and
  24453.  one OS/2, that are "glued" together to form one executable file.
  24454.  
  24455.  Every OS/2 program, when linked, has the option to link-in a "stub"
  24456.  DOS program. Originally, the stub DOS program was meant to print an
  24457.  appropriate message when you attempt to run an OS/2 program under DOS.
  24458.  Usually the message is "This program cannot be run in DOS mode," or a
  24459.  similar message. You include this stub DOS program by putting the
  24460.  following line in the linker .DEF file when you link the OS/2 program
  24461.  (where DOSPROG.EXE is the name of your own DOS program):
  24462.  
  24463.     STUB 'DOSPROG.EXE'
  24464.  
  24465.  Originally, the only purpose of this stub file was to print this
  24466.  user-friendly message, and then exit back to DOS. Eventually,
  24467.  programmers began to let this "stub" program get larger and larger
  24468.  until it became a full-blown application that ran under DOS when you
  24469.  attempted to run the OS/2 program in DOS. (The user can't tell the
  24470.  difference.) Commercial applications, such as Microsoft Word version
  24471.  5.00, were created this way. Because dual-mode applications are
  24472.  literally two full applications glued together, they tend to be huge.
  24473.  
  24474.  This technique can be used with programs created with the Microsoft
  24475.  BASIC PDS product. However, one limitation of dual-mode applications
  24476.  is that the DOS portion cannot contain overlays. Attempting to run a
  24477.  dual-mode application, where the DOS portion was linked with overlays,
  24478.  will hang the machine.
  24479.  
  24480.  Illustration
  24481.  ------------
  24482.  
  24483.  The following compile and link lines create two dual-mode program
  24484.  examples, OS2OVL.EXE and OS2NOOVL.EXE. (Source code is not provided
  24485.  but you can write it easily). OS2OVL.EXE is an OS/2 program and
  24486.  includes a DOS stub program that uses overlays.
  24487.  
  24488.  WARNING: Running OS2OVL.EXE will hang your machine, requiring you to
  24489.  reboot.
  24490.  
  24491.  OS2NOOVL.EXE is an OS/2 program, with an identical DOS version of the
  24492.  program enclosed as its stub file. OS2NOOVL.EXE does not use overlays,
  24493.  and will run without problem under DOS or OS/2.
  24494.  
  24495.  To compile and link the hypothetical programs, use the following
  24496.  commands:
  24497.  
  24498.  bc dosprog.bas /Lr /o ;
  24499.  bc mod1.bas    /Lr /o ;
  24500.  bc mod2.bas    /Lr /o ;
  24501.  link dosprog mod1 mod2, dosnoovl.exe ;
  24502.  link dosprog (mod1) (mod2), dosovl.exe ;
  24503.  bc dosprog.bas /Lp /o ;
  24504.  bc mod1.bas    /Lp /o ;
  24505.  bc mod2.bas    /Lp /o ;
  24506.  link os2prog mod1 mod2, os2noovl.exe,,, os2noovl.def ;
  24507.  link os2prog mod1 mod2, os2ovl.exe ,,, os2ovl.def ;
  24508.  
  24509.  DOSPROG.BAS is a main program that calls subprograms contained in
  24510.  separate support modules, MOD1.BAS and MOD2.BAS.
  24511.  
  24512.  OS2NOOVL.DEF contains the following line:
  24513.  
  24514.     STUB 'DOSNOOVL.EXE'
  24515.  
  24516.  OS2OVL.DEF contains the following line:
  24517.  
  24518.     STUB 'DOSOVL.EXE'
  24519.  
  24520.  (A LINK.EXE .DEF file is a module definition file that BASIC can use
  24521.  when linking OS/2 protected-mode programs.)
  24522.  
  24523.  
  24524.  392. ISAM Files Cannot Be Opened by Multiple Networked Workstations
  24525.  
  24526.  Product Version(s): 7.00 7.10 | 7.10
  24527.  Operating System:   MS-DOS    | OS/2
  24528.  Flags: ENDUSER | SR# S910107-151 docerr
  24529.  Last Modified: 16-JAN-1991    ArticleIdent: Q68339
  24530.  
  24531.  The note on page 336 of the "Microsoft BASIC 7.0: Programmer's Guide"
  24532.  for Microsoft BASIC PDS 7.00 and 7.10 incorrectly states that you can
  24533.  open an ISAM database for read-only by one BASIC process and then have
  24534.  another BASIC process open it for reading as well.
  24535.  
  24536.  If a database is already open, even if it is opened for read-only
  24537.  access, the ISAM engine will generate a "Permission denied" error when
  24538.  another process attempts to open the database. If the first process
  24539.  closes the file, then the second process can access it.
  24540.  
  24541.  This information apples to Microsoft BASIC PDS versions 7.00 and 7.10
  24542.  for MS-DOS and 7.10 for MS OS/2.
  24543.  
  24544.  Note that "processes" refer to two separate programs or users
  24545.  attempting to access a file on a network server. However, this can
  24546.  also apply to two separate programs under multitasking, systems such
  24547.  as OS/2 or Microsoft Windows.
  24548.  
  24549.  For an in-depth explanation for why BASIC PDS 7.10 does not yet
  24550.  support multiuser ISAM, query on the following:
  24551.  
  24552.     why and BASIC and multiuser and ISAM
  24553.  
  24554.  
  24555.  393. WIDTH "CONS:" or "SCRN:" Uses Only 40 or 80 in BASIC 7.00/7.10
  24556.  
  24557.  Product Version(s): 7.00 7.10
  24558.  Operating System:   MS-DOS
  24559.  Flags: ENDUSER | SR# S901023-92 buglist7.00 buglist7.10 docerr
  24560.  Last Modified: 29-JAN-1991    ArticleIdent: Q68446
  24561.  
  24562.  In BASIC PDS 7.00 and 7.10, the WIDTH for the screen device is
  24563.  restricted to 40 or 80 characters across all the different WIDTH
  24564.  syntaxes.
  24565.  
  24566.  The WIDTH statement fails to set widths other than 40 or 80 for the
  24567.  "CONS:" device name in QuickBASIC 4.50 (buglist4.50) and BASIC PDS
  24568.  7.00 and 7.10. The WIDTH statement also fails to set widths other than
  24569.  40 or 80 for the "SCRN:" device name for BASIC PDS 7.00 and 7.10, but
  24570.  succeeds in QuickBASIC 4.50. (The problem occurs both in the
  24571.  environment and in a compiled .EXE program.) The documentation does
  24572.  not explicitly say what is expected for the WIDTH dev$,wid% syntax.
  24573.  
  24574.  This may be a design restriction. Microsoft is researching this
  24575.  problem and will post new information here as it becomes available.
  24576.  
  24577.  This information applies to QuickBASIC version 4.50 and to Microsoft
  24578.  BASIC Professional Development System (PDS) versions 7.00 and 7.10 for
  24579.  MS-DOS.
  24580.  
  24581.  BASIC PDS 7.00 and 7.10 only lets you use WIDTH of 40 or 80 for the
  24582.  WIDTH dev$,wid% syntax when dev$ is the screen device name "CONS:" or
  24583.  "SCRN:". (This behavior actually matches the documented restriction
  24584.  for the separate WIDTH wid%,height% syntax for screen output.)
  24585.  
  24586.  The following code example demonstrates this behavior:
  24587.  
  24588.  Code Example
  24589.  ------------
  24590.  
  24591.  CLS
  24592.  WIDTH "scrn:", 11   ' Sets screen width to 11 characters.
  24593.  OPEN "scrn:" FOR OUTPUT AS #1                ' OK in 4.50, but
  24594.  PRINT #1, "123456789012345678901234567890"   ' WIDTH ignored in BASIC
  24595.  CLOSE                                        ' 7.x in .EXE and QBX.EXE
  24596.  OPEN "scrn:" FOR OUTPUT AS #2
  24597.  WIDTH #2, 11                                 ' OK in 4.50, but WIDTH
  24598.  PRINT #2, "123456789012345678901234567890"   ' ignored in BASIC 7.x
  24599.  CLOSE
  24600.  WIDTH "cons:", 11
  24601.  OPEN "cons:" FOR OUTPUT AS #3
  24602.  PRINT #3, "123456789012345678901234567890"  ' WIDTH ignored, 7.x, 4.50
  24603.  CLOSE
  24604.  OPEN "cons:" FOR OUTPUT AS #4
  24605.  WIDTH #4, 10
  24606.  PRINT #4, "123456789012345678901234567890"  ' WIDTH ignored, 7.x, 4.50
  24607.  CLOSE
  24608.  
  24609.  ' Note that the problem doesn't occur with the "LPT1:" device:
  24610.  WIDTH "lpt1:", 11   ' Sets printer width to 11 characters.
  24611.  OPEN "lpt1:" FOR OUTPUT AS #1
  24612.  PRINT #1, "123456789012345678901234567890"  ' Works find in all versions.
  24613.  CLOSE
  24614.  
  24615.  Reference:
  24616.  
  24617.  The following partial description of the WIDTH statement is taken from
  24618.  the QBX.EXE online help:
  24619.  
  24620.     WIDTH {#filenumber% | device$}, width%
  24621.  
  24622.  WIDTH {#filenumber% | device$}, width%
  24623.    The WIDTH #filenumber%, width% form:
  24624.      - Sets the line width of an output device already opened as a file
  24625.        (for example, LPT1: or CONS:).
  24626.      - The argument filenumber% is the number associated with the
  24627.        file in the OPEN statement.
  24628.      - The "#" character in front of filenumber% is not optional.
  24629.      - The width assignment takes place immediately.
  24630.    The WIDTH device$, width% form:
  24631.      - Sets to width% the line with of device$ (a device filename).
  24632.        The device should be a string expression (for example, "LPT1:").
  24633.      - The width assignment is deferred until the next OPEN statement
  24634.        affecting the device.
  24635.      - The assignment does not affect output for an already open file.
  24636.  
  24637.  
  24638.  394. ISAM Files Open at Once, "Too Many Files" Error 67, Correction
  24639.  
  24640.  Product Version(s): 7.00 7.10 | 7.10
  24641.  Operating System:   MS-DOS    | OS/2
  24642.  Flags: ENDUSER | docerr
  24643.  Last Modified: 29-JAN-1991    ArticleIdent: Q68462
  24644.  
  24645.  Page 673 of the "Microsoft BASIC 7.0: Language Reference" (under the
  24646.  "Too many files" error in Appendix D) incorrectly states that ISAM is
  24647.  limited to opening 12 databases at once.
  24648.  
  24649.  This should be corrected to read as follows:
  24650.  
  24651.     At run time, the "Too many files" error may occur because:
  24652.  
  24653.     ISAM has a limit to the number of databases and tables that can be
  24654.     open at one time and your program has exceeded this limit.
  24655.     The maximum number of database files that you can have open at once
  24656.     is four. Also, the maximum number of tables that you can have
  24657.     open at once is 13 tables in one database file, or 10 tables in 2
  24658.     database files, or 7 tables in 3 database files, or 4 tables in 4
  24659.     database files.
  24660.  
  24661.  This information applies to Microsoft BASIC Professional Development
  24662.  System (PDS) versions 7.00 and 7.10 for MS-DOS and 7.10 for MS OS/2.
  24663.  
  24664.  Reference:
  24665.  
  24666.  An ISAM database file in Microsoft BASIC Professional Development
  24667.  System (PDS) version 7.00 or 7.10 is created with the default
  24668.  extension .MDB and contains the physical data for each table plus the
  24669.  indexes used to define and point to the data.
  24670.  
  24671.  (This correct ISAM information is taken from page 388 of the
  24672.  "Microsoft BASIC 7.0: Programmer's Guide" for versions 7.00 and 7.10
  24673.  [Chapter 10, "Database Programming with ISAM"].)
  24674.  
  24675.  
  24676.  395. OutGText% Works Only on First Call If WINDOW Invoked; UI Font
  24677.  
  24678.  Product Version(s): 7.00 7.10
  24679.  Operating System:   MS-DOS
  24680.  Flags: ENDUSER | SR# S910114-77
  24681.  Last Modified: 29-JAN-1991    ArticleIdent: Q68588
  24682.  
  24683.  Using the OutGText% function more than once does not display the text
  24684.  in the same location if you have invoked the SCREEN command prior to
  24685.  invoking OutGText%. GTextWindow must be called before any OutGText%
  24686.  commands.
  24687.  
  24688.  This information applies to the User Interface (UI) Toolbox Font
  24689.  procedures in Microsoft BASIC Professional Development System (PDS)
  24690.  versions 7.00 and 7.10 for MS-DOS. (See GTextWindow in the README.DOC
  24691.  file.)
  24692.  
  24693.  The procedure OutGText% initializes the screen to its full-screen
  24694.  parameters before displaying the user's text. To reinitialize the
  24695.  screen back to its original user-specified parameters, GTextWindow
  24696.  must have been called. GTextWindow stores the screen coordinates for
  24697.  later use (for example, in the OutGText% function).
  24698.  
  24699.  Because the WINDOW statement uses the same parameters as GTextWindow,
  24700.  you may want to include the command WINDOW(X1,Y1,X2,Y2) in the
  24701.  GTextWindow procedure, and substitute the GTextWindow call whenever
  24702.  referencing the WINDOW statement.
  24703.  
  24704.  Code Example
  24705.  ------------
  24706.  
  24707.  The code below demonstrates the correct method to display the text
  24708.  "Hello world" in the location (0,100). If GTextWindow is not called,
  24709.  "Hello world" will be displayed twice in two different locations.
  24710.  
  24711.  SCREEN 9
  24712.  FontNum% = RegisterFonts("TMSRB.FON")
  24713.  var1% = LoadFont%("N4,N5,N6")
  24714.  a$ = "Hello world"
  24715.  CALL GTextWindow(-200, -200, 200, 200, FALSE)   'store coordinates
  24716.  WINDOW (-200, -200)-(200, 200)
  24717.  PSET (0, 100)
  24718.  var1% = OutGText%(0, 100, a$)
  24719.  var1% = OutGText%(0, 100, a$)
  24720.  PSET (0, 100)
  24721.  END
  24722.  
  24723.  Reference
  24724.  ---------
  24725.  
  24726.  According to the README.DOC file for BASIC PDS 7.00 and 7.10, after
  24727.  the first call to OutGText to output text, you must precede each
  24728.  subsequent call to OutGText with a call to GTextWindow in order to
  24729.  preserve logical coordinates of the window.
  24730.  
  24731.  
  24732.  396. How to Display Mouse Pointer on Multiple Pages, in UI Toolbox
  24733.  
  24734.  Product Version(s): 7.00 7.10
  24735.  Operating System:   MS-DOS
  24736.  Flags: ENDUSER | SR# S910111-277 B_QuickBas H_Mouse
  24737.  Last Modified: 29-JAN-1991    ArticleIdent: Q68589
  24738.  
  24739.  The User Interface (UI) Toolbox demonstration programs supplied with
  24740.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  24741.  and 7.10 are not written to accomodate mouse support on video pages
  24742.  other than page 0 (zero). If you change the SCREEN statement to use
  24743.  any video page other than page 0, the mouse cursor (pointer) will not
  24744.  be visible. To make the mouse cursor visible, you must call DOS
  24745.  interrupt 33 hex.
  24746.  
  24747.  Note that you may also use interrupt 33 hex with QuickBASIC version
  24748.  4.00, 4.00b, and 4.50 to show the mouse cursor on desired video pages.
  24749.  
  24750.  DOS function 33 hex, with function 1D hex, selects the display page
  24751.  for the mouse pointer. Before calling this DOS service, you must load
  24752.  the AX register with 1D hexadecimal, and the BX register with the
  24753.  desired page number. This page number coincides with the second
  24754.  argument to BASIC's SCREEN statement.
  24755.  
  24756.  Code Example
  24757.  ------------
  24758.  
  24759.  Combine (load into QBX.EXE) the following main-module code and
  24760.  subprogram along with the MOUSE.BAS source file provided with BASIC
  24761.  PDS 7.00 and 7.10.
  24762.  
  24763.  '$INCLUDE: 'qbx.bi'
  24764.  DIM SHARED Regs as Regtype
  24765.  MouseShow
  24766.  SelectPage(9,0,0)
  24767.  SLEEP
  24768.  SelectPage(9,1,0)
  24769.  END
  24770.  SUB SelectPage(Mode%, Page%, Visible%)
  24771.     Regs.AX = &H1D
  24772.     Regs.BX = 0
  24773.     Interrupt &H33, Regs, Regs
  24774.  END SUB
  24775.  
  24776.  
  24777.  397. "Symbol Defined More Than Once" LINKing BASIC 7.10/FORTRAN 5.0
  24778.  
  24779.  Product Version(s): 7.10
  24780.  Operating System:   MS-DOS
  24781.  Flags: ENDUSER | SR# S910111-256 H_FORTRAN
  24782.  Last Modified: 29-JAN-1991    ArticleIdent: Q68590
  24783.  
  24784.  Below is an example where linking BASIC PDS 7.10 with FORTRAN 5.00
  24785.  gives several "Symbol defined more than once" errors. In this specific
  24786.  case, the problem can be worked around by compiling with BC /O (the
  24787.  stand-alone .EXE option, using BCL71ENR.LIB).
  24788.  
  24789.  =======================================================================
  24790.  
  24791.  IMPORTANT NOTE: Linking Microsoft BASIC Professional Development
  24792.  System (PDS) 7.10 with Microsoft FORTRAN 5.00 requires first changing
  24793.  the FORTRAN library and including a Microsoft C 6.00 library, as
  24794.  explained in a separate application note, "How to Link BASIC PDS 7.10
  24795.  with C 5.10, FORTRAN 5.00, or Pascal 4.00." To find this application
  24796.  note in a separate article in this knowledge base, search for the
  24797.  words shown in the title of the application note, or BB0345. Despite
  24798.  using the steps in the application note, linking certain BASIC 7.10
  24799.  and FORTRAN 5.00 programs may generate the "Symbol defined more than
  24800.  once" errors described in the example below.
  24801.  
  24802.  Although the methods in the application note have been designed to
  24803.  produce compatible results, we have not put the methods through a
  24804.  standard Microsoft mixed-language testing cycle, and it is possible
  24805.  that you may still encounter compatibility problems under certain
  24806.  conditions. We cannot guarantee the complete success of mixed-
  24807.  language programming of BASIC PDS 7.10 with C 5.10, FORTRAN 5.00, or
  24808.  Pascal 4.00. Further problems or questions can be directed to
  24809.  Microsoft Language Support Services.
  24810.  
  24811.  =======================================================================
  24812.  
  24813.  To duplicate the problem, create the following code:
  24814.  
  24815.  BASIC.BAS
  24816.  ---------
  24817.  
  24818.  REM *********************BASIC CODE*****************************
  24819.  DIM x%(2048)
  24820.  COMMON SHARED /nmalloc/ x%()
  24821.  DECLARE SUB Test()
  24822.  CALL Test
  24823.  END
  24824.  
  24825.  FORTRAN.FOR
  24826.  -----------
  24827.  
  24828.  C  *********************FORTRAN CODE***************************
  24829.        SUBROUTINE Test
  24830.        REAL frq(1)
  24831.        WRITE(6,*)wreal
  24832.        i=INT(frq(i))
  24833.        RETURN
  24834.        END
  24835.  
  24836.  Compile and link with the following commands:
  24837.  
  24838.     (Note: To create MIXED.LIB, you must obtain the application note
  24839.     "How to Link BASIC PDS 7.10 with C 5.10, FORTRAN 5.00, or Pascal
  24840.     4.00.")
  24841.  
  24842.   BC /E /FPi /Zi basic.bas;
  24843.   fl /c /4Yb /FPi /Zi fortran.for
  24844.   link /NOD/NOE/CO basic.obj + fortran.obj,s.exe,,brt71enr.lib+
  24845.                     llibcer.lib+mixed.lib;
  24846.  
  24847.  LINK.EXE generates the following errors:
  24848.  
  24849.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __flds : symbol defined
  24850.  more than once.
  24851.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fsts : symbol defined
  24852.  more than once.
  24853.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fadds: symbol defined
  24854.  more than once.
  24855.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fdivs: symbol defined
  24856.  more than once.
  24857.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fsubs: symbol defined
  24858.  more than once.
  24859.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fmuls: symbol defined
  24860.  more than once.
  24861.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fstsp: symbol defined
  24862.  more than once.
  24863.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fdivsr: symbol
  24864.  defined more than once.
  24865.  mixed.lib(\mrt\c\87ccallf.asm) : error L2025: __fsubsr: symbol
  24866.  defined more than once.
  24867.  
  24868.  To work around this problem, add /O to the BASIC compiler command line
  24869.  and then relink, as follows:
  24870.  
  24871.     BC /O /E /FPi /Zi basic.bas;
  24872.     link /NOD/NOE/CO basic.obj + fortran.obj,s.exe,,BCL71ENR.LIB+
  24873.                     llibcer.lib+mixed.lib;
  24874.  
  24875.  
  24876.  398. "Illegal Function Call" Selecting Menu Item Using UI Toolbox
  24877.  
  24878.  Product Version(s): 7.00 7.10
  24879.  Operating System:   MS-DOS
  24880.  Flags: ENDUSER | SR# S901120-94
  24881.  Last Modified: 14-FEB-1991    ArticleIdent: Q69109
  24882.  
  24883.  An "Illegal function call" error can occur when you select an item
  24884.  from a user-defined menu with the ALT+Key1+Key2 combination, even
  24885.  though selecting the same item with the mouse does not give an error.
  24886.  This error can be caused by using an incorrect parameter in the
  24887.  MenuSet procedure. The fifth argument of the MenuSet SUB is
  24888.  accesskey%. If zero is passed as the fifth parameter, then that menu
  24889.  item and any after it will generate an error when selected with key
  24890.  combinations. This error does not occur if you use the mouse. This
  24891.  article shows why this error occurs, and gives a workaround for this
  24892.  problem.
  24893.  
  24894.  This information applies to the User Interface (UI) Toolbox in
  24895.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  24896.  and 7.10 for MS-DOS.
  24897.  
  24898.  The MenuSet SUB is described on pages 545 and 546 of the "Microsoft
  24899.  BASIC 7.0: Programmer's Guide" for versions 7.00 and 7.10.
  24900.  
  24901.  The accesskey% argument specifies the position of the character within
  24902.  the menu item text that is used in conjunction with the ALT key to
  24903.  select that item. You may want accesskey% to be zero if you don't want
  24904.  the item to be selected. If you don't want the item to be selected,
  24905.  pass a zero as the third parameter (the State% argument).
  24906.  
  24907.  Code Example
  24908.  ------------
  24909.  
  24910.  The following code example demonstrates the "Illegal function call"
  24911.  error. In this case, a zero is passed as the fifth parameter of
  24912.  MenuSet because the text is just a horizontal line across the menu.
  24913.  
  24914.  To run this example, save the code as <filename>.BAS, then invoke
  24915.  QBX.EXE with the following command:
  24916.  
  24917.  QBX <filename> /L UITBEFR
  24918.  
  24919.  ' UIERROR.BAS
  24920.  DEFINT A-Z
  24921.  '$DYNAMIC
  24922.  '$INCLUDE: 'GENERAL.BI'
  24923.  '$INCLUDE: 'MENU.BI'
  24924.  '$INCLUDE: 'MOUSE.BI'
  24925.  '$INCLUDE: 'WINDOW.BI'
  24926.  
  24927.  'These global variables are required by the UI Toolbox routines:
  24928.  COMMON SHARED /uitools/ GloMenu         AS MenuMiscType
  24929.  COMMON SHARED /uitools/ GloTitle()      AS MenuTitleType
  24930.  COMMON SHARED /uitools/ GloItem()       AS MenuItemType
  24931.  
  24932.  '******************************************************************
  24933.  'MAXMENU and MAXITEM are constants defined in *.BI above.
  24934.  'The TYPEs MenuTitleType and MenuItemType are also defined
  24935.  'in the *.BI files above.
  24936.  '******************************************************************
  24937.  DIM GloTitle(MaxMenu)         AS MenuTitleType
  24938.  DIM GloItem(MaxMenu, MaxItem) AS MenuItemType
  24939.  COLOR 2, 1
  24940.  CLS
  24941.  MenuInit
  24942.  COLOR 15, 1                       'Sets the background to blue
  24943.  MenuSet 1, 0, 1, "Salutation", 1  'Menu title
  24944.  MenuSet 1, 1, 1, "Hello", 1       'First item under Salutation
  24945.  MenuSet 1, 2, 1, "-", 0           'Line across the menu
  24946.  MenuSet 1, 3, 1, "Goodbye", 1     'Last item under Salutation
  24947.  MenuPreProcess
  24948.  MenuShow
  24949.  MouseShow
  24950.  ProgramFinished = False
  24951.  WHILE NOT ProgramFinished
  24952.    kbd$ = MenuInkey$
  24953.    WHILE MenuCheck(2)
  24954.      GOSUB MenuTrap
  24955.    WEND
  24956.  WEND
  24957.  MouseHide
  24958.  END
  24959.  
  24960.  MenuTrap:
  24961.    Menu = MenuCheck(0)
  24962.    item = MenuCheck(1)
  24963.    COLOR 2, 1
  24964.    SELECT CASE Menu
  24965.      CASE 1
  24966.        SELECT CASE item
  24967.          CASE 1                        'If hello was selected then
  24968.            LOCATE 12, 37               'print hello.
  24969.            PRINT "Hello"
  24970.          CASE 3                        'If goodbye was selected then
  24971.            LOCATE 13, 36               'print goodbye and end.
  24972.            PRINT "GoodBye"
  24973.            ProgramFinished = True
  24974.          CASE ELSE
  24975.            ProgramFinished = False
  24976.        END SELECT
  24977.      CASE ELSE
  24978.        ProgramFinished = False
  24979.    END SELECT
  24980.    RETURN
  24981.  
  24982.  Workaround
  24983.  ----------
  24984.  
  24985.  This problem can be solved by either not passing a zero as the fifth
  24986.  parameter in MenuSet or by changing a few lines of code in the
  24987.  MENU.BAS program. The problem lies in the MENU.BAS program in the
  24988.  MenuDo SUB. There is a DO LOOP shortly after the following comment:
  24989.  
  24990.  '==================================================================
  24991.  'If menu is selected, search items for matching access key, and
  24992.  'select that (menu,item) and exit MenuDo if item is enabled
  24993.  '==================================================================
  24994.  
  24995.  The LOOP statement reads:
  24996.  
  24997.  LOOP UNTIL UCASE$(MID$(GloItem(currMenu, newItem).text,_
  24998.  GloItem(currMenu, newItem.accesskey,1)) = kbd$ AND GloItem(currMenu,_
  24999.  newItem).state > 0 AND RTRIM$(GloItem(currMenu, newItem).text) <>_
  25000.  "-") OR newItem = loopEnd
  25001.  
  25002.  Note: The above is one line of code in MENU.BAS. The underscore (_)
  25003.  characters indicate line continuation.
  25004.  
  25005.  If zero was passed as the fifth parameter in MenuSet, then
  25006.  GloItem(currMenu, newItem).accesskey = 0 when the loop reaches that
  25007.  menu item. This condition causes an "illegal function call" in the
  25008.  MID$ function. Adding the following IF statement to the loop will
  25009.  solve the problem:
  25010.  
  25011.  DO
  25012.    newItem = (newItem) MOD MAXITEM + 1
  25013.    IF GloItem(currMenu, newItem).accesskey = 0 THEN
  25014.      LoopDone% = (newItem = loopEnd)
  25015.    ELSE
  25016.      LoopDone% = UCASE$(MID$(GloItem(currMenu, newItem).text,_
  25017.      GloItem(currMenu, newItem.accesskey,1)) = kbd$ AND_
  25018.      GloItem(currMenu, newItem).state > 0 AND RTRIM$(GloItem(currMenu,_
  25019.      newItem).text) <> "-") OR newItem = loopEnd
  25020.    END IF
  25021.  LOOP UNTIL LoopDone%
  25022.  
  25023.  To include these changes in the files UITBEFR.LIB and UITBEFR.QLB, do
  25024.  the following:
  25025.  
  25026.  1. At the DOS prompt, type:
  25027.  
  25028.        QBX MENU
  25029.  
  25030.  2. Make the changes in the DO LOOP as stated above.
  25031.  
  25032.  3. Save the new MENU.BAS.
  25033.  
  25034.  4. Exit QBX.EXE.
  25035.  
  25036.  5. At the DOS prompt, type:
  25037.  
  25038.        BC MENU /X/Fs;
  25039.  
  25040.  6. Type:
  25041.  
  25042.        LIB UITBEFR - MENU.OBJ + MENU.OBJ
  25043.  
  25044.  7. Type:
  25045.  
  25046.        LINK /Q UITBEFR.LIB, UITBEFR.QLB,, QBXQLB.LIB;
  25047.  
  25048.  
  25049.  399. Correction for Scroll SUB in GENERAL.BAS, UI Toolbox
  25050.  
  25051.  Product Version(s): 7.00 7.10
  25052.  Operating System:   MS-DOS
  25053.  Flags: ENDUSER | SR# S910115-118 buglist7.00 buglist7.10
  25054.  Last Modified: 14-FEB-1991    ArticleIdent: Q69111
  25055.  
  25056.  The subprogram Scroll within GENERAL.BAS will not display the correct
  25057.  attributes if you select a negative number for "lines" when you want
  25058.  to scroll the window down. A correction for this problem is shown
  25059.  below. (Scrolling in the up direction displays the correct attributes,
  25060.  and needs no correction.)
  25061.  
  25062.  This correction applies to the User Interface (UI) Toolbox in
  25063.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  25064.  and 7.10 for MS-DOS.
  25065.  
  25066.  The DOS Interrupt call 16 hex with function 7 or 6 requires that the
  25067.  BX register be set with the color attribute. The bits 6 through 4 are
  25068.  set to the desired background attribute. The following formula shifts
  25069.  this attribute into the correct location in the word register BX:
  25070.  
  25071.     regs.bx = 256 * (attr MOD 8) * 16
  25072.  
  25073.  The original code for subprogram Scroll has the following attributes
  25074.  set for the BX register:
  25075.  
  25076.     regs.bx = 256 * attr
  25077.  
  25078.  The following excerpt is from Scroll with the correct modifications:
  25079.  
  25080.  SUB Scroll (row1, col1, row2, col2, lines, attr)
  25081.            .
  25082.            .
  25083.            .
  25084.       MAXCOL THEN
  25085.          DIM regs AS RegType
  25086.          IF lines < 0 THEN
  25087.              regs.ax = 256 * 7 + (-lines)
  25088.             'regs.bx = 256 * attr                 <=== old code
  25089.              regs.bx = 256 * (attr MOD 8) * 16   '<=== change to this
  25090.              regs.cx = 256 * (row1 - 1) + (col1 - 1)
  25091.              regs.dx = 256 * (row2 - 1) + (col2 - 1)
  25092.          ELSE
  25093.              regs.ax = 256 * 6 + lines                  'AH = 06
  25094.              regs.bx = 256 * (attr MOD 8) * 16
  25095.              regs.cx = 256 * (row1 - 1) + (col1 - 1)
  25096.              regs.dx = 256 * (row2 - 1) + (col2 - 1)
  25097.          END IF
  25098.          INTERRUPT 16, regs, regs
  25099.      END IF
  25100.  END SUB
  25101.  
  25102.  
  25103.  400. How to Estimate Size of BASIC PDS ISAM Database Components
  25104.  
  25105.  Product Version(s): 7.00 7.10 | 7.10
  25106.  Operating System:   MS-DOS    | OS/2
  25107.  Flags: ENDUSER | SR# S910114-194
  25108.  Last Modified: 14-FEB-1991    ArticleIdent: Q69112
  25109.  
  25110.  Using the output of ISAMPACK.EXE can give you a rough estimate of the
  25111.  size of an ISAM database.
  25112.  
  25113.  This information applies to Microsoft BASIC Professional System (PDS)
  25114.  versions 7.00 and 7.10 for MS-DOS and 7.10 for OS/2.
  25115.  
  25116.  Because an ISAM file contains descriptive information, it has some
  25117.  size overhead. This overhead is required for the speed and efficiency
  25118.  that ISAM files possess compared to random access files. With this
  25119.  overhead, data manipulation, such as searches, seeks, and sorts,
  25120.  becomes extremely easy. The ISAM engine is responsible for all this
  25121.  data manipulation, which allows you to spend your time developing the
  25122.  code, and frees you from worrying about the fine details of the
  25123.  database management.
  25124.  
  25125.  You can use the output of the ISAMPACK.EXE utility to roughly guess
  25126.  the size of the components of an ISAM database.
  25127.  
  25128.  The ISAM database is divided into several components, which have the
  25129.  following size requirements:
  25130.  
  25131.  1. A database requires a header of 3K for its own use.
  25132.  2. The system data dictionary requires 39K.
  25133.  3. Each table requires 4K of overhead beyond the data space.
  25134.  4. Each index is allocated in 2K chunks.
  25135.  5. Actual data is allocated in 2K increments.
  25136.  
  25137.  Additionally, to optimize speed and flexibility, the file will grow in
  25138.  large increments of 32K, rather than in record-size increments as
  25139.  single records are added. For this same reason, the indexes and data
  25140.  are allocated in 2K chunks. Although the files are quite large
  25141.  compared to random access files, the ISAM file has room for growth and
  25142.  can be extremely fast. This can be a hurdle for some programmers, and
  25143.  is an important consideration when designing a program. Please read
  25144.  "ISAM Components/When to Use ISAM" on page 329 of the "Microsoft BASIC
  25145.  7.0: Programmer's Guide" (for 7.00 and 7.10) to determine which is
  25146.  more appropriate for your needs, ISAM files or random access files.
  25147.  
  25148.  The following tables were constructed using the sample database
  25149.  AMAZRAYS.MDB and the output from ISAMPACK.EXE.
  25150.  
  25151.  To run ISAMPACK.EXE, first invoke the PROISAMD.EXE TSR (terminate and
  25152.  stay resident) program, then use the following arguments for
  25153.  ISAMPACK.EXE:
  25154.  
  25155.     ISAMPACK AMAZRAYS.MDB AMAZRAYS.RPT
  25156.  
  25157.  More information on ISAMPACK.EXE can be found on page 394 of the
  25158.  "Microsoft BASIC 7.0: Programmer's Guide."
  25159.  
  25160.  Header
  25161.  ------
  25162.  
  25163.   * Each database requires a 3K header.                           3K
  25164.  
  25165.  Data Dictionary
  25166.  ---------------
  25167.  
  25168.   * Five system tables and eight system indexes.                  39K
  25169.  
  25170.  Tables Overhead
  25171.  ---------------
  25172.  
  25173.   * Each table has 4K of overhead beyond its actual data records.
  25174.  
  25175.        CustTable
  25176.        InventTable
  25177.        InvoiceTable
  25178.        TransTable          4 * 4K =                               16K
  25179.  
  25180.  Indexes
  25181.  -------
  25182.  
  25183.   * Each index is allocated in 2K chunks:
  25184.  
  25185.     IndexName      Columns        Size   NumRecords  Size   Actual
  25186.     ---------      -------        ----   ----------  ----   ------
  25187.  
  25188.     AcctIndex      AcctNo(5)        5      7           35    2K
  25189.  
  25190.     CompanyIndex   Company(70)
  25191.                    AcctNo(5)       75      7          525    2K
  25192.  
  25193.     ItemIndex      ItemNo(5)        5      8           40    2K
  25194.  
  25195.     InvoiceIndex   InvoiceNo(6)     6     24          144    2K
  25196.  
  25197.     DateIndex      Date(6)
  25198.                    InvoiceNo(6)    12     24          288    2K
  25199.  
  25200.     InvAcctIndex   AcctNo(6)
  25201.                    Date(6)
  25202.                    InvoiceNo(6)    36     24          864    2K
  25203.  
  25204.     TransInvIndex  InvoiceNo(6)
  25205.                    TransNo(2)      12     46          552    2K
  25206.  
  25207.                                         Total Index Space...    14K
  25208.  
  25209.  Database
  25210.  --------
  25211.  
  25212.   * Each database is allocated in 2K chunks.
  25213.  
  25214.     Table        b/rec    #rec     Calc(K)  Act(K)
  25215.     -----        -----    ----     -------  ------
  25216.  
  25217.     CustTable     326        7     2.282       4
  25218.     InventTable   163        8     1.304       2
  25219.     InvoiceTable   33       24     0.792       2
  25220.     TransTable     23       46     1.058       2
  25221.                                                     Total...    10K
  25222.  
  25223.  Database Size
  25224.  =============
  25225.  
  25226.   * Growth is in 32K chunks.
  25227.  
  25228.                                    Grand total(82K)....   83,968 bytes
  25229.     Adjusted for 32K chunk (3 * 32K * 1024 bytes/K)....   98,304 bytes
  25230.             Actual file reported after packing file....   98,304 bytes
  25231.  
  25232.  
  25233.  401. ISAMCVT Doesn't Properly Convert db/LIB Date Fields
  25234.  
  25235.  Product Version(s): 7.00 7.10
  25236.  Operating System:   MS-DOS
  25237.  Flags: ENDUSER | SR# S910116-88 buglist7.00 buglist7.10
  25238.  Last Modified: 11-FEB-1991    ArticleIdent: Q69158
  25239.  
  25240.  Page 393 of the "Microsoft BASIC 7.0: Programmer's Guide" (for
  25241.  versions 7.00 and 7.10) states that the ISAMCVT utility will convert
  25242.  db/LIB date fields to BASIC double-precision numbers for use with the
  25243.  Date/Time add-on libraries.
  25244.  
  25245.  ISAMCVT does convert a date field to a double-precision number, but
  25246.  the resulting number is not a serial number that can be used with the
  25247.  date libraries included with BASIC.
  25248.  
  25249.  Microsoft has confirmed this to be a problem with the ISAMCVT.EXE
  25250.  utility for Microsoft BASIC Professional Development System (PDS)
  25251.  versions 7.00 and 7.10 for MS-DOS. We are researching this problem and
  25252.  will post new information here as it becomes available.
  25253.  
  25254.  When ISAMCVT converts a date field, it converts it to a 8-byte string,
  25255.  but tags it internally as a double. To see the string, you must use
  25256.  the MKD$ function to convert the double to a string.
  25257.  
  25258.  However, ISAMCVT also converts the year portion of the date
  25259.  incorrectly by dropping the last two digits (for example, 1990 becomes
  25260.  19, and 1890 becomes 18.)
  25261.  
  25262.  For example, if you have a db/LIB file ("test.dbf") containing
  25263.  three fields and one record
  25264.  
  25265.     NUMERIC (length=4, # decimals=1)   = 1.2
  25266.     CHARACTER (length = 50)            = My Name
  25267.     DATE                               = 19901214
  25268.  
  25269.  and then you converted it using
  25270.  
  25271.     ISAMCVT /D test.dbf table test.mdb
  25272.  
  25273.  the program below will then show that the ISAM file contains the
  25274.  following:
  25275.  
  25276.      CustNum = 1.2
  25277.      Name    = My Name
  25278.      Date    = 12/14/19
  25279.  
  25280.  Code Sample
  25281.  -----------
  25282.  
  25283.  Note: PROISAM.EXE must be loaded before running this program inside of
  25284.  QBX.EXE.
  25285.  
  25286.  TYPE rectype
  25287.      CustNum AS DOUBLE
  25288.      Name AS STRING * 50
  25289.      Date AS DOUBLE
  25290.  END TYPE
  25291.  DIM a AS rectype
  25292.  OPEN "test.mdb" FOR ISAM rectype "table" AS #1
  25293.  SETINDEX #1, ""
  25294.  MOVEFIRST #1
  25295.  RETRIEVE #1, a
  25296.  PRINT a.CustNum
  25297.  PRINT a.Name
  25298.  PRINT MKD$(a.Date)
  25299.  CLOSE #1
  25300.  
  25301.  
  25302.  402. Example of How to Call BASIC SetUEvent from C; ON UEVENT GOSUB
  25303.  
  25304.  Product Version(s): 6.00 6.00b 7.00 7.10
  25305.  Operating System:   MS-DOS
  25306.  Flags: ENDUSER | SR# S910107-180 B_QUICKBAS S_C
  25307.  Last Modified: 14-FEB-1991    ArticleIdent: Q69159
  25308.  
  25309.  Page 310 of the "Microsoft BASIC 7.0: Programmer's Guide" states:
  25310.  
  25311.     Trapping a user-defined event involves writing a non-BASIC
  25312.     routine, such as in Microsoft Macro Assembler (MASM) or C, ....
  25313.  
  25314.  On the same page, this statement is followed by an example of how to
  25315.  set up the ON UEVENT GOSUB routine in assembly language.
  25316.  
  25317.  This article shows how the same example can be written in the
  25318.  Microsoft C language.
  25319.  
  25320.  The code example below applies to Microsoft QuickBASIC versions 4.00b
  25321.  and 4.50, to Microsoft BASIC Compiler versions 6.00 and 6.00b, and to
  25322.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  25323.  and 7.10 for MS-DOS.
  25324.  
  25325.  Compile the C program below with:
  25326.  
  25327.     CL -Od -AM -c uevent.c
  25328.  
  25329.  Compile the BASIC program below with:
  25330.  
  25331.     BC /O/V BASIC.BAS;
  25332.  
  25333.  Link the programs together with:
  25334.  
  25335.     LINK /NOE BASIC+UEVENT, UEVENT.EXE;
  25336.  
  25337.  When the program is executed, the line "Arrived here after 4.5
  25338.  seconds" will print every 4.5 seconds.
  25339.  
  25340.  Note: The C program must be compiled with the medium memory model
  25341.  because the DS register must point to BASIC's DGROUP space when
  25342.  SetUevent is called.
  25343.  
  25344.  BASIC Code Example, BASIC.BAS
  25345.  -----------------------------
  25346.  
  25347.  DECLARE SUB SetInt
  25348.  DECLARE SUB RestInt
  25349.  ' Install new interrupt service routine:
  25350.  CALL SetInt
  25351.  ' Set up the BASIC event handler:
  25352.  ON UEVENT GOSUB SpecialTask
  25353.  UEVENT ON
  25354.  
  25355.  DO
  25356.  ' Normal program operation occurs here.
  25357.  ' Program ends when any key is pressed.
  25358.  LOOP UNTIL INKEY$ <> ""
  25359.  
  25360.  ' Restore old interrupt service routine before quitting:
  25361.  CALL RestInt
  25362.  END
  25363.  
  25364.  ' Program branches here every 4.5 seconds:
  25365.  SpecialTask:
  25366.  ' Code for special task goes here, for example:
  25367.  PRINT "Arrived here after 4.5 seconds"
  25368.  RETURN
  25369.  
  25370.  C Code Example, UEVENT.C
  25371.  ------------------------
  25372.  
  25373.  #include <dos.h>
  25374.  void (_interrupt _far *OldInt) (void);    // The old interrupt vector.
  25375.  void _interrupt _far EventHandler (void);       // The UEVENT handler.
  25376.  char TimerTicks = 0;                      // Number of ticks elapsed.
  25377.  
  25378.  void pascal SetInt()                      // Set up the interrupts
  25379.  {                                         //   to point to the UEVENT
  25380.      OldInt = _dos_getvect(0x1C);          //    handler.
  25381.      _dos_setvect(0x1C, EventHandler);
  25382.  }
  25383.  
  25384.  void interrupt EventHandler()            // This is the UEVENT handler.
  25385.  {
  25386.      extern pascal SetUevent();
  25387.      if (++TimerTicks > 82)               // Check to see if 4.5 secs
  25388.        {                                  //    has elapsed (18.2
  25389.          TimerTicks = 0;                  //    ticks = 1 sec).
  25390.          SetUevent();
  25391.        }
  25392.      _chain_intr(OldInt);                // Continue through old
  25393.  }                                       //    interrupt routine.
  25394.  
  25395.  void pascal RestInt()                   // Restore old interrupt
  25396.  {                                       //    when done to avoid
  25397.      _dos_setvect(0x1C, OldInt);         //    conflicts after exit.
  25398.  }
  25399.  
  25400.  
  25401.  403. "Subscript Out of Range," Graphics GET with LONG Integer
  25402.  
  25403.  Product Version(s): 6.00 6.00b 7.00 7.10 | 6.00 6.00b 7.00 7.10
  25404.  Operating System:   MS-DOS               | OS/2
  25405.  Flags: ENDUSER | b_quickbas buglist6.00 buglist6.00b buglist7.00 buglist7.10
  25406.  Last Modified: 14-FEB-1991    ArticleIdent: Q69160
  25407.  
  25408.  If the graphics GET statement is used in a subprogram with a LONG
  25409.  integer array and if the starting index of the array is not the first
  25410.  element, a "Subscript out of Range" error will be generated if the
  25411.  program is compiled with BC /D. If the program is compiled without the
  25412.  /D option, BC.EXE will give an "Illegal function call" error.
  25413.  
  25414.  This problem does not occur in the QBX.EXE or QB.EXE environment.
  25415.  
  25416.  Microsoft has confirmed this to be a problem with Microsoft QuickBASIC
  25417.  versions 4.00, 4.00b, and 4.50 for MS-DOS; Microsoft BASIC compiler
  25418.  versions 6.00 and 6.00b for MS-DOS and MS OS/2; and Microsoft BASIC
  25419.  Professional Development System (PDS) versions 7.00 and 7.10 for
  25420.  MS-DOS and MS OS/2. We are researching this problem and will post new
  25421.  information here as it becomes available.
  25422.  
  25423.  The program below demonstrates the problem. Compile and link as
  25424.  follows:
  25425.  
  25426.     BC /D SAMPLE;
  25427.     LINK SAMPLE;
  25428.  
  25429.  When the program is run, it will draw a circle and then print
  25430.  "Subscript out of Range in line 7 of module SAMPLE."
  25431.  
  25432.  To work around this problem, either place the array in COMMON SHARED
  25433.  or use a local array instead of one that is passed as a parameter. It
  25434.  is also possible to uses SINGLE precision numbers instead of LONG
  25435.  integers.
  25436.  
  25437.  Code Sample: SAMPLE.BAS
  25438.  -----------------------
  25439.  
  25440.  DECLARE SUB test (array() AS LONG)
  25441.  1 DIM array(1000) AS LONG
  25442.  2 SCREEN 1
  25443.  3 CIRCLE (50, 50), 50
  25444.  4 CALL test(array())
  25445.  5 CLS
  25446.  6 PUT (100, 100), array(4)
  25447.  
  25448.  SUB test (array() AS LONG)
  25449.  7  GET (50, 50)-(100, 100), array(4)
  25450.  END SUB
  25451.  
  25452.  
  25453.  404. ISAMCVT Btrieve Specfiles Cannot Have Spaces; Must Use Commas
  25454.  
  25455.  Product Version(s): 7.00 7.10
  25456.  Operating System:   MS-DOS
  25457.  Flags: ENDUSER | docerr SR# S910205-152
  25458.  Last Modified: 14-FEB-1991    ArticleIdent: Q69343
  25459.  
  25460.  Page 392 of the "Microsoft BASIC 7.0: Programmer's Guide" (for BASIC
  25461.  PDS 7.00 and 7.10) gives an incorrect example of a Btrieve specfile.
  25462.  The fields of each entry are incorrectly shown separated by spaces;
  25463.  instead, the fields should be separated by commas.
  25464.  
  25465.  ISAMCVT specfiles must not contain spaces.
  25466.  
  25467.  This information applies to Microsoft BASIC PDS versions 7.00 and 7.10
  25468.  for MS-DOS.
  25469.  
  25470.  The specfile on page 392 should be changed to the following:
  25471.  
  25472.     string,4,StringCol
  25473.     integer,2,IntColumn
  25474.     Long,10,LongColumn
  25475.     Double,5,DoubleCol
  25476.  
  25477.  If ISAMCVT is run with this specfile and an appropriate Btrieve file,
  25478.  the Btrieve file will be successfully converted. Note that the
  25479.  specfile must specify the format for every column in the Btrieve file
  25480.  (for both indexes and non-indexes).
  25481.  
  25482.  Page 392 gives the following incorrect example of a Btrieve specfile:
  25483.  
  25484.     string 4 StringCol
  25485.     integer 2 IntColumn
  25486.     Long 10 LongColumn
  25487.     Double 5 DoubleCol
  25488.  
  25489.  ISAMCVT gives the following error message when using the above
  25490.  specfile:
  25491.  
  25492.     ISAMCVT: Invalid data type 'string 4 StringCol
  25493.     ' in line 1 of <specfilename>.
  25494.  
  25495.  ISAMCVT does not allow spaces as field separators. It is also illegal
  25496.  to mix commas and spaces as in the next example:
  25497.  
  25498.     string, 4, StringCol
  25499.     integer, 2, IntColumn
  25500.     Long, 10, LongColumn
  25501.     Double, 5, DoubleCol
  25502.  
  25503.  ISAMCVT gives the following error message when using the above
  25504.  specfile:
  25505.  
  25506.     ISAMCVT: Missing or invalid column name in line 1 of <specfilename>
  25507.  
  25508.  The fields of an ISAMCVT specfile must be separated by commas and no
  25509.  spaces should be in the file.
  25510.  
  25511.  
  25512.  
  25513.  
  25514.  
  25515.  
  25516.  Microsoft QuickBASIC
  25517.  =============================================================================
  25518.  
  25519.  
  25520.  1. Getting the DTA Address Using INT86
  25521.  
  25522.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  25523.  Operating System:   MS-DOS
  25524.  Flags: ENDUSER | B_BasicCom
  25525.  Last Modified: 28-DEC-1989    ArticleIdent: Q11785
  25526.  
  25527.  Problem:
  25528.  
  25529.  I would like to search for files with a given extension, save them in
  25530.  an array, and display them on the screen for user selection using
  25531.  QuickBASIC Version 2.00 and the DOS interrupt routine INT86. I have
  25532.  written a sample program that calls function 4E and 4F to find the
  25533.  desired files. They appear to be working correctly, as the flag
  25534.  returned in the low byte of register AX is showing 0 for each
  25535.  successful find and 18 when no files exist or when the last file has
  25536.  been found. However, I do not know how to read the DTA (Disk Transfer
  25537.  Address) after I successfully find a file, thus I cannot store the
  25538.  filename for later display.
  25539.  
  25540.  Response:
  25541.  
  25542.  In QuickBASIC Versions 2.00, 2.01, and 3.00, you can perform DOS
  25543.  Interrupts by calling the external routine INT86. In QuickBASIC
  25544.  Versions 4.00, 4.00b, and 4.50, you can call the external routines
  25545.  INT86OLD INT86XOLD INTERRUPT and INTERRUPTX.
  25546.  
  25547.  It is difficult to find the current DTA of a program (and its offset
  25548.  is subject to change without notice); therefore, it is better to ask
  25549.  DOS (via INT 21, function Hex 1A "Set DTA") to reassign the DTA to a
  25550.  location over which you have control. For the application indicated,
  25551.  you should try the following:
  25552.  
  25553.  1. Issue the DOS function call to change the DTA address (INT 21,
  25554.     function Hex 1A) to an address of a structure in your code space
  25555.     (this way you will know where to find it).
  25556.  
  25557.  2. Perform your "Find first" (INT 21, function Hex 4E).
  25558.  
  25559.  3. Perform your loop of "Continue file search" (INT 21, function Hex
  25560.     4F).
  25561.  
  25562.  Within your loop you may check your variables in the structure as
  25563.  desired. The "Microsoft MS-DOS Programmer's Reference" manual includes
  25564.  an example of how to set up the structure for the DTA in assembler.
  25565.  
  25566.  The book "Advanced MS-DOS," by Ray Duncan (Microsoft Press, 1986) also
  25567.  is a very helpful reference for using DOS function calls.
  25568.  
  25569.  
  25570.  2. "Illegal Number" Using -2147483648& in Long Integer Notation
  25571.  
  25572.  Product Version(s): 4.00 4.00b 4.50
  25573.  Operating System:   MS-DOS
  25574.  Flags: ENDUSER | SR# S890824-44 B_BasicCom
  25575.  Last Modified: 20-DEC-1989    ArticleIdent: Q48725
  25576.  
  25577.  BC.EXE, QB.EXE, and QBX.EXE do not allow the "&" character on the end
  25578.  of the smallest (negative) constant allowed for a long integer,
  25579.  -2147483648. To enter the smallest long integer constant in your
  25580.  source code, you must use either (-2147483647& - 1&) or -2147483648#.
  25581.  
  25582.  This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
  25583.  and 4.50 for MS-DOS, to Microsoft BASIC Compiler Versions 6.00 and
  25584.  6.00b for MS-DOS and MS OS/2, and to Microsoft BASIC PDS Version 7.00
  25585.  for MS-DOS and MS OS/2.
  25586.  
  25587.  The BC.EXE compiler reports an "Illegal type character in numeric
  25588.  constant" error, and the QB.EXE and QBX.EXE editors report an "Illegal
  25589.  number" error for the following statement:
  25590.  
  25591.     A& = -2147483648&
  25592.  
  25593.  The error may have surprised you since -2147483648& is within the
  25594.  allowed range for long integers (-2147483648& to +2147483647&).
  25595.  
  25596.  However, this is not a software problem. Both the BASIC compiler and
  25597.  the QB and QBX interpreters parse -2147483648& as follows:
  25598.  
  25599.     - (2147483648&)
  25600.  
  25601.  In other words, "take a large long integer and negate it." This means
  25602.  that the number is first parsed as a positive long integer and then it
  25603.  is negated before it is assigned to the number. However, the largest
  25604.  positive long integer is 2147483647 (one fewer than the largest
  25605.  negative number), making 2147483648& an illegal number, and therefore,
  25606.  causing an error.
  25607.  
  25608.  You must use one of the following instead:
  25609.  
  25610.     A& = (-2147483647& - 1&)
  25611.  or
  25612.     A& = -2147483648#
  25613.  
  25614.  
  25615.  3. Printing Delayed when DOS PRINT Command Invoked from SHELL
  25616.  
  25617.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  25618.  Operating System:   MS-DOS
  25619.  Flags: ENDUSER | B_BasicCom
  25620.  Last Modified:  7-FEB-1989    ArticleIdent: Q28208
  25621.  
  25622.  If you invoke the DOS Print utility during a SHELL, the printer output
  25623.  does not print until you exit QuickBASIC. This problem occurs because
  25624.  DOS Print is a terminate-and-stay-resident (TSR) program.
  25625.  
  25626.  Note: You should never install a TSR program, such as DOS Print, with
  25627.  the SHELL statement because it fragments memory. This can result in
  25628.  the following error messages: "Out of Memory" and "Program Too Large
  25629.  to Fit in Memory". You must reboot to eliminate the memory
  25630.  fragmentation.
  25631.  
  25632.  If you must SHELL to a TSR program, it must have been installed in
  25633.  memory before running the QuickBASIC program. Note: Many TSR programs
  25634.  may conflict with QuickBASIC with other symptoms, and may not be
  25635.  compatible.
  25636.  
  25637.  We do not recommended you use DOS Print, or any TSR program, with
  25638.  QuickBASIC. Due to a memory conflict, the printing will be delayed
  25639.  when the DOS Print is invoked during the execution of a SHELL command.
  25640.  
  25641.  In the first example below, printing occurs immediately because the
  25642.  Print is invoked (i.e., loaded into memory) prior to the running of
  25643.  QuickBASIC. In this case, Print takes a portion of memory for its
  25644.  buffer, QuickBASIC loads, the SHELL executes, and the previously
  25645.  allocated buffer is used.
  25646.  
  25647.  If DOS Print is initially invoked by the SHELL statement itself, then
  25648.  printing does not occur until after exiting QuickBASIC. In this case
  25649.  QuickBASIC loads, the SHELL executes, Print tries to set up the buffer
  25650.  but does not have enough room so it spools. Once memory is freed up,
  25651.  either after exiting QuickBASIC or after the SHELL is executed, a
  25652.  print buffer can be allocated and the DOS Print is executed. Similar
  25653.  limitations occur in earlier versions of the QuickBASIC compiler.
  25654.  
  25655.  Below is the first example. DOS Print is loaded prior to running
  25656.  QuickBASIC, and no delayed printing occurs in the following example:
  25657.  
  25658.  1. Invoke DOS Print utility. Resident portion of Print gets loaded
  25659.     into memory.
  25660.  
  25661.  2. Invoke the QuickBASIC editor (QB.EXE).
  25662.  
  25663.  3. Run the following program:
  25664.  
  25665.               CLS
  25666.               Shell "print filename"
  25667.               End
  25668.  
  25669.  Below is the second example. DOS Print is loaded by the SHELL
  25670.  statement itself, and printing is delayed until after leaving
  25671.  QuickBASIC, and memory is fragmented in the following example:
  25672.  
  25673.  1. Reboot.
  25674.  
  25675.  2. Invoke the QuickBASIC editor (QB.EXE).
  25676.  
  25677.  3. Run the program above. Print loads resident portion.
  25678.  
  25679.  
  25680.  4. Negative Array Subscripts Checked with Debug, /D
  25681.  
  25682.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  25683.  Operating System:   MS-DOS
  25684.  Flags: ENDUSER | B_BasicCom
  25685.  Last Modified: 28-DEC-1989    ArticleIdent: Q11880
  25686.  
  25687.  Question:
  25688.  
  25689.  I have two questions on subscripts in QuickBASIC, as follows:
  25690.  
  25691.  1. What is supposed to happen when I use negative array subscripts in
  25692.     QuickBASIC?
  25693.  
  25694.  2. Does QuickBASIC check the validity of subscripts?
  25695.  
  25696.  Response:
  25697.  
  25698.  The following are responses to your questions:
  25699.  
  25700.  1. Negative subscripts are not supported in Versions 3.00 and earlier,
  25701.     so when you use negative subscripts, the results are unpredictable.
  25702.     Versions 4.00 and later support the "TO" optional syntax, which allows
  25703.     for subscripts in the range of -32768 to 32767. However, invalid
  25704.     subscripts, such as negative values in Versions 3.00 and later, and
  25705.     subscripts out of range in all versions, are not checked for unless
  25706.     you have compiled with /D.
  25707.  
  25708.     For example, compile the following program with BC.EXE without /D:
  25709.  
  25710.        DIM A(10), B(10)
  25711.        A(9) = 1
  25712.        A(10) = 2
  25713.        PRINT B(-1)  'the value printed is 2, which is value of A(10)
  25714.        PRINT B(-2)  'the value printed is 1, which is the value of A(9)
  25715.        END
  25716.  
  25717.        Since BASIC may move items around in memory, the above results
  25718.        might not occur if there were other operations between the
  25719.        assignment statements and the PRINT statements.
  25720.  
  25721.  2. QuickBASIC checks subscript range validity when the /D switch is
  25722.     on, or when the Debug option is selected in the editors in Versions
  25723.     2.x and 3.00.
  25724.  
  25725.  
  25726.  5. List of BASICs Using MBF versus IEEE Floating-Point Format
  25727.  
  25728.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  25729.  Operating System:   MS-DOS
  25730.  Flags: ENDUSER | B_BasicCom
  25731.  Last Modified: 14-FEB-1991    ArticleIdent: Q11936
  25732.  
  25733.  This article lists which BASIC versions (for MS-DOS) use Microsoft
  25734.  Binary Format (MBF) and which versions use IEEE format for storing
  25735.  single- and double-precision floating-point numbers.
  25736.  
  25737.  Single- and double-precision real numbers are stored in the Microsoft
  25738.  Binary Format (MBF) in the following languages:
  25739.  
  25740.  1. QuickBASIC versions 1.00, 1.01, 1.02, 2.00, 2.01, and the
  25741.     non-coprocessor QB.EXE version 3.00, for MS-DOS
  25742.  
  25743.  2. IBM and Compaq BASICA Interpreters (BASICA.COM) for MS-DOS
  25744.  
  25745.  3. GW-BASIC Interpreter versions 3.20, 3.22, and 3.23 (GWBASIC.EXE)
  25746.     for MS-DOS
  25747.  
  25748.  4. Microsoft BASIC Interpreter version 5.28 for MS-DOS
  25749.  
  25750.  5. Microsoft BASIC Compiler versions 5.35 and 5.36 for MS-DOS
  25751.  
  25752.  QuickBASIC versions 4.00, 4.00b, and 4.50 (QB.EXE, BC.EXE) and the
  25753.  coprocessor version of QuickBASIC version 3.00 (QB87.EXE) use IEEE
  25754.  floating-point format for single- and double-precision real numbers.
  25755.  
  25756.  Note that Microsoft Business BASIC Compiler versions 1.00 and 1.10 use
  25757.  a different floating-point format called Decimal Math. Decimal Math is
  25758.  very slow but has no rounding or representation errors because numbers
  25759.  are stored in their exact decimal form, instead of in an approximate
  25760.  binary form. (Sales of Business BASIC were discontinued.)
  25761.  
  25762.  In QuickBASIC version 3.00, the coprocessor version of QuickBASIC uses
  25763.  IEEE format numbers. Conversion routines are provided in version 3.00
  25764.  to convert between the MBF used in the non-coprocessor version
  25765.  (QB.EXE) and the IEEE floating-point format used in the coprocessor
  25766.  version (QB87.EXE).
  25767.  
  25768.  QuickBASIC versions 4.00, 4.00b, and 4.50, Microsoft BASIC Compiler
  25769.  versions 6.00 and 6.00b, and Microsoft BASIC Professional Development
  25770.  System (PDS) versions 7.00 and 7.10 only use IEEE format numbers, but
  25771.  conversion routines and a compiler switch are provided to convert
  25772.  between MBF and IEEE format. This conversion is necessary if you want
  25773.  to retrieve floating-point numbers from random access files that were
  25774.  created using MBF.
  25775.  
  25776.  References:
  25777.  
  25778.  For additional articles that discuss MBF and IEEE, search for the
  25779.  following words:
  25780.  
  25781.     floating and point and format and QuickBASIC
  25782.  
  25783.  
  25784.  6. "Bad File Name"; OPEN "COM1:"; 8 Data Bits Must Have No Parity
  25785.  
  25786.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  25787.  Operating System:   MS-DOS
  25788.  Flags: ENDUSER | B_BasicCom
  25789.  Last Modified:  4-SEP-1990    ArticleIdent: Q12027
  25790.  
  25791.  When you use the OPEN "COM" statement with the data bits set to 8 and
  25792.  parity set to Even or Odd, you will get a "Bad File Name" error. For
  25793.  example, "Bad File Name" occurs at run time when you open the serial
  25794.  communications port as follows:
  25795.  
  25796.     OPEN "COM1:9600,E,8,1" AS 2
  25797.  
  25798.  This error disappears using 7 data bits, or No (N) parity.
  25799.  
  25800.  When you specify 8 data bits, you must specify a parity of N. This is
  25801.  a limitation in the design of QuickBASIC versions 1.00, 1.01, 1.02,
  25802.  2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50; Microsoft BASIC Compiler
  25803.  versions 6.00 and 6.00b for MS-DOS and MS OS/2; and Microsoft BASIC
  25804.  PDS versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  25805.  
  25806.  As a workaround in QuickBASIC versions 4.00 and later, Microsoft BASIC
  25807.  Compiler versions 6.00 or 6.00b, or BASIC PDS, you can call a
  25808.  Microsoft C version 5.10 routine from BASIC to do the communications
  25809.  with 8 bits and odd or even parity. The following book will help in
  25810.  doing this:
  25811.  
  25812.     "Microsoft C Programming for the IBM" by Robert Lafore (published by
  25813.     the Waite Group)
  25814.  
  25815.  The QuickBASIC Compiler, BASIC compiler 6.00, and BASIC PDS 7.00 are
  25816.  designed with a 10-bit data frame for communications. The frame is as
  25817.  follows:
  25818.  
  25819.              1 2  -  8 9 A
  25820.              S DDDDDDD P S
  25821.  
  25822.  Bit  1     = Start Bit    (Always 1)
  25823.  Bits 2 - 8 = Data Bits    (7 or 8)
  25824.  Bit  9     = Parity       (Odd, Even, or None)
  25825.  Bit  A     = Stop Bit(s)  (1 or 2)
  25826.  
  25827.  The combination of the bits should add up to 10 bits. When you try to
  25828.  set 1 start + 8 data + 1 parity + 1 stop, that adds up to an 11-bit
  25829.  data frame, which BASIC is not designed for.
  25830.  
  25831.  
  25832.  7. CLEAR Should Not Be Used in Event Trap
  25833.  
  25834.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  25835.  Operating System:   MS-DOS
  25836.  Flags: ENDUSER | B_BasicCom
  25837.  Last Modified:  4-JAN-1990    ArticleIdent: Q12074
  25838.  
  25839.  The presence of a CLEAR statement in the following event handling
  25840.  routine generates an "Illegal function call" error at compile time:
  25841.  
  25842.        CLEAR ,,800
  25843.        KEY(2) ON
  25844.        ON KEY(2) GOSUB 200
  25845.        WHILE INKEY$="" : WEND
  25846.        PRINT "this is a test"
  25847.        END
  25848.    200 CLEAR ,,800
  25849.        PRINT "this worked"
  25850.        RETURN
  25851.  
  25852.  The error occurs because the CLEAR statement changes the stack. The
  25853.  CLEAR statement is not allowed in an event handler because it would
  25854.  destroy the return address.
  25855.  
  25856.  
  25857.  8. How to Obtain Upper and Lower Bytes of an Integer
  25858.  
  25859.  Product Version(s): 4.00 4.00b 4.50
  25860.  Operating System:   MS-DOS
  25861.  Flags: ENDUSER | B_BasicCom
  25862.  Last Modified: 28-DEC-1989    ArticleIdent: Q27097
  25863.  
  25864.  The following program demonstrates how to obtain the upper and lower
  25865.  bytes of an integer. The following is sample code:
  25866.  
  25867.  CLS
  25868.  a% = &HA0B0
  25869.  ah% = (a% AND &HFF00) \ 256 AND &HFF   'Note: "\" means integer division
  25870.  al% = a% AND &HFF
  25871.  PRINT HEX$(ah%)                 'Prints upper bytes: A0
  25872.  PRINT HEX$(al%)                 'Prints lower bytes: B0
  25873.  
  25874.  This information applies to Microsoft QuickBASIC 4.00 4.00B and 4.50
  25875.  for MS-DOS, to Microsoft BASIC Compiler 6.00 and 6.00B for MS-DOS and
  25876.  MS OS/2, and to Microsoft BASIC PDS Version 7.00 for MS-DOS and MS
  25877.  OS/2.
  25878.  
  25879.  
  25880.  9. No Error Listing File in QB 2.00; Error-Only File in 2.01/3.00
  25881.  
  25882.  Product Version(s): 2.00 2.01 3.00
  25883.  Operating System:   MS-DOS
  25884.  Flags: ENDUSER |
  25885.  Last Modified: 19-OCT-1989    ArticleIdent: Q12243
  25886.  
  25887.  QuickBASIC Version 2.00 cannot list compiler errors to a file when
  25888.  compiling from the DOS command line (outside the QB.EXE editor) (see
  25889.  "Separate Compilation Method" in Appendix D of the "Microsoft
  25890.  QuickBASIC Compiler" Version 2.0 and 3.0 manual). This means that all
  25891.  debugging must be done in the QB.EXE Version 2.00 editor.
  25892.  
  25893.  In contrast, earlier versions of QuickBASIC (1.00, 1.01, and 1.02)
  25894.  give a listing (.LST) file that includes all source lines and flags
  25895.  those lines that have errors.
  25896.  
  25897.  Versions 2.01 and 3.00 have enhanced the Separate Compilation Method
  25898.  so that you can redirect compiler error messages to a file or device.
  25899.  If you compile from a DOS batch (.BAT) file, this feature allows you
  25900.  to automatically report the errors to an output file. For example:
  25901.  
  25902.     Command Line               Action
  25903.     ------------               ------
  25904.  
  25905.     QB TEST.BAS;               Compile TEST.BAS and display any errors
  25906.                                encountered on the screen.
  25907.  
  25908.     QB TEST.BAS; > TEST.LST    Compile TEST.BAS and redirect any error
  25909.                                messages generated to the file TEST.LST.
  25910.  
  25911.     QB TEST.BAS; > PRN         Redirects output to the DOS printer device.
  25912.  
  25913.  Only the lines in error and their associated error messages are sent
  25914.  to the screen or output file in 2.01 and 3.00. Source lines that don't
  25915.  have errors aren't listed.
  25916.  
  25917.  As there is no full-source-listing (.LST) output feature in QuickBASIC
  25918.  Versions 2.00, 2.01, and 3.00, there is also no compiler /A option to
  25919.  output the assembler translation of the BASIC code. The compiler /A
  25920.  option is supported only in QuickBASIC Versions 1.00, 1.02, 1.02,
  25921.  4.00, 4.00b, and 4.50.
  25922.  
  25923.  
  25924.  10. Explanation of String Space Garbage Collection; FRE Function
  25925.  
  25926.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  25927.  Operating System:   MS-DOS
  25928.  Flags: ENDUSER | B_BasicCom
  25929.  Last Modified: 29-DEC-1989    ArticleIdent: Q12337
  25930.  
  25931.  This article discusses three topics regarding string space
  25932.  compression:
  25933.  
  25934.  1. When QuickBASIC compresses string space during execution of a
  25935.     program
  25936.  
  25937.  2. Whether disabling string space compression is possible
  25938.  
  25939.  3. Whether string descriptors are fixed in memory or if they move
  25940.  
  25941.  This information applies to Microsoft QuickBASIC 4.00 4.00B and 4.50,
  25942.  to Microsoft BASIC Compiler 6.00 and 6.00B, and to Microsoft BASIC PDS
  25943.  Version 7.00 for MS-DOS and MS OS/2.
  25944.  
  25945.  1. When a string variable is assigned a new value, the new string
  25946.     takes the next available memory in string space. The old string
  25947.     value is deallocated but takes up space until string space "garbage
  25948.     collection" occurs.
  25949.  
  25950.     A program compresses string space as part of "garbage collection"
  25951.     when deallocated strings fill up the 60,000 bytes of available data
  25952.     space and the program needs to reallocate a string variable or a
  25953.     temporary string variable. You can force string compression with
  25954.     the FRE function [PRINT FRE("")], but there is no other way to
  25955.     predict when it will occur. An OPEN or CLOSE of a file can also
  25956.     trigger garbage collection.
  25957.  
  25958.  2. There is no way to disable the automatic garbage collection. At
  25959.     the time garbage collection occurs, your program is out of memory,
  25960.     so that if you were to disable it, your program could not continue
  25961.     to execute.
  25962.  
  25963.     You can schedule garbage collection to some extent by using the FRE
  25964.     function before executing code where you do not want garbage
  25965.     collection to occur, but if memory is tight, garbage collection may
  25966.     occur again anyway.
  25967.  
  25968.  3. String descriptors are the first bytes of each string, and they
  25969.     move as the strings move.
  25970.  
  25971.  
  25972.  11. Sperry PC BASIC's SCREEN B Is Not Supported
  25973.  
  25974.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  25975.  Operating System:   MS-DOS
  25976.  Flags: ENDUSER | B_BasicCom
  25977.  Last Modified: 28-DEC-1989    ArticleIdent: Q21792
  25978.  
  25979.  QuickBASIC does not support the SCREEN B statement found in the BASIC
  25980.  sold by Sperry with its PC/IT. This information also applies to
  25981.  Microsoft BASIC Compiler Versions 6.00 and 6.00b and to Microsoft
  25982.  BASIC PDS Version 7.00.
  25983.  
  25984.  
  25985.  12. No Support for More Than Two Communications Ports in BASIC
  25986.  
  25987.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  25988.  Operating System:   MS-DOS
  25989.  Flags: ENDUSER | B_BasicCom
  25990.  Last Modified: 26-MAR-1990    ArticleIdent: Q21789
  25991.  
  25992.  QuickBASIC does not support more than two communications ports.
  25993.  QuickBASIC supports only the devices COM1 and COM2. Some computers
  25994.  supply COM3 and COM4 devices, but these are not supported in compiled
  25995.  BASIC. This information applies to Microsoft QuickBASIC Versions 1.00,
  25996.  1.01, 1.02, 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50; to Microsoft
  25997.  BASIC Compiler Versions 6.00 and 6.00b; and to Microsoft BASIC
  25998.  Professional Development System (PDS) Version 7.00.
  25999.  
  26000.  To access COM3 and COM4, it may be possible for compiled BASIC to call
  26001.  third-party library routines, which are listed in catalogs such as the
  26002.  "Programmer's Connection Buyer's Guide," which can be obtained by
  26003.  calling (800) 336-1166 in the United States; (800) 225-1166 in Canada;
  26004.  or (216) 494-8899 for the Customer Service department. Using this
  26005.  catalog, you may wish to contact the company Software Interphase at
  26006.  401) 274-5465, for example, to determine if its product QuickComm
  26007.  supports COM3 and COM4 called from Microsoft compiled BASIC.
  26008.  
  26009.  When purchasing add-on products, make sure the vendor has tested its
  26010.  product under your version of BASIC. For a list of other catalogs,
  26011.  query on the following words:
  26012.  
  26013.     programmer and tool and catalog
  26014.  
  26015.  
  26016.  13. "/" Switches on the Wang PC
  26017.  
  26018.  Product Version(s): 1.00 1.01 1.02 2.00 3.00 4.00 4.00b 4.50
  26019.  Operating System:   MS-DOS
  26020.  Flags: ENDUSER |
  26021.  Last Modified: 17-FEB-1989    ArticleIdent: Q21795
  26022.  
  26023.  Problem:
  26024.  
  26025.  I cannot use compiler switches when I run BASCOM on a Wang PC. For
  26026.  example, BASCOM test.bas/E/D does not work correctly.
  26027.  
  26028.  Response:
  26029.  
  26030.  On some Wang PC models, you must use "-" instead of "/" for the
  26031.  QuickBASIC Version 1.x compiler switches.
  26032.  
  26033.  
  26034.  14. Compatibility with AT&T PC 6300: No SCREEN 100 or SCREEN B
  26035.  
  26036.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26037.  Operating System:   MS-DOS
  26038.  Flags: ENDUSER |  B_BasicCom
  26039.  Last Modified: 27-DEC-1989    ArticleIdent: Q21790
  26040.  
  26041.     In general, QuickBASIC works very well on the AT&T PC 6300
  26042.  computer. However, please note that in QuickBASIC Versions 2.x, 3.00,
  26043.  4.00, 4.00b, and 4.50 you must run QB with the /B option to see the
  26044.  QuickBASIC editor menus and help screens properly on the AT&T's
  26045.  monochrome monitor.
  26046.     The BASIC that comes with the AT&T PC 6300 has SCREEN B and SCREEN
  26047.  100 statements that are not supported in any version of QuickBASIC or
  26048.  IBM BASICA. However, QuickBASIC Version 4.00b has added a new screen
  26049.  mode, SCREEN 4, which is supported on the following machines:
  26050.  
  26051.     Olivetti Personal Computers, models M24, M28, M240, M280, M380
  26052.     AT&T 6300 Personal Computer series
  26053.  
  26054.     SCREEN 4 is a 640x400 graphics mode that allows you to specify one
  26055.  of 16 colors (0-15) as the foreground color. Use the SCREEN statement
  26056.  to select the mode and the COLOR statement to select the foreground
  26057.  color. The example below shows how to specify this mode with a blue
  26058.  foreground color:
  26059.  
  26060.     SCREEN 4
  26061.     COLOR 1
  26062.  
  26063.     You must invoke QB with the /B option on the AT&T PC 6300 because
  26064.  the AT&T has a graphics card and a monochrome monitor installed.
  26065.  QuickBASIC can detect what graphics card is installed, but you have to
  26066.  tell it with the /B option that a monochrome monitor is installed.
  26067.  (Please read about the QB /B option on Page 72 of the "Microsoft
  26068.  QuickBASIC Compiler" manual for Versions 2.x and 3.00, or Page 49 of
  26069.  the "QuickBASIC Version 4.00: Learning and Using" manual.)
  26070.     The BASIC interpreter provided with the AT&T 6300 gives a cursor on
  26071.  graphics screens; however, there is no cursor in IBM BASICA or
  26072.  Microsoft QuickBASIC when working with graphics screens.
  26073.     On the AT&T machines, the communications ports ("COM1:" and
  26074.  "COM2:") produce errors such as "Device not available" in QuickBASIC
  26075.  Versions 1.00, 1.01, and 1.02. QuickBASIC Versions 2.x and later have
  26076.  had few reports of problems with communications on the AT&T PC 6300.
  26077.  
  26078.  
  26079.  15. Communications Device Buffer Size Can Be Set with /C: Switch
  26080.  
  26081.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26082.  Operating System:   MS-DOS
  26083.  Flags: ENDUSER | docerr B_BasicCom
  26084.  Last Modified: 29-DEC-1989    ArticleIdent: Q21787
  26085.  
  26086.  The communications device receiving buffer size can be set with the
  26087.  /C: compiler switch. For example, in Versions 1.x, you can set the COM
  26088.  receiving buffer to 1000 bytes by compiling BASCOM/C:1000. This
  26089.  information needs to be added to Pages 46 and 176 in the "Microsoft
  26090.  QuickBASIC Compiler" documentation for Versions 1.x. Note that for
  26091.  Version 1.x, if you specify a buffer between 1 and 255 in QuickBASIC,
  26092.  you always get 255 bytes; in IBM BASICA Interpreter you get whatever
  26093.  buffer size you specify.
  26094.  
  26095.  In Versions 2.x and 3.00, the communications buffer must be set before
  26096.  invoking the editor. This action is done in a similar manner, for
  26097.  example, QB/C:xxxx, where xxxx represents the desired number of bytes.
  26098.  The command line method of compilation is also similar, but the
  26099.  command line ends with a semicolon (;), for example, QB program/C:xxxx;.
  26100.  
  26101.  In Versions 4.00, 4.00b, and 4.50, you may set the transmission buffer
  26102.  size as well as the receiving buffer size.
  26103.  
  26104.  
  26105.  16. Cannot Access FIELDed Variables After CLOSE in Compiled BASIC
  26106.  
  26107.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26108.  Operating System:   MS-DOS
  26109.  Flags: ENDUSER | docerr B_BasicCom
  26110.  Last Modified: 15-MAR-1989    ArticleIdent: Q21815
  26111.  
  26112.  Problem:
  26113.  
  26114.  I cannot access FIELDed variables after I close the random access
  26115.  file. I am able to access the variables in IBM BASICA, but not in the
  26116.  QuickBASIC compiler.
  26117.  
  26118.  Response:
  26119.  
  26120.  This is a difference between the IBM BASICA Interpreter and the
  26121.  QuickBASIC Compiler.
  26122.  
  26123.  You must assign the FIELDed variables to unFIELDed string variables to
  26124.  access the data in the FIELD buffer after the file is closed.
  26125.  
  26126.  Note: If the file is closed, and a FIELD variable is used as an
  26127.  argument to a function, you may receive an "Illegal Function Call"
  26128.  message.
  26129.  
  26130.  This information needs to be added to Appendix A "Converting BASICA
  26131.  Programs to QuickBASIC" in the following manuals:
  26132.  
  26133.  1. "Microsoft BASIC Compiler Version 6.00 for MS OS/2 and MS-DOS:
  26134.     Learning and Using Microsoft QuickBASIC"
  26135.  
  26136.  2. "Microsoft QuickBASIC: Programming in BASIC Version 4.50"
  26137.  
  26138.  This information can also be added to Chapter 10,
  26139.  "Compiler-Interpreter Language Differences," of the "Microsoft
  26140.  QuickBASIC Compiler" Versions 2.0x and 3.00 manual.
  26141.  
  26142.  
  26143.  17. QB 4.50 SETUP.EXE Hanging Problem on Leading Edge Model D
  26144.  
  26145.  Product Version(s): 4.50
  26146.  Operating System:   MS-DOS
  26147.  Flags: ENDUSER | SR# S900510-44
  26148.  Last Modified: 27-JUL-1990    ArticleIdent: Q64099
  26149.  
  26150.  Two separate customers reportedly hung their Leading Edge Model D
  26151.  computers after executing the QuickBASIC version 4.50 installation
  26152.  program (SETUP.EXE on the Setup/Microsoft QB Express Disk) under DOS
  26153.  version 3.20. Microsoft could not duplicate this problem using either
  26154.  MS-DOS or PC-DOS version 3.20. The reported problem did not occur when
  26155.  the customers attempted installation with the next version of the
  26156.  operating system, DOS version 3.21, on their Leading Edge Model D
  26157.  computers.
  26158.  
  26159.  Please note that the SETUP.EXE program for QuickBASIC 4.50 is mostly a
  26160.  file-transferring program. To work around the problem above without
  26161.  upgrading DOS, you can set up QuickBASIC by simply copying the files
  26162.  directly from the original distribution disks.
  26163.  
  26164.  The QB Express program can also be copied and run from a hard disk. To
  26165.  run QB Express, copy all files on the root directory of the
  26166.  Setup/Microsoft QB Express disk. Then type LEARN to start QB Express.
  26167.  
  26168.  
  26169.  18. Support for IBM EGA and Hercules Graphics Cards
  26170.  
  26171.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  26172.  Operating System:   MS-DOS
  26173.  Flags: ENDUSER | B_BasicCom
  26174.  Last Modified: 29-DEC-1989    ArticleIdent: Q21839
  26175.  
  26176.  This article describes which versions of QuickBASIC support the IBM
  26177.  EGA (Enhanced Graphics Adapter) Card and which versions support
  26178.  Hercules Monochrome Graphics Cards.
  26179.  
  26180.  EGA Support
  26181.  -----------
  26182.  
  26183.  QuickBASIC Versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50 support
  26184.  EGA through the use of SCREEN modes 7, 8, 9, and 10. QuickBASIC
  26185.  Versions 1.00, 1.01, and 1.02 do not support the EGA. The 43-line EGA
  26186.  mode is supported in the Editor and in the WIDTH statement in
  26187.  QuickBASIC Versions 3.00, 4.00, 4.00b, and 4.50. The EGA is also
  26188.  supported in OS/2 real mode and MS-DOS for programs compiled with
  26189.  Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS and MS
  26190.  OS/2, and Microsoft BASIC PDS Version 7.00. The EGA is not currently
  26191.  supported for BASIC programs that run in OS/2 protected mode.
  26192.  
  26193.  Hercules Support
  26194.  ----------------
  26195.  
  26196.  Microsoft QuickBASIC Versions 4.00 and later, the Microsoft BASIC
  26197.  Compiler 6.00 and 6.00B, and Microsoft BASIC PDS 7.00 all support the
  26198.  Hercules Monochrome Graphics Card, Hercules Graphics Card Plus,
  26199.  Hercules InColor Card, and cards that are 100 percent compatible with
  26200.  these cards. The following describes how Hercules cards are supported
  26201.  in QuickBASIC:
  26202.  
  26203.  1. Hercules graphics mode is SCREEN 3.
  26204.  
  26205.  2. Hercules text mode is SCREEN 0.
  26206.  
  26207.  3. With Hercules, you must use a monochrome monitor.
  26208.  
  26209.  4. You must load the Hercules driver (QBHERC.COM) before running your
  26210.     program. If the driver is not loaded, the SCREEN 3 statement gives
  26211.     an "Illegal function call" error message. Type "QBHERC" to load the
  26212.     driver.
  26213.  
  26214.  5. The text dimensions are 80x25 (9x14 character box); the bottom two
  26215.     scan lines of the 25th row are not visible.
  26216.  
  26217.  6. The resolution is 720x348 pixels, monochrome.
  26218.  
  26219.  7. SCREEN 3 supports two pages (0 and 1); SCREEN 0 used with Hercules
  26220.     supports only one page.
  26221.  
  26222.  8. The PALETTE statement is not supported.
  26223.  
  26224.  9. To make function calls to the Microsoft Mouse, you must follow
  26225.     special instructions for Hercules cards in the "Microsoft Mouse
  26226.     Programmer's Reference Guide." (This manual must be ordered
  26227.     separately; it is not supplied with either the QuickBASIC or the
  26228.     Microsoft Mouse packages.)
  26229.  
  26230.  The use of Hercules cards is also documented in the README.DOC file on
  26231.  the QuickBASIC Version 4.00, 4.00b, and 4.50 release disk, which
  26232.  supplements the Microsoft QuickBASIC Compiler documentation.
  26233.  
  26234.  
  26235.  19. Integer Overflow Handling in Compiler Differs from Interpreter
  26236.  
  26237.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26238.  Operating System:   MS-DOS
  26239.  Flags: ENDUSER |
  26240.  Last Modified: 27-DEC-1989    ArticleIdent: Q21844
  26241.  
  26242.  Question:
  26243.     Why does the compiler give negative numbers or "Overflow" errors in
  26244.  intermediate calculations involving two integers, when the same program
  26245.  works correctly in the IBM BASICA and GW-BASIC Interpreters?
  26246.     The following program is an example of the problem:
  26247.  
  26248.     10 FOR I%=240 TO 300
  26249.     20 Z! = INT( 130 * I% )
  26250.     30 PRINT I%,Z!
  26251.     40 NEXT
  26252.  
  26253.     The above program will give incorrect negative results in
  26254.  QuickBASIC Version 1.x when I% exceeds 252 and Z! exceeds 32K
  26255.  (32,767).
  26256.     In QuickBASIC Versions 2.x and greater, you will get an "Overflow"
  26257.  error.
  26258.     The same program will run in GW-BASIC and IBM BASICA completely
  26259.  through to I%=300 and print the correct values for Z!.
  26260.  
  26261.  Response:
  26262.     The above program will work properly if you make the integer
  26263.  constant "130" into a single-precision constant ("130!" or "130.") or
  26264.  double-precision constant "130#" as shown in the following example:
  26265.  
  26266.     20 Z! = INT( 130! * I% )
  26267.  
  26268.     QuickBASIC Version 1.x should not give negative results when an
  26269.  integer overflow occurs. This problem was corrected in Version 2.x and
  26270.  later, in which you properly get an "Overflow" message.
  26271.     The QuickBASIC compiler handles integer overflow differently than
  26272.  the GW-BASIC and IBM BASICA Interpreters handle it.
  26273.     When the compiler compiles a mathematical expression, it has to
  26274.  decide at compile time how to most efficiently optimize the expression
  26275.  into machine language. When the compiler sees the intermediate
  26276.  calculation 130*I% in the above program, it decides to restrict it to
  26277.  integer limits at compile time because 130*I% is the product of two
  26278.  integers. Changing the intermediate expression to the product of an
  26279.  integer and a higher-precision constant or variable will prevent the
  26280.  overflow problem.
  26281.     The interpreters are able to dynamically make the decision at
  26282.  run time to convert 130*I% to a single-precision constant to avoid
  26283.  integer overflow. The disadvantage of dynamic handling is the slower
  26284.  speed of the interpreters when compared with the compiler.
  26285.  
  26286.  
  26287.  20. Duplicate Labels Can Only Be Separately Compiled             s
  26288.  
  26289.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26290.  Operating System:   MS-DOS
  26291.  Flags: ENDUSER | docerr
  26292.  Last Modified: 27-DEC-1989    ArticleIdent: Q21862
  26293.  
  26294.  Question:
  26295.  
  26296.  Can I use the same line numbers or line labels in different
  26297.  subprograms that are compiled in the same source file?
  26298.  
  26299.  Response:
  26300.  
  26301.  No, but you can use the same line numbers or line labels if the
  26302.  subprograms are separately compiled.
  26303.  
  26304.  Line numbers and labels are local to the compiled module in which they
  26305.  occur. Line numbers and labels must be unique within a given compiled
  26306.  module. You do not need to worry about duplicate labels in separately
  26307.  compiled modules.
  26308.  
  26309.  Note that using the REM $INCLUDE metacommand to include source code
  26310.  from a separate file is similar to putting the two sources into one
  26311.  file. Any files included at compile time with the REM $INCLUDE
  26312.  metacommand are considered as part of that module, and are included in
  26313.  the .OBJ file.
  26314.  
  26315.  This information needs to be added to Section 9.2.1, "Using Line
  26316.  Labels", on Page 160 of the "Microsoft QuickBASIC Compiler" manual for
  26317.  Versions 2.00, 2.01, and 3.00.
  26318.  
  26319.  
  26320.  21. CALL ABSOLUTE "Unresolved Subprogram Reference," "Not Defined"
  26321.  
  26322.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  26323.  Operating System:   MS-DOS
  26324.  Flags: ENDUSER | B_BasicCom
  26325.  Last Modified: 27-DEC-1989    ArticleIdent: Q21899
  26326.  
  26327.  Problem:
  26328.  
  26329.  When I attempt to use the CALL ABSOLUTE statement in the QB.EXE
  26330.  editor, I get an "Unresolved Subprogram Reference" error message at
  26331.  compile time in QuickBASIC Versions 2.00, 2.01, and 3.00. I get a
  26332.  "Subprogram not defined" error message in QB.EXE in QuickBASIC
  26333.  Versions 4.00, 4.00b, 4.50.
  26334.  
  26335.  Response:
  26336.  
  26337.  For QuickBASIC Versions 4.00, 4.00b, 4.50
  26338.  -----------------------------------------
  26339.  
  26340.  The routine named ABSOLUTE is an external assembly language routine
  26341.  located in the QB.QLB Quick library (and in the QB.LIB linker
  26342.  library). To invoke CALL ABSOLUTE from within the QB.EXE 4.00, 4.00b,
  26343.  or 4.50 editor, you must invoke QB /L to load the QB.QLB Quick
  26344.  library. If you choose Make EXE File... from the Run menu, QuickBASIC
  26345.  then automatically links your program with QB.LIB.
  26346.  
  26347.  For QuickBASIC Versions 2.00, 2.01, 3.00
  26348.  ----------------------------------------
  26349.  
  26350.  The routine called ABSOLUTE is an external assembly language routine
  26351.  located in a file called USERLIB.OBJ in QuickBASIC Versions 2.00 and
  26352.  2.01, and in a file called ABSOLUTE.OBJ in Version 3.00. To CALL
  26353.  ABSOLUTE, you will need to build a user library containing ABSOLUTE's
  26354.  .OBJ file, or link your program directly to it, as in the following
  26355.  examples:
  26356.  
  26357.  1. To CALL ABSOLUTE from a user library in Versions 2.00 and 2.01, do
  26358.     the following:
  26359.  
  26360.        BUILDLIB USERLIB.OBJ,USELIB1.EXE;
  26361.        QB test.bas/L USELIB1.EXE;
  26362.  
  26363.     To LINK TEST.BAS to ABSOLUTE in Versions 2.00 and 2.01, do the
  26364.     following:
  26365.  
  26366.        QB test.bas;
  26367.        LINK test.OBJ+USERLIB.OBJ;
  26368.  
  26369.  2. To CALL ABSOLUTE from a user library in Version 3.00, do the
  26370.     following:
  26371.  
  26372.        BUILDLIB ABSOLUTE.OBJ,USELIB1.EXE;
  26373.        QB test.bas/L USELIB1.EXE;
  26374.  
  26375.     To LINK TEST.BAS to ABSOLUTE in Version 3.00, do the following:
  26376.  
  26377.        QB test.bas;
  26378.        LINK test.OBJ+ABSOLUTE.OBJ;
  26379.  
  26380.  
  26381.  22. QuickBASIC and BASIC Compiler 6.00 Support Only MS-NET, PC-NET
  26382.  
  26383.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.50
  26384.  Operating System:   MS-DOS
  26385.  Flags: ENDUSER | B_BasicCom
  26386.  Last Modified: 29-DEC-1989    ArticleIdent: Q21850
  26387.  
  26388.  The only network supported by QuickBASIC versions earlier than and
  26389.  including Version 4.50 is the MS-NET family, including IBM PC-NET.
  26390.  
  26391.  Microsoft BASIC Compiler Versions 6.00 and 6.00b and Microsoft BASIC
  26392.  PDS Version 7.00 also only support networks in the MS-NET family,
  26393.  including IBM PC-NET.
  26394.  
  26395.  
  26396.  23. FILES Statement Always Displays Name of Current Directory
  26397.  
  26398.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26399.  Operating System:   MS-DOS
  26400.  Flags: ENDUSER |
  26401.  Last Modified: 27-DEC-1989    ArticleIdent: Q21809
  26402.  
  26403.  Problem:
  26404.     When I request a directory listing of a subdirectory other than the
  26405.  current directory using FILES "\subdir", I get the file list for the
  26406.  different subdirectory, but I get the name of the current directory
  26407.  displayed at the top. I expected the requested subdirectory name to be
  26408.  at the top.
  26409.  
  26410.  Response:
  26411.     The FILES statement in QuickBASIC is behaving in a manner
  26412.  consistent with BASICA and GW-BASIC Version 3.20. It is not likely that
  26413.  this behavior will change.
  26414.  
  26415.  
  26416.  24. 8087 Coprocessor Support for QuickBASIC
  26417.  
  26418.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26419.  Operating System:   MS-DOS
  26420.  Flags: ENDUSER |
  26421.  Last Modified: 27-DEC-1989    ArticleIdent: Q21819
  26422.  
  26423.  Question:
  26424.  
  26425.  Does QuickBASIC support the 8087 or 80287 coprocessor?
  26426.  
  26427.  Response:
  26428.  
  26429.  QuickBASIC Versions 3.00 and later support the 8087 and 80287 coprocessor.
  26430.  
  26431.  The QuickBASIC Versions 1.x and 2.x do not support the 8087 chip.
  26432.  However, Hauppage Computer Works, New York (516-360-3827), may offer a
  26433.  library to which you can link to provide this support.
  26434.  
  26435.  
  26436.  25. Compatibility of Compiled BASIC with Microsoft Windows
  26437.  
  26438.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26439.  Operating System:   MS-DOS
  26440.  Flags: ENDUSER |  B_BasicCom
  26441.  Last Modified: 21-SEP-1990    ArticleIdent: Q21831
  26442.  
  26443.  This article discusses compatibility between Microsoft Windows and the
  26444.  following BASIC products and their compiled programs: QuickBASIC for
  26445.  the IBM PC, Microsoft BASIC Compiler versions 6.00 and 6.00b for
  26446.  MS-DOS, and Microsoft BASIC Professional Development System (PDS)
  26447.  versions 7.00 and 7.10 for MS-DOS and MS OS/2.
  26448.  
  26449.  Windows 3.00 Compatibility
  26450.  --------------------------
  26451.  
  26452.  If you use Microsoft Windows version 3.00 with the special 386
  26453.  enhanced mode, you can run a BASIC program in a text window, which you
  26454.  could not do in earlier versions of Windows. In 386 enhanced mode,
  26455.  BASIC programs can run as background processes in the text window. In
  26456.  earlier Windows releases, you could only run BASIC programs as
  26457.  full-screen processes. However, in both Windows 3.00 and in earlier
  26458.  versions, you cannot run the QB.EXE or QBX.EXE editor in a window; you
  26459.  must instead run QB.EXE or QBX.EXE as a full-screen process.
  26460.  
  26461.  In Windows 3.00 standard mode (WIN /r) and real mode (WIN /s), you can
  26462.  run a compiled program, QB.EXE, or QBX.EXE only as full-screen
  26463.  processes, which means that they won't run in the background. You
  26464.  cannot press the Windows key combinations CTRL+ESC or ALT+ESC to get
  26465.  out of the full-screen BASIC program. Furthermore, other Windows
  26466.  processes will be stopped while you run the full-screen process. You
  26467.  must terminate the BASIC program to return to Windows.
  26468.  
  26469.  Windows 1.x, 2.x Compatibility
  26470.  ------------------------------
  26471.  
  26472.  Compiled BASIC programs, QB.EXE, and QBX.EXE run only as "bad
  26473.  applications" in Microsoft Windows versions 1.x and 2.x. "Bad
  26474.  applications" require you to create a PIF (Program Information File)
  26475.  using the Windows PIFEDIT.EXE program. When you make a PIF for QB.EXE,
  26476.  QBX.EXE, or BASIC compiled programs, you need to specify that the
  26477.  program directly modifies the screen, the keyboard, COM1, COM2, and
  26478.  memory. QuickBASIC version 4.00, 4.00b, and 4.50 programs have been
  26479.  successfully tested under Microsoft Windows 1.x and 2.x.
  26480.  
  26481.  The QB.PIF or QBX.PIF file provided on the QuickBASIC 4.00, 4.00b, and
  26482.  4.50, BASIC compiler 6.00 and 6.00b, or BASIC PDS 7.00 and 7.10
  26483.  release disks can be studied in PIFEDIT.EXE as a guideline for making
  26484.  your own PIF files for your compiled .EXE programs.
  26485.  
  26486.  Neither QuickBASIC version 3.00 and its earlier versions nor Microsoft
  26487.  BASIC Compiler 5.36 or earlier versions have been tested under
  26488.  Microsoft Windows. Therefore, they may or may not run successfully as
  26489.  bad applications.
  26490.  
  26491.  
  26492.  26. Reserved Words Not Necessarily Implemented as Features
  26493.  
  26494.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26495.  Operating System:   MS-DOS
  26496.  Flags: ENDUSER | B_BasicCom
  26497.  Last Modified: 28-DEC-1989    ArticleIdent: Q21832
  26498.  
  26499.  This article discusses why some of the reserved words listed in the
  26500.  manual are not implemented in QuickBASIC. For example, LCOPY is not
  26501.  supported in QuickBASIC Version 1.00, 1.01, 1.02, 2.00, 2.01, 3.00,
  26502.  4.00, 4.00b, or 4.50 for MS-DOS, Microsoft BASIC Compiler Version
  26503.  6.00, 6.00b for MS-DOS and MS OS/2, or Microsoft BASIC PDS Version
  26504.  7.00 for MS-DOS and MS OS/2. Another case is where PALETTE and PALETTE
  26505.  USING were not supported in QuickBASIC Versions 1.x, but were added in
  26506.  Versions 2.00 and later.
  26507.  
  26508.  Keywords are reserved for reasons of compatibility with past, present,
  26509.  and future versions of Microsoft BASIC. A list of reserved words is
  26510.  provided to warn programmers not to use keywords used in past and
  26511.  present versions of Microsoft BASIC. Some words are on the list but
  26512.  not currently implemented or supported because these reserved words
  26513.  represent possible additions for future versions of BASIC.
  26514.  
  26515.  
  26516.  27. .EXE File Size Larger than Other BASIC Compilers
  26517.  
  26518.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26519.  Operating System:   MS-DOS
  26520.  Flags: ENDUSER |
  26521.  Last Modified: 27-DEC-1989    ArticleIdent: Q21833
  26522.  
  26523.  Question:
  26524.  
  26525.  Why is an .EXE file compiled in QuickBASIC larger than an .EXE file
  26526.  compiled in the IBM Version 1.0 BASIC Compiler or the generic
  26527.  Microsoft MS-DOS BASIC Compiler Version 5.36?
  26528.  
  26529.  Response:
  26530.  
  26531.  QuickBASIC .EXE programs are larger because of added features and
  26532.  functionality. A program compiled with QuickBASIC will usually be
  26533.  larger than one compiled with older compilers.
  26534.  
  26535.  
  26536.  28. Last SOUND Truncated at End of Program
  26537.  
  26538.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26539.  Operating System:   MS-DOS
  26540.  Flags: ENDUSER |
  26541.  Last Modified: 28-DEC-1989    ArticleIdent: Q21835
  26542.  
  26543.  Question:
  26544.  
  26545.  When I put SOUND statements at the end of the program and run the .EXE
  26546.  file, why is the sound truncated at the end?
  26547.  
  26548.  Response:
  26549.  
  26550.  When a program ends, the BASIC run-time system is exited, which
  26551.  immediately stops any SOUND whose duration exceeds the time taken to
  26552.  execute any remaining statements in the program. If you have
  26553.  QuickBASIC Version 2.00 or later, the problem will not occur in the
  26554.  editor environment, because the run-time system is still available.
  26555.  
  26556.  To give the program time to complete its SOUND statements, give the
  26557.  program something to do after the SOUND (a dummy loop for example) so
  26558.  that the SOUND has time to finish before the program terminates.
  26559.  
  26560.  
  26561.  29. Length of Strings, String Descriptors in Compiler, Interpreter
  26562.  
  26563.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26564.  Operating System:   MS-DOS
  26565.  Flags: ENDUSER | B_BasicCom B_GWBasicI
  26566.  Last Modified:  1-AUG-1990    ArticleIdent: Q21836
  26567.  
  26568.  String variables in QuickBASIC versions 1.00 through 4.50 and in
  26569.  Microsoft BASIC Compiler versions 6.00 and 6.00b and in Microsoft
  26570.  BASIC Professional Development System (PDS) versions 7.00 and 7.10 can
  26571.  contain up to 32,767 characters (32K). Each variable-length string
  26572.  variable has a 4-byte string descriptor, which is composed of a 2-byte
  26573.  length followed by a 2-byte address.
  26574.  
  26575.  Fixed-length strings (which were introduced in QuickBASIC versions
  26576.  4.00 and later and in BASIC compiler 6.00 and later) do not have a
  26577.  string descriptor.
  26578.  
  26579.  For comparison, variable-length string variables in Microsoft GW-BASIC
  26580.  (versions 3.20, 3.22, 3.23) and IBM BASICA Interpreters have 3-byte
  26581.  string descriptors, with 1 byte of length followed by 2 bytes of
  26582.  address. String variables may contain up to 255 characters in GW-BASIC
  26583.  and IBM BASICA.
  26584.  
  26585.  
  26586.  30. Maximum Number of Records in a Random Access File
  26587.  
  26588.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26589.  Operating System:   MS-DOS
  26590.  Flags: ENDUSER |
  26591.  Last Modified: 22-JAN-1990    ArticleIdent: Q21811
  26592.  
  26593.  Question:
  26594.  
  26595.  What is the largest number of records that I can use in a random
  26596.  access file?
  26597.  
  26598.  Response:
  26599.  
  26600.  The maximum relative record number for QuickBASIC Versions 3.00 and
  26601.  earlier is 16,777,215 (16 megabytes).
  26602.  
  26603.  QuickBASIC Version 4.00 is capable of handling up to 2 to the 31st
  26604.  power minus 1 (or 2,147,483,647), but DOS limits you to 32 megabytes
  26605.  of one-byte records.
  26606.  
  26607.  For all versions of QuickBASIC, a record length cannot exceed 32,767
  26608.  bytes.
  26609.  
  26610.  DOS versions up to Version 3.30 and OS/2 Version 1.00 limit you to a
  26611.  total file size of 32 megabytes, or 32,768,000 bytes. The following
  26612.  are two examples of the maximum number of records allowed:
  26613.  
  26614.  1. 8.192 million records with 4 bytes each
  26615.  
  26616.  2. 2.048 million records with 16 bytes each
  26617.  
  26618.  
  26619.  31. WIDTH 40, WIDTH 80; "Illegal Function Call"
  26620.  
  26621.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26622.  Operating System:   MS-DOS
  26623.  Flags: ENDUSER |
  26624.  Last Modified: 21-DEC-1988    ArticleIdent: Q21859
  26625.  
  26626.  Question:
  26627.  
  26628.  Why do I get an "Illegal Function Call" using a WIDTH statement with a
  26629.  width other than 40 or 80?
  26630.  
  26631.  Response:
  26632.  
  26633.  The WIDTH statement operates the same way in QuickBASIC as it does in
  26634.  the GW-BASIC Version 3.20 and IBM BASICA interpreters.
  26635.  
  26636.  To change the allowed width of screen output, you need to open the
  26637.  "SCRN:" device and output as follows:
  26638.  
  26639.    width "scrn:",11    ' Sets screen width to 11 characters.
  26640.    open "scrn:" for output as #1
  26641.    print#1, "123456789012345678901234567890"
  26642.    close
  26643.  
  26644.  
  26645.  32. < RESUME Linenumber > Is Not Allowed for Subprograms
  26646.  
  26647.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00
  26648.  Operating System:   MS-DOS
  26649.  Flags: ENDUSER | docerr
  26650.  Last Modified: 16-NOV-1988    ArticleIdent: Q21805
  26651.  
  26652.  Question:
  26653.  
  26654.  How can I use ON ERROR GOTO to trap errors that occur inside of
  26655.  subprograms separately compiled from the main program in QuickBASIC
  26656.  Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00, and 4.00 for MS-DOS?
  26657.  
  26658.  Response:
  26659.  
  26660.  The following information should be added to the "Microsoft QuickBASIC
  26661.  Compiler" documentation for Versions 1.x, 2.x, and 3.00:
  26662.  
  26663.  Error handling in separately compiled subprograms should be coded in
  26664.  the following fashion:
  26665.  
  26666.     SUB test STATIC
  26667.     ON ERROR GOTO errortrap
  26668.        ' body of subprogram
  26669.     END SUB
  26670.     errortrap:
  26671.        ' The error is handled here:
  26672.        PRINT "Error Number Trapped="ERR
  26673.        RESUME NEXT
  26674.  
  26675.  In QuickBASIC Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00, and 4.00,
  26676.  the ON ERROR GOTO Label statement must be established for each module;
  26677.  otherwise, an error occurring in that module will not be trapped, and
  26678.  the program will stop. In QuickBASIC Versions 4.00 and earlier, error
  26679.  handling routines are local to each separately compiled module. A
  26680.  given error handling routine serves all subprograms that are compiled
  26681.  in the same module. To trap errors, the ON ERROR GOTO statement should
  26682.  appear in each subprogram that is compiled separately from the main
  26683.  module.
  26684.  
  26685.  In contrast to earlier versions, QuickBASIC Versions 4.00b and 4.50,
  26686.  and the Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS
  26687.  and MS OS/2 offer global handling of ON ERROR (as explained in the
  26688.  UPDATE.DOC disk file). With global error-handling, an ON ERROR handler
  26689.  in the main program handles errors occurring in separate modules when
  26690.  those modules do not have their own ON ERROR handlers.
  26691.  
  26692.  All versions of QuickBASIC do not allow you to use < RESUME
  26693.  linenumber > or < RESUME linelabel > to handle errors that occur in
  26694.  subprograms. QuickBASIC only allows the use of RESUME or RESUME NEXT
  26695.  with subprograms. This fact needs to be added to Pages 128 and 129 of
  26696.  the "Microsoft QuickBASIC Compiler" documentation for Versions 2.x and
  26697.  3.00.
  26698.  
  26699.  In Version 1.02, if a < RESUME linenumber > or < RESUME linelabel >
  26700.  statement is used in a separately compiled subprogram, an "SB"
  26701.  (subprogram) error displays, but an OBJ file still will be created.
  26702.  You should not LINK the OBJ file if it receives an "SB" error, or if
  26703.  it uses < RESUME linenumber > or < RESUME linelabel > with
  26704.  subprograms. If you did use the file, you could receive unpredictable
  26705.  errors at run time due to eventual stack overflow.
  26706.  
  26707.  QuickBASIC Versions 2.00 and later will properly give you a
  26708.  "Subprogram Error" message and will not produce an OBJ file if you use
  26709.  < RESUME linenumber > or < RESUME linelabel >.
  26710.  
  26711.  Note also that < RETURN linenumber > or < RETURN linelabel > is not
  26712.  allowed with "ON event GOSUB" trapping used with subprograms; only
  26713.  RETURN is allowed. This fact applies to ON TIMER GOSUB, ON KEY GOSUB,
  26714.  ON PLAY GOSUB, ON STRIG GOSUB, and ON PEN GOSUB. Event trapping should
  26715.  be structured similar to error trapping in the sample program above.
  26716.  
  26717.  For a related article, you may query on "subprogram module error
  26718.  resume QuickBASIC" in this database.
  26719.  
  26720.  
  26721.  33. Passing Variables to ON ERROR and ON Event Handlers
  26722.  
  26723.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26724.  Operating System:   MS-DOS
  26725.  Flags: ENDUSER | B_BasicCom
  26726.  Last Modified: 29-DEC-1989    ArticleIdent: Q21863
  26727.  
  26728.  This article discusses how a QuickBASIC program can I pass variables
  26729.  to ON ERROR and ON "event" handler routines compiled with subprograms
  26730.  that are separate from the main program.
  26731.  
  26732.  (The different ON "event" statements are ON TIMER GOSUB, ON KEY GOSUB,
  26733.  ON PLAY GOSUB, ON STRIG GOSUB, and ON PEN GOSUB.)
  26734.  
  26735.  This information applies to Microsoft QuickBASIC 1.00 1.01 1.02 2.00
  26736.  2.01 3.00 4.00 4.00B and 4.50, to Microsoft BASIC Compiler 6.00 and
  26737.  6.00B, and to Microsoft BASIC PDS Version 7.00 for MS-DOS and MS OS/2.
  26738.  
  26739.  Variables can be passed through the COMMON SHARED statement to ON
  26740.  ERROR and ON "event" handler routines compiled separately from the
  26741.  main program. Variables that are not in COMMON SHARED are not
  26742.  accessible to the handler routines (unless the handler is in the same
  26743.  source file as the main program).
  26744.  
  26745.  The following is an example of a separately compiled subprogram that
  26746.  shares a flag variable with its error handler routine:
  26747.  
  26748.     ' TEST.BAS
  26749.     COMMON SHARED FLAG
  26750.     errortrap:
  26751.        ' The error is handled here:
  26752.        PRINT "Error Number Trapped="ERR
  26753.        FLAG=5
  26754.        RESUME NEXT  ' Resumes to line after where error occurred.
  26755.     SUB test STATIC
  26756.     ON ERROR GOTO errortrap
  26757.     FLAG=0
  26758.     ERROR 5  ' Forces a test error number 5 to occur.
  26759.     PRINT "FLAG=",FLAG  ' Execution resumes here after the error.
  26760.     END SUB
  26761.  
  26762.  This program is called by the following separate main program module:
  26763.  
  26764.     ' MAIN.BAS
  26765.     CALL TEST
  26766.  
  26767.  First, compile as follows:
  26768.  
  26769.     BC MAIN/X;
  26770.     BC TEST/X;
  26771.  
  26772.  You then can LINK MAIN+TEST; run the resulting program as an example.
  26773.  
  26774.  You cannot use the linenumber or linelabel option of RETURN or RESUME
  26775.  in conjunction with subprograms.
  26776.  
  26777.  In QuickBASIC Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00, and 4.00,
  26778.  error and event handling routines are local to each separately
  26779.  compiled module. A given error or event handling routine serves all
  26780.  subprograms compiled in the same module. The ON ERROR GOTO or ON event
  26781.  GOSUB statement should appear in each subprogram that is compiled
  26782.  separately from the main program.
  26783.  
  26784.  QuickBASIC Versions 4.00b and 4.50, Microsoft BASIC Compiler Versions
  26785.  6.00 and 6.00b, and Microsoft BASIC PDS Version 7.00 offer global
  26786.  error handling, which is described in a separate article. For more
  26787.  information, query on the following words:
  26788.  
  26789.     global and error and handling and QuickBASIC
  26790.  
  26791.  
  26792.  34. COMSPEC; SHELL "Illegal Function Call", Can't Find COMMAND.COM
  26793.  
  26794.  Product Version(s): 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50
  26795.  Operating System:   MS-DOS
  26796.  Flags: ENDUSER | B_BasicCom
  26797.  Last Modified: 29-DEC-1989    ArticleIdent: Q21901
  26798.  
  26799.  Customers who have floppy disk drive systems frequently find that the
  26800.  SHELL command fails in the QuickBASIC editor or in a program running
  26801.  on the system because QuickBASIC cannot find COMMAND.COM.
  26802.  
  26803.  Note that the SHELL command will work reliably only under DOS Version
  26804.  3.00 or later.
  26805.  
  26806.  Failure to locate COMMAND.COM during a SHELL can generate one of the
  26807.  following errors:
  26808.  
  26809.  1. The error message "File not found"
  26810.  
  26811.  2. The error message "Could not load COMMAND.COM"
  26812.  
  26813.  3. The error message "Illegal Function Call"
  26814.  
  26815.  4. A refusal to SHELL
  26816.  
  26817.  A program needs to find COMMAND.COM before it can execute a SHELL
  26818.  statement. The SHELL command in the File menu in the editor in
  26819.  QuickBASIC Version 2.00, 2.01, 3.00, 4.00, 4.00b, or 4.50 also needs
  26820.  to find COMMAND.COM before executing.
  26821.  
  26822.  QuickBASIC looks first for COMMAND.COM in the directory specified by
  26823.  the system COMSPEC environment variable and then in the current
  26824.  directory.
  26825.  
  26826.  The COMSPEC environment variable can be set by the MS-DOS SET command
  26827.  in your AUTOEXEC.BAT file or in the MS-DOS command line, as follows:
  26828.  
  26829.     SET COMSPEC=drive:\directory
  26830.  
  26831.  To tell MS-DOS where to find COMMAND.COM, you can also specify the
  26832.  following command in your MS-DOS Version 3.20 CONFIG.SYS file (which
  26833.  is executed at boot time):
  26834.  
  26835.     SHELL=A:\COMMAND.COM /E:1000 /P
  26836.  
  26837.  In the above command, /E:size sets the size (in bytes) for MS-DOS
  26838.  environment space, and /P tells the command processor that it is the
  26839.  first program in the system so that it can process the MS-DOS EXIT
  26840.  command. This SHELL= statement may not work under MS-DOS Version 3.30,
  26841.  but works properly under MS-DOS Version 3.20. Under MS-DOS Version
  26842.  3.30, you need to use SET COMSPEC.
  26843.  
  26844.  This article applies to QuickBASIC Versions 2.00, 2.01, 3.00, 4.00,
  26845.  4.00b, and 4.50 for the IBM PC and compatibles, Microsoft BASIC
  26846.  Compiler Versions 6.00 and 6.00b for MS-DOS, and Microsoft BASIC PDS
  26847.  Version 7.00 for MS-DOS.
  26848.  
  26849.  
  26850.  35. EGA 43-Line Mode Supported in QuickBASIC Version 3.00 Editor
  26851.  
  26852.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  26853.  Operating System:   MS-DOS
  26854.  Flags: ENDUSER |
  26855.  Last Modified: 24-JAN-1990    ArticleIdent: Q21911
  26856.  
  26857.  This article discusses which versions of QuickBASIC will display EGA
  26858.  43-line mode in the editor or "environment."
  26859.  
  26860.  QuickBASIC Versions 2.00, 2.01, and earlier do not support EGA 43-line
  26861.  mode.
  26862.  
  26863.  QuickBASIC Versions 3.00 and later do support EGA 43-line mode. The
  26864.  MODE43.EXE program can be run in DOS to toggle 43-line mode on or off
  26865.  before running QuickBASIC.
  26866.  
  26867.  In Versions 4.00 and later, an /h option for QB has been added to
  26868.  automatically display the highest resolution possible on your
  26869.  hardware. For example, if you have an EGA card, QuickBASIC displays 43
  26870.  lines and 80 columns of text when you type the following at the DOS
  26871.  prompt:
  26872.  
  26873.     QB DEMO1.BAS /H
  26874.  
  26875.  As with QuickBASIC Version 3.00, a compiled program itself can also
  26876.  put the screen into 43-line mode on an EGA-equipped computer by using
  26877.  the WIDTH statement. The 43-line mode syntax for WIDTH is documented
  26878.  in the README.DOC file for QuickBASIC Version 3.00, in the BASIC
  26879.  language reference for QuickBASIC Versions 4.00, 4.00b, and 4.50, and
  26880.  also in the QB Advisor in Version 4.50.
  26881.  
  26882.  
  26883.  36. Beep When Editing INPUT or LINE INPUT Statement Responses
  26884.  
  26885.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  26886.  Operating System:   MS-DOS
  26887.  Flags: ENDUSER | B_BasicCom
  26888.  Last Modified: 29-DEC-1989    ArticleIdent: Q21915
  26889.  
  26890.  This article explains why the UP, DOWN, PGUP, and PGDN cursor keys
  26891.  produce a beep when editing what is typed in response to the INPUT or
  26892.  LINE INPUT statement at run time.
  26893.  
  26894.  The input editor used by INPUT and LINE INPUT is a line editor only.
  26895.  This means you can move and edit only horizontally, such as with the
  26896.  LEFT and RIGHT ARROW cursor-control keys and the BACKSPACE key.
  26897.  Attempts to use the UP, DOWN, PGUP, and PGDN cursor keys produce a
  26898.  beep.
  26899.  
  26900.  This information applies to Microsoft QuickBASIC 2.00 2.01 3.00 4.00
  26901.  4.00B and 4.50, to Microsoft BASIC Compiler 6.00 and 6.00B, and to
  26902.  Microsoft BASIC PDS Version 7.00 for MS-DOS and MS OS/2.
  26903.  
  26904.  
  26905.  37. CIRCLE Starting Angle of -0 Does Not Draw Line from Center
  26906.  
  26907.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  26908.  Operating System:   MS-DOS
  26909.  Flags: ENDUSER | B_BasicCom
  26910.  Last Modified: 29-DEC-1989    ArticleIdent: Q21947
  26911.  
  26912.  In SCREEN 1 or 2 (or a higher graphics mode such as SCREEN 8), a
  26913.  CIRCLE statement with a start or end angle value of negative zero (-0)
  26914.  does not generate a line from the circle edge to the center in
  26915.  QuickBASIC Versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50, Microsoft
  26916.  BASIC Compiler Versions 6.00 and 6.00b for MS-DOS, and Microsoft BASIC
  26917.  PDS Version 7.00. It does generate the line in BASICA or GW-BASIC
  26918.  Version 3.20.
  26919.  
  26920.  The following is an example:
  26921.  
  26922.     10 SCREEN 1
  26923.     20 X=0
  26924.     25 REM  Radius=100, -x=start angle, 1=end angle:
  26925.     30 CIRCLE (160,100),100,,-X,1
  26926.  
  26927.  A workaround is to use x=.00001 instead of x=0 in the above program,
  26928.  as follows:
  26929.  
  26930.     10 SCREEN 1
  26931.     20 X=.00001
  26932.     30 CIRCLE (160,100),100,,-X,1
  26933.  
  26934.  Microsoft considers this to be an acceptable difference between the
  26935.  QuickBASIC Compiler and the BASIC interpreters.
  26936.  
  26937.  
  26938.  38. ENVIRON Statement Produces "Out of Memory" Error Message
  26939.  
  26940.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  26941.  Operating System:   MS-DOS
  26942.  Flags: ENDUSER | b_basiccom
  26943.  Last Modified: 29-APR-1990    ArticleIdent: Q21963
  26944.  
  26945.  Most forms of the ENVIRON statement produce the run-time error message
  26946.  "Out of memory" (on DOS Versions 2.x through 3.30). The following
  26947.  example produces the "Out of memory" error message:
  26948.  
  26949.     ENVIRON "PATH=C:\COBOL"
  26950.  
  26951.  The following example usually works correctly, however, the ENVIRON
  26952.  statement is not very practical in QuickBASIC:
  26953.  
  26954.     ENVIRON "PATH=;"
  26955.  
  26956.  Expanding the environment table cannot be done in a QuickBASIC program
  26957.  because the size of the environment table is limited to its size
  26958.  rounded up to the nearest multiple of 16 bytes, when QuickBASIC or a
  26959.  QuickBASIC program is initiated.
  26960.  
  26961.  QuickBASIC does not modify the actual DOS environment table; it only
  26962.  modifies a local copy.
  26963.  
  26964.  You can work around this problem by doing the following:
  26965.  
  26966.  1. SET a large string in the MS-DOS environment table before running
  26967.     QB.EXE or a compiled program, as in the following example:
  26968.  
  26969.     SET JUNK=123456789012345678901234567890
  26970.  
  26971.  2. Use the following ENVIRON statements in your program to set the
  26972.     large string equal to a null string, then you can allocate strings
  26973.     whose length totals up to the size that was deallocated:
  26974.  
  26975.     PRINT ENVIRON$("JUNK")  ' DOS environment variables MUST be
  26976.                             ' uppercase.
  26977.  
  26978.  ENVIRON "JUNK=;"           ' This deallocates environment table
  26979.                             ' space.
  26980.  
  26981.  PRINT ENVIRON$("JUNK")     ' This confirms deallocation; prints
  26982.                             ' nothing.
  26983.  
  26984.  ENVIRON "TEST=C:\COBOL"    ' This sets up new environment string.
  26985.  
  26986.  PRINT ENVIRON$("TEST")     ' This displays the new environment
  26987.                             ' string.
  26988.  
  26989.     Note that the MS-DOS environment variable names must be uppercase.
  26990.  
  26991.  
  26992.  39. "Subscript Out of Range" Dimensioning a Dynamic Numeric Array
  26993.  
  26994.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  26995.  Operating System:   MS-DOS
  26996.  Flags: ENDUSER | B_BasicCom
  26997.  Last Modified: 11-JAN-1990    ArticleIdent: Q21964
  26998.  
  26999.  Problem:
  27000.     I can dimension a single-dimensional dynamic integer array with
  27001.  32,000 elements; however, I get the message "Subscript Out of Range"
  27002.  dimensioning a two-dimensional integer array with only 30,000
  27003.  elements. The following is an example:
  27004.  
  27005.     Rem $dynamic
  27006.     dim b%(32000) 'this is okay
  27007.     dim c%(10,2850) 'this is also okay
  27008.     dim a%(10,3000) ' this will give a "subscript out of range" error
  27009.  
  27010.  Response:
  27011.     The statement DIM A%(10,3000) exceeds the 64K size limit that
  27012.  exists for each dynamic numeric array. In QuickBASIC Version 4.00 and
  27013.  greater, you can compile with QB /AH or BC /AH to allow dynamic
  27014.  numeric (or fixed-length string) arrays to exceed 64K. The /AH switch
  27015.  is not implemented in QuickBASIC 3.00 and previous versions.
  27016.     An array dimensioned DIM B%(32000) actually has 32,001 elements
  27017.  because the counting begins at element 0 by default, and the array
  27018.  will take up 64,002 bytes, since there are two bytes per integer
  27019.  element.
  27020.     You may change the default starting element to 1 with the OPTION
  27021.  BASE 1 statement. An array dimensioned DIM C%(10,2850) actually has
  27022.  31,361 elements (11 multiplied by 2,851) which would take up 62,722
  27023.  bytes. An integer array dimensioned (10,3000) gives a "subscript out
  27024.  of range" error because it has 33,011 elements, or 66,022 bytes, which
  27025.  exceeds the dynamic numeric array size limit of 65,536 bytes (64K).
  27026.     Note that there are 1,024 bytes per Kilobyte (K), therefore 64K
  27027.  multiplied by 1024 bytes per Kilobyte equals 65,536 bytes.
  27028.  
  27029.  
  27030.  40. ON KEY Trap Fails If CAPS/NUM LOCK Active; Need Separate KEY
  27031.  
  27032.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27033.  Operating System:   MS-DOS
  27034.  Flags: ENDUSER | B_BasicCom docerr
  27035.  Last Modified: 15-JAN-1990    ArticleIdent: Q21987
  27036.  
  27037.  This article describes a necessary addition to the "Microsoft
  27038.  QuickBASIC Compiler" manual for Versions 2.00, 2.01, and 3.00. This
  27039.  information is already covered in the documentation for QuickBASIC
  27040.  Versions 4.00, 4.00b, and 4.50, Microsoft BASIC Compiler Versions
  27041.  6.00, 6.00b, and Microsoft BASIC Professional Development System (PDS)
  27042.  Version 7.00. The information below also applies to these versions.
  27043.  
  27044.  Key trapping does not function while the CAPS LOCK key or NUM LOCK key
  27045.  is activated, unless you specifically set up special user-defined keys
  27046.  for that key combination. The program below (and the similar program
  27047.  on Page 317 of the "Microsoft QuickBASIC Compiler" manual for Versions
  27048.  2.00, 2.01, and 3.00) demonstrates the ignored key trapping when CAPS
  27049.  LOCK or NUM LOCK is active.
  27050.  
  27051.  The following program correctly traps CTRL+C when CAPS LOCK and NUM
  27052.  LOCK are NOT active, but does NOT trap CTRL+C if either CAPS LOCK or
  27053.  NUM LOCK (or both) is activated:
  27054.  
  27055.     key 15,chr$(&H04)+chr$(&H2E)
  27056.     key(15) on
  27057.     on key(15) gosub test
  27058.     while x$<>chr$(27)
  27059.     x$=inkey$
  27060.     if x$<>"" the print x$,asc(x$)
  27061.     wend
  27062.     end
  27063.     test:
  27064.     print "Control-C has been trapped"
  27065.     return
  27066.  
  27067.  This behavior is not a problem in the compiler. The following notes
  27068.  should be added to Page 317 of the "Microsoft QuickBASIC Compiler"
  27069.  manual for Versions 2.0x and 3.00; these notes also apply to
  27070.  QuickBASIC Versions 4.00, 4.00b, and 4.50, BASIC Compiler Versions
  27071.  6.00, 6.00b, and BASIC PDS Version 7.00.
  27072.  
  27073.  To trap the desired key in combination with the CAPS LOCK or NUM LOCK
  27074.  key active, a different keyboard flag must be used for each
  27075.  combination. A value of &H20 hex must be added to the keyboard flag if
  27076.  you want to trap a key while the NUM LOCK key is down. An &H40 must be
  27077.  added to the keyboard flag if you want to trap a key while the CAPS
  27078.  LOCK key is down. For example, a KEY 16 can be added to the above
  27079.  program to trap CTRL+C while the CAPS LOCK key is down, as in the
  27080.  following:
  27081.  
  27082.     KEY 16, CHR$(&H44)+CHR$(&H2E)
  27083.     ON KEY (16) GOSUB TEST
  27084.  
  27085.  The &H44 above reflects the sum of &H40 (for CAPS LOCK active) and
  27086.  &H04 (the keyboard flag for CTRL).
  27087.  
  27088.  A KEY 17 can be added to the above program to trap CTRL+C when both
  27089.  CAPS LOCK and NUM LOCK are pressed down, as in the following:
  27090.  
  27091.     KEY 17, CHR$(&H64)+CHR$(&H2E)
  27092.     ON KEY (17) GOSUB TEST
  27093.  
  27094.  The keyboard flag &H64 above reflects the sum of &H40 (for CAPS LOCK
  27095.  active), &H20 (for NUM LOCK active), and &H04 (the keyboard flag for
  27096.  CTRL).
  27097.  
  27098.  
  27099.  41. Using Page 2 in SCREEN 9 Gives "Illegal Function Call" on EGA
  27100.  
  27101.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27102.  Operating System:   MS-DOS
  27103.  Flags: ENDUSER |
  27104.  Last Modified: 11-JAN-1990    ArticleIdent: Q21956
  27105.  
  27106.  Question:
  27107.  
  27108.  Why do I get an "Illegal Function Call" error message when I reference
  27109.  Page 2 in SCREEN mode 9 on a computer with an EGA card? The following
  27110.  is an example:
  27111.  
  27112.     SCREEN 9,1,2,2  'EGA mode=9, 1=colorswitch on, apage=2, vpage=2
  27113.     COLOR 2,0
  27114.     LINE (1,1)-(100,100)
  27115.  
  27116.  Response:
  27117.  
  27118.  Screen 9 does have two pages available, but the pages are referenced
  27119.  as "0" and "1". Note that "2" is not a valid page number in screen 9.
  27120.  The program will work correctly if coded as follows:
  27121.  
  27122.     SCREEN 9,1,1,1  'EGA mode=9, 1=colorswitch on, apage=1, vpage=1
  27123.     COLOR 2,0
  27124.     LINE (1,1)-(100,100)
  27125.  
  27126.  
  27127.  42. CTRL+BREAK Doesn't Break Program on Tandy 1000; Use CTRL+HOLD
  27128.  
  27129.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27130.  Operating System:   MS-DOS
  27131.  Flags: ENDUSER | B_BasicCom
  27132.  Last Modified: 11-JAN-1990    ArticleIdent: Q21973
  27133.  
  27134.  On a Tandy 1000, running a program from the QuickBASIC editor, the
  27135.  CTRL+BREAK key sequence does not break execution of the program.
  27136.  
  27137.  This is not a problem with QuickBASIC but is rather a nonstandard
  27138.  keyboard sequence on the Tandy 1000. CTRL+HOLD should be used instead
  27139.  of CTRL+BREAK on a Tandy 1000. This also applies to the Tandy 1000 SX.
  27140.  
  27141.  This information applies to the QB.EXE environment in Microsoft
  27142.  QuickBASIC Versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50 for
  27143.  MS-DOS, to QB.EXE in Microsoft BASIC Compiler Versions 6.00 and 6.00b
  27144.  for MS-DOS, and to QBX.EXE in Microsoft BASIC PDS Version 7.00 for
  27145.  MS-DOS.
  27146.  
  27147.  
  27148.  43. SCREEN 1 COLOR Yellow Is Brown (Muddy) on EGA Versus CGA Card
  27149.  
  27150.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27151.  Operating System:   MS-DOS
  27152.  Flags: ENDUSER |
  27153.  Last Modified: 11-JAN-1990    ArticleIdent: Q21969
  27154.  
  27155.  The following program, which uses the COLOR statement on SCREEN 1, may
  27156.  give different colors on a machine with an EGA card compared to the
  27157.  colors on a machine equipped with a CGA card:
  27158.  
  27159.     10 SCREEN 1
  27160.     20 COLOR 8,0
  27161.     30 LINE (30,100)-(40,150),3,bf
  27162.     40 LINE (10,40)-(60,100),2,bf
  27163.     50 LINE (100,100)-(130,130),1,bf
  27164.  
  27165.  The background color selected is dark gray (8). Palette 0 is selected,
  27166.  and includes red, green, and yellow on a CGA. Under QuickBASIC on an
  27167.  EGA card, the colors may appear "muddy" compared to running on a CGA
  27168.  card: the red and green are less intense than shown on a CGA card and
  27169.  the yellow is brown.
  27170.  
  27171.  This is not a problem with QuickBASIC, but is a difference between CGA
  27172.  and EGA cards. The EGA allows only nonintensified colors. The same
  27173.  colors occur on an EGA card in the Microsoft GW-BASIC Version 3.20,
  27174.  3.22, or 3.23 Interpreter on an EGA card.
  27175.  
  27176.  Note that in SCREEN 1 on an EGA or VGA, the PALETTE statement can
  27177.  change the color used by output from the PRINT statement, for example
  27178.  
  27179.     PALETTE 3,n
  27180.  
  27181.  where n can be a color from 0 to 15. On an EGA card, PALETTE 3,6
  27182.  (where 6 is brown) is the default. PALETTE 3,14 will make PRINT output
  27183.  appear in yellow.
  27184.  
  27185.  The PALETTE statement is not supported on CGA cards. On a CGA card,
  27186.  the color of text output with the PRINT statement can only be changed to
  27187.  one of two possible colors by changing the palette argument of the
  27188.  COLOR statement. For example
  27189.  
  27190.     COLOR b,p
  27191.  
  27192.  where b is the background color, and p (the palette) can be 0 or 1. If
  27193.  the p argument is 0, PRINT output displays in color number 6 (brown on
  27194.  an EGA, yellow on some CGA cards). If the p argument is 1, PRINT
  27195.  output displays in color number 7 (white). See the COLOR statement in
  27196.  the BASIC language reference documentation for more information.
  27197.  
  27198.  Graphics statements such as LINE and CIRCLE can use color (attribute)
  27199.  arguments 0, 1, 2, or 3 to allow simultaneous display of four colors
  27200.  at once (including the background) in SCREEN 1 on CGA, EGA, or VGA.
  27201.  
  27202.  
  27203.  44. SHELL Can Give "Out of Memory" Error or Fragment Memory
  27204.  
  27205.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27206.  Operating System:   MS-DOS
  27207.  Flags: ENDUSER | B_BasicCom
  27208.  Last Modified: 21-DEC-1989    ArticleIdent: Q21902
  27209.  
  27210.  Question:
  27211.  
  27212.  Why do I get an "Out of Memory" error when I use the SHELL statement
  27213.  or the Shell command?
  27214.  
  27215.  Response:
  27216.  
  27217.  The SHELL statement does not clean up or compress memory. If not
  27218.  enough contiguous memory is available (for example, if many CHAIN
  27219.  statements have been executed, or several dynamic arrays were
  27220.  allocated then erased), a SHELL statement may fail with an "Out of
  27221.  memory" error. This includes both the Shell command from the File menu
  27222.  and also the SHELL statement in a running program.
  27223.  
  27224.  Also, if you mistakenly install any TSR (terminate and stay resident)
  27225.  program during a SHELL command, you will fragment memory, which often
  27226.  results in an "Out of Memory" error. For example, if you run the
  27227.  QuickBASIC environment, choose the Shell command from the File menu,
  27228.  install a TSR, EXIT the Shell, Exit the QuickBASIC environment, and
  27229.  reinvoke the QuickBASIC environment from DOS, then you get an "Out of
  27230.  Memory" error immediately before you can do anything in the
  27231.  environment. You must reboot to unfragment DOS memory.
  27232.  
  27233.  This information applies to Microsoft QuickBASIC Versions 2.00, 2.01,
  27234.  3.00, 4.00, 4.00b, and 4.50, to Microsoft BASIC Compiler Versions 6.00
  27235.  and 6.00b for MS-DOS, and to Microsoft BASIC PDS Version 7.00 for
  27236.  MS-DOS.
  27237.  
  27238.  TSR programs should NEVER be installed during a SHELL statement or a
  27239.  Shell from the File menu. Examples of TSR programs are MSHERC.COM
  27240.  (from QuickBASIC 4.50) and QBHERC.COM (from QuickBASIC 4.00/4.00b and
  27241.  the BASIC compiler 6.00/6.00b).
  27242.  
  27243.  
  27244.  45. "Type Mismatch" Using TAB() Between PRINT USING Variables
  27245.  
  27246.  Product Version(s): 4.00 4.00b
  27247.  Operating System:   MS-DOS
  27248.  Flags: ENDUSER | buglist4.00 buglist4.00b fixlist4.50 B_BasicCom
  27249.  Last Modified: 22-JAN-1990    ArticleIdent: Q32968
  27250.  
  27251.  When using the TAB function between variables in the following PRINT
  27252.  USING and LPRINT USING statements, a "Type Mismatch" error displays in
  27253.  the QB.EXE Version 4.00 or 4.00b environment:
  27254.  
  27255.     PRINT USING "$$##.##";x;TAB(10);z
  27256.     LPRINT USING "$$##.##";x;TAB(10);z
  27257.  
  27258.  However, when run as an .EXE program, the above statements print
  27259.  successfully. They also run correctly in QuickBASIC Version 3.00,
  27260.  either in the editor or as an .EXE program.
  27261.  
  27262.  Microsoft has confirmed this to be a problem in QuickBASIC Versions
  27263.  4.00 and 4.00b and in the QuickBASIC editor provided with Microsoft
  27264.  BASIC Compiler Versions 6.00 and 6.00b for MS-DOS (buglist6.00,
  27265.  buglist6.00b). This problem was corrected in QB.EXE in QuickBASIC
  27266.  Version 4.50 and does not occur in the QBX.EXE environment of
  27267.  Microsoft BASIC Professional Development System (PDS) Version 7.00
  27268.  (fixlist7.00).
  27269.  
  27270.  Note: The documentation for PRINT USING and LPRINT USING does not say
  27271.  whether TAB is legal in the PRINT USING expressionlist. TAB should be
  27272.  avoided in PRINT USING statements because compatibility with future
  27273.  Microsoft BASIC versions cannot be guaranteed.
  27274.  
  27275.  The best workaround for the above problem is to avoid using the TAB
  27276.  function in the PRINT USING or LPRINT USING statement, as shown in the
  27277.  following examples:
  27278.  
  27279.  1. To output at a desired column, use spaces between the desired
  27280.     format strings, instead of using the TAB function, as follows:
  27281.  
  27282.        x = 12.34 : z = 56.78
  27283.        PRINT USING"$$##.##         $$##.##";x;z
  27284.  
  27285.  2. To position the cursor at a desired column, use the LOCATE
  27286.     statement before executing the PRINT USING statement, as in the
  27287.     following example:
  27288.  
  27289.        x = 12.34: z = 56.78
  27290.        LOCATE 2, 1
  27291.        PRINT USING "$$##.##"; x
  27292.        LOCATE 2, 10
  27293.        PRINT USING "$$##.##"; z
  27294.  
  27295.  Note: When you type the following statement in QB.EXE Versions 4.00 or
  27296.  4.00b, the editor automatically inserts the missing semicolon in front
  27297.  of z:
  27298.  
  27299.     PRINT USING "$$##.##";x;tab(10) z
  27300.  
  27301.  The program then usually runs correctly (without getting a "Type
  27302.  Mismatch" error) in QB.EXE.
  27303.  
  27304.  
  27305.  46. PLAY "N0" First Note of Rest Clicks Speaker in QuickBASIC
  27306.  
  27307.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27308.  Operating System:   MS-DOS
  27309.  Flags: ENDUSER | B_BasicCom buglist3.00 buglist4.00 buglist4.00b buglist4.50
  27310.  Last Modified: 20-SEP-1990    ArticleIdent: Q22018
  27311.  
  27312.  In QuickBASIC, the PLAY statement can produce a click on the speaker
  27313.  for the first note of rest (but not for subsequent notes of rest). For
  27314.  example, the following program will produce no sound when run under
  27315.  the BASICA or GW-BASIC Interpreter, but produces a single click when
  27316.  run as a compiled QuickBASIC program:
  27317.  
  27318.     10 while inkey$ = ""
  27319.     20 play "N0"    ' N followed by zero (0) means play a note of rest.
  27320.     30 wend
  27321.  
  27322.  Microsoft has confirmed this to be a problem in QuickBASIC versions
  27323.  2.00, 2.01 (buglist2.00, buglist2.01), 3.00, 4.00, 4.00b, and 4.50; in
  27324.  Microsoft BASIC Compiler versions 6.00 and 6.00b (buglist6.00,
  27325.  buglist6.00b); and in Microsoft BASIC Professional Development System
  27326.  (PDS) versions 7.00 and 7.10 (buglist7.00, buglist7.10). We are
  27327.  researching this problem and will post new information here as it
  27328.  becomes available.
  27329.  
  27330.  
  27331.  47. XON/XOFF Communications Protocol Not Supported in QuickBASIC
  27332.  
  27333.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27334.  Operating System:   MS-DOS
  27335.  Flags: ENDUSER | docerr B_BasicCom
  27336.  Last Modified: 17-JAN-1991    ArticleIdent: Q22019
  27337.  
  27338.  The XON/XOFF handshaking protocol of the ASC option of the OPEN COM
  27339.  statement is not implemented in any version of QuickBASIC (including
  27340.  versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50), in Microsoft BASIC
  27341.  Compiler version 6.00 or 6.00b for MS-DOS, or in Microsoft BASIC
  27342.  Professional Development System (PDS) version 7.00 or 7.10 for MS-DOS.
  27343.  
  27344.  Except for XON/XOFF protocol, the other features of the ASC option of
  27345.  the OPEN COM statement work properly. During communications, the ASC
  27346.  option expands tabs to spaces, forces carriage returns at the
  27347.  end-of-line, treats CTRL+Z (ASCII value 26) as the end-of-file flag,
  27348.  and transmits CTRL+Z when you CLOSE the communications channel.
  27349.  
  27350.  When you OPEN the COM1 or COM2 communications port and specify the ASC
  27351.  option, XON and XOFF bytes have no effect. A program will continue to
  27352.  transmit and pass all received XON and XOFF characters to the program
  27353.  without halting or resuming transmission. This behavior occurs because
  27354.  the XON/XOFF handshaking protocol of the ASC option of the OPEN COM
  27355.  statement is not implemented.
  27356.  
  27357.  The sentence saying "XON/XOFF protocol is enabled" should be deleted
  27358.  in the documentation for the ASC option of the OPEN COM statement in
  27359.  the following manuals:
  27360.  
  27361.  1. Page 375 of the "Microsoft QuickBASIC Compiler" manual for
  27362.     QuickBASIC versions 2.x and 3.00
  27363.  
  27364.  2. Page 297 of the "Microsoft QuickBASIC 4.0: BASIC Language
  27365.     Reference" manual for QuickBASIC versions 4.00 and 4.00b
  27366.  
  27367.  3. Page 297 of the "Microsoft BASIC Compiler 6.0: BASIC Language
  27368.     Reference" manual for versions 6.00 and 6.00b
  27369.  
  27370.  This documentation error has been corrected in the documentation for
  27371.  Microsoft QuickBASIC 4.50 and the BASIC Professional Development
  27372.  System (PDS) for MS-DOS and MS OS/2.
  27373.  
  27374.  Additional Background Information
  27375.  ---------------------------------
  27376.  
  27377.  XOFF is also known as CTRL+S, which is a character with an ASCII
  27378.  value of 19. CTRL+S tells a device or program that knows XON/XOFF
  27379.  protocol to stop transmission.
  27380.  
  27381.  XON is also known as CTRL+Q, which is a character with an ASCII value
  27382.  of 17. CTRL+Q tells a device or program that knows XON/XOFF protocol
  27383.  to continue transmission.
  27384.  
  27385.  The CTRL+S (XOFF) and CTRL+Q (XON) bytes pass without special handling
  27386.  through devices or programs that do not support the XON/XOFF
  27387.  communications protocol. While it is possible to write a BASIC program
  27388.  that checks every character for XON or XOFF and then programmatically
  27389.  starts or stops communications, such a program is unlikely to be as
  27390.  reliable as the XON/XOFF handshaking that is built into dedicated
  27391.  commercial communications software or hardware packages.
  27392.  
  27393.  
  27394.  48. SHELL "PATH=\..." Affects Only a Local Copy of DOS
  27395.  
  27396.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27397.  Operating System:   MS-DOS
  27398.  Flags: ENDUSER |
  27399.  Last Modified: 31-JAN-1990    ArticleIdent: Q22015
  27400.  
  27401.  SHELLing to the DOS PATH command fails to change the default directory
  27402.  search path when you exit QuickBASIC. BASICA Version 3.10 behaves
  27403.  similarly.
  27404.  
  27405.  The following is an example:
  27406.  
  27407.     SHELL "PATH=\BASIC"
  27408.  
  27409.  According to Page 458 of the "Microsoft QuickBASIC Compiler" manual
  27410.  for Version 3.00 and Page 396 of the "Microsoft QuickBASIC Version
  27411.  4.0: BASIC Language Reference" manual, the SHELL statement allows
  27412.  execution of DOS commands such as DIR, PATH, and SORT.
  27413.  
  27414.  When you invoke a SHELL command from a QuickBASIC program, a local
  27415.  copy of COMMAND.COM and the DOS environment is spawned. When paths are
  27416.  changed, only the local environment copy is changed, not the original
  27417.  DOS environment.
  27418.  
  27419.  
  27420.  49. OPEN LEN=reclen Effect on Sequential File Buffering and Speed
  27421.  
  27422.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27423.  Operating System:   MS-DOS
  27424.  Flags: ENDUSER | docerr B_BasicCom
  27425.  Last Modified: 19-JAN-1990    ArticleIdent: Q22021
  27426.  
  27427.  QuickBASIC Versions 2.00, 2.01, and 3.00 don't behave according to the
  27428.  following statement on Page 370 of the "Microsoft QuickBASIC Compiler"
  27429.  manual for Versions 2.00, 2.01, and 3.00, which discusses the
  27430.  recordlength option of the OPEN statement for sequential files:
  27431.  
  27432.     When used to open a sequential file, recordlength specifies the
  27433.     number of characters to be loaded to the buffer before it is
  27434.     written to, or read from, the disk. A larger buffer means more room
  27435.     taken from BASIC, but faster file I/O.
  27436.  
  27437.  Changing the LEN=reclen statement will not change the sequential
  27438.  file-access speed or buffering for QuickBASIC Versions 2.00, 2.01, or
  27439.  3.00, but WILL change speed and buffering for QuickBASIC 4.00 and
  27440.  later versions.
  27441.  
  27442.  For greater file-access speed, boot with a BUFFERS=20 statement in
  27443.  your CONFIG.SYS file (DOS configuration file) on the root directory of
  27444.  your start-up disk.
  27445.  
  27446.  Please note that in QuickBASIC Versions 4.00, 4.00b, and 4.50 for
  27447.  MS-DOS, Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS
  27448.  and OS/2, and Microsoft BASIC Professional Development System (PDS)
  27449.  Version 7.00, the LEN=reclen statement changes both the buffer size
  27450.  and sequential file-access speed. The default sequential-access buffer
  27451.  size is 512 bytes in these versions.
  27452.  
  27453.  The 512-byte size gives fast disk input/output speed because it
  27454.  matches the sector size or a multiple of the sector size for most disk
  27455.  drives. This is correctly documented in the "Microsoft QuickBASIC 4.0:
  27456.  BASIC Language Reference" manual for Versions 4.00 and 4.00b.
  27457.  
  27458.  By changing LEN=256 to LEN=10 or LEN=1000 in the following program, no
  27459.  file-output buffering or speed changes are apparent in QuickBASIC 2.x
  27460.  and 3.00 when you watch the disk-access light on the drive. However,
  27461.  you will notice buffering and speed changes in later QuickBASIC
  27462.  versions:
  27463.  
  27464.     PRINT "Start of program"
  27465.     OPEN "buf.dat" FOR OUTPUT AS #1 LEN=256
  27466.     PRINT "File was just opened"
  27467.     WHILE INKEY$="":WEND
  27468.     FOR Index% = 1 to 30
  27469.     PRINT "Record number --> ";Index%
  27470.     WRITE #1, STRING$(79,CHR$(48+Index%))
  27471.     WHILE INKEY$="":WEND
  27472.     NEXT Index%
  27473.     CLOSE #1
  27474.     END
  27475.  
  27476.  
  27477.  50. PRINT Forces Contiguous String to Next Row & Doesn't Wrap It
  27478.  
  27479.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27480.  Operating System:   MS-DOS
  27481.  Flags: ENDUSER | B_GWBasicI B_BasicCom
  27482.  Last Modified: 19-JAN-1990    ArticleIdent: Q22022
  27483.  
  27484.  The PRINT statement displays a contiguous string constant on the next
  27485.  row below the current print position (without breaking or wrapping the
  27486.  string) if printing it from the current screen column exceeds the 80th
  27487.  column.
  27488.  
  27489.  This behavior is by design. You will need to break the string into a
  27490.  piece small enough to fit within the space before the 80th column to
  27491.  avoid forcing the whole string to the next line (see example below).
  27492.  
  27493.  This standard behavior occurs in most retail Microsoft BASIC versions
  27494.  for MS-DOS, including the following products:
  27495.  
  27496.  1. QuickBASIC Compiler (Versions 2.00, 2.01, 3.00, 4.00, 4.00b,
  27497.     and 4.50) for MS-DOS
  27498.  
  27499.  2. Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS and
  27500.     OS/2
  27501.  
  27502.  3. Microsoft BASIC Professional Development System (PDS) Version 7.00
  27503.     for MS-DOS and OS/2
  27504.  
  27505.  4. GW-BASIC Versions 3.20, 3.22, and 3.23
  27506.  
  27507.  The following is a code example:
  27508.  
  27509.     5  CLS
  27510.     10 LOCATE 1,1    ' LOCATEs in column 1.
  27511.     20 PRINT "LOCATED ON ROW 1, THIS STRING STAYS ON ROW 1."
  27512.     30 LOCATE 2,70    ' LOCATEs in column 70, leaving no room.
  27513.     40 PRINT "DESPITE BEING LOCATED ON ROW 2, THIS PRINTS ON ROW 3"
  27514.     50 LOCATE 4,71   ' To make it wrap, break up the string as follows:
  27515.     60 PRINT "1234567890";"THIS STARS IN COLUMN 1"
  27516.  
  27517.  
  27518.  51. SCREEN 7,8,9 "Illegal Function Call" Using Foreground COLOR 0
  27519.  
  27520.  Product Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
  27521.  Operating System:   MS-DOS
  27522.  Flags: ENDUSER | B_BasicCom
  27523.  Last Modified: 15-JAN-1991    ArticleIdent: Q22036
  27524.  
  27525.  Executing the COLOR statement with a zero (0) as the foreground color
  27526.  gives "Illegal Function Call" on the EGA SCREEN modes 7, 8, and 9. For
  27527.  example:
  27528.  
  27529.     10 SCREEN 9
  27530.     20 COLOR 0,0   ' Gives "Illegal function call"
  27531.  
  27532.  This is because zero (0) is not within the allowed range of attributes
  27533.  with the EGA. The range of attributes is 1 to 3 for an EGA with 64K,
  27534.  and 1 to 15 for an EGA with more than 64K of memory.
  27535.  
  27536.  You can work around this behavior by using the PALETTE statement to
  27537.  reassign the color of zero to another attribute number. This can be
  27538.  accomplished by doing the following:
  27539.  
  27540.     DIM Pal%(16)
  27541.     SCREEN 7
  27542.     Pal%(0) = 15
  27543.     Pal%(15) = 0
  27544.     PALETTE USING Pal%(0)
  27545.     COLOR 15,1
  27546.     CLS
  27547.  
  27548.  This information applies to QuickBASIC versions 2.00, 2.01, 3.00,
  27549.  4.00, 4.00b, and 4.50; to Microsoft BASIC Compiler versions 6.00 and
  27550.  6.00b for MS-DOS, and to Microsoft BASIC Professional Development
  27551.  System (PDS) versions 7.00 and 7.10 for MS-DOS.
  27552.  
  27553.  Another way to simulate a foreground color of zero (0) in screen mode
  27554.  9 or 12 is shown in a separate article in this Knowledge Base. To find
  27555.  this article, query on the following words:
  27556.  
  27557.     foreground and background and GET and PUT and 16 and simultaneously
  27558.  
  27559.  (The graphics GET and PUT technique and sample program shown in this
  27560.  separate article could be modified for QuickBASIC 2.0x and 3.00.)
  27561.  
  27562.  
  27563.  52. CTRL+UP and CTRL+DOWN ARROW Keys No Longer Scroll the Screen
  27564.  
  27565.  Product Version(s): 3.00
  27566.  Operating System:   MS-DOS
  27567.  Flags: ENDUSER | B_BasicCom
  27568.  Last Modified: 22-JAN-1990    ArticleIdent: Q23388
  27569.  
  27570.  CTRL+UP ARROW and CTRL+DOWN ARROW do not scroll the screen in QB.EXE
  27571.  in QuickBASIC Version 3.00, but they do in QuickBASIC Versions 2.00,
  27572.  2.01, 4.00, 4.00b, 4.50, in the QB.EXE editor that is included with
  27573.  Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS, and in
  27574.  the QBX.EXE editor of Microsoft BASIC Professional Development System
  27575.  (PDS) Version 7.00 for MS-DOS.
  27576.  
  27577.  Changes were made in the QuickBASIC Version 3.00 editor to allow
  27578.  Superkey support; support for CTRL+UP ARROW and CTRL+DOWN ARROW was
  27579.  removed during this change. In the non-3.00 product versions above,
  27580.  these keys successfully scroll the screen down or up one line at a
  27581.  time.
  27582.  
  27583.  
  27584.  53. Unexpected Result from CINT(.5) in QB87; IEEE Rounds to Even
  27585.  
  27586.  Product Version(s): 3.00
  27587.  Operating System:   MS-DOS
  27588.  Flags: ENDUSER | B_BasicCom
  27589.  Last Modified: 21-FEB-1991    ArticleIdent: Q23389
  27590.  
  27591.  The coprocessor version of QuickBASIC version 3.00 (QB87.EXE) returns
  27592.  0 (zero) in the following example (as do QuickBASIC versions 4.00,
  27593.  4.00b, and 4.50; Microsoft BASIC Compiler versions 6.00 and 6.00b; and
  27594.  Microsoft BASIC Professional Development System (PDS) versions 7.00
  27595.  and 7.10, which all use the IEEE floating-point format):
  27596.  
  27597.     PRINT CINT(1/2)
  27598.     PRINT CINT(.5)
  27599.     PRINT CINT(1.0/2.0)
  27600.  
  27601.  Three zeros (0) are printed. This differs from the non-coprocessor
  27602.  version of QuickBASIC version 3.00 (QB.EXE) and earlier versions,
  27603.  which instead prints three ones (1).
  27604.  
  27605.  Compare this with the fact that PRINT CINT(1.5) returns 2 in both the
  27606.  coprocessor and non-coprocessor versions of QuickBASIC version 3.00
  27607.  (and in the other more recent products listed above).
  27608.  
  27609.  The observed rounding difference in the first case above is not caused
  27610.  by any bug. The IEEE standard dictates that rounding of x.5 occurs to
  27611.  the even integer nearest to x, for example, CINT(.5)=0, CINT(1.5)=2,
  27612.  CINT(2.5)=2, CINT(3.5)=4, CINT(4.5)=4, etc.
  27613.  
  27614.  The non-coprocessor version of QuickBASIC 3.00 (QB.EXE) supports a
  27615.  different floating-point format, the Microsoft Binary format (MBF),
  27616.  which rounds differently than the IEEE standard.
  27617.  
  27618.  
  27619.  54. Workarounds for CLOSE of COM(n) Disconnecting Phone Connection
  27620.  
  27621.  Product Version(s): 4.00
  27622.  Operating System:   MS-DOS
  27623.  Flags: ENDUSER |
  27624.  Last Modified: 16-APR-1990    ArticleIdent: Q26471
  27625.  
  27626.  QuickBASIC disconnects the phone connection when a program CLOSEs the
  27627.  communications port or when the program ENDs. This happens because the
  27628.  DTR line is dropped on a CLOSE or END statement. Below are several
  27629.  possible workarounds that might help you to overcome this design
  27630.  limitation of Microsoft QuickBASIC.
  27631.  
  27632.  This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
  27633.  and 4.50, to Microsoft BASIC Compiler Versions 6.00 and 6.00b for
  27634.  MS-DOS, and to Microsoft BASIC Professional Development System (PDS)
  27635.  Version 7.00 for MS-DOS.
  27636.  
  27637.  The first workaround is to attempt to reset the DTR line immediately
  27638.  after the CLOSE statement. To do this, the correct OUT instruction is
  27639.  sent to the modem control register to set DTR (pin 20) high. Consider
  27640.  the following example:
  27641.  
  27642.       OPEN "COM(n): <parameters>" FOR <mode> AS #n
  27643.       ' The rest of your program code goes here.
  27644.       CLOSE #n
  27645.       OUT &H3FC,3
  27646.       END
  27647.  
  27648.  However, this example may not work because there is a small period of
  27649.  time between the CLOSE and the OUT statements. The modem may
  27650.  disconnect the phone connection even in this small time period.
  27651.  
  27652.  Some "smart" modems allow you to adjust the time-out period for the
  27653.  DTR line. If you set this time-out period higher, the modem will wait
  27654.  longer before disconnecting the phone connection. This gives you just
  27655.  enough time to execute the OUT instruction to set the DTR line higher.
  27656.  The following is an example:
  27657.  
  27658.       OPEN "COM(n): <parameters>" FOR <mode> AS #n
  27659.       PRINT #n, <control string>
  27660.       ' The rest of your program code goes here.
  27661.       CLOSE #n
  27662.       OUT &H3FC,3
  27663.       END
  27664.  
  27665.  In the above example, <control string> is a series of control codes
  27666.  sent to the modem to set the DTR time-out period higher. Consult the
  27667.  manual for your modem to determine the correct control code string.
  27668.  The following is an example of the above code modified to work with a