home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / maj / 659 / cz.hlp (.txt) < prev    next >
CZ Help  |  1993-08-30  |  196KB  |  3,432 lines

  1. CZ_HELP!
  2. INDEX
  3. TUTORIAL_INDEX
  4. LICENSE_AGREEMENq
  5. LICENSE_A
  6. PRODUCT_SUPPORT
  7. STARTING_CZ
  8. USING_CZ
  9. USING_CZ_A
  10. USING_CZ_B
  11. ABOUT_CZ
  12. IS_BULLET
  13. IS_A_DATABASE
  14. IS_DBF
  15. IS_A_BTREE
  16. IS_A_NETWORK
  17. IS_FILE_LOCKING
  18. IS_NLS
  19. DESIGN_A_DB
  20. CREATE_A_DB
  21. ADD_TO_THE_DB
  22. QUERY_THE_DB
  23. UPDATE_THE_DB
  24. DELETE_A_RECORD
  25. TC_COMPILE_WITH
  26. QC_COMPILE_WITH
  27. LIB_WITH
  28. CALL_BULLET
  29. SPECS_OVERALL
  30. SPECS_DBF
  31. SPECS_DBF_A
  32. SPECS_DBF_B
  33. SPECS_DBF_C
  34. SPECS_INDEX
  35. SPECS_INDEX_A
  36. SPECS_INDEX_B
  37. SPECS_INDEX_C
  38. SPECS_MEMORY
  39. SPECS_MEMORY_A
  40. SPECS_OS_CALLS
  41. SPECS_LANGUAGES
  42. SPECS_OSES
  43. SPECS_NETWORKS
  44. SPECS_PERFORMANC
  45. INITXB
  46. EXITXB
  47. ATEXITXB
  48. MEMORYXB
  49. BREAKXB
  50. BACKUPFILEXB
  51. STATHANDLEXB
  52. GETEXTERRORXB
  53. DVMONCXB
  54. CREATEDXB
  55. OPENDXB
  56. CLOSEDXB
  57. STATDXB
  58. READDHXB
  59. FLUSHDHXB
  60. COPYDHXB
  61. ZAPDHXB
  62. CREATEKXB
  63. CREATEKXB_A
  64. CREATEKXB_B
  65. CREATEKXB_C
  66. CREATEKXB_D
  67. CREATEKXB_E
  68. CREATEKXB_F
  69. OPENKXB
  70. CLOSEKXB
  71. STATKXB
  72. READKHXB
  73. FLUSHKHXB
  74. COPYKHXB
  75. ZAPKHXB
  76. GETDESCRIPTORXB
  77. GETRECORDXB
  78. ADDRECORDXB
  79. UPDATERECORDXB
  80. DELETERECORDXB
  81. UNDELETERECORDXB
  82. PACKRECORDSXB
  83. FIRSTKEYXB
  84. EQUALKEYXB
  85. NEXTKEYXB
  86. PREVKEYXB
  87. LASTKEYXB
  88. STOREKEYXB
  89. DELETEKEYXB
  90. BUILDKEYXB
  91. CURRENTKEYXB
  92. GETFIRSTXB
  93. GETEQUALXB
  94. GETNEXTXB
  95. GETPREVXB
  96. GETLASTXB
  97. INSERTXB
  98. UPDATEXB
  99. REINDEXXB
  100. LOCKXB
  101. UNLOCKXB
  102. LOCKKEYXB
  103. UNLOCKKEYXB
  104. LOCKDATAXB
  105. UNLOCKDATAXB
  106. DRIVEREMOTEXB
  107. FILEREMOTEXB
  108. SETRETRIESXB
  109. DELETEFILEDOS
  110. RENAMEFILEDOS
  111. CREATEFILEDOS
  112. ACCESSFILEDOS
  113. OPENFILEDOS
  114. SEEKFILEDOS
  115. READFILEDOS
  116. EXPANDFILEDOS
  117. WRITEFILEDOS
  118. CLOSEFILEDOS
  119. MAKEDIRDOS
  120. ACCESSPACK
  121. BREAKPACK
  122. COPYPACK
  123. CREATEDATAPACK
  124. CREATEKEYPACK
  125. DESCRIPTORPACK
  126. DOSFILEPACK
  127. DVMONPACK
  128. EXITPACK
  129. FIELDDESCTYPE
  130. HANDLEPACK
  131. INITPACK
  132. MEMORYPACK
  133. OPENPACK
  134. REMOTEPACK
  135. SETRETRIESPACK
  136. STATDATAPACK
  137. STATKEYPACK
  138. STATHANDLEPACK
  139. XERRORPACK
  140. ERRORS_BULLET
  141. ERRORS_BULLET_B
  142. ERRORS_BULLET_C
  143. ERRORS_BULLET_D
  144. ERRORS_DOS
  145. ERRORS_DOS_B
  146. ERRORS_DOS_C
  147. INITXBSRC
  148. EXITXBSRC
  149. ATEXITXBSRC
  150. MEMORYXBSRC
  151. BREAKXBSRC
  152. BACKUPFILEXBSRC
  153. STATHANDLEXBSRC
  154. GETEXTERRORXBSRCCJ
  155. DVMONCXBSRC
  156. CREATEDXBSRC
  157. CREATEDXBSRC_A
  158. OPENDXBSRC
  159. CLOSEDXBSRC
  160. STATDXBSRC
  161. READDHXBSRC
  162. FLUSHDHXBSRC
  163. COPYDHXBSRC
  164. ZAPDHXBSRC
  165. CREATEKXBSRC
  166. OPENKXBSRC
  167. CLOSEKXBSRC
  168. STATKXBSRC
  169. READKHXBSRC
  170. FLUSHKHXBSRC
  171. COPYKHXBSRC
  172. ZAPKHXBSRC
  173. GETDESCRIPTORXBS"x
  174. GETRECORDXBSRC
  175. ADDRECORDXBSRC
  176. UPDATERECORDXBSRE
  177. DELETERECORDXBSR
  178. UNDELETERECORDSR
  179. PACKRECORDSXBSRC
  180. FIRSTKEYXBSRC
  181. EQUALKEYXBSRC
  182. NEXTKEYXBSRC
  183. PREVKEYXBSRC
  184. LASTKEYXBSRC
  185. STOREKEYXBSRC
  186. DELETEKEYXBSRC
  187. BUILDKEYXBSRC
  188. CURRENTKEYXBSRC
  189. GETFIRSTXBSRC
  190. GETEQUALXBSRC
  191. GETNEXTXBSRC
  192. GETPREVXBSRC
  193. GETLASTXBSRC
  194. INSERTXBSRC
  195. UPDATEXBSRC
  196. REINDEXXBSRC
  197. LOCKXBSRC
  198. UNLOCKXBSRC
  199. LOCKKEYXBSRC
  200. UNLOCKKEYXBSRC
  201. LOCKDATAXBSRC
  202. UNLOCKDATAXBSRC
  203. DRIVEREMOTEXBSRC
  204. FILEREMOTEXBSRC
  205. SETRETRIESXBSRC
  206. DELETEFILEDOSSRC
  207. RENAMEFILEDOSSRC?
  208. CREATEFILEDOSSRC
  209. ACCESSFILEDOSSRC
  210. OPENFILEDOSSRC
  211. SEEKFILEDOSSRC
  212. READFILEDOSSRC
  213. EXPANDFILEDOSSRC
  214. WRITEFILEDOSSRC
  215. CLOSEFILEDOSSRC
  216. MAKEDIRDOSSRC
  217. ~INDEX            CZ.HLP-BULLET for C
  218.  System 
  219.  Mid-level Record/Key Access 
  220. InitXB        
  221. CreateDXB    CreateKXB    GetDescriptorXB     FirstKeyXB     
  222. ExitXB        
  223. OpenDXB      OpenKXB      GetRecordXB         EqualKeyXB     
  224. AtExitXB      
  225. CloseDXB     CloseKXB     AddRecordXB         NextKeyXB      
  226. MemoryXB      
  227. StatDXB      StatKXB      UpdateRecordXB      PrevKeyXB      
  228. BreakXB       
  229. ReadDHXB     ReadKHXB     DeleteRecordXB      LastKeyXB      
  230. BackupFileXB  
  231. FlushDHXB    FlushKHXB    UndeleteRecordXB    StoreKeyXB     
  232. StatHandleXB  
  233. CopyDHXB     CopyKHXB     PackRecordsXB       DeleteKeyXB    
  234. GetExtErrorXB 
  235. ZapDHXB      ZapKHXB                          BuildKeyXB     
  236. DVmonCXB      
  237.                                               CurrentKeyXB   
  238.  High-level Access 
  239.  Network 
  240. GetFirstXB    InsertXB     
  241. LockXB           UnlockXB        LockKeyXB      
  242. GetEqualXB    UpdateXB     
  243. UnlockKeyXB      LockDataXB      UnlockDataXB   
  244. GetNextXB     ReindexXB    
  245. DriveRemoteXB    FileRemoteXB    SetRetriesXB   
  246. GetPrevXB                  
  247. GetLastXB                  
  248.  Low-level DOS Access 
  249.                            
  250. DeleteFileDOS    OpenFileDOS     WriteFileDOS   
  251.                            
  252. RenameFileDOS    SeekFileDOS     CloseFileDOS   
  253.  Move cursor to index item 
  254. CreateFileDOS    ReadFileDOS     MakeDirDOS     
  255.  and press <Enter>.        
  256. AccessFileDOS    ExpandFileDOS                  
  257. See: TUTORIAL_INDEX
  258. ~TUTORIAL_INDEX   CZ.HLP-BULLET for C
  259.  CZ.COM 
  260.  Using BULLET 
  261.  1.03 
  262. Starting_CZ   
  263. What:              How to:                                   
  264. Using_CZ      
  265.  is_BULLET          design_a_DB         TC_compile_with      
  266. About_CZ      
  267.  is_a_database      create_a_DB         QC_compile_with      
  268.               
  269.  is_DBF             add_to_the_DB       LINK_with            
  270.  is_a_Btree         query_the_DB        LIB_with             
  271.  Error Codes
  272.  is_a_network       update_the_DB      
  273.        
  274. Errors_BULLET 
  275.  is_file_locking    delete_a_record    
  276.  call_BULLET 
  277.        
  278. Errors_DOS    
  279.  is_NLS                                
  280.        
  281.               
  282.                     LICENSE_AGREEMENT   Product_Support      
  283.  Structure Pack Types 
  284.  Specifications 
  285. AccessPack       DVmonPack        RemotePack     
  286. Specs_Overall            
  287. BreakPack        ExitPack         SetRetriesPack 
  288. Specs_DBF                
  289. CopyPack         FieldDescTYPE    StatDataPack   
  290. Specs_Index              
  291. CreateDataPack   HandlePack       StatKeyPack    
  292. Specs_Memory             
  293. CreateKeyPack    InitPack         StatHandlePack 
  294. Specs_OS_Calls           
  295. DescriptorPack   MemoryPack       XErrorPack     
  296. Specs_Languages          
  297. DOSFilePack      OpenPack                        
  298. Specs_OSes               
  299.                                                  
  300. Specs_Networks           
  301.                                                  
  302. Specs_Performance        
  303. See: License_Agreement
  304. ~License_Agreement
  305. Before using this software you must agree to the following:
  306.  1. You are not allowed to operate more than one (1) copy of this software
  307.     package at one time per license. This means that if you have 10 programmers
  308.     that COULD possibly use the BULLET library at the same time, you must also
  309.     have ten (10) BULLET licenses.
  310.  2. You are not allowed to distribute non-executable code containing BULLET
  311.     code. This means that you are not allowed to redistribute BULLET code as
  312.     another .LIB, for example. Also, if BULLET code is to be contained in a
  313.     Dynamic Link Library (DLL) then it must be part of a stand-alone product.
  314.     This means that you cannot provide a .DLL containing BULLET code if that
  315.     .DLL is to be used as a programming library for other programmers. If you
  316.     wish to distribute non-executable code containing BULLET code you must
  317.     obtain written permission from the author.
  318.  3. This license grants you the right to use the BULLET library code on a
  319.     royalty-free basis.
  320. See: License_a                                                          -MORE-
  321. ~License_a
  322.  4. BULLET is owned by the author, Cornel Huth, and is protected by United
  323.     States copyright laws and international treaty provisions. You are not
  324.     allowed to make copies of this software except for archival purposes.
  325.  5. You may not rent or lease BULLET. You may not transfer this license without
  326.     the written permission of the author. If this software is an update or
  327.     upgrade, you may not sell or give away previous versions.
  328.  6. You may not reverse engineer, decompile, or disassemble this software.
  329.  7. There are no expressed or implied warranties with this software.
  330.  8. All liabilities in the use of this software rest with the user.
  331.  9. U.S. Government Restricted Rights. This software is provided with
  332.     restricted rights. Use, duplication, or disclosure by the Government is
  333.     subject to restrictions as set forth in subparagraph (c)(1)(ii) of the
  334.     Rights in Technical Data and Computer Software clause at 52.227-7013.
  335.     Manufacturer is Cornel Huth/6402 Ingram Rd/San Antonio, TX 78238.
  336.     This agreement is governed by the laws of the state of Texas.
  337. See: Product_Support
  338. ~Product_Support
  339. Support is available at my BBS, The 40th Floor, 7 days a week. Hours are
  340. 5pm to 9am, Central Time (USA). Weekend BBS hours are 1pm to 9am. Hours other
  341. than during above periods are voice. Central Time is UTC time -5/6 hours.
  342.         BBS tele#: 1-210-684-8065 (times listed above)
  343.                    N81, 300 to 14.4k bps
  344. Latest releases of BULLET are available for free download by registered users.
  345. Also available are other shareware products by me such as LP100, RUCKUS,
  346. QBTREE, QBEVGFX plus many more.
  347. The 40th Floor BBS is V32b, V32 compatible. Data rates 300 to 14.4k bps.
  348. My E-mail address:
  349.   Fidonet: 1:387/800.8
  350.  Internet: chuth@lonestar.utsa.edu
  351. See: Starting_CZ
  352. ~Starting_CZ
  353. At CZ's initial load it looks into the current directory for CZ.HLP, then in 
  354. the directory of CZ.COM, and last it looks for the pathname specified by the 
  355. DOS variable CZH (SET CZH=C:\DOC\CZ.HLP). Use /f: for alternate locations or 
  356. if CZ has any trouble locating its CZ.HLP file (C>cz /f:D:\BIN\CZ.HLP).      
  357. Load CZ.COM from the DOS command line. Options are:
  358.         /f:helpfile.ext       Use other than default CZ.HLP help file
  359.         /h# where n=1 to 4    Use alternate hot-key from default Alt-F1
  360.             #=1  Ctrl-h
  361.             #=2  F12
  362.             #=3  left+right Shift
  363.             #=4  Alt-left Shift
  364.         /u  uninstall CZ from memory (after initial load)
  365.         /s  temporarily put CZ to sleep by restoring all hooked vectors
  366.         /r  restore CZ from its sleep by rehooking vectors
  367.         /?  quick help
  368.  E.g., C>cz /f:D:\PRG_C\CBULLET.HLP   supply entire pathname when using /f:
  369.        C>cz /h1                       change hot key from Alt-F1 to Ctrl-H
  370. See: Using_CZ
  371. ~Using_CZ
  372. To activate CZ press the hot-key while the cursor is on the word you want to
  373. look up. Information on that word, if any, is displayed. If none is available,
  374. an index of help items in the dictionary is shown. Along the top-right of the
  375. index screens is the control bar. You can quickly move to the control bar by
  376. pressing <Home> or the See: line with <End>. Move the cursor to TUTORIAL_INDEX
  377. to select the second index screen or QUIT to return to whatever you were doing
  378. or over any index item. Then press <Enter> to move to that item's help entry.
  379. <F1> can be used as <Enter>. A mouse can also be used and is recommended.
  380. For example, to find out about CreateDXB, type it in your application and move
  381. the cursor on it. Press the hot-key. The CreateDXB screen is displayed. To see
  382. what pack type it uses, move to CreateDataPack (at Pack:) and press <Enter>.
  383. For a source example, move the cursor to Src: CreateDXBsrc. To go straight to
  384. the index from your application, press the hot-key with the cursor on a blank
  385. space. The <Esc> key returns you to your application.
  386. If there are more screens for the current topic the See: line has the same   
  387. topic name plus a letter, and -MORE- at the end. Move the cursor (or mouse)  
  388. to the topicname text (by using the <End> key) and press <Enter> (or click). 
  389. See: Using_CZ_a                                                         -MORE-
  390. ~Using_CZ_a
  391. CZ.COM can be loaded high but it is ESSENTIAL that you have at least 15K of  
  392. free UMB RAM available. It will load in as little as 4.5K but it will not    
  393. operate correctly. Use MEM/c to see how much Upper Memory RAM is available.  
  394. CZ opens the help file at installation. The help file is opened for Read-Only
  395. access with a Deny None sharing attribute. The file is closed when CZ is
  396. uninstalled (C>cz /u). CZ makes use of its own 256-byte stack.
  397. If you have several CZ help files, rename them to their particular application.
  398. For example:
  399. Rename the C BULLET CZ.HLP to CBULLET.HLP. Put CBULLET.HLP into your
  400. help files directory. Put SET CZH=C:\HELPFILES\CBULLET.HLP in your AUTOEXEC.BAT
  401. file. The next time CZ is installed it uses CBULLET.HLP from C:\HELPFILES.
  402. At anytime you can specify CZ.COM to use another help file. For example, if the
  403. current CZ help file is CBULLET.HLP but you want to use the QBULLET.HLP file,
  404. use C>cz /f:\helpfiles\qbullet.hlp. QBULLET.HLP then becomes the active file
  405. the next time you popup CZ.
  406. See: Using_CZ_b                                                         -MORE-
  407. ~Using_CZ_b
  408. Limitations:
  409. 1) CZ is a stable TSR but like all TSRs in a DOS system, unforseen events can
  410. take place that could conceivably cause the computer to crash. Therefore, it's
  411. recommended that you save your work often (you should do so whether a TSR is
  412. installed or not).
  413. See: About_CZ
  414. ~About_CZ
  415.               
  416.               
  417.                      CZ HELP                     
  418.               
  419.                                                  
  420.               
  421.       Context-sensitive Online Help Manager      
  422.               
  423.                                                  
  424.               
  425.                      for the                     
  426.               
  427.                                                  
  428.               
  429.                
  430.               
  431.               
  432.                
  433.                
  434.               
  435.                
  436.                
  437.               
  438.                
  439.                
  440.               
  441.                                                  
  442.               
  443.                 compiler libraries               
  444.               
  445.                                                  
  446.               
  447.               DOS C compiler version             
  448.               
  449.         (available for most DOS compilers)       
  450.               
  451.                                                  
  452.               
  453.            Copyright 1993  Cornel Huth           
  454.               
  455.                                                  
  456.               
  457. Ver 1.03         INT2F MuxID=C2         22-Apr-93
  458.               
  459. See: Specs_Overall
  460. ~is_BULLET - What?
  461. BULLET is a program module that handles the details of putting information to
  462. and getting information from your hard disk using a standard data file format
  463. called the Xbase DBF format with very fast and efficient index file routines.
  464. It can be used as-is by most DOS compilers.
  465. BULLET is written in 100% assembly language. Why? Two reasons. First, control.
  466. There's no compiler code or run-time library code in between BULLET and your
  467. data. Second, efficiency. BULLET knows exactly what it requires from the
  468. operating system and when. Result: fast, small, and robust applications.
  469. See: is_a_database
  470. ~is_a_database - What?
  471. A database is a collection of data arranged so that the it can be accessed as
  472. useful information. For example, let's say we have two files. Each consists of
  473. two fields. The first file has codenumber and score. The second file has a
  474. codenumber and name. Separately, the files are merely a collection of data.
  475. Together, however, they tie the name to the score:
  476.         score codenumber   codenumber name
  477.          99     100           100     John
  478.          87     155           105     Paul
  479.          66     125           110     George
  480.           :      :             :       :
  481. Codenumber 100 is John, who scored 99. The other members scores are not in the
  482. abbreviated data file listing.
  483. A database can be a single data file but more often it is a group of related
  484. data files and usually these data files are indexed by keys (in the index file,
  485. also called key file) so that very fast, direct access is possible.
  486. See: is_DBF
  487. ~is_DBF - What?
  488. DBF is the file extension of dBASE III-compatible data files (filename.DBF).
  489. The file format is used by dBASE IV, FoxPro and many other database programs.
  490. Many programs can also use the file format to import/export data using it.
  491. The DBF format is the most common data file format used on PCs.
  492. A DBF-compatible data file consists 3 distinct areas. First is the data header.
  493. This contains information such as the number of records in the file. Second is
  494. the field descriptors. These descriptors define the makeup of each field in the
  495. record. The third is the record area. Each record is a logical unit of data.
  496. For example, a record, all of which are made up of the same fields but with
  497. different data, could (conceptually) look like this:
  498.                field 1         field 2         field 3       field n
  499.            
  500.   record 1 
  501. Johnson         
  502. Larry          
  503. 465310555     ...
  504.            
  505.   record 2 
  506. Aberdeen        
  507. Zara           
  508. 465230555     ...
  509.            
  510.   record n
  511. See: is_a_Btree  Specs_DBF
  512. ~is_a_Btree - What?
  513. A b-tree is a sorting method ideally suited to data structures maintained on a
  514. hard disk. It is very fast on retrieval and is inherently self-balancing during
  515. inserts and deletes. Self-balancing ensures performance remains consistent.
  516. The reason the b-tree is ideally suited to hard disks is that, when looking for
  517. a particular key, most of the time involved in accessing the key is spent by
  518. the hard drive moving to various locations on the disk. The task of a good
  519. access method is to reduce the number of seeks that the disk must perform. The
  520. b-tree accomplishes this by maintaining several keys (perhaps 50) on each node,
  521. with the necessary pointers to previous and following nodes. A b-tree of order
  522. 20 (19 keys per node) can find a key in a file of 1,000,000 keys in a MAXIMUM
  523. of 5 disk accesses, where each disk access visits a node.
  524. 'BASIC program to find *max* seeks needed/avg time
  525. Keys& = 1000000: KeysPerNode = 19: AvgSR = 25
  526. Order = KeysPerNode + 1
  527. max = (LOG((Keys& + 1) / 2) / LOG(Order / 2))
  528. PRINT "Max nodes accessed for"; Keys; "keys & b-tree of order"; Order;
  529. PRINT "is"; max; "nodes"
  530. PRINT "Max disk time based on avg seek+read of"; AvgSR;
  531. PRINT "ms is"; AvgSR / 1000 * max; "seconds"
  532. See: is_a_network  Specs_Index
  533. ~is_a_network - What?
  534. A network is a group of computers able to communicate with one another. Often
  535. called a LAN (local area network), a network allows resources to be shared.
  536. Sharing resources can lead to problems if steps are not taken to ensure that
  537. two computers don't try to share the same resource at the same time. For
  538. example, say two computers try to change the same record in a file on a network
  539. drive. Let's say both users are accessing the number of widgets in inventory.
  540. The first user gets there a micro-second before the second and allocates the
  541. last widget in stock. The second user comes in right after and, since the first
  542. user has not yet updated the inventory, allocates the very same widget. One
  543. widget, two users. When the first user updates the inventory, widgets in
  544. inventory is changed to 0 (previous - 1). The second updates the inventory in
  545. the same manner and sets widgets to 1 less what it was when it started, or 0
  546. also. You see the problem.
  547. In order to successfully share a file on a network, the file must first be
  548. locked to a single user. Once that user has locked the file, he has sole access
  549. to the data within it and he will not experience the scenario above. When the
  550. user has completed the changes, he unlocks the file so that others may use it.
  551. See: is_file_locking
  552. ~is_file_locking - What?
  553. File locking is a means to obtain exclusive access to a file. This is needed in
  554. cases of multiple programs or users accessing a shared file at the same time.
  555. There are several methods to ensure only one process or user has access to a
  556. file. The first method is to open the file so that while the file is open only
  557. your program can access any part of it. This is simple to implement and the
  558. operating system handles the details of this. However, it requires your program
  559. to open/close files all the time since no other process may access the file
  560. while it is open.
  561. Another method is to use byte-level locks. Also managed by the OS, this method
  562. allows for restricting access to any particular region within the file. Which
  563. regions are to be locked is to be determined by your program, however, and it
  564. can be complex to perform multiple locks at the byte, field, or record level.
  565. Another use of the byte-level lock is to specify that all bytes within the file
  566. are to be locked. This greatly simplifies the process of obtaining a lock and
  567. has the advantage over a file access lock of not needing to open/close the file
  568. for each lock. It is very fast and easy to implement. BULLET offers all three
  569. lock types.
  570. See: is_NLS
  571. ~is_NLS - What?
  572. NLS stands for National Language Support. This feature is available in DOS 3.3
  573. and later. BULLET makes use of NLS by getting from DOS the current DOS country
  574. collate-sequence table. The collate table is used to properly sort mixed-case
  575. character strings and also foreign (or non-USA) language character strings
  576. according to that country's alphabet. This is an option but is recommended.
  577. In addition, BULLET provides for a programmer-supplied collate-sequence table.
  578. See: design_a_DB
  579. ~design_a_DB - How to
  580. To design a database, above all else, know what information you require from
  581. it. Having established what you need to know, collect the data that lets you
  582. formulate this into useful information.
  583. For example, you want to track a class of students and determine how well they
  584. achieve on tests. The criterion you use is the test score. You determine that
  585. your data is 1) students, 2) tests, and 3) test scores. Too simplify, you use
  586. a single 20-character field for student, a numeric field for test number
  587. (1 to the n tests), and a numeric field for test scores (0 to 100).
  588. Since the objective is to track students' scores, arrange the data so that
  589. output consists of each student's score in test order. Do this by specifying an
  590. index file containing an index based on the student's name and test number:
  591.   char keyexpression[136];
  592.   strcpy (keyexpression,"STUDENT+TEST"); /* use two-field key */
  593. By using the routines of the database langauge, you can easily create the data
  594. and index files, add data, list student's scores, or make changes to the
  595. database. Note: these How_to examples are meant only to show the basis behind
  596. an operation.
  597. See: create_a_DB  CreateKXB
  598. ~create_a_DB - How to
  599. Having defined the database, create it. First, create the datafile based on the
  600. 3 fields you defined in your design. To do this, allocate an array for the
  601. field descriptors for the number of fields (see also CreateDataPack):
  602. struct fielddesctype fieldlist[3];
  603. strcpy(fieldlist[0].fieldname, "STUDENT"); 
  604. strcpy(fieldlist[0].fieldtype, "C");       
  605. The fieldlist is a struct member 
  606. fieldlist[0].fieldlen = 20;                
  607. in CDP (CreateDataPack) as in:   
  608. fieldlist[0].fielddc = 0;                  
  609. CDP.func=CREATEDXB;              
  610. strcpy(fieldlist[1].fieldname, "TEST");    
  611.   :        :                     
  612. strcpy(fieldlist[1].fieldtype, "N");       
  613. CDP.fieldlistptr=fieldlist;      
  614. fieldlist[1].fieldlen = 1;                 
  615.   :        :                     
  616. fieldlist[1].fielddc = 0;                  
  617. strcpy(fieldlist[2].fieldname, "SCORE");
  618. strcpy(fieldlist[2].fieldtype, "N");
  619. fieldlist[2].fieldlen = 3;
  620. fieldlist[2].fielddc = 0;
  621. Call CreateDXB to create the data file. To create the index file, first open
  622. the data file just created, then call CreateKXB to create the index file. Open
  623. the index file so we can use it (data file is already open).
  624. See: add_to_the_DB  CreateDXB
  625. ~add_to_the_DB - How to
  626. Once you have the database designed and the data and key files created and open
  627. you can start putting the student's test data into it. Note that the DBF-format
  628. requires that all data in a data file be in ASCII format. This means that we
  629. must convert the numeric test score into its ASCII form. C has the ITOA()
  630. function to do this. In addition, numbers generally should be right-justified
  631. in their field.
  632. Note that BULLET does not require that you use only ASCII field data. If you
  633. want to forgo dBASE compatibility, binary data can be used directly in the
  634. fields.
  635. See: query_the_DB  InsertXB
  636. ~query_the_DB - How to
  637. Now that you have data in the database you want to see what's in there. Since
  638. the index file is in "STUDENT+TEST" order, the information we'll be getting
  639. out of the database is in Student name order, with each student's scores in
  640. test number order.
  641. If we want to look at all the students, we can use GetFirstXB to retrieve the
  642. first student's score for the first test. GetNextXB retrieves the next record
  643. (the first student's score for the second test), and so on. When all records
  644. have been retrieve GetNextXB returns an End Of File error code.
  645. If we want to look at a particular student's score only, we can use GetEqualXB
  646. to go directly to a student's first test score. GetNextXB get his next and so
  647. on until GetNextXB retrieves the next student's first test score. You can stop
  648. at this point (student names no longer match).
  649. We might also want to find all students who scored less than 65 on any test. To
  650. do this we can GetFirstXB, check SR.score for < 65 and if so print that record.
  651. Continue by using GetNextXB, printing each record that has a score < 65.
  652. See: update_the_DB  GetFirstXB
  653. ~update_the_DB - How to
  654. To update a particular record in the database we must first locate and identify
  655. it using one of the get routines such as GetEqualXB. The Get() routine return
  656. the record data, and also the physical record number of the record accessed,
  657. into the AccessPack RecNo. Having used one of the Get() routines to read the
  658. data record from disk to memory, you can make any changes to the data record in
  659. memory. E.g., if a student's score needs to be changed from a 69 to a 96, first
  660. find the record (and its RecNo), then update the score field.
  661. Note that any change to a key field will initiate a key file update
  662. automatically.
  663. See: delete_a_record  UpdateXB
  664. ~delete_a_record - How to
  665. To delete a particular record in the database we must first locate it using
  666. one of the get routines such as GetEqualXB. These Get() routines return the
  667. actual record number of the data record accessed by Get() into the AccessPack
  668. RecNo. Having used one of the Get() routines to find the data record, make a
  669. call to the delete function.
  670. The DeleteRecordXB routine does not physically remove the record from the data
  671. file but instead tags it as being "deleted".
  672. See: TC_compile_with  DeleteRecordXB
  673. ~TC_compile_with - How to
  674. To create an EXE file using Turbo C, comile you source using the medium,
  675. large, or huge memory models. No special compiler switches are required other
  676. than choosing the correct model.
  677. For example, if you have a single-module C source file called STUGRADE.C,
  678. compile it:
  679.  C>tcc -mm studgrade BULLET.lib
  680. If successful, the LINK program will automatically be called and the EXE
  681. program will be ready to run.
  682. It couldn't be simpler. One .LIB.  One .H.
  683. See: QC_compile_with
  684. ~QC_compile_with - How to
  685. To create an EXE file using Quick C, comile you source using the medium,
  686. large, or huge memory models. No special compiler switches are required other
  687. than choosing the correct model.
  688. For example, if you have a single-module C source file called STUGRADE.C,
  689. compile it:
  690.  C>tcl -Am stugrade BULLET.lib
  691. If successful, the LINK program will automatically be called and the EXE
  692. program will be ready to run.
  693. It couldn't be simpler. One .LIB.  One .H.
  694. See: LIB_with
  695. ~LIB_with - How to
  696. BULLET.LIB is composed of many separate assembly language modules. All these
  697. modules have been combined into a single, easy-to-use .LIB library. While it
  698. is possible to combine, or add, other .OBJ files or even other .LIB files to
  699. BULLET.LIB, I do NOT, -NOT-, recommend that you do so.
  700. If you need to use two or more libraries with your programs, no problem, LINK
  701. can handle as many as you have. When LINK prompts you for a library file, just
  702. enter BULLET.LIB followed by any other library you need. For example:
  703.  C>LINK
  704.  Microsoft (R) Segmented-Executable Linker  Version 5.10
  705.  Copyright (C) Microsoft Corp 1984-1990.  All rights reserved.
  706.  Object Modules [.OBJ]: STUGRAD1+STUGRAD2+STUB
  707.  Run File [STUGRAD1.EXE]: STUGRADE.EXE
  708.  List File [NUL.MAP]: nul
  709.  Libraries [.LIB]: BULLET MOUSE;
  710. Consult your linker programs documentation for more.
  711. See: call_BULLET
  712. ~call_BULLET - How to?
  713. BULLET is called through a single entry point. The only argument passed to it
  714. is a far pointer to the control pack using the Pascal calling convention. The
  715. first two entries in this pack are the function to be performed and the
  716. function return status. BULLET is a function call returning an integer status
  717. value. See BULLET.H for more.
  718. Each function (or routine) uses a prescribed pack format. For example, some
  719. routines need only know the handle of the file, along with the function number
  720. itself. So, to flush a data file, for example, you would do the following:
  721.  struct handlepack HP;
  722.  HP.func = FLUSHDHXB;         /* FLUSHDHXB is defined as a CONST in BULLET.H */
  723.  HP.handle = file2flushhandle;/* handle as returned from the Open() routine  */
  724.  rstat = BULLET(&HP);         /* do the actual call to BULLET                */
  725. The value of rstat is set to the completion code as returned by the FlushDHXB
  726. routine. It is the same as the value returned in HP.stat *IN ALL BUT A FEW*  
  727. cases: InsertXB, UpdateXB, ReindexXB, and LockXB. These routines return not  
  728. the actual error code, but rather a transaction index number of the access   
  729. that failed. See those routines for more information.                        
  730. See: is_BULLET  FlushDHXB
  731. ~Specs_Overall
  732. BULLET is dBASE III/III+/IV .DBF-compatible. This format is compatible with a
  733. large base of software programs including the latest database packages such as
  734. dBASE IV and FoxPro. Spreadsheet packages such as Excel and 1-2-3 can directly
  735. import BULLET DBF data files, too. And because of BULLET's versatility, it can
  736. also create very non-standard data files. This may be a useful feature if data
  737. secrecy is of concern.
  738. BULLET requires MS-DOS 3.30 or above. It uses 19K of code/static data space and
  739. requires at least 40K of workspace. 140K of workspace is ideal.
  740. Overall Specifications:
  741.               DBF           (per file)          INDEX
  742.       
  743.     Max records: 16,777,215                Max nodes: 65,535
  744.   Record length: 2-4000 (8192)              Max keys: 4,063,170
  745.      Max fields: 128 (255)                Key length: 1-64
  746.    Field length: 1-254 (255)          Max key fields: 16
  747. Total open index plus data files can be up to 255. Numbers in () indicate
  748. extended specifications.
  749. See: Specs_DBF
  750. ~Specs_DBF
  751. To remain compatible with other dBASE III .DBF platforms you should restrict
  752. your data files to the following specifications:
  753.  File ID byte: 3  (83hex if .DBF has memo field, not currently supported)
  754.  Max record size: 4000 bytes  Max fields/rec: 128   Max field size: 254 bytes
  755.  Allowable field name characters: A-Z and the _ (upper-case)
  756.  Allowable field types:
  757.   C-character, 1-254 bytes
  758.   D-date, 8 bytes, in the format YYYYMMDD (19920531)
  759.   L-logical, 1 byte, either space, "T" or "Y", "F" or "N"
  760.   M-memo, 10 bytes, used as pointer into .DBT file (currently not supported)
  761.   N-numeric, 1-19 bytes, ASCII format, uses explicit decimal if needed...
  762.     ...decimal places may be 0, or 2 to (field size - 3) but no more than 15
  763. Restrict all data in .DBF fields to ASCII. This means you should convert binary
  764. data to the equivalent ASCII representation, e.g., if you have the binary value
  765. 22154, it must first be converted to the string "22154" before you can store it
  766. to the .DBF data file. So, while your in-program code deals with binary data,
  767. your I/O code must convert it to/from ASCII. This is a dBASE-compatibility
  768. issue only. If you can forgo these requirements you can use binary fields, any-
  769. character field names, record sizes to 8192 bytes, and up to 255 fields.
  770. See: Specs_DBF_a                                                        -MORE-
  771. ~Specs_DBF_a
  772. A dBASE III .DBF is composed of 3 sections: the header, the field descriptors,
  773. and the data area.
  774. The header structure (first 32 bytes of file):
  775.     Name     Type   Offset  Meaning
  776.  FileID      byte        0  data file type id, 03 standard (43,63,83,88h)
  777.  LastYR      byte        1  last update year, binary
  778.  LastMo      byte        2  last update month, binary
  779.  LastDA      byte        3  last update day, binary
  780.  NoRecs      long        4  number of records in file
  781.  HdrLen      word        8  length of header, including field descriptors, +1
  782.  RecLen      word       10  length of data record including delete tag
  783.  internal    byte    12-31  reserved
  784. The last update values are updated to the current date whenever the .DBF file
  785. is flushed or closed. Likewise, the NoRecs value is updated whenever a record
  786. is added to the .DBF. The FileID is specified when you create the file, HdrLen
  787. and RecLen are computed and stored when the file is created, too.
  788. See: Specs_DBF_b                                                        -MORE-
  789. ~Specs_DBF_b
  790. The field descriptor format (follows header, one per field):
  791.     Name     Type   Offset  Meaning
  792.  FieldName   char        0  field name 10 ASCII characters, A-Z or _ (0-filled)
  793.         0T   byte       10  field name zero-termintor (must be 0)
  794.  FieldType   char       11  field type (C D L M N)
  795.  internal    long       12  reserved
  796.  FieldLen    byte       16  length of this field
  797.  FieldDC     byte       17  decimal count
  798.  internal    byte    18-31  reserved
  799.       
  800. The unused bytes in the FieldName must be set to zeroes (CHR$(0)).
  801. Each field is described by a 32-byte descriptor. The first field's descriptor
  802. starts right after the header proper, at offset +32. After the last field
  803. descriptor is data byte ASCII 13. (Note: the orginal dBASE III has a 0 byte
  804. following this ASCII 13.) Immediately following this is the actual record data.
  805. See: Specs_DBF_c                                                        -MORE-
  806. ~Specs_DBF_c
  807. The data record format:
  808. The first record is located at offset HdrLen (from the header). The first byte
  809. of each record is a delete tag. This tag is maintained by the BULLET routines.
  810. A space, ASCII 32, means the record is not deleted; an asterisk, ASCII 42,
  811. means the record has been deleted (marked as deleted, often this is used as a
  812. method to temporarily tag records, for whatever purpose).
  813. Following the tag is the data for each field, not delimited (i.e., the fields
  814. run together without anything separating them). The second record is at offset
  815. HdrLen+reclen. The start offset of any record in the file can be computed as
  816. (recordnumber - 1) * reclen + HdrLen. All data is in ASCII form.
  817. An EOF marker (ASCII 26) is placed at the end of the last record.
  818. See: Specs_Index
  819. ~Specs_Index
  820. BULLET uses a proprietary, modified b-tree index method to manage the index
  821. files. The supported key types are:
  822.     Type     Length  Meaning
  823.  Character     1-64  ASCII, NLS, or user-supplied sort table
  824.  Integer          2  signed or unsigned 16-bit value
  825.  Long Int         4  signed or unsigned 32-bit value
  826. In addition to the above types, BULLET allows for unique or duplicate keys in
  827. the index file. If duplicates are allowed, BULLET enumerates each key with an
  828. enumerator word (see FirstKeyXB).
  829. The key may be composed of up to 16 character fields or substrings within those
  830. fields. Numeric fields are considered character fields by BULLET unless the key
  831. is set to binary (see KeyFlags). Integer or LongInt binary keys can be composed
  832. of a single field only. The key expression is specified in text (e.g., "LNAME+
  833. SUBSTR(FNAME,1,1)+MI") and is fully evaluated when the index file is created.
  834. A BULLET index file is composed of 3 sections: the header, the collate-sequence
  835. table, and the node/key entry area.
  836. See: Specs_Index_a                                                      -MORE-
  837. ~Specs_Index_a
  838. The header structure:
  839.     Name     Type   Offset  Meaning
  840.  FileID      byte        0  index file type id, 20
  841.  RootNode    word        1  root node number
  842.  Keys        24bit       3  number of keys in index file
  843.  AvalNode    word        6  node number available for reuse
  844.  FreeNode    word        8  next free node number
  845.  KeyLen      byte       10  key length
  846.  NodeKeys    byte       11  number of keys that fit on a node
  847.  CodePage    word       12  code page ID
  848.  CtryCode    word       14  country code
  849.  internal    byte    16-21  reserved
  850.  KeyFlags    word       22  key flags
  851.  KeyExprn    byte   24-159  key expression
  852.  internal    byte      160  reserved
  853.  KeyXFlds    byte      161  number of fields used by key (1-16)
  854.  KeyXlate    byte  162-225  translated key expression
  855.  internal    byte  226-253  reserved
  856.  CTsize      word      254  collate-sequence table size
  857. See: Specs_Index_b                                                      -MORE-
  858. ~Specs_Index_b
  859. The collate-sequence table structure:
  860.  table      byte   256-511  sort weight table of ASCII character 0-255
  861. Node/key entry structure (first entry is in node #1, file offset 512):
  862.   2A  0A 00  KEY123  7B 00 00  12 00  KEY178  B2 00 00  0C 00 ...
  863.    1.   2.     3.       4.       5.     6.       7.       8.   9.
  864.       
  865.  1. Key count for that node (first byte of each node)
  866.  2. 16-bit node back pointer (for non-leaf nodes, 0 if leaf node)
  867.  3. First key value, "KEY123" in this case
  868.  4. 24-bit data record pointer (low word/hi byte) 7Bh = DBF record number 123
  869.  5. 16-bit node forward ptr/back ptr (for non-leaf nodes, 0 if leaf node)
  870.     --in this case, it indicates that the key following KEY123 is in node# 12h
  871.     --and also that the key before KEY178 is in that node as well
  872.  6. Second key (here "KEY178")
  873.  7. 24-bit data pointer (record number in DBF)
  874.  8. 16-bit forward node pointer (for non-leaf nodes, 0 if leaf node)
  875.  9. Repeat 6 to 8 for each key on node. (node size is 512 bytes)
  876. See: Specs_Index_c                                                      -MORE-
  877. ~Specs_Index_c
  878. As in many b-tree implementations, BULLET's index files maintain an average
  879. load percentage of approximately 66%. This means that in any given node, 66% of
  880. the available space is in use. The free space in the node is attributable to
  881. the constant reshaping of the file as keys are inserted or deleted, causing the
  882. nodes to be split and merged. A split will occur when an insert needs to add a
  883. key to an already full node; a merge will occur when a neighboring node is
  884. small enough to be merged into a just split node. This constant prune-and-graft
  885. of the b-tree results in a node load of about 66% (50% in degenerate cases such
  886. as with already sorted data). It's this aspect of the b-tree that makes it a
  887. consistent performer and a widely-used method of managing index files.
  888. The following formula can be used to determine the number of keys that an index
  889. file can hold:
  890.   MaxKeys = MaxNodes * MaxKeysPerNode * LoadFactor
  891.   MaxKeys = 65535 * 509/(keylen+5) * .66
  892. The load factor can be increased to ~95% by using the ReindexXB routine. This
  893. load factor results in superior retrieval speeds since there are more keys on
  894. each node. Insertion speed will be decreased, however, since splitting will
  895. occur more frequently, though perhaps not noticeably.
  896. See: Specs_Memory
  897. ~Specs_Memory
  898. BULLET allocates memory on an as-needed basis. When linked to an executable
  899. program, BULLET makes use of 17.5K of code space and about 1.5K of static
  900. DGROUP data space. To accomodate the wide variety of compilers, BULLET's API
  901. structure will have the linker included all of the library into your final EXE
  902. program.
  903. All runtime memory allocations are obtained from the operating system (the
  904. far heap).
  905. The amount of memory that BULLET requires is based on which routines are used.
  906. See the next screen for a list of the routines that make malloc calls to the
  907. operating system and how much memory they require.
  908. Note that the malloc calls are made with DOS INT21/48.
  909. See: Specs_Memory_a  MemoryXB                                           -MORE-
  910. ~Specs_Memory_a
  911. Routines making dynamic memory allocations and amount (within 
  912.  16 bytes):
  913.   Routine           Bytes        Basis
  914. InitXB                  272   permanent, released when program ends (JFTmode=1)
  915. BackupFileXB             32K  temp, released when routine exits
  916. CreateDXB        48+(NF*32)   temp, released when routine exits (NF=NoFields)
  917. CreateKXB               544   temp, released when routine exits
  918. OpenDXB     144+((1+NF)*32)   semi-permanent, released when file closed
  919. OpenKXB                1264   semi-permanent, released when file closed
  920. PackRecordsXB      RL to 64K  temp, released when routine exits (RL=RecLength)
  921. ReindexXB        32K to 128K  temp, released when routine exits
  922. UpdateXB              2K+RL   temp, released when routine exits (RL=RecLength)
  923. For example, when BackupFileXB is called it attempts to allocate 32K from the
  924. OS. If 32K is not available, BackupFileXB returns with an error code of 8 (DOS
  925. error #8, not enough memory). If you won't be using Backup or Reindex, BULLET
  926. can make do with much less memory (use table above).
  927. Needed stack space is 4K (max) for ReindexXB. Other routines can operate with
  928. less than 1K of stack space. In other words, stack use is minimal.
  929. See: Specs_OS_calls
  930. ~Specs_OS_calls
  931. BULLET makes use of the following operating system calls:
  932. INT21/25 DOS_setvector                  INT21/44/0B DOS_setsharingretrycount
  933. INT21/2A DOS_getdate                    INT21/48 DOS_malloc
  934. INT21/30 DOS_version                    INT21/49 DOS_free
  935. INT21/35 DOS_getvector                  INT21/51 DOS_getpsp
  936. INT21/39 DOS_makedir                    INT21/56 DOS_renamefile
  937. INT21/3D DOS_openfile                   INT21/59 DOS_getextendederror
  938. INT21/3E DOS_closefile                  INT21/5A DOS_createtempfile
  939. INT21/3F DOS_readfile                   INT21/5B DOS_createnewfile
  940. INT21/40 DOS_writefile                  INT21/5C DOS_lockunlockfile
  941. INT21/41 DOS_deletefile                 INT21/65/01 DOS_getextendedcountryinfo
  942. INT21/42 DOS_movefileptr                INT21/65/06 DOS_getcollatesequencetable
  943. INT21/44/09 DOS_isdriveremote           INT21/67 DOS_sethandlecount
  944. INT21/44/0A DOS_isfileremote            INT2F/10/00 DOS_isshareinstalled
  945. No other operating system calls are made. No BIOS calls are made.
  946. See: Specs_Languages
  947. ~Specs_Languages
  948. BULLET is compatible with most DOS compilers. The only requirements are that
  949. your compiler allow you to:
  950.  1. Call a library routine via a FAR call using PASCAL calling convention
  951.  2. Pass a far pointer (of the parameter pack) on the stack, by value
  952.  3. Supply far pointers to the various pack parameters
  953.  4. Be able to return an integer value from the FAR call
  954.     (this is optional but recommended for the transaction-based routines)
  955. These requirements can be met with most BASIC, C, and other-language DOS
  956. compilers.
  957. CZ online help is currently available in BASIC and C versions. Others are
  958. pending. You should be able to do well with either of these versions using
  959. other-language compilers since the only difference is the source code examples.
  960. See: Specs_OSes
  961. ~Specs_OSes
  962. BULLET is currently available only for MS-DOS and compatible operating systems.
  963. It requires DOS 3.3 or higher.
  964. To provide efficient memory use, BULLET uses a single-buffer cache per index
  965. file. The single-buffer cache also provides for very quick network access since
  966. a minimum amount of memory needs to be flushed when releasing control of BULLET
  967. files. For maximum speed, however, an external high-performance disk cache can
  968. be used. Hyperdisk is a good choice (shareware, $50+). A properly configured
  969. cache can increase BULLET's performance from 10 to 300%. The most improvement
  970. is with the InsertXB routine. The least is with ReindexXB and PackRecordsXB,
  971. which do most of their work in temporarily allocated memory. Hyperdisk is about
  972. the best designed disk cache available for PCs. SmartDRV 4.x is also good.
  973. If you do not use a disk cache then it's recommended that you set your BUFFERS=
  974. statement in CONFIG.SYS to at least 20 or 30. Even without a disk cache, BULLET
  975. is still very fast. Also, be sure to set your FILES= to the number of files
  976. that you'll be opening at any one time. If you set FILES=20 you can have BULLET
  977. open 14 files (CZ.COM uses 1 and DOS reserves 5 more). You can set FILES=255
  978. allowing BULLET to open up to 249 files at one time.
  979.                  DO NOT set FILES= to a value greater than 255.
  980. See: Specs_Networks
  981. ~Specs_Networks
  982. BULLET currently operates on all DOS-compatible network platforms.
  983. Be sure to install SHARE.EXE (or compatible) on the server and, if you are
  984. mutlitasking, on your local machine. If you'll be opening many files you
  985. should extended the default SHARE file-sharing information space and the number
  986. of locks that can performed at one time. The DOS 5.0 default is /F:2048 and
  987. /L:20. This allocates 2K for file-sharing info space and allows 20 consecutive
  988. locks to be active. If the F: value is too low, error 5 (extended error 32) is
  989. returned on an open attempt. If you extend the JFT in InitXB and plan to use
  990. many files, say more than 50, be sure to extend /F: by 2K for every 50
  991. additional files and set the /L: to the number of files you plan on having
  992. open. If L: is too low, error 1 (ext err 36) is returned on a lock attempt.
  993. As an example, if you'll be using 100 files, set FILES=106 in CONFIG.SYS, set
  994. SHARE /F:4096 /L:106, and IP.JFTmode=1 for InitXB. These values are a minimum.
  995. If you have more than one process active, you need to account for other apps.
  996. Note that Windows always returns a "SHARE is installed" using the DOS detection
  997. routines used by BULLET. To determine if SHARE is actually installed, attempt
  998. to perform a lock using one of the LockXB routines. An error code indicates
  999. that SHARE (or compatible) is not installed.
  1000. See: Specs_Performance
  1001. ~Specs_Performance
  1002.  Test: Reindex 1,000 to 1,000,000 records (BC_LAI10.C)
  1003.        DBF: extended DBF using binary sort field
  1004.        key: LONG+SIGNED+UNIQUE                        Machine: 486/33 SHO
  1005.  1Meg
  1006.                                                      *
  1007.      
  1008.      
  1009.                                     *
  1010.      
  1011.                    Records  Time  Reindex Rate
  1012.      
  1013.        *           -------  ----  ------------
  1014.  100k
  1015.   *                   1000   < 1  1000+/sec
  1016.      
  1017.                       5000     2    2500
  1018.      
  1019.  *                   10000     4    2500
  1020.      
  1021. *                    25000     7    3571   3500+ records indexed/second!
  1022.      
  1023.                      50000    14    3571   Times in table are in seconds
  1024.   10k
  1025. *                   100000    28    3571
  1026.      
  1027.                     200000    81    2469
  1028.      
  1029. *                   500000   355    1408
  1030.      
  1031.                    1000000  1124     890
  1032.    1k
  1033.      
  1034.  time (secs)  100       200       300       400       18:00     20:00 (min)
  1035. See: Specs_Overall
  1036. ~InitXB
  1037. Pack: InitPack          Src: InitXBsrc          Func:   0/System
  1038. Before using any routine you must initialize the BULLET file system.
  1039. If you want more than the standard number of file handles, set InitPack.JFTmode
  1040. to 1. This expands the current process's Job File Table to allow 255 open files
  1041. maximum.
  1042. On return the DOS version (INT21/30h) is in InitPack.DOSver. Major version in
  1043. the high byte. Minor in the low. The BULLET version (*100) is returned as is
  1044. the address of the ExitXB routine. You can use this address to register ExitXB
  1045. with your own _atexit function if your runtime library does not provide _atexit
  1046. already.
  1047. Note: _atexit is a routine available in most DOS, OS/2, and ANSI runtime
  1048. library code and is called just prior to the program ending. See AtExitXB for
  1049. information on what to do if your library does not have _atexit.
  1050. See: ExitXB
  1051. ~ExitXB
  1052. Pack: ExitPack          Src: ExitXBsrc          Func:   1/System
  1053. Before ending your program you should call ExitXB to close any open BULLET
  1054. files. This also will release any memory still allocated to those files.
  1055. This restores the default keyboard break handlers if they were changed.
  1056. In normal operation you would see to closing all files yourself. However, if
  1057. your program fails to reach the programmed end, it's very possible that files
  1058. may still be left open. It is essential that you properly close all BULLET
  1059. files before ending. There are two methods to achieve this:
  1060. 1. Direct you startup code so that on fatal errors, your program executes
  1061. ExitXB before returning to DOS.
  1062. 2. Use AtExitXB to automatically register ExitXB to be executed in the normal
  1063. shut-down code of the compiler. This method is preferred.
  1064. See: AtExitXB
  1065. ~AtExitXB
  1066. Pack: ExitPack          Src: AtExitXBsrc        Func:   2/System
  1067. Used to automatically close all BULLET files, release allocated memory, and
  1068. restore the default Break handlers when your program ends. Your compiler
  1069. generates specific code to be executed in the course of ending your program.
  1070. AtExitXB registers the ExitXB routine to be performed in this compiler-
  1071. generated code.
  1072. This routine is standard in most DOS, OS/2, and ANSI runtime libraries. If   
  1073. yours does not have _atexit, then you must link with the supplied            
  1074. NOATEXIT.OBJ file:                                                           
  1075.                                                                              
  1076. C>link YOURPRG + NOATEXIT, ...                                               
  1077. You can tell if your compiler doesn't supply _atexit at link time. LINK reports
  1078. '_atexit' : unresolved external. Add NOATEXIT.OBJ as described above.
  1079. Be sure that your _atexit routine is for the medium, large, or huge memory
  1080. models since BULLET uses multiple code segments and far calls.
  1081. See: MemoryXB  ExitXB  BreakXB
  1082. ~MemoryXB
  1083. Pack: MemoryPack        Src: MemoryXBsrc        Func:   3/System
  1084. This is the only BULLET routine that can be used before InitXB. It reports the
  1085. largest free block of memory available from the OS. This memory does not
  1086. include fragmented memory or UMB memory that BULLET can and will use.
  1087. With DOS able to use UMB memory, memory for BULLET requests may be provided
  1088. from this region. You can use StatPack.HereSeg from StatXB to locate from which
  1089. segment address the allocations are being made. Anything above C800h is UMB.
  1090. See: BreakXB  StatXB  OpenDXB  OpenKXB
  1091. ~BreakXB
  1092. Pack: BreakPack         Src: BreakXBsrc         Func:   4/System
  1093. Disables system response to Control-C and Control-Break keys preventing users
  1094. from inadvertently exiting the program without first doing a BULLET shutdown.
  1095. It's REQUIRED that you reinstate the default break handlers with this routine
  1096. before ending your program. ExitXB automatically reinstates the default break
  1097. handlers.                                                                    
  1098. This routine will not disable Control-Alt-Delete (a warm-boot). If the user is
  1099. at this point, he may prefer to exit via a warm-boot rather than reset the
  1100. machine.
  1101. This routine will not surpress the ^C displayed by DOS. If you don't want the
  1102. ^C to be displayed move the cursor to a location off-screen, say, row 26.
  1103. See: BackupFileXB  ExitXB
  1104. ~BackupFileXB
  1105. Pack: CopyPack          Src: BackupFileXBsrc    Func:   5/System
  1106. Copy an open BULLET key or data file. BULLET repacks and reindexes files in-
  1107. place, requiring less disk space to perform the function. BackupFileXB allows
  1108. you to safely copy a file before doing this.
  1109. This function is recommended prior to packing a data file with PackRecordsXB 
  1110. since the data is very valuable. There is probably little need to do so when 
  1111. reindexing an index file since index files can be constructed very easily    
  1112. from the data file but a CopyKHXB to preserve the key expression is quick    
  1113. and recommended.                                                             
  1114. See: StatHandleXB  PackRecordsXB  ReindexXB
  1115. ~StatHandleXB
  1116. Pack: StatHandlePack    Src: StatHandleXBsrc    Func:   6/System
  1117. Get information on a DOS file handle number to determine if it is a BULLET file
  1118. and if so, if that file is a BULLET key or data file.
  1119. If the returned ID value is 0, the handle is to a BULLET index file. ID=1 then
  1120. the handle is a BULLET .DBF file. ID= -1 then the handle is not a BULLET file.
  1121. See: CreateDXB  StatDXB  StatKXB
  1122. ~GetExtErrorXB
  1123. Pack: XErrorPack        Src: GetExtErrorXBsrc   Func:   7/System
  1124. Get the extended error information for the last operation. This information
  1125. includes the extended error code, the error class, the recommended action, and
  1126. the location of the error. See Errors_DOS for the extended error meaning an
  1127. Errors_DOS_c for the class, action, and locus code meanings.
  1128. Note that on fatal DOS errors, such as an open floppy drive door, the extended
  1129. error code returned is 83 - fail on INT24. This indicates that the INT24
  1130. handler was invoked by DOS and that the INT24 handler told DOS to ignore the
  1131. error. (BULLET invokes its own INT24 handler each time it accesses the DOS file
  1132. system and restores it promptly after the access.) In such cases, this extended
  1133. error code is less informative than the standard return code and, the other
  1134. 'extended' information should be disregarded. (In fatal DOS errors the standard
  1135. return code IS the extended error code.)
  1136. This routine returns the extended error information for the LAST DOS system  
  1137. error. This information remains the same until the next DOS system error.    
  1138. See: CreateDXB  Errors_DOS
  1139. ~DVmonCXB
  1140. Pack: DVmonPack         Src: DVmonCXBsrc        Func:   9/DEBUG
  1141. Control BULLET debug monitor.
  1142. This routine is available only in the debug engine.                          
  1143. The monitor displays in realtime the state of a data file handle, or an index
  1144. and data file handle pair if an index handle is specified. DVmonCXB is best
  1145. used on dual-display systems in which the video output is sent to the secondary
  1146. video monitor. In any case, a 4000-byte screen image is updated in real-time.
  1147. To use the monitor, set mode=1, handle=file to monitor, and VideoSeg=segment
  1148. address of 4000-byte area. The typical VideoSeg would be to video memory. If
  1149. you have a color system as the main monitor and a mono as the secondary, set
  1150. VideoSeg=0xB000. Detail system stats are continually updated to the secondary
  1151. monitor. If you have a single monitor with at least 2 video pages, set VideoSeg
  1152. to your base address plus the page size\16, typically 0xB800+(4096\16). If you
  1153. have only a single-page video system, you can allocate a 4000-byte memory area
  1154. and update the video manually by moving it to your video display (80x25).
  1155. See: CreateDXB  StatDXB  StatKXB
  1156. ~CreateDXB
  1157. Pack: CreateDataPack    Src: CreateDXBsrc       Func:  10/Mid-level
  1158. Create a new BULLET .DBF data file. Before using this routine allocate a field
  1159. description array of TYPE FieldDescTYPE for at least as many fields as are in
  1160. the record.
  1161. Conventional dBASE .DBF files have a FileID=3. Other possible FileIDs that you
  1162. may come across are (in hex):
  1163.  43h \__ are special-use Xbase IV DBF files, BULLET can process these file IDs
  1164.  63h /                                    since they are similar to ID type 3
  1165.  83h --- this DBF file has an Xbase III/III+ memo field/file
  1166.  88h --- this DBF file has an Xbase IV memo field/file
  1167. In creating your .DBF files, specify FileID=3 to ensure compatibility across 
  1168. Xbase versions.                                                              
  1169. BULLET makes no special use of the FileID byte.
  1170. See: OpenDXB  FieldDescTYPE  CreateKXB
  1171. ~OpenDXB
  1172. Pack: OpenPack          Src: OpenDXBsrc         Func:  11/Mid-level
  1173. Open an existing .DBF data file for use. You need to specify two things, the
  1174. filename and the DOS file access mode. If the open succeeds, the DOS file
  1175. handle is returned. Use this handle for all further access to this file.
  1176. Each .DBF data file you open allocates 144+((1 + number of fields) * 32) bytes
  1177. for internal use. This memory is not deallocated until you close the file with
  1178. CloseDXB or execute ExitXB.
  1179. You must open the data file before you can open (or create) any of its index
  1180. files.
  1181. See: CloseDXB  OpenKXB
  1182. ~CloseDXB
  1183. Pack: HandlePack        Src: CloseDXBsrc        Func:  12/Mid-level
  1184. Close an existing .DBF data file for use. Closing the file updates the file
  1185. header and deallocates the memory used by this file.
  1186. You MUST close all BULLET files before ending your program or file corruption
  1187. may occur. To ensure that all files are closed in the event of an unscheduled
  1188. program termination, use AtExitXB.                                           
  1189. See: StatDXB  ExitXB  CloseKXB
  1190. ~StatDXB
  1191. Pack: StatDataPack      Src: StatDXBsrc         Func:  13/Mid-level
  1192. Get basic information on the BULLET .DBF data file handle specified.
  1193. Information returned includes the number of records in the file, the record
  1194. length, number of fields per record, and the date the file was last updated.
  1195. Typically, your program will keep track of whether a particular handle belongs
  1196. to a data file or a key file. In cases where this is not possible, call the
  1197. StatHandleXB routine to determine what file type a handle is.
  1198. Note that a just-created data file will have the LastUpdate date set to 0/0/0.
  1199. See: ReadDHXB  StatKXB  StatHandleXB
  1200. ~ReadDHXB
  1201. Pack: HandlePack        Src: ReadDHXBsrc        Func:  14/Mid-level
  1202. Reload the disk copy of the data header for the opened .DBF data file handle
  1203. to the internal copy.
  1204. In single-user, single-tasking systems this routine is not needed. However, in
  1205. a multi-user or multi-tasking system it's possible, and desirable, for two or
  1206. more programs to use the same data file. Consider this scenario: A data file
  1207. has 100 records. Two programs access this data file, both opening it. Program 1
  1208. locks the file, adds a new record, then flushes and unlocks the file. Program 1
  1209. knows that there are now 101 records in the file. However, Program 2 is not
  1210. aware of the changes that Program 1 made--it thinks that there are still 100
  1211. records in the file. This out-of-sync situation is easily remedied by having
  1212. Program 2 reload the data header from the file on disk.
  1213. How does Program 2 know that it needs to reload the header? It doesn't. Instead
  1214. BULLET uses a simple yet effective approach when dealing with such problems.
  1215. Whenever your program locks a file, BULLET automatically reloads the header.
  1216. Whenever you unlock a file, BULLET automatically flushes the header.
  1217. See: FlushDHXB  ReadKHXB  LockXB
  1218. ~FlushDHXB
  1219. Pack: HandlePack        Src: FlushDHXBsrc       Func:  15/Mid-level
  1220. Write the internal copy of the data header for the opened .DBF data file handle
  1221. to disk. The actual write occurs only if the header has been changed.
  1222. This is to ensure that the data header on disk matches exactly the data header
  1223. that is being maintained by BULLET. Also, this routine updates the operating
  1224. system's directory entry for this file.
  1225. Assume the following: A data file with 100 records. Your program opens the data
  1226. file and adds 1 record. Physically, there are 101 records on disk. However, the
  1227. header image of the data file on disk still reads 100 records. This isn't a
  1228. problem, BULLET uses its internal copy of the data header and the internal copy
  1229. does read 101 records. BUT, if there were a system failure now, the disk image
  1230. would not get updated. After the system restart, BULLET opens the file, reads
  1231. the header and thinks that there are 100 records. You lost a record. Now, if
  1232. after that add above, your program issued a FlushDHXB, the header on disk is
  1233. refreshed with the internal copy, keeping the two in-sync. Also, the routine
  1234. updates the DOS directory entry, keeping things neat there as well. Still, it
  1235. doesn't come without cost: flushing will take additional time, therefore, you
  1236. may elect to flush periodically, or whenever the system is idle.
  1237. See: CopyDHXB  ReadDHXB  FlushKHXB  LockXB
  1238. ~CopyDHXB
  1239. Pack: CopyPack          Src: CopyDHXBsrc        Func:  16/Mid-level
  1240. Copy the .DBF file structure of an open data file to another DOS file.
  1241. This routine makes it easy for you to duplicate the structure of an existing
  1242. .DBF file without having to specify all the information needed by CreateDXB.
  1243. The resultant .DBF will be exactly like the source, including number of fields
  1244. and field descriptions. It will contain 0 records.
  1245.      
  1246. See: ZapDHXB  CopyDHXB
  1247. ~ZapDHXB
  1248. Pack: HandlePack        Src: ZapDHXBsrc         Func:  17/Mid-level
  1249. Delete all records for a .DBF data file.
  1250. This routine is similar to CopyDHXB except for one major difference: ALL DATA
  1251. RECORDS IN THE *SOURCE* FILE ARE PHYSICALLY DELETED, so be *careful*.
  1252. If you have a .DBF file with 100 records and use ZapDHXB on it, all 100 records
  1253. will be physically deleted and the file truncated to 0 records. There is no
  1254. return from this routine. All data is gone.
  1255.                            
  1256.                            
  1257. * C A U T I O N *
  1258.                            
  1259.      
  1260. See: CreateKXB  CopyDHXB  ZapKHXB
  1261. ~CreateKXB
  1262. Pack: CreateKeyPack     Src: CreateKXBsrc       Func:  20/Mid-level
  1263. Create a new BULLET key file. Before you can create a key file, you must first
  1264. have opened (and have created if necessary) the BULLET .DBF data file that it
  1265. is to index. (BULLET couples index and data files tightly.)
  1266. To create the key file, you need to provide the key expression, key flags, .DBF
  1267. file link handle, and optionally, the code page ID, country code, and collate
  1268. table.
  1269.                                 Key Expression
  1270. The key expression is an ASCII character string composed of the elements that
  1271. are to make up this index file's key. The key can be composed of any or all of
  1272. the fields in the .DBF data record or sub-strings within any of those fields.
  1273. Two functions are supported in evaluating a key expression. These are SUBSTR()
  1274. and UPPER(). SUBSTR() extracts part of a string starting at a particular
  1275. position for x number of characters. UPPER() converts all lower-case letters to
  1276. their upper-case equivalent. Since BULLET supports NLS, UPPER() conversion is
  1277. not required for proper sorting of mixed-case text strings.
  1278. See: CreateKXB_a  CreateDXB                                             -MORE-
  1279. ~CreateKXB_a
  1280. All names used in the key expression must be a valid field name in the DBF data
  1281. file. Some sample key expressions given that the .DBF has the following fields:
  1282.  Fields...             Valid key expressions
  1283.      
  1284.  FNAME C 25 0       "LNAME"
  1285.  LNAME C 25 0       "LNAME+FNAME"
  1286.  SSN   C  9 0       "SUBSTR(LNAME,1,4)+SUBSTR(FNAME,1,1)+SUBSTR(SSN,6,4)
  1287.  DEPT  N  5 0       "UPPER(LNAME+FNAME)"  (for non-NLS index files)
  1288.   :     :           "DEPT+SSN" (N- + C-type is valid for non-binary keys)
  1289.                                     Key Flags
  1290. The key expression is used in conjunction with the key flags to determine the
  1291. type of key generated.
  1292. First, if your index file is to disallow duplicate keys, add 1 to KeyFlag.
  1293. If you have a key composed of a character field(s) or portions thereof, you
  1294. specify a KeyFlag = 2. This instructs BULLET that the sort order is left-to-
  1295. right (proper mixed-case sorting is available, see code page ID).
  1296. See: CreateKXB_b                                                        -MORE-
  1297. ~CreateKXB_b
  1298. If you have a key composed of a numeric field(s) or portions thereof, you can
  1299. also specify a KeyFlag = 2. This instructs BULLET to treat the numeric field
  1300. as a regular character field for sorting. To ensure proper sorting, you must
  1301. decimal-align the +numeric strings in the .DBF data field, i.e., right-justify
  1302. the numeric strings (dBASE .DBF numeric strings are stored as ASCII strings).
  1303. These non-binary numeric fields are just like character fields to BULLET.
  1304. In addition, if you have a key composed of a SINGLE numeric field (fld type N)
  1305. and the field is an integer (NO DECIMAL POINT), you can specify a KeyFlag of 16
  1306. or 32. KeyFlag=16 is for a field known to be in word/integer range; KeyFlag=32
  1307. if the field is known to be in LongInt range. These KeyFlag values instruct
  1308. BULLET to sort the key as a 16/32-bit BINARY value. It also stores the key as a
  1309. 16- or 32-bit value (only 2 or 4 bytes) in the index, eventhough the data field
  1310. is in ASCII (keyflag=16 or 32).
  1311. Although not dBASE compatible, you may use BINARY FIELDS in your data records.
  1312. dBASE always has ASCII data in the data fields, even if the field is numeric.
  1313. For example, an N type field of 8.2 is stored as an ASCII text string in the
  1314. data record, say, a string like " 1100.55". If you want dBASE compatibility
  1315. your field data must also be ASCII. However, if you can forgo this requirement,
  1316. you can use binary values in the fields.
  1317. See: CreateKXB_c                                                        -MORE-
  1318. ~CreateKXB_c
  1319. To do this you must specify a field type of "B" (actually, anything but a "N")
  1320. and, IF IT IS TO BE USED AS A KEY FIELD, also set the 16- or 32-bit KeyFlag.
  1321. Unique and signed may also be flagged. The field length for a "B" field type is
  1322. 2 or 4. Make sure the key flags match (2 if cINTEGER, 4 if cLONG).
  1323. If you specify a binary key flag (for either N or B field types), you must also
  1324. specify whether the field is to be treated as a signed or unsigned value. If
  1325. values less than 0 are possible, add to KeyFlag the hex number 0x8000.
  1326.  KeyFlag = cUNIQUE|cCHAR;          /* unique character key (NLS sort)      */
  1327.  KeyFlag = cINTEGER|cUNIQUE;       /* unique unsigned integer (binary sort)*/
  1328.  KeyFlag = cUNIQUE|cSIGNED|cLONG;  /* unique signed long                   */
  1329.  KeyFlag = cCHAR;                  /* character key with duplicates allowed*/
  1330.  KeyFlag = cCHAR|cINTEGER;         /* THIS IS AN INVALID KEY FLAGS!        */
  1331. The following values are defined in BULLET.H:
  1332.   cUNIQUE=1, cCHAR=2, cINTEGER=0x10, cLONG=0x20, cNLS=0x4000, cSIGNED=0x8000
  1333. The NLS flag is assigned by BULLET. StatKXB is used to query KeyFlags.
  1334. See: CreateKXB_d                                                        -MORE-
  1335. ~CreateKXB_d
  1336. The key expression you specify may be up to 136 characters, and evaluate out to
  1337. 64 bytes (62 bytes if unique key is not specified). I.e, "SUBSTR(..." can
  1338. be up to 136 characters, and that the actual key built from this expression can
  1339. be no longer that 64 bytes, or 62 if you did not specify UNIQUE. In general,
  1340. shorter keys (the key itself, not the expression) offer better performance.
  1341.                          DBF File Link Handle (XBlink)
  1342. Since BULLET evaluates the key expression at CreateKXB, it must have access to
  1343. the DBF file to verify that the key expression is valid. You must therefore
  1344. supply CreateKXB with the OS file handle of the opened DBF data file.
  1345. National Language Support (NLS)
  1346. With DOS 3.3 and later, NLS is available. BULLET uses NLS to build the collate
  1347. sequence table that it uses to ensure proper sorting of mixed-case keys as well
  1348. as the sorting of foreign language alphabets. In order for BULLET to use the
  1349. proper collate table, it must know what code page ID and coutry code to use.
  1350. This table is made part of the index file so that all subsequent access to the
  1351. index file maintains the original sort order, even if the MIS shop is moved to
  1352. another location/computer system using another country code/code page.
  1353. See: CreateKXB_e                                                        -MORE-
  1354. ~CreateKXB_e
  1355.                                 Code Page ID
  1356. To use the default code page ID of the computer in use, specify a code page ID
  1357. of -1. This instructs BULLET to use the collate-sequence table as provided by
  1358. MS-DOS running on the machine. You may also specify the code page ID for BULLET
  1359. to use, but only if support for the code page ID is available on your machine.
  1360. Look in your DOS manual under CUSTOMIZING FOR INTERNATIONAL USE for specific
  1361. code page IDs and country codes. See also the COUNTRY and NLSFUNC commands.
  1362. You may also specify a code page ID = 0 in which case no collate table is used.
  1363.                                 Country Code
  1364. To use the default country code of the computer in use, specify a country code
  1365. of -1. This instructs BULLET to use the collate-sequence table as provided by
  1366. MS-DOS running on the machine. You may also specify the country code for BULLET
  1367. to use, but only if support for the country code is available on your machine.
  1368. Look in your DOS manual under CUSTOMIZING FOR INTERNATIONAL USE for specific
  1369. code page IDs and country codes. See also the COUNTRY and NLSFUNC commands.
  1370. You may also specify a country code = 0 in which case no collate table is used.
  1371. Typically, you set CodePageID = -1, CoutryCode = -1 and CollatePtr = 0.
  1372. See: CreateKXB_f                                                        -MORE-
  1373. ~CreateKXB_f
  1374.                          User-specified Collate Table
  1375. If you are to use a MS-DOS supplied collate table (BOTH codepage ID and country
  1376. codes are non-zero) then you do not need to specify a collate table--DOS will.
  1377. The option to allow a user-specified collate table is to work around some DOS
  1378. versions supplying incorrect collate tables. If you find that the DOS-supplied
  1379. collate table is not valid (it's stored in the second sector of the file) for
  1380. your country, you can supply the table to be used by pointing the CollatePtr
  1381. variables to your in-memory version of a valid collate table. If you want to
  1382. use the DOS-supplied collate table, you MUST set the CollatePtr variables = 0.
  1383. Note: The collate table is a 256-byte table that contains the sort value of
  1384. each character (0-255). For example, the first byte would be 0, second would
  1385. be 1, and so on. Values for characters up to the lower-case letters (ASCII 97)
  1386. are usually as you would expect: "A" has a value of 65. However, the lower-case
  1387. letters have the same value as their upper-case counterparts: "a" also has a
  1388. value of 65. BULLET uses this collate table to ensure proper sorting.
  1389. If you specify EITHER code page ID OR country code = 0 then no collate table
  1390. is used or built. Instead, sorting is done by standard ASCII sort. This is
  1391. somewhat faster but less versatile. Use UPPER() for mixed-case sort if needed.
  1392. See: OpenKXB  CreateKXB
  1393. ~OpenKXB
  1394. Pack: OpenPack          Src: OpenKXBsrc         Func:  21/Mid-level
  1395. Open an existing key file for use.
  1396. Each key file that you open allocates 1264 bytes for internal use. This memory
  1397. is not deallocated until you close the file with CloseKXB or execute ExitXB.
  1398. You must open the data file before you can open its related index file
  1399. because you must supply the handle of the data file that this index files
  1400. indexes.
  1401. See: CloseKXB  OpenDXB
  1402. ~CloseKXB
  1403. Pack: HandlePack        Src: CloseKXBsrc        Func:  22/Mid-level
  1404. Close an open key file. Closing the file updates the file header and
  1405. deallocates the memory used by this file.
  1406. You MUST close all BULLET files before ending your program or file corruption
  1407. may occur. To ensure that all files are closed on the event of an unscheduled
  1408. program termination, use AtExitXB.                                           
  1409. See: StatKXB  ExitXB  CloseDXB
  1410. ~StatKXB
  1411. Pack: StatKeyPack       Src: StatKXBsrc         Func:  23/Mid-level
  1412. Get basic information on a BULLET key file handle specified. Information
  1413. returned includes the number of keys in the file, the key length, the data file
  1414. handle for this key, the last accessed record number of that data file, NLS
  1415. information, and the key flags.
  1416. Typically, your program will keep track of whether a particular handle belongs
  1417. to a key file or a data file. In cases where this is not possible, call the
  1418. StatHandleXB routine to determine what file type a handle is.
  1419. See: ReadKHXB  StatDXB  StatHandleXB
  1420. ~ReadKHXB
  1421. Pack: HandlePack        Src: ReadKHXBsrc        Func:  24/Mid-level
  1422. Reload the disk copy of the key header for the opened key file handle to the
  1423. internal copy.
  1424. In single-user, single-tasking systems this routine is not needed. However, in
  1425. a multi-user or multi-tasking system it's possible, and desirable, for two or
  1426. more programs to use the same data file. Consider this scenario: A key file has
  1427. 100 keys. Two programs access this key file, both opening it. Program 1 locks
  1428. the file, adds a new key, then flushes and unlocks the file. Program 1 knows
  1429. that there are now 101 keys in the file. However, Program 2 is not aware of the
  1430. changes that Program 1 made--it thinks that there are still 100 keys in the
  1431. file. This out-of-sync situation is easily remedied by having Program 2 reload
  1432. the key header from the file on disk.
  1433. How does Program 2 know that it needs to reload the header? It doesn't. Instead
  1434. BULLET uses a simple yet effective approach when dealing with such problems.
  1435. Whenever your program locks a file, BULLET automatically reloads the header.
  1436. Whenever you unlock a file, BULLET automatically flushes the header.
  1437. See: FlushKHXB  ReadDHXB  FlushDHXB  LockXB
  1438. ~FlushKHXB
  1439. Pack: HandlePack        Src: FlushKHXBsrc       Func:  25/Mid-level
  1440. Write the internal copy of the key header for the opened key file handle to
  1441. disk. The actual write occurs only if the header has been changed.
  1442. This is to ensure that the key header on disk matches exactly the key header
  1443. that is being maintained by BULLET. Also, this routine updates the operating
  1444. system's directory entry for this file.
  1445.      
  1446. Assume the following: A data file with 100 keys. Your program opens the key
  1447. file and adds 1 key. Physically, there are 101 keys on disk. However, the
  1448. header image of the data file on disk still reads 100 keys. This isn't a
  1449. problem, BULLET uses its internal copy of the key header and the internal copy
  1450. does read 101 keys. BUT, if there were a system failure now, the disk image
  1451. would not get updated. After the system restart, BULLET opens the file, reads
  1452. the header and thinks that there are 100 keys. You lost a key. Now, if after
  1453. that add above, your program issued a FlushKHXB, the header on disk is
  1454. refreshed with the internal copy, keeping the two in-sync. Also, the routine
  1455. updates the DOS directory entry, keeping things neat there as well. Still, it
  1456. doesn't come without cost: flushing will take additional time, therefore, you
  1457. may elect to flush periodically, or whenever the system is idle.
  1458. See: CopyKHXB  ReadKHXB  FlushKHXB  LockXB
  1459. ~CopyKHXB
  1460. Pack: CopyPack          Src: CopyKHXBsrc        Func:  26/Mid-level
  1461. Copy the key file structure of an open key file to another DOS file.
  1462. This routine makes it easy for you to duplicate the structure of an existing
  1463. key file without having to specify all the information needed by CreateKXB.
  1464. The resultant key file will be exactly like the source, including key flags and
  1465. key expression. It will contain 0 keys.
  1466.      
  1467. See: ZapKHXB  CopyKHXB
  1468. ~ZapKHXB
  1469. Pack: HandlePack        Src: ZapKHXBsrc         Func:  27/Mid-level
  1470. Delete all keys for a key file.
  1471. This routine is similar to CopyKHXB except for one major difference: ALL KEYS
  1472. IN THE *SOURCE* FILE ARE PHYSICALLY DELETED, so be *careful*.
  1473. If you have a key file with 100 keys and use ZapKHXB on it, all 100 keys will
  1474. be physically deleted and the file truncated to 0 keys. There is no return from
  1475. this routine. All data is gone.
  1476.                            
  1477.                            
  1478. * C A U T I O N *
  1479.                            
  1480.      
  1481. See: GetDescriptorXB  CopyKHXB  ZapDHXB
  1482. ~GetDescriptorXB
  1483. Pack: DescriptorPack    Src: GetDescriptorXBsrc Func:  30/Mid-level
  1484. Get the field descriptor information for a field.
  1485. You can specifiy either the fieldname or the field number (position of the
  1486. field within the record where the first field is #1) to get info on.
  1487. The field descriptor contains the following information:
  1488.   FIELDNAME  10 upper-case characters, A-Z and _ allowed, unused space is
  1489.              0-filled and is 0-terminated (11 bytes, ASCII, byte 11 always=0)
  1490.   FIELDTYPE  single ASCII character where C=character, N=numeric, D=date,
  1491.              L=logical, and M=memo field (1 byte, ASCII)
  1492.   FIELDLEN   length of field: C=1-254, N=1-19, D=8 (yyyymmdd), L=1 (T/F/space),
  1493.              M=10, this is total field length (1 byte, binary)
  1494.   FIELDDC    places right of decimal point if N field type, minimum if not 0 is
  1495.              2, can be up to 6 or 8, non-N fields always 0 (1 byte, binary)
  1496. See: GetRecordXB
  1497. ~GetRecordXB
  1498. Pack: AccessPack        Src: GetRecordXBsrc     Func:  31/Mid-level
  1499. Get the physical record from the data file into a data buffer by record number.
  1500. The data buffer is typically a struct variable defined as the DBF record itself
  1501. is defined. For example, if the DBF record has 2 fields, LNAME and FNAME, then
  1502. variable would be struct'ed as:
  1503. struct rectype {
  1504.         char  tag[1];        /* The Xbase DBF delete flag (must be included) */
  1505.         char  lastname[25];  /* same field length as the .DBF LNAME field    */
  1506.         char  firstname[25]; /* same field length as the .DBF FNAME field    */
  1507. }; /* 51 */
  1508. struct rectype recbuff;
  1509. This method of accessing the data file does not use any indexing. Therefore, it
  1510. typically is not used except for special purposes. The preferred method to
  1511. access the data is by one of the keyed Get() routines.
  1512. See: AddRecordXB  GetEqualXB
  1513. ~AddRecordXB
  1514. Pack: AccessPack        Src: AddRecordXBsrc     Func:  32/Mid-level
  1515. Append the record in the data buffer to the end of the DBF file.
  1516. This method of adding a record does not involve any indexing. It is typically
  1517. used to build a data file en masse and do the indexing after the entire .DBF 
  1518. file(s) has been built.                                                      
  1519. If you have several thousand data records to be added at once, this method of
  1520. building the DBF first and then using the ReindexXB routine is often faster
  1521. than using the InsertXB routine for each record to add.
  1522. The AddRecordXB is very fast. 400 recs/sec on an AT machine is typical. Over
  1523. 2000 recs/sec can be added on a fast 486 machine--that's 120,000 records added
  1524. per minute.
  1525. The record number used is determined by BULLET and it is returned in AP.RecNo.
  1526. See: UpdateRecordXB  InsertXB  ReindexXB
  1527. ~UpdateRecordXB
  1528. Pack: AccessPack        Src: UpdateRecordXBsrc  Func:  33/Mid-level
  1529. Write the updated data record to the the physical record number.
  1530. This method of writing the updated record must not be used if any field(s) in
  1531. the record is used as a key field(s) and has been changed.                   
  1532. This method of updating a record is very fast if you know that that update is
  1533. not going to alter any field used as a key in any index file that uses it. You
  1534. must, of course, first get the data record into the record buffer. Then you can
  1535. change it and write the update out to disk with this routine.
  1536. If you need to change a field(s) that is used as a key field or part of one,
  1537. use the UpdateXB routine. UpdateXB not only dynamically updates all related
  1538. index files if you change a key field, it also will undo any and all changes if
  1539. an error occurs in the transaction.
  1540. See: DeleteRecordXB  GetRecordXB  UpdateXB
  1541. ~DeleteRecordXB
  1542. Pack: AccessPack        Src: DeleteRecordXBsrc  Func:  34/Mid-level
  1543. Tag the record at the physical record number as being deleted.
  1544. This does not tag any in-memory copies of the record so be sure to mark any
  1545. such copies as being deleted yourself.                                     
  1546. The first byte of every .DBF record is reserved for the delete tag. This tag
  1547. is a space (ASCII 32) if the record is normal, or a * (ASCII 42) if it's marked
  1548. as being deleted. This delete tag is a reserved field in the DBF record and as
  1549. such is not defined as a formal field with a descriptor, etc. Make sure that
  1550. you define your in-memory buffers to reserve the first byte for the delete tag.
  1551. The Xbase DBF standard doesn't physically remove records marked as deleted from
  1552. the data file. It doesn't mark them as available/reusable either. To physically
  1553. remove records marked as deleted use PackRecordsXB.
  1554. Records can be temporarily marked as deleted then recalled to normal status.
  1555. The Key/Get routines (GetFirstXB, etc.) return the record number needed for
  1556. this routine after each access in AP.RecNo.
  1557. See: UndeleteRecordXB  PackRecordsXB
  1558. ~UndeleteRecordXB
  1559. Pack: AccessPack        Src: UndeleteRecordsrc  Func:  35/Mid-level
  1560. Tag the record at the physical record number as being normal (not deleted).
  1561. This does not tag any in-memory copies of the record so be sure to mark any
  1562. such copies as being normal yourself.                                      
  1563. The first byte of every .DBF record is reserved for the delete tag. This tag
  1564. is a space (ASCII 32) if the record is normal, or a * (ASCII 42) if it's marked
  1565. as being deleted. This delete tag is a reserved field in the DBF record and as
  1566. such is not defined as a formal field with a descriptor, etc. Make sure that
  1567. you define your in-memory buffers to reserve the first byte for the delete tag.
  1568. The Xbase DBF standard does not physically remove records marked as deleted
  1569. from the data file so you can "recall" then back to normal status as easily as
  1570. you marked them deleted.
  1571. See: PackRecordsXB  DeleteRecordXB
  1572. ~PackRecordsXB
  1573. Pack: AccessPack        Src: PackRecordsXBsrc   Func:  36/Mid-level
  1574. Rebuild the open DBF file by physically removing all records marked as deleted.
  1575. Packing occurs in place using the existing file. It's recommended that you   
  1576. use BackupFileXB to copy the current DBF file before using this routine in   
  1577. case of a failure during the pack process.                                   
  1578. The newly packed file is truncated to reflect the current, actual size.
  1579. If there are index files for this .DBF file, they MUST all be reindexed after
  1580. the pack process by using ReindexXB.
  1581. This routine dynamically allocates at least as many bytes as the length of   
  1582. the record. More if available.                                               
  1583. See: FirstKeyXB  DeleteRecordXB  BackupFileXB  ReindexXB
  1584. ~FirstKeyXB
  1585. Pack: AccessPack        Src: FirstKeyXBsrc      Func:  40/Mid-level
  1586. Retrieve the first key in index order from the index file.
  1587. This routine does not access the .DBF file and so does not retrieve the data 
  1588. record. What it does do is locate the first key of the index, returning it,  
  1589. and also returning the record number within the .DBF that the key indexes.   
  1590. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1591. method, however, is to use the GetFirstXB.
  1592. The key returned includes an enumerator if a non-unique index file is involved.
  1593. The enumerator is a little-endian 16-bit value that serves to differentiate  
  1594. up to 65535 "identical", non-unique keys. It is attached to all keys of non- 
  1595. unique index files and occupies the last two bytes of the key.               
  1596. This routine is typically used to position the index file to the first key so
  1597. as to allow forward in-order access to the keys by using NextKeyXB.
  1598. See: EqualKeyXB  GetFirstXB  GetRecordXB
  1599. ~EqualKeyXB
  1600. Pack: AccessPack        Src: EqualKeyXBsrc      Func:  41/Mid-level
  1601. Search for the exact key in the index file.
  1602. This routine does not access the .DBF file and so does not retrieve the data 
  1603. record. What it does do is search for the key in the index, and if found,    
  1604. returns the record number within the .DBF that the key indexes. The key must 
  1605. be an exact match, including enumerator word if a non-unqiue index file.     
  1606. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1607. method, however, is to use the GetEqualXB.
  1608. This routine will only find EXACT matches to the specified key (including the
  1609. enumerator if applicable). However, even if the exact key is not found in the
  1610. index file, the index file is positioned so that the next NextKeyXB retrieves
  1611. the key that would have followed the unmatched specified key. For example,
  1612. if the key to match was "KINGS" (a partial key in this case), EqualKeyXB would
  1613. return a key not found error. If you were to now do a NextKeyXB, the next key
  1614. would be returned, let's say it is "KINGSTON".
  1615. See: NextKeyXB  GetEqualXB  GetRecordXB
  1616. ~NextKeyXB
  1617. Pack: AccessPack        Src: NextKeyXBsrc       Func:  42/Mid-level
  1618. Retrieve the next key in index order from the index file.
  1619. This routine does not access the .DBF file and so does not retrieve the data 
  1620. record. What it does do is retreive the next key of the index, returning it, 
  1621. and also returning the record number within the .DBF that the key indexes.   
  1622. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1623. method, however, is to use the GetNextXB.
  1624. The key returned includes an enumerator if a non-unique index file is involved.
  1625. This routine is typically called after the index file has first been positioned
  1626. to a known key using either FirstKeyXB or EqualKeyXB, or after a previous
  1627. NextKeyXB or even PrevKeyXB. What it basically does is get the key following
  1628. the current key, and then make that key the new current key.
  1629. See: PrevKeyXB  GetNextXB  GetRecordXB
  1630. ~PrevKeyXB
  1631. Pack: AccessPack        Src: PrevKeyXBsrc       Func:  43/Mid-level
  1632. Retrieve the previous key in index order from the index file.
  1633. This routine does not access the .DBF file and so does not retrieve the data 
  1634. record. What it does do is retreive the previous key of the index, returning 
  1635. it and also returning the record number within the .DBF that the key indexes.
  1636. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1637. method, however, is to use the GetPrevXB.
  1638. The key returned includes an enumerator if a non-unique index file is involved.
  1639. This routine is typically called after the index file has first been positioned
  1640. to a known key using either LastKeyXB or EqualKeyXB, or after a previous
  1641. PrevKeyXB or even NextKeyXB. What it basically does is to get the key previous
  1642. the current key, and then make that key the new current key.
  1643. See: LastKeyXB  GetPrevXB  GetRecordXB
  1644. ~LastKeyXB
  1645. Pack: AccessPack        Src: LastKeyXBsrc       Func:  44/Mid-level
  1646. Retrieve the last key in index order from the index file.
  1647. This routine does not access the .DBF file and so does not retrieve the data 
  1648. record. What it does do is locate the last key of the index, returning it,   
  1649. and also returning the record number within the .DBF that the key indexes.   
  1650. To retrieve the data record you can use the GetRecordXB routine. The preferred
  1651. method, however, is to use the GetLastXB.
  1652. This routine is typically used to position the index file to the last key so as
  1653. to allow reverse in-order access to the keys by using PrevKeyXB.
  1654. See: StoreKeyXB  GetLastXB  GetRecordXB
  1655. ~StoreKeyXB
  1656. Pack: AccessPack        Src: StoreKeyXBsrc      Func:  45/Mid-level
  1657. Insert the key into the index file in proper key order.
  1658. This routine does not add the data record to the .DBF file. It only inserts  
  1659. the key and record number into the index file. Use InsertXB, instead.        
  1660. To do a complete data record and key insert, you could use AddRecordXB to add
  1661. the data record to the .DBF, BuildKeyXB to construct the key, then StoreKeyXB
  1662. to insert the key and record number information into the index file. If that
  1663. key already exists and the file allows duplicate keys, you need to attach the
  1664. proper enumerator word and retry StoreKeyXB.
  1665. This is much too much to do. Instead, just use InsertXB. All these details
  1666. including adding the data record and multi-key inserts are performed
  1667. automatically with just the single call.
  1668. See: DeleteKeyXB  InsertXB
  1669. ~DeleteKeyXB
  1670. Pack: AccessPack        Src: DeleteKeyXBsrc     Func:  46/Mid-level
  1671. Physically remove the specified key from the index file.
  1672. This routine requires an EXACT key match for all bytes of the key, including 
  1673. the enumerator word if a non-unique index file is involved.                  
  1674. This routine would seldom be used, typically, since deleted dBASE data records
  1675. are only physically deleted during a PackRecordsXB and the index file is
  1676. rebuilt afterward using ReindexXB.
  1677. See: BuildKeyXB  CurrentKeyXB
  1678. ~BuildKeyXB
  1679. Pack: AccessPack        Src: BuildKeyXBsrc      Func:  47/Mid-level
  1680. Build the key for the specifed data record based on the key expression for the
  1681. index file. If the index file is non-unique, a 0-value enumerator is attached.
  1682. The enumerator is a little-endian 16-bit value that serves to differentiate  
  1683. up to 65535 "identical", non-unique keys. It is attached to all keys of non- 
  1684. unique index files and occupies the last two bytes of the key.               
  1685. This routine, like most of the mid-level routines, typically would not be used
  1686. since the high-level access routines take care of this detail automatically.
  1687. See: CurrentKeyXB  StoreKeyXB
  1688. ~CurrentKeyXB
  1689. Pack: AccessPack        Src: CurrentKeyXBsrc    Func:  48/Mid-level
  1690. Retrieve the current key value for the specified key file handle and also the
  1691. data record number that it indexes.
  1692. This routine is useful in that it retrieves on demand the actual key value of
  1693. the last accessed key in the index file (and the data record number). Most
  1694. often you don't need this information so it would be a waste of time and space
  1695. for your program to explicitly track each current key for each index file that
  1696. you have open.
  1697. See: GetFirstXB  ReindexXB  DeleteKeyXB
  1698. ~GetFirstXB
  1699. Pack: AccessPack        Src: GetFirstXBsrc      Func:  60/High-level
  1700. Retrieve the first indexed key and data record.
  1701. The key returned includes an enumerator if a non-unique index file is involved.
  1702. This routine is typically used to process a database in index order starting at
  1703. the first ordered key (and its data record). After processing this first entry,
  1704. subsequent in-order access of the database is achieved by using GetNextXB until
  1705. the end of the database is reached.
  1706. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1707. the record accessed. In GetFirstXB's case, it fills AP.RecNo with the record
  1708. number pointed to by the first key. Since this is so, the AP pack is primed for
  1709. an UpdateXB after each high-level Get. Other methods to get the record number
  1710. are to use CurrKeyXB or any of the Key routines (KeyFirstXB, etc.).
  1711. See: GetEqualXB  FirstKeyXB  UpdateXB
  1712. ~GetEqualXB
  1713. Pack: AccessPack        Src: GetEqualXBsrc      Func:  61/High-level
  1714. Search for the exact key in the index file and return its data record.
  1715. This routine will only find EXACT matches to the specified key (including the
  1716. enumerator if applicable). However, even if the exact key is not found in the
  1717. index file, the index file is positioned so that the next GetNextXB retrieves
  1718. the key that would have followed the unmatched specified key. For example,
  1719. if the key to match was "KINGS" (a partial key in this case), GetEqualXB would
  1720. return a key not found error. If you were to now do a GetNextXB, the next key
  1721. and data record would be returned, let's say the key is "KINGSTON" and its data
  1722. record is the data record for that key. Another GetNextXB would retrieve the
  1723. key and record after that. (GetPrevXB can be used in this fashion too.)
  1724. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1725. the record accessed. In GetEqualXB's case, it fills AP.RecNo with the record
  1726. number pointed to by the matched key. Since this is so, the AP pack is primed
  1727. for an UpdateXB after each high-level Get. Other methods to get the record
  1728. number are to use CurrKeyXB or any of the Key routines (KeyEqualXB, etc.).
  1729. See: GetNextXB  EqualKeyXB
  1730. ~GetNextXB
  1731. Pack: AccessPack        Src: GetNextXBsrc       Func:  62/High-level
  1732. Retrieve the next indexed key and its data record.
  1733. The key returned includes an enumerator if a non-unique index file is involved.
  1734. This routine is typically calld after the index file has first been positioned
  1735. to a known key using either GetFirstXB or GetEqualXB, or after a previous
  1736. GetNextXB or even GetPrevXB. What it basically does is get the key and data
  1737. record following the current key, and then make that key the new current key.
  1738. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1739. the record accessed. In GetNextXB's case, it fills AP.RecNo with the record
  1740. number pointed to by the next key. Since this is so, the AP pack is primed for
  1741. an UpdateXB after each high-level Get. Other methods to get the record number
  1742. are to use CurrKeyXB or any of the Key routines (KeyNextXB, etc.).
  1743. See: GetPrevXB  NextKeyXB
  1744. ~GetPrevXB
  1745. Pack: AccessPack        Src: GetPrevXBsrc       Func:  63/High-level
  1746. Retrieve the previous indexed key and record.
  1747. The key returned includes an enumerator if a non-unique index file is involved.
  1748. This routine is typically called after the index file has first been positioned
  1749. to a known key using either GetLastXB or GetEqualXB, or after a previous
  1750. GetPrevXB or even GetNextXB. What it basically does is to get the key and data
  1751. record previous the current key, and then make that key the new current key.
  1752. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1753. the record accessed. In GetPrevXB's case, it fills AP.RecNo with the record
  1754. number pointed to by the previous key. Since this is so, the AP pack is primed
  1755. for an UpdateXB after each high-level Get. Other methods to get the record
  1756. number are to use CurrKeyXB or any of the Key routines (KeyPrevXB, etc.).
  1757. See: GetLastXB  PrevKeyXB
  1758. ~GetLastXB
  1759. Pack: AccessPack        Src: GetLastXBsrc       Func:  64/High-level
  1760. Retrieve the last indexed key and record.
  1761. This routine is typically used to process a database in reverse index order
  1762. starting at the last ordered key (and its data record). After processing this
  1763. last entry, subsequent reverse-order access of the database is achieved by
  1764. using GetPrevXB until the top of the database is reached.
  1765. This routine, like all the high-level Get routines, fills in the AP.RecNo of
  1766. the record accessed. In GetLastXB's case, it fills AP.RecNo with the record
  1767. number pointed to by the last key. Since this is so, the AP pack is primed for
  1768. an UpdateXB after each high-level Get. Other methods to get the record number
  1769. are to use CurrKeyXB or any of the Key routines (KeyLastXB, etc.).
  1770. See: InsertXB  LastKeyXB
  1771. ~InsertXB
  1772. Pack: AccessPack        Src: InsertXBsrc        Func:  65/High-level
  1773. Add the data record to data file and insert the related key(s) into the linked
  1774. index file(s).
  1775. This routine is used to add new entries into a database, one at a time. The
  1776. data record is first added to the data file, then for each related index file,
  1777. a key is inserted into the appropriate index file. Up to 32 index files can be
  1778. automatically maintained for each data file.
  1779. This and several other routines are transaction-based. If a failure occurs
  1780. prior to the routine's completion, all changes made to the database by the
  1781. routine will be backed-out and the database (data and related index file(s))
  1782. effectively restored to its original state.
  1783.                                   
  1784. If the routine failed to complete, the function return value is the number of
  1785. the pack that caused the failure. The pack's Stat is checked to determine the
  1786. error code. If the function return value is 0, YOU MUST STILL check the first
  1787. pack's Stat. If it's non-zero, then the failure occured with the data record.
  1788. See: UpdateXB  StoreKeyXB
  1789. ~UpdateXB
  1790. Pack: AccessPack        Src: UpdateXBsrc        Func:  66/High-level
  1791. Modify an existing data record (identified by record number) and automatically
  1792. perform any index file updates needed to keep the index file(s) in sync.
  1793. If any key fields changed between the original record and the new one, this
  1794. routine updates the appropriate index file(s) by replacing the original key(s)
  1795. with new the key(s) based on the updated data record. Up to 32 index files can
  1796. be automatically maintained for each data file. Get routines (GetFirstXB, etc.)
  1797. set the AP.RecNo of the record that UpdateXB uses.
  1798. This and several other routines are transaction-based. If a failure occurs
  1799. prior to the routine's completion, all changes made to the database by the
  1800. routine will be backed-out and the database (data and related index file(s))
  1801. effectively restored to its original state.
  1802. If the routine failed to complete, the function return value is the number of
  1803. the pack that caused the failure. The pack's Stat is checked to determine the
  1804. error code. If the function return value is 0, YOU MUST STILL check the first
  1805. pack's Stat. If it's non-zero, then the failure occured with the data record.
  1806. See: ReindexXB  UpdateRecordXB
  1807. ~ReindexXB
  1808. Pack: AccessPack        Src: ReindexXBsrc       Func:  67/High-level
  1809. Reindex all related index files for a data file.
  1810. The index file(s) must already exist and be open. Any existing key data is
  1811. overwritten by the new key data. In other words, if you have a 10MByte index
  1812. file, ReindexXB uses the same file space building the news keys over the old.
  1813. This results in a less fragmented disk and also minimizes disk space needed.
  1814. You can also create a new, empty index file and reindex to that. This would be
  1815. useful, for instance, if you needed to create a temporary index file--something
  1816. that you'd use for a report, say, then delete after the report.
  1817. This routine creates a TEMPORARY work file in either the current directory or,
  1818. if the DOS environment variable TMP is defined, in the TMP= directory. The size
  1819. of this file is approx. bytes = (RECORDS * (KEYLEN+6)). ReindexXB can operate
  1820. in as little as 32K of available memory and can use up to 128K. The resultant
  1821. index file(s) are optimized for minimum size AND maximum retrieval speed.
  1822. If the routine failed to complete, the function return value is the number of
  1823. the pack that caused the failure. The pack's Stat is checked to determine the
  1824. error code. A return value of zero indicates no error occured.               
  1825. See: LockXB  PackRecordsXB
  1826. ~LockXB
  1827. Pack: AccessPack        Src: LockXBsrc          Func:  80/Network
  1828. Lock all bytes in the index file handle(s) for exclusive use by the current
  1829. process and reload the index file header(s) from disk. Also lock all bytes in
  1830. the related data file and reload the data file header from disk.
  1831. The files must have been opened with the appropriate share attribute and not 
  1832. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  1833. This routine is transaction-based and will lock all index files specified in 
  1834. AccessPack and the data file. If any lock fails, all previous locks by this  
  1835. routine are released. The return value indicates which access pack failed, if
  1836. any. This value is used as the index into the AccessPack group for you to    
  1837. identify the error code. See LockXBsrc for determining this exactly.         
  1838. Use the DriveRemoteXB and/or FileRemoteXB to determine if locking is necessary.
  1839. If the files are on a remote drive then it is best to use locking. Locking may
  1840. also be necessary on multitasking local machines accessing shared files.
  1841. This routine is a combination of LockKeyXB and LockDataXB.
  1842. See: UnlockXB  LockKeyXB  LockDataXB  DriveRemoteXB  FileRemoteXB
  1843. ~UnlockXB
  1844. Pack: AccessPack        Src: UnlockXBsrc        Func:  81/Network
  1845. Unlock all bytes in the specified file handle(s) (previously locked) and flush
  1846. the file header(s) to disk (flush done before lock(s) released). Also unlock
  1847. all bytes in the related data file and flush the data file header to disk.
  1848. The files must have been opened with the appropriate share attribute and not 
  1849. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  1850. This routine is transaction-based and will unlock all index files specified in
  1851. AccessPack and the data file. If an unlock fails the routine exits with a
  1852. return value indicating which access pack failed. This value is used as the
  1853. index into the AccessPack group for you to identify the error code. Note that
  1854. this routine does not attempt to re-lock those files unlocked successfully if
  1855. an error occurs in the transaction. If an error does occur (unlikely) you will
  1856. need to provide for unlocking the remaining files manually with the UnlockKeyXB
  1857. and UnlockDataXB routines. You should not rely on the operating system to
  1858. automatically unlock files when they're closed.
  1859. This routine is a combination of UnlockKeyXB and UnlockDataXB.
  1860. See: LockKeyXB  UnlockKeyXB  UnlockDataXB
  1861. ~LockKeyXB
  1862. Pack: AccessPack        Src: LockKeyXBsrc       Func:  82/Network
  1863. Lock all bytes in the index file handle(s) for exclusive use by the current
  1864. process and reload the index file header(s) from disk.
  1865. The files must have been opened with the appropriate share attribute and not 
  1866. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  1867. This routine is transaction-based and will lock all index files specified in
  1868. AccessPack. If any lock fails, all previous locks by this routine are released.
  1869. The return value indicates which access pack failed, if any. This value is used
  1870. as the index into the AccessPack group for you to identify the error code.
  1871. The advantage of using region locks (LockKeyXB locks the entire file region) to
  1872. control file access is that the file does not need to be opened/closed using
  1873. the Deny Read/Write sharing attribute. Opening the file for Deny None, and
  1874. controlling subsequent access with region locks, allows for faster processing
  1875. since files do not need to be constantly opened and closed, as they would if
  1876. access were controlled by opening with Deny Read/Write.
  1877. See: UnlockKeyXB  LockXB
  1878. ~UnlockKeyXB
  1879. Pack: AccessPack        Src: UnlockKeyXBsrc     Func:  83/Network
  1880. Unlock all bytes in the specified file handle(s) (previously locked) and flush
  1881. the file header(s) to disk (flush done before lock(s) released).
  1882. The files must have been opened with the appropriate share attribute and not 
  1883. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  1884. This routine is transaction-based and will unlock all index files specified in
  1885. AccessPack. If an unlock fails the routine exits with a return value indicating
  1886. which access pack failed. This value is used as the index into the AccessPack
  1887. group for you to identify the error code.
  1888. All file locks should be released when exclusive access in no longer needed. 
  1889. It is not recommended that you end your program without having released active
  1890. file locks. This is especially a valid concern for DOS versions prior to 5.0.
  1891. DOS 5 releases locks on files that are closed.
  1892. See: LockDataXB  UnlockXB
  1893. ~LockDataXB
  1894. Pack: AccessPack        Src: LockDataXBsrc      Func:  84/Network
  1895. Lock all bytes in the file handle's data file for exclusive use by the current
  1896. process and reload the data file header from disk. You must set AP.RecNo=0 to
  1897. do this. To lock a single record, set AP.RecNo=record# to lock.
  1898. The files must have been opened with the appropriate share attribute and not 
  1899. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  1900. This routine locks the specified data file. If the handle specified is that of
  1901. an index file, that index file's related data file handle is used. For single-
  1902. record locks, AP.Handle must have a data file handle specified. Header loading
  1903. is not performed if locking a single record.
  1904. The advantage of using region locks (LockDataXB locks the entire file region)
  1905. to control file access is that the file does not need to be opened/closed using
  1906. the Deny Read/Write sharing attribute. Opening the file for Deny None, and
  1907. controlling subsequent access with region locks, allows for faster processing
  1908. since files do not need to be constantly opened and closed, as they would if
  1909. access were controlled by opening with Deny Read/Write.
  1910. See: UnlockDataXB
  1911. ~UnlockDataXB
  1912. Pack: AccessPack        Src: UnlockDataXBsrc    Func:  85/Network
  1913. Unlock all bytes in the specified file handle (previously locked) and flush the
  1914. data file header to disk (flush done before lock released). To do this you must
  1915. set AP.RecNo=0. To unlock a single record, set AP.RecNo=record# to unlock.
  1916. The files must have been opened with the appropriate share attribute and not 
  1917. in compatibility mode. SHARE.EXE MUST be installed or DOS error 1 is issued. 
  1918. This routine unlocks the specified data file. If the handle specified is that
  1919. of an index file that index file's related datafile handle is used. For single-
  1920. record unlocks, AP.Handle must have a data file handle specified. Flushing is
  1921. not performed if unlocking a single record.
  1922. All file locks should be released when exclusive access in no longer needed. 
  1923. It is not recommended that you end your program without having released active
  1924. file locks. This is especially a valid concern for DOS versions prior to 5.0.
  1925. DOS 5 releases locks on files that are closed.
  1926. See: DriveRemoteXB
  1927. ~DriveRemoteXB
  1928. Pack: RemotePack        Src: DriveRemoteXBsrc   Func:  86/Network
  1929. Determine if specified drive is remote (default drive=0, A:=1, B=2, C=3...).
  1930. This routine uses INT21/44/sub function 09.
  1931. In addition to returning the IsRemote state, this routine sends back the result
  1932. of the DX register and also the install state of SHARE.EXE.
  1933. The meaning of the bitflags in Flags are (where IsRemote=0):
  1934. Bit   Meaning drive...
  1935.  1   1=uses 32-bit sectoring
  1936.  6   1=accepts Generic IOCTL (for INT21/44/0D,0E,0Fh)
  1937.  7   1=accepts Query IOCTL Device (INT21/44/11h)
  1938.  9   1=is local but shared by other computers in the network
  1939. 11   1=accepts Does-Device-Use-Removable-Media (INT21/44/08)
  1940. 13   1=requires media descriptor in FAT
  1941. 14   1=accepts Receive/Send Control Data from Block Device (INT21/44/04,05)
  1942. 15   1=is Substitution drive (set by the DOS SUBST command)
  1943.      (all other bits=0)
  1944. See: FileRemoteXB  LockXB
  1945. ~FileRemoteXB
  1946. Pack: RemotePack        Src: FileRemoteXBsrc    Func:  87/Network
  1947. Determine if specified handle of file or device is remote.
  1948. This routine uses INT21/44/sub function 0Ah.
  1949. In addition to returning the IsRemote state, this routine sends back the result
  1950. of the DX register and also the install state of SHARE.EXE.
  1951. Flags bit 7=1 then handle is device, =0 then handle is file.
  1952. Bit   Meaning DEVICE...                 Bit   Meaning DEVICE...(cont)
  1953.  0   1=is console input device          13   1=is named pipe
  1954.  1   1=is console output device         15   1=is remote, 0=is local
  1955.  2   1=is null device                        (all other bits=0)
  1956.  3   1=is clock device                  Bit   Meaning FILE...
  1957.  4   1=is special device               0-5   xxxxxx=drive number (0=A...)
  1958.  5   1=is in binary mode, 0=in ASCII     6   1=has not been written to
  1959.  6   0=returns EOF if device is read    12   1=is NoInherit
  1960. 11   1=is network spooler               14   1=date/time not set at close
  1961. 12   1=is NoInherit                     15   1=is remote, 0=is local
  1962.                                              (all other bits=0)
  1963. See: SetRetriesXB  DriveRemoteXB  LockXB
  1964. ~SetRetriesXB
  1965. Pack: SetRetriesPack    Src: SetRetriesXBsrc    Func:  88/Network
  1966. Set the number of times DOS retries disk operations after a failure due to
  1967. file-sharing operations (locked file regions from LockXB routines).
  1968. This routine uses INT21/44/sub function 0Bh.
  1969. By default DOS retries an operation 3 times (without pausing between attempts)
  1970. before returning an error to the application.
  1971. If you change the default values it's recommended that the default state be  
  1972. restored before your application ends (Retries=3, Pause=1).                  
  1973. These values are pretty much determined by trial-and-error. You may find that
  1974. adding a delay between retries returns fewer access-denied errors.
  1975. See: DeleteFileDOS  LockXB
  1976. ~DeleteFileDOS
  1977. Pack: DOSFilePack       Src: DeleteFileDOSsrc   Func: 100/DOS
  1978. Delete the specified file.
  1979. This routine uses DOS INT21/41 (interrupt 21h function 41h).
  1980. See: RenameFileDOS
  1981. ~RenameFileDOS
  1982. Pack: DOSFilePack       Src: RenameFileDOSsrc   Func: 101/DOS
  1983. Rename a file. May also be used to move the file to a new directory within the
  1984. partition.
  1985. This routine uses DOS INT21/56.
  1986. If the specified directory differs from the file's directory, the file's     
  1987. directory entry is moved to the new directory.                               
  1988. For example, if the FilenamePtr filename is C:\LP100\PROJ93A.INF and the
  1989. NewFilenamePtr filename is C:\ARCH\PROJ93A.INA, the file is essentially
  1990. renamed and also moved to the \ARCH directory.
  1991. See: CreateFileDOS
  1992. ~CreateFileDOS
  1993. Pack: DOSFilePack       Src: CreateFileDOSsrc   Func: 102/DOS
  1994. Create a new file.
  1995. This routine uses INT21/3C.
  1996. The specified filename/pathname must NOT already exist.
  1997. The file created is not left open. You must OpenFileDOS to use it.
  1998. The attribute used during the create can be:
  1999.   ATTRIBUTE       VALUE    MEANING
  2000.    Normal              0    normal access permitted to file
  2001.    Read-Only           1    read-only access permitted to file
  2002.    Hidden              2    file does not appear in directory listing
  2003.    System              4    file is a system file
  2004.    Volume              8    FILENAME used as volume label if no current label
  2005.    Archive            20h   file is marked for archiving
  2006. See: AccessFileDOS  OpenFileDOS
  2007. ~AccessFileDOS
  2008. Pack: DOSFilePack       Src: AccessFileDOSsrc   Func: 103/DOS
  2009. Determine if the specified file can be accessed with the specified
  2010. access/sharing mode.
  2011. This routine uses INT21/3D and INT21/3E.
  2012. Basically, a Does-File-Exist routine. It uses the specified access/sharing
  2013. attributes when trying to open the file. For example, if you specify
  2014. DFP.Attr = &H42 (R/W access + Deny None sharing) and use AccessFileDOS on a
  2015. Read-Only DOS file, the return value would be DOS error 5, Access Denied.
  2016. See: OpenFileDOS
  2017. ~OpenFileDOS
  2018. Pack: DOSFilePack       Src: OpenFileDOSsrc     Func: 104/DOS
  2019. Open the specified file with the specified access/sharing mode.
  2020. This routine uses INT21/3D.
  2021.   ACCESS          VALUE    MEANING
  2022.    Read-only           0    open for read-only access
  2023.    Write-only          1    open for write-only access
  2024.    Read/Write          2    open for read/write access
  2025.   SHARE
  2026.    Compatibility       0     any process may share file (not recommended)
  2027.    Deny Read/Write    10h    no other process may share file
  2028.    Deny Write         20h    no other process may share file for write
  2029.    Deny Read          30h    no other process may share file for read
  2030.    Deny None          40h    any process may share file except in Compatibilty
  2031.   INHERIT                                                                 mode
  2032.    NoInheritFlag      80h    if set child processes do not inherit file handles
  2033.                              (child process cannot inherit handle > 20)
  2034. The file access mode is a combination of ACCESS + SHARE + INHERIT.
  2035. See: SeekFileDOS  OpenPack
  2036. ~SeekFileDOS
  2037. Pack: DOSFilePack       Src: SeekFileDOSsrc     Func: 105/DOS
  2038. Position the DOS file pointer of the specified file to the specified position.
  2039. This routine uses INT21/42.
  2040. The position is a 32-bit value and is relative to either the start of the file,
  2041. the current file pointer position, or the end of the file.
  2042.  Method  Meaning
  2043.     0    start move from the start of file (offset is a 32-bit unsigned value)
  2044.     1    start move at the current position (offset a signed value)
  2045.     2    start move at the end of file (offset a signed value)
  2046. For example, to move to the 511th byte of a file (byte 0 being the first), set
  2047. the offset value to 511 and use Method 0. On return, the absolute offset value
  2048. of the new position is returned. This is useful with Method 2 since you can
  2049. specify an offset of 0 and have the file length returned.
  2050. Never position the file pointer to before the start of file.                 
  2051. See: ReadFileDOS
  2052. ~ReadFileDOS
  2053. Pack: DOSFilePack       Src: ReadFileDOSsrc     Func: 106/DOS
  2054. Read from the file or device the specified number of bytes into a buffer.
  2055. This routine uses INT21/3F.
  2056. On block devices (such as disks) input starts at the current file position and
  2057. the file pointer is repositioned to the last byte read +1.
  2058. It is possible to read less than the bytes specified without an error being  
  2059. generated. Compare the bytes to read with the returned bytes read value. If  
  2060. less then end of file was reached during the read, if 0 then file was at EOF.
  2061. By using DOS's predefined handles you can read from the keyboard (STDIN) by
  2062. using the STDIN handle, 0. The input will terminate after all specified bytes
  2063. have been read or after a CR (ASCII 0Dh). If more bytes are entered than were
  2064. requested, the next read will retrieve those excess bytes. Therefore, it's
  2065. suggested that you specify 129 bytes to input (DOS will process 127+CR/LF bytes
  2066. maximum when reading the STDIN device). Post-process the entered data by
  2067. scanning for the CR/LF.
  2068. See: ExpandFileDOS
  2069. ~ExpandFileDOS
  2070. Pack: DOSFilePack       Src: ExpandFileDOSsrc   Func: 107/DOS
  2071. Expands the specified file by the specified number of bytes.
  2072. This routine uses INT21/42 and INT21/40.
  2073. This routine is useful in pre-allocating disk space. By reserving disk space in
  2074. advance you can guarantee that enough disk space will be available for a future
  2075. operation (especially if more than 1 process is running). You'll also be able
  2076. ensure that the disk space that a file does use is as contiguous as possible.
  2077. Database systems are dynamic and their files typically allocate new space on
  2078. an as-needed basis. This dynamic allocation can cause parts of a file to be
  2079. located throughout the disk system, possibly affecting performance drastically.
  2080. By pre-allocating the disk space you can be assured of consistent throughput
  2081. performance since the file is contiguous.
  2082. See: WriteFileDOS
  2083. ~WriteFileDOS
  2084. Pack: DOSFilePack       Src: WriteFileDOSsrc    Func: 108/DOS
  2085. Write to the file or device the specified number of bytes from a buffer.
  2086. This routine uses INT21/40.
  2087. If the number of bytes written is less than the specified bytes, this routine
  2088. returns a -2 error code (or 65554 unsigned).                                 
  2089. On block devices (such as disk) output starts at the current file position, and
  2090. the file pointer is repositioned to the last byte written +1.
  2091. If the specified bytes to write is 0, the file is truncated at the current   
  2092. file pointer position.                                                       
  2093. By using DOS's predefined handles you can write to the screen (STDOUT) by
  2094. using the STDOUT handle, 1.
  2095. See: CloseFileDOS
  2096. ~CloseFileDOS
  2097. Pack: DOSFilePack       Src: CloseFileDOSsrc    Func: 109/DOS
  2098. Close the file flushing any internal buffers, releasing any locked regions, and
  2099. update the directory entry to the correct size, date, and time.
  2100. This routine uses INT21/3E.
  2101. If you have opened a file using the DOS open routine you should close it when
  2102. you no longer need it.
  2103. This routine can be used to close the predefined DOS handles (0-4) and make  
  2104. those handles available for reuse. Typically handles 0 and 1 should not be   
  2105. closed by an application since they are the STDIN and STDOUT that DOS uses   
  2106. for the current application (keyboard and screen).                           
  2107. Since BULLET provides for up to 250 user file handles for your applications it
  2108. isn't necessary for you to eek 3 more file handles by closing handles 2-4.
  2109. See: MakeDirDOS
  2110. ~MakeDirDOS
  2111. Pack: DOSFilePack       Src: MakeDirDOSsrc      Func: 110/DOS
  2112. Create a new subdirectory.
  2113. This routine uses INT21/39.
  2114. See: DeleteFileDOS
  2115. ~AccessPack
  2116.  Src: InsertXBsrc      Func: InsertXB and many more
  2117. struct accesspack {             /* AP (AP is recommended pack name)
  2118.         unsigned        func;   /* varies
  2119.         unsigned        rstat;  /* ret:completion status
  2120.         unsigned        handle; /* OS handle
  2121.         long            recno;  /* in:rec# to get/delete/update (if applicable)
  2122.                                 /* in:set to single rec# to lock or 0=lock all
  2123.                                 /* ret:record number of data record accessed
  2124.         void       far *recptr; /* far pointer to record storage buffer
  2125.         void       far *keyptr; /* far pointer to search key buffer
  2126.         void       far *nextptr;/* far pointer to next key access pack
  2127. }; /* 22 */                     /* or 0:0 if end of link or if N/A
  2128. The NextPtr variables are only used by InsertXB, UpdateXB, ReindexXB, and the
  2129. LockXB routines. NextPtr is used as a link to the next related access pack,
  2130. if any. Not all entries are used by all routines. Generally, any routine that
  2131. gets/puts user data to the database uses this pack.
  2132. Note: Due to space limitations all comments should be assumed to be terminated
  2133. on the same line (implicit */).
  2134. See: BreakPack
  2135. ~BreakPack
  2136.  Src: BreakXBsrc       Func: BreakXB
  2137. struct breakpack {             /* BP
  2138.         unsigned        func;  /* 4
  2139.         unsigned        rstat; /* ret:completion status
  2140.         unsigned        mode;  /* =0 disable Ctrl-C/Ctrl-Break, 1=restore
  2141. }; /* 6 */
  2142. A simple pack.
  2143. See: CopyPack
  2144. ~CopyPack
  2145.  Src: BackupFileXBsrc  Func: BackupFileXB, CopyDHXB, CopyKHXB
  2146. struct copypack {                   /* CP
  2147.         unsigned        func;       /* 5=BackupFileXB,16=CopyDHXB,26=CopyKHXB
  2148.         unsigned        rstat;      /* ret:completion status
  2149.         unsigned        handle;     /* handle of BULLET file
  2150.         char       far *filenameptr;/* far pointer to filenameZ
  2151. }; /* 10 */
  2152. See: CreateDataPack
  2153. ~CreateDataPack
  2154.  Src: CreateDXBsrc     Func: CreateDXB
  2155. struct createdatapack {              /* CDP
  2156.         unsigned        func;        /* 10
  2157.         unsigned        rstat;       /* ret:completion status
  2158.         char       far *filenameptr; /* far pointer to filenameZ to create
  2159.         unsigned        nofields;    /* number of fields per record
  2160.         void       far *fieldlistptr;/* far pointer to field list
  2161.         unsigned        fileid;      /* file signature byte, usually=3
  2162. }; /* 16 */
  2163. The FieldListPtr variables point to an array of struct fielddesctype. This
  2164. array is dimensioned for as many fields as there are in the record and contains
  2165. the field descriptors, one for each field.
  2166. See: CreateKeyPack  FieldDescTYPE
  2167. ~CreateKeyPack
  2168.  Src: CreateKXBsrc     Func: CreateKXB
  2169. struct createkeypack {              /* CKP
  2170.         unsigned        func;       /* 20
  2171.         unsigned        rstat;      /* ret:completion status
  2172.         char       far *filenameptr;/* far pointer to filenameZ
  2173.         char       far *keyexpptr;  /* far pointer to key expressionZ
  2174.         unsigned        xblink;     /* BULLET XB data handle this file indexes
  2175.         unsigned        keyflags;   /* bit 0=unique,1=char,4=int,5=lng,F=signed
  2176.         int             codepageid; /* codepage for NLS, -1 use system default
  2177.         int             countrycode;/* country code for NLS, -1 to use default
  2178.         char       far *collateptr; /* far ptr to prg-supplied collate table
  2179. }; /* 24 */                         /* or 0:0 if using sys-determined NLS table
  2180. Bit 14 in KeyFlags (0Eh) is set by BULLET during CreateKXB if a collate table
  2181. is present.
  2182. See: DescriptorPack  is_NLS
  2183. ~DescriptorPack
  2184.  Src: GetDescriptorXBsrc  Func: GetDescriptorXB
  2185. struct descriptorpack {             /* DP
  2186.         unsigned        func;       /* 30
  2187.         unsigned        rstat;      /* ret:completion status
  2188.         unsigned        handle;     /* BULLET data file handle to get info on
  2189.         unsigned        fieldnumber;/* field number to get info on, or if 0...
  2190.         struct fielddesctype   fd;  /* ...search for DP.FD.FieldName
  2191. }; /* 40 */
  2192. GetDescriptorXB allows you to get the field descriptor info for a particular
  2193. field number (as in the first field, or the 10th field, etc.) or, if you don't
  2194. know the physical field number, the routine can also get the info for a field
  2195. by field name.
  2196. To get the info for field number, say 5, set DP.FieldNumber = 5. The DP.FD
  2197. structure element is filled in with field 5's information.
  2198. To get the info for a field by fieldname, say LASTNAME, set dp.fieldnumber=0 &
  2199. strcpy(dp.fd.fieldname, "LASTNAME\0\0\0")--the fieldname must be zero-filled
  2200. and zero-terminated.
  2201. See: DOSFilePack  FieldDescTYPE
  2202. ~DOSFilePack
  2203.  Src: AccessFileDOSsrc  Func: AccessFileDOS
  2204.                               (all routines ending with DOS)
  2205. struct dosfilepack {                /* DFP
  2206.         unsigned        func;       /* varies, see DeleteFileDOS for first
  2207.         unsigned        rstat;      /* ret:completion status
  2208.         char       far *filenameptr;/* far pointer to filenameZ
  2209.         unsigned        handle;     /* in: handle to access  ret: handle opened
  2210.         unsigned        asmode;     /* open access/sharing mode
  2211.         unsigned        bytes;      /* in: bytes to read  ret: bytes read
  2212.         long            seekoffset; /* seek to file position
  2213.         unsigned        method;     /* seek method
  2214.         void       far *bufferptr;  /* far pointer to read/write buffer
  2215.         unsigned        attr;       /* file create directory entry attribute
  2216.         char       far *newnameptr; /* far pointer to new filenameZ for rename
  2217. }; /* 30 */
  2218. All of the xDOS routines use this pack. Often only a few of the structure
  2219. member elements are used by any one of the routines. Set only those needed.
  2220. See: DVmonPack
  2221. ~DVmonPack
  2222.  Src: DVmonCXBsrc      Func: DVmonCXB
  2223. struct dvmonpack {             /* AVAILABLE ONLY IN THE DEBUG ENGINE
  2224.         unsigned        func;  /* 9
  2225.         unsigned        rstat; /* ret:completion status
  2226.         unsigned        mode;  /* =0 disable montitoring, =1 enable
  2227.         unsigned        handle;/* file handle to monitor
  2228.         unsigned        vs;    /* segment to write screen image (e.g., 0xB800)
  2229. }; /* 10 */
  2230. This routine is supplied only in the BULLET debug engine. It displays real-time
  2231. monitoring information of a .DBF file or index and .DBF file pair including
  2232. searches, seeks, hits, current record number, current key, key node contents,
  2233. key node pointers, stack state, key and record counts, and other info.
  2234. See: ExitPack
  2235. ~ExitPack
  2236.  Src: InitXBsrc        Func: ExitXB, AtExitXB
  2237. struct exitpack {              /* EP
  2238.         unsigned        func;  /* 1=ExitXB, 2=AtExitXB
  2239.         unsigned        rstat; /* ret:completion status
  2240. }; /* 4 */
  2241. See: FieldDescTYPE
  2242. ~FieldDescTYPE
  2243.  Src: CreateDXBsrc     Func: CreateDXB
  2244. struct fielddesctype {                /* used by CreateDataPack ONLY
  2245.         char            fieldname[11];/* 0-filled (use only ASCII 65-90,95)
  2246.         char            fieldtype[1]; /* C-har,N-umeric,D-ate,L-ogical,M-emo
  2247.         unsigned long   fieldda;      /* =0,reserved
  2248.         unsigned char   fieldlen;     /* C=1-254,N=1-19(varies),D=8,L=1,M=10
  2249.         unsigned char   fielddc;      /* dec places for FieldType=N (0,2-15)
  2250.         long            fieldrez;     /* =0,reserved
  2251.         char            filler[10];   /* =0,reserved
  2252. }; /* 32 */
  2253. If you can can forgo dBASE compatility you can use the B field type. This type
  2254. is for fields that contain binary data (all dBASE fields contain ASCII text or
  2255. numeric strings). If you specify a FieldType = "B" for, say an integer field,
  2256. use a FieldLen = 2. If the field is a long integer, use FieldLen = 4. You can
  2257. also use this non-standard field type for indexing. See CreateKXB for more.
  2258. See: HandlePack  CreateDataPack  CreateKXB
  2259. ~HandlePack
  2260.  Src: CloseDXBsrc      Func: CloseDXB, ReadDHXB, FlushDHXB, ZapDHXB
  2261.                              CloseKXB, ReadKHXB, FlushKHXB, ZapKHXB
  2262.                                /* HP
  2263. struct handlepack {            /* 12=CloseDXB,14=ReadDHXB,15=FlushDHXB,17=ZapDH
  2264.         unsigned        func;  /* 22=CloseDXB,24=ReadKHXB,25=FlushKHXB,27=ZapKH
  2265.         unsigned        rstat; /* ret:completion status
  2266.         unsigned        handle;/* handle of BULLET file
  2267. }; /* 6 */
  2268. See: InitPack
  2269. ~InitPack
  2270.  Src: InitXBsrc        Func: InitXB
  2271. struct initpack {               /* IP
  2272.         unsigned        func;   /* 0
  2273.         unsigned        rstat;  /* ret:completion status
  2274.         unsigned        jftmode;/* expand JFT if non-zero
  2275.         unsigned        dosver; /* ret:DOS version
  2276.         unsigned        version;/* ret:BULLET version * 100
  2277.         unsigned long   exitptr;/* ret:far pointer to ExitXB routine
  2278. }; /* 14 */
  2279.      
  2280. See: MemoryPack
  2281. ~MemoryPack
  2282.  Src: MemoryXBsrc      Func: MemoryXB
  2283. struct memorypack {            /* MP
  2284.         unsigned        func;  /* 3
  2285.         unsigned        rstat; /* ret:completion status
  2286.         unsigned long   memory;/* ret:largest free OS memory block
  2287. See: OpenPack
  2288. ~OpenPack
  2289.  Src: OpenDXBsrc       Func: OpenDXB, OpenKXB
  2290. struct openpack {                   /* OP
  2291.         unsigned        func;       /* 11=OpenDXB,21=OpenKXB
  2292.         unsigned        rstat;      /* ret:completion status
  2293.         unsigned        handle;     /* ret:OS handle of file opened
  2294.         char       far *filenameptr;/* far pointer to filenameZ to open
  2295.         unsigned        asmode;     /* DOS access-sharing mode(see OpenFileDOS)
  2296.         unsigned        xblink;     /* if opening index this related data file
  2297. }; /* 14 */                         /* (if opening data file xbHandle not used)
  2298. Note: you must supply xbHandle on index file opens
  2299. See: RemotePack  OpenFileDOS
  2300. ~RemotePack
  2301.  Src: DriveRemoteXBsrc  Func: DriveRemoteXB, FileRemoteXB
  2302. struct remotepack {               /* RP
  2303.         unsigned        func;     /* 86=DriveRemoteXB,87=FileRemoteXB
  2304.         unsigned        rstat;    /* ret:completion status
  2305.         unsigned        handle;   /* handle/drive depending on routine
  2306.         unsigned        isremote; /* ret:0=local,1=remote
  2307.         unsigned        flags;    /* ret:dx register as returned by DOS
  2308.         unsigned        isshare;  /* ret:0=SHARE.EXE not loaded
  2309. }; /* 12 */
  2310. See: SetRetriesPack
  2311. ~SetRetriesPack
  2312.  Src: SetRetriesXBsrc  Func: SetRetriesXB
  2313. struct setretriespack {          /* SRP
  2314.         unsigned        func;    /* 88
  2315.         unsigned        rstat;   /* ret:completion status
  2316.         unsigned        mode;    /* 0=set DOS default else Pauses/Retries below
  2317.         unsigned        pause;   /* 0-65535 loop counter between retries
  2318.         unsigned        retries; /* 0-65535 retries to access locked file
  2319. }; /* 10 */
  2320. The default values for Retries is 3 and Pause is 1.
  2321. The Pause value is used as a simple loop counter used to waste time. This loop
  2322. IS dependent on CPU power so values are not portable across different machines.
  2323. Do not use unrealistic values. For example, don't set Retries to 30,000 unless
  2324. you really want to wait for DOS to try 30,000 times before returning an error!
  2325. See: StatDataPack
  2326. ~StatDataPack
  2327.  Src: StatDXBsrc       Func: StatDXB
  2328. struct statdatapack {              /* SDP
  2329.         unsigned        func;      /* 13
  2330.         unsigned        rstat;     /* ret:completion status
  2331.         unsigned        handle;    /* BULLET data file to get status on
  2332.         unsigned char   filetype;  /* ret:1=BULLET XB data file
  2333.         unsigned char   dirty;     /* ret:0=not changed
  2334.         unsigned long   recs;      /* ret:records in file
  2335.         unsigned        reclen;    /* ret:record length
  2336.         unsigned        fields;    /* ret:fields per record ()
  2337.         char            f1;        /* reserved (1=update DVmon)
  2338.         unsigned char   luyear;    /* ret:binary, year file last updated
  2339.         unsigned char   lumonth;   /* ret:month--LUs are 0 if DBF newly created
  2340.         unsigned char   luday;     /* ret:day
  2341.         unsigned        hereseg;   /* ret:this file's control segment
  2342.         char            filler[10];/* reserved
  2343. }; /* 32 */
  2344. See: StatKeyPack
  2345. ~StatKeyPack
  2346.  Src: StatKXBsrc       Func: StatKXB
  2347. struct statkeypack {                     /* SKP
  2348.         unsigned        func;            /* 23
  2349.         unsigned        rstat;           /* ret:completion status
  2350.         unsigned        handle;          /* BULLET key file to get status on
  2351.         unsigned char   filetype;        /* ret:0=BULLET XB key file
  2352.         unsigned char   dirty;           /* ret:0=not changed
  2353.         unsigned long   keys;            /* ret:keys in file
  2354.         unsigned        keylen;          /* ret:key length
  2355.         unsigned        xblink;          /* ret:related BULLET XB data handle
  2356.         unsigned long   xbrecno;         /* ret:recno attached to current key
  2357.         unsigned        hereseg;         /* ret:this file's control segment
  2358.         unsigned        codepageid;      /* ret:codepage of key file sort
  2359.         unsigned        countrycode;     /* ret:countrycode of key file sort
  2360.         unsigned        collatetablesize;/* ret:size of collate table, 0 or 256
  2361.         unsigned        keyflags;        /* ret:bit 0=unique,1=char,4=int,
  2362.         char            filler[2];       /*     5=long,E=NLS,F=signed
  2363. }; /* 32 */
  2364. See: StatHandlePack
  2365. ~StatHandlePack
  2366.  Src: StatHandleXBsrc  Func: StatHandleXB
  2367. struct stathandlepack {              /* SHP
  2368.         unsigned        func;        /* 6
  2369.         unsigned        rstat;       /* ret:completion status
  2370.         unsigned        handle;      /* file handle to get information on
  2371.         unsigned        id;          /* ret:0=index,1=data,-1=not BULLET handle
  2372.         char       far *filenameptr; /* pointer to filename of handle
  2373. }; /* 12 */
  2374. See: XErrorPack
  2375. ~XErrorPack
  2376.  Src: GetExtErrorXBsrc Func: GetExtErrorXB
  2377. struct xerrorpack {              /* XEP
  2378.         unsigned        func;    /* 7
  2379.         unsigned        rstat;   /* ret:extended error
  2380.         unsigned        class;   /* ret:error class
  2381.         unsigned        action;  /* ret:suggested action
  2382.         unsigned        location;/* ret:error location
  2383. }; /* 10 */
  2384. See: AccessPack  Errors_DOS
  2385. ~Errors_BULLET    (200-209)
  2386. 200 key not found - The search key for Equal was not matched exactly.
  2387.     Next/Prev routines can be used to continue search from point of mismatch.
  2388. 201 key already exists - Attempted to add a key that already exists in the
  2389.     index file created to allow only unique keys.
  2390. 202 end of file - A Next routine is past the last key of the index file.
  2391. 203 top of file - A Prev routine is before the first key of the index file.
  2392. 204 key file empty - A key access was attempted with no keys in the index file.
  2393. 205 key type unknown - Generally indicates a corrupt index header (keyflags
  2394.     unknown at key insert).
  2395.     reserved,206-207
  2396. 208 no more nodes - The index file has reached full capacity (32MB). ReindexXB
  2397.     can often shrink an index file by 30 to 50%.
  2398. 209 key file corrupt - The index file is corrupt (write attempt to node 0).
  2399. See: Errors_BULLET_b
  2400. ~Errors_BULLET_b  (210-232)
  2401. 210 key file corrupt - The index file is corrupt (internal overflow).
  2402.     reserved,211-219
  2403. 220 incorrect DOS version - BULLET requires DOS 3.3 or later.
  2404. 221 invalid key length - The key is > 62 bytes (or 64 if unique specified).
  2405. 222 file not open - The specified handle is not an open BULLET file.
  2406.        
  2407.     reserved,223
  2408. 224 invalid record number - The specified record number is < 0, past the last
  2409.     record number in the .DBF, or is > 16,777,215.
  2410.     reserved,225-227
  2411. 228 invalid filetype - The specified handle is not the correct type for the
  2412.     operation (i.e., specifying a data file handle for a key file operation).
  2413.     reserved,229-232
  2414. See: Errors_BULLET_c
  2415. ~Errors_BULLET_c  (233-243)
  2416. 233 init not active - InitXB must be called before all others except MemoryXB.
  2417. 234 init already active - InitXB has already been called. Use ExitXB first to
  2418.     call InitXB more than once per process. (Make sure the xxP.Func <> 0.)
  2419. 235 too many indexes - BULLET can handle up to 32 index files per transaction
  2420.     record with the InsertXB and UpdateXB routines. Contact the author if you
  2421.     need to allow for more than 32 index files/transaction record.
  2422.     reserved,236-239
  2423. 240 invalid key expression - The CreateKXB key expression could not be
  2424.     evaluated.
  2425.     reserved,241
  2426. 242 field not found - The fieldname was not found in the descriptor area.
  2427. 243 invalid field count - Too many fields were specified or the specified field
  2428.     number is past the last field.
  2429. See: Errors_BULLET_d
  2430. ~Errors_BULLET_d  (244-255)
  2431.     reserved,244-249
  2432. 250 invalid country info - The specifed country code or code page ID is not
  2433.     valid or not installed (according to DOS).
  2434. 251 invalid collate table size - The specified country code/code page ID uses
  2435.     a collate-sequence table > 256 bytes (2-byte characters as with Kanji).
  2436. 252 invalid keyflags - The specified keyflags are invalid.
  2437.     reserved,253-254
  2438. 255 evaluation mode shutdown - BULLET evaluation period has completed.
  2439.     You can reinstall to continue evaluation, though you may want to consider
  2440.     your motives for reinstalling since the original evaluation period has
  2441.     expired. This error occurs only after the evaluation period has expired.
  2442.     It is not recommended that you continue to use BULLET after the evaluation
  2443.     period. It is possible for no 255 error to be generated for quite some
  2444.     time since it occurs only under certain load conditions and then only when
  2445.     certain routine sequences are performed. The specified evaluation period of
  2446.     21 days should be adhered to.
  2447. See: Errors_DOS
  2448. ~Errors_DOS
  2449. -2 disk full or unexpected end of file
  2450. -1 bad filename
  2451.  0 no error
  2452.  1 function not supported              19 disk write protected
  2453.  2 file not found                      20 unknown unit
  2454.  3 path not found                      21 drive not ready
  2455.  4 too many open files                 22 unknown command
  2456.  5 access denied (see Specs_Networks)  23 data error (CRC)
  2457.  6 handle invalid                      24 bad request structure length
  2458.  7 MCBs destroyed                      25 seek error
  2459.  8 not enough memory                   26 unknown medium type
  2460.  9 memory block address invalid        27 sector not found
  2461. 10 environment invalid                 28 printer out of paper
  2462. 11 format invalid                      29 write fault
  2463. 12 access code invalid                 30 read fault
  2464. 13 data invalid                        31 general failure
  2465.    reserved-0Eh                        32 sharing violation
  2466. 15 disk drive invalid                  33 lock violation
  2467. 16 cannot remove current directory     34 disk change invalid/wrong disk
  2468. 17 not same device                     35 FCB unavailable
  2469. 18 no more files                       36 sharing buffer overflow
  2470. See: Errors_DOS_b
  2471. ~Errors_DOS_b
  2472. 37 code page mismatched                58 incorrect response from network
  2473. 38 handle EOF                          59 unexpected network error
  2474. 39 handle disk full                    60 incompatible remote adapter
  2475.    reserved-28h                        61 print queue full
  2476.    reserved-29h                        62 no spool space
  2477.    reserved-2Ah                        63 not enough space to print file
  2478.    reserved-2Bh                        64 network name deleted
  2479.    reserved-2Ch                        65 network access denied
  2480.    reserved-2Dh                        66 network device type incorrect
  2481.    reserved-2Eh                        67 network name not found
  2482.    reserved-2Fh                        68 network name limit exceeded
  2483.    reserved-30h                        69 NETBIOS session limit exceeded
  2484.    reserved-31h                        70 sharing temporarily paused
  2485. 50 network request not supported       71 network request not accepted
  2486. 51 remote computer not listening       72 print/disk redirection paused
  2487. 52 duplicate name on network              reserved-49h
  2488. 53 network pathname not found             reserved-4Ah
  2489. 54 network busy                           reserved-4Bh
  2490. 55 network device no longer exists        reserved-4Ch
  2491. 56 NETBIOS command limit exceeded         reserved-4Dh
  2492. 57 network adapter hardware error         reserved-4Eh
  2493. See: Errors_DOS_c
  2494. ~Errors_DOS_c
  2495.    reserved-4Fh                  
  2496.  DOS Class Codes 
  2497. 80 file exists
  2498. 81 duplicate FCB                 1 out of resources       7 application error
  2499. 82 cannot make                   2 temporary situation    8 not found
  2500. 83 fail on INT24                 3 authorization          9 bad format
  2501. 84 out of structures             4 internal error        10 locked
  2502. 85 already assigned              5 hardware failure      11 media failure
  2503. 86 invalid password              6 system failure        12 already exists
  2504. 87 invalid parameter                                     13 unknown
  2505. 88 network write fault
  2506.    reserved-59h                    DOS Action Codes         DOS Locus Codes
  2507. 90 sys comp not loaded
  2508.                                  1 retry immediately      1 unknown
  2509.                                  2 delay and retry        2 block device
  2510.                                  3 reenter input          3 network
  2511.                                  4 abort ASAP             4 serial device
  2512.                                  5 abort immediately      5 memory
  2513.                                  6 ignore error
  2514.                                  7 user intervention
  2515. See: Errors_BULLET
  2516. ~InitXBsrc
  2517. Func: InitXB           Pack: InitPack           Func:   0/System
  2518. struct initpack IP;
  2519. struct exitpack EP;
  2520. IP.func = INITXB;       /* InitXB defined in BULLET.H
  2521. IP.jftmode = 1;         /* expand JFT to 255 handles
  2522. rstat = BULLET(&IP);
  2523. if (rstat == 0) {
  2524.    EP.func = ATEXITXB;  /* register ExitXB with _atexit shutdown routine
  2525.    rstat = BULLET(&EP);
  2526. if (rstat != 0) /*error
  2527. Note: Due to space limitations all comments should be assumed to be terminated
  2528. on the same line (implicit */). Right.
  2529. See: ExitXBsrc
  2530. ~ExitXBsrc
  2531. Func: ExitXB           Pack: ExitPack           Func:   1/System
  2532. struct exitpack EP;
  2533. EP.func = EXITXB      /* ExitXB defined in BULLET.H
  2534. rstat = BULLET(&EP)
  2535. The return value from ExitXB is currently always 0.
  2536. See: AtExitXBsrc
  2537. ~AtExitXBsrc
  2538. Func: AtExitXB         Pack: ExitPack           Func:   2/System
  2539. struct initpack IP;
  2540. struct exitpack EP;
  2541. IP.func = INITXB;       /* InitXB defined in BULLET.H
  2542. IP.jftmode = 1;         /* expand JFT to 255 handles
  2543. rstat = BULLET(&IP);
  2544. if (rstat == 0) {
  2545.    EP.func = ATEXITXB;  /* register ExitXB with _atexit shutdown routine
  2546.    rstat = BULLET(&EP);
  2547. if (rstat != 0)  /* error
  2548. See: MemoryXBsrc
  2549. ~MemoryXBsrc
  2550. Func: MemoryXB         Pack: MemoryPack         Func:   3/System
  2551. struct memoryPack MP;
  2552. MP.func = MEMORYXB;
  2553. rstat = BULLET(&MP);
  2554. /* MP.memory = amount of far heap available */
  2555. MP.memory does not reflect memory available through DOS in the UMB area. It's
  2556. possible that all memory requests can be satisfied by UMB RAM. Consult a DOS 5+
  2557. programmer reference for more information on this (see DOS INT21/58 for more).
  2558. Borland C/C++ compiler users must install the BCFIX.ZIP files. See it for more.
  2559. See: BreakXBsrc
  2560. ~BreakXBsrc
  2561. Func: BreakXB          Pack: BreakPack          Func:   4/System
  2562. struct breakpack BP;
  2563. BP.func = BREAKXB;    /* BreakXB defined in BULLET.H
  2564. BP.mode = 0;          /* disable Ctrl-C/Ctrl-BREAK (do nothing on those keys)
  2565. rstat = BULLET(&BP);  /* rstat=0 always
  2566. If BreakXB is called multiple times with the same BP.mode each time, only the
  2567. first is acted on. You can set BP.mode = 1 to restore the default handlers
  2568. (those installed originally) and then again set BP.Mode = 0 to disable them.
  2569. ExitXB calls this routine automatically as part of the BULLET shutdown to
  2570. restore the original default break handlers.
  2571. See: BackupFileXBsrc
  2572. ~BackupFileXBsrc
  2573. Func: BackupFileXB     Pack: CopyPack           Func:   5/System
  2574. struct accesspack AP;
  2575. struct copypack CP;
  2576. CP.func = BACKUPFILEXB;         /* defined in BULLET.H
  2577. CP.handle = datahandle;         /* handle of data file to backup
  2578. CP.filenameptr = newfilename;   /* filename to save to
  2579. rstat = BULLET(&CP);
  2580. if (rstat == 0) {
  2581.    AP.func = PACKRECORDSXB;
  2582.    AP.handle = datahandle;
  2583.    rstat = BULLET(&AP);
  2584. IF (rstat != 0) ... /* error
  2585. See: StatHandleXBsrc
  2586. ~StatHandleXBsrc
  2587. Func: StatHandleXB     Pack: StatHandlePack     Func:   6/System
  2588. struct stathandlepack SHP;
  2589. struct statkeypack SKP;
  2590. struct statdatapack SDP;
  2591. SHP.func = STATHANDLEXB;        /* defined in BULLET.H
  2592. SHP.handle = thehandlenumber;
  2593. rstat = BULLET(&SHP);
  2594. if (SHP.ID == 0) {     /* handle belongs to an index file (index file/key file)
  2595.    SKP.func = STATKXB; /* get key stats  -- see StatKXB/StatDXB for more
  2596.    SKP.handle = passedhandlenumber;     /* on the SKP structure
  2597.    rstat = BULLET(&SKP);
  2598. elseif (SHP.ID == 1) {   /*.DBF data file
  2599.    /* get DBF stats
  2600.    /* error not a BULLET file type
  2601. See: GetExtErrorXBsrc
  2602. ~GetExtErrorXBsrc
  2603. Func: GetExtErrorXB    Pack: XErrorPack         Func:   7/System
  2604. /* an error just occured in the range 1 to 199 as returned in one of the
  2605. /* pack.stat variables (current max DOS error is 90 (5Ah))
  2606. /* remember, transaction-based routines return a bad pack index in the return
  2607. /* rstat value, which you use to check the appropriate pack.Stat variable
  2608. struct xerrorpack XEP;
  2609. XEP.func = GETEXTERRORXB;       /* defined in BULLET.H
  2610. rstat = BULLET(&XEP);
  2611. if (rstat != 0) {
  2612.    /*             error=XEP.rstat
  2613.    /*       error class=XEP.class
  2614.    /* recommened action=XEP.action
  2615.    /*          location=XEP.location
  2616. See: DVmonCXBsrc  StatKXB
  2617. ~DVmonCXBsrc
  2618. Func: DVmonCXB         Pack: DVmonPack          Func:   9/DEBUG
  2619. /* at this point a data file and a key file have been opened
  2620. /* kf is that key file's DOS handle
  2621. struct dvmonpack DVP;
  2622. DV.func = DVMONCXB;     /* defined in BULLET.H
  2623. DV.mode = 1;            /* enable monitoring
  2624. DV.handle = kf;         /* monitor key file handle, kf (and its XBlink file)
  2625. DV.videoseg = 0xB800+(4096/16);/* output to color screen, page 1 (pages 0 to ?)
  2626. rstat = BULLET(&DV);    /* rstat=0 always even if not DEBUG ENGINE
  2627. For two-monitor systems (with a color monitor as the main system) output should
  2628. be directed to 0xB000, the mono monitor's video memory.
  2629. DVmonCXB stands for Dual Video Monitor Control XB. This module is available
  2630. on the BBS in the BULLET conference files. It is not included in the
  2631. distribution.
  2632. See: CreateDXBsrc
  2633. ~CreateDXBsrc
  2634. Func: CreateDXB        Pack: CreateDataPack     Func:  10/Mid-level
  2635. struct createdatapack CDP;
  2636. struct fielddesctype fieldlist[2]; /* fld descriptions for each of the fields..
  2637.                                    /* ...in the record (record has 2 fields)
  2638. /* build FD first for each of the fields in the record
  2639. strcpy(fieldlist[0].fieldname, "STUDENT");
  2640. strcpy(fieldlist[0].fieldtype, "C");
  2641. fieldlist[0].fieldlen = 20;
  2642. fieldlist[0].fielddc = 0;
  2643. strcpy(fieldlist[1].fieldname, "SCORE");
  2644. strcpy(fieldlist[1].fieldtype, "N");
  2645. fieldlist[1].fieldlen = 3;
  2646. fieldlist[1].fielddc = 0;
  2647. /* (cont)
  2648.                      (for BINARY FieldType="B" see FieldDescTYPE)
  2649. See: CreateDXBsrc_a                                                     -MORE-
  2650. ~CreateDXBsrc_a
  2651. /* build the CDP
  2652. CDP.func = CREATEDXB;           /* defined in BULLET.H
  2653. CDP.filenameptr = filename;     /* filenameZ (Z=0-terminated str)
  2654. CDP.nofields = 2;               /* this example has 2 fields
  2655. CDP.fieldlistptr = fieldlist    /* point to the first field decription...
  2656. CDP.fileid = 3;                 /* standard dBASE file ID
  2657. rstat = BULLET(&CDP);           /* create the DBF data file
  2658. if (rstat !=0) ... /* error
  2659. Normally this code would be written as a generalized FUNCTION. The CDP could be
  2660. a global allocation and the fieldlist would also.
  2661. BULLET can be customized very easily and with very little overhead. If you
  2662. don't like the default API, just develop your own using your own parameter
  2663. order, etc.
  2664. See: OpenDXBsrc  CreateDXBsrc
  2665. ~OpenDXBsrc
  2666. Func: OpenDXB          Pack: OpenPack           Func:  11/Mid-level
  2667. struct openpack OP;
  2668. OP.func = OPENDXB;                /* defined in BULLET.H
  2669. OP.filenameptr = filename;        /* file to open (must already exist)
  2670. OP.asmode = ReadWrite | DenyNone; /* defined in BULLET.H
  2671. rstat = BULLET(&OP);
  2672. if (rstat !=0) ... /* error
  2673. The ASmode (access/sharing mode) determines how the operating system controls
  2674. access to the file. See OpenFileDOS for the meanings of the various ASmodes.
  2675. See: CloseDXBsrc  OpenFileDOS
  2676. ~CloseDXBsrc
  2677. Func: CloseDXB         Pack: HandlePack         Func:  12/Mid-level
  2678. struct handlepack HP;
  2679. HP.func = CLOSEDXB;           /* defined in BULLET.H
  2680. HP.handle = datahandle;       /* handle of the file to close
  2681. rstat = BULLET(&HP);
  2682. if (rstat !=0) ... /* error
  2683. See: StatDXBsrc
  2684. ~StatDXBsrc
  2685. Func: StatDXB          Pack: StatDataPack       Func:  13/Mid-level
  2686. struct statdatapack SDP;
  2687. SDP.func = STATDXB;        /* defined in BULLET.H
  2688. SDP.handle = datahandle;   /* data handle to get stats on
  2689. rstat = BULLET(&SDP);      /* must be a data handle, use StatHandleXB if you...
  2690. if (rstat == 0) {          /* ...don't know the type of file a handle's for
  2691.    /* SDP.filetype is set to 1
  2692.    /* SDP.dirty is set to 1 if the file has changed (0=not changed)
  2693.    /* SDP.recs = number of records in the DBF file
  2694.    /* SDP.recLen = record length
  2695.    /* SDP.fields = number of fields in the record
  2696.    /* SDP.f1 is reserved
  2697.    /* SDP.luyear = year file last updated, binary (year = ASC(SDP.LUyear))
  2698.    /* SDP.lumonth = month, binary
  2699.    /* SDP.luday = day, binary
  2700.    /* SDP.hereseg is set to this handle's control segment (location in memory)
  2701. See: ReadDHXBsrc
  2702. ~ReadDHXBsrc
  2703. Func: ReadDHXB         Pack: HandlePack         Func:  14/Mid-level
  2704. struct handlepack HP;
  2705. HP.func = READDHXB;          /* defined in BULLET.H
  2706. HP.handle = datahandle;      /* handle of file whose header you want to reload
  2707. rstat = BULLET(&HP);
  2708. if (rstat != 0) ... /* error
  2709. This routine is automatically called by the network lock routines.
  2710. See: FlushDHXBsrc  LockDataXB
  2711. ~FlushDHXBsrc
  2712. Func: FlushDHXB        Pack: HandlePack         Func:  15/Mid-level
  2713. struct handlepack HP;
  2714. HP.func = FLUSHDHXB;          /* defined in BULLET.H
  2715. HP.handle = datahandle;       /* handle of file you want to flush
  2716. rstat = BULLET(&HP);
  2717. if (rstat != 0) ... /* error
  2718. Note that the physical write to disk is performed only if the file has changed
  2719. since the open or last flush.
  2720. This routine is automatically called by the network unlock routines.
  2721. See: CopyDHXBsrc  UnlockDataXB
  2722. ~CopyDHXBsrc
  2723. Func: CopyDHXBsrc      Pack: CopyPack           Func:  16/Mid-level
  2724. struct copypack CP;
  2725. CP.func = COPYDHXB;           /* defined in BULLET.H
  2726. CP.handle = datahandle;       /* handle of file to copy from (the source)
  2727. CP.filenameptr = filename;    /* far pointer to filenameZ for copy (dest)
  2728. rstat = BULLET(&CP);
  2729. if (rstat !=0) ... /* error
  2730. See: ZapDHXBsrc
  2731. ~ZapDHXBsrc
  2732. Func: ZapDHXB          Pack: HandlePack         Func:  17/Mid-level
  2733. struct handlepack HP;
  2734. HP.func = ZAPDHXB;            /* defined in BULLET.H
  2735. HP.handle = datahandle;       /* handle of file you want !ZAP!
  2736. rstat = BULLET(&HP);
  2737. if (rstat !=0)... /* error
  2738. Note that this removes ALL data records from the data file.
  2739. See: CreateKXBsrc
  2740. ~CreateKXBsrc
  2741. Func: CreateKXB        Pack: CreateKeyPack      Func:  20/Mid-level
  2742. /* This code assumes that the datafile was created as in CreateDXBsrc, and that
  2743. /* the datafile was opened as in OpenDXBsrc.
  2744. strcpy(keyexpression,"SUBSTR(STUDENT,1,5)\0"); /* a non-unique, character key
  2745. struct createkeypack CKP;
  2746. CKP.func = CREATEKXB;           /* defined in BULLET.H
  2747. CKP.filenameptr = filename;     /* far pointer to filenameZ
  2748. CKP.keyexpptr = keyexpression;  /* far pointer to key expressionZ
  2749. CKP.XBlink = datahandle;        /* the datafile handle returned from OpenDXB
  2750. CKP.KeyFlags = cCHAR;           /* -KEYFLAGS- are defined in BULLET.H
  2751. CKP.CodePageID = -1;            /* use DOS default code page ID
  2752. CKP.CountryCode = -1;           /* use DOS default country code
  2753. CKP.CollatePtrOff = 0;          /* no user-supplied collate table...
  2754. CKP.CollatePtrSeg = 0;          /* ...
  2755. rstat = BULLET(&CKP);
  2756. IF (rstat !=0) ... /* error
  2757. Normally this code would be written as a generalized FUNCTION.
  2758. See: OpenKXBsrc  CreateKXBsrc
  2759. ~OpenKXBsrc
  2760. Func: OpenKXB          Pack: OpenPack           Func:  21/Mid-level
  2761. struct openpack OP;
  2762. OP.func = OPENKXB;               /* defined in BULLET.H
  2763. OP.filenamePtr = filename;       /* point to filenameZ (Z=0-terminated str)
  2764. OP.asmode = ReadWrite | DenyNone;/* defined in BULLET.H
  2765. OP.xblink = datafilehandle;      /* OpenKXB needs to know the data file handle
  2766. rstat = BULLET(&OP);
  2767. if (rstat !=0) ... /* error
  2768. The ASmode (access/sharing mode) determines how the operating system controls
  2769. access to the file. See OpenFileDOS for the meanings of the various ASmodes.
  2770. Before you can open an index file you must first open its associated data file.
  2771. See: CloseKXBsrc  OpenFileDOS
  2772. ~CloseKXBsrc
  2773. Func: CloseKXB         Pack: HandlePack         Func:  22/Mid-level
  2774. struct handlepack HP;
  2775. HP.func = CLOSEDXB;           /* defined in BULLET.H
  2776. HP.handle = indexhandle;      /* handle of the file to close
  2777. rstat = BULLET(&HP);
  2778. if (rstat !=0) ... /* error
  2779. See: StatKXBsrc
  2780. ~StatKXBsrc
  2781. Func: StatKXB          Pack: StatKeyPack        Func:  23/Mid-level
  2782. struct statkeypack SKP;
  2783. SKP.func = STATKXB;       /* defined in BULLET.H
  2784. SKP.handle = indexhandle; /* handle to get stats on
  2785. rstat = BULLET(&SKP);     /* must be index handle, use StatHandleXB if you...
  2786. if (rstat == 0) {         /* ...don't know the type of file a handle's for
  2787.   /* SKP.filetype is set to 0
  2788.   /* SKP.dirty is set to 1 if the file has changed (0=not changed)
  2789.   /* SKP.keys = number of key in the index file (index file=key file)
  2790.   /* SKP.keyLen = physical key length (1-64 bytes)
  2791.   /* SKP.xblink = datafile handle that this index file is associated with
  2792.   /* SKP.xbrecno is set to record number associated with last accessed key
  2793.   /* SKP.hereseg is set to this handle's control segment (location in memory)
  2794.   /* SKP.codepageid returns this index file's permanent code page ID
  2795.   /* SKP.countrycode returns this index file's permanent country code
  2796.   /* SKP.collatetablesize = 0 (no collate table present) or 256 (table present)
  2797.   /* SKP.keyflags= key flags specifed at CreateKXB (except NLS flag may be set)
  2798. else                                               (NLS flag is bit 14, 0x4000)
  2799.   /* error
  2800. See: ReadKHXBsrc
  2801. ~ReadKHXBsrc
  2802. Func: ReadKHXB         Pack: HandlePack         Func:  24/Mid-level
  2803. struct handlepack HP;
  2804. HP.func = READKHXB;           /* defined in BULLET.H
  2805. HP.handle = indexhandle;      /* handle of file whose header you want to reload
  2806. rstat = BULLET(&HP);
  2807. if (rstat !=0) ... /* error
  2808. This routine is automatically called by the network lock routines.
  2809. See: FlushKHXBsrc  LockKeyXB
  2810. ~FlushKHXBsrc
  2811. Func: FlushKHXB        Pack: HandlePack         Func:  25/Mid-level
  2812. struct handlepack HP;
  2813. HP.func = FLUSHKHXB;          /* defined in BULLET.H
  2814. HP.handle = indexhandle;      /* handle of file you want to flush
  2815. rstat = BULLET(&HP);
  2816. if (rstat !=0) ... /* error
  2817. Note that the physical write to disk is performed only if the file has changed
  2818. since the open or last flush.
  2819. This routine is automatically called by the network unlock routines.
  2820. See: CopyKHXBsrc  UnlockKeyXB
  2821. ~CopyKHXBsrc
  2822. Func: CopyKHXBsrc      Pack: CopyPack           Func:  26/Mid-level
  2823. struct copypack CP;
  2824. CP.func = COPYKHXB;           /* defined in BULLET.H
  2825. CP.handle = indexhandle;      /* handle of file to copy from (the source)
  2826. CP.filenameptr = filename;    /* far pointer to filenameZ for copy
  2827. rstat = BULLET(&CP);
  2828. if (rstat !=0) ... /* error
  2829. See: ZapKHXBsrc
  2830. ~ZapKHXBsrc
  2831. Func: ZapKHXB          Pack: HandlePack         Func:  27/Mid-level
  2832. struct handlepack HP;
  2833. HP.func = ZAPKHXB;              /* defined in BULLET.H
  2834. HP.handle = indexhandle;        /* handle of file you want !ZAP!
  2835. rstat = BULLET(&HP);
  2836. if (rstat !=0) ... /* error
  2837. Note that this removes ALL keys from the index file.
  2838. See: GetDescriptorXBsrc
  2839. ~GetDescriptorXBsrc
  2840. Func: GetDescriptorXB  Pack: DescriptorPack     Func:  30/Mid-level
  2841. struct desciptorpack DP;
  2842. DP.func = GETDESCRIPTORXB;            /* defined in BULLET.H
  2843. DP.handle = datahandle;               /* handle of file
  2844. if (fieldnumber > 0) {
  2845.    DP.fieldnumber = fieldnumber;      /* field number to get info on
  2846. else {                                /* or, if 0, then
  2847.    DP.fieldnumber = 0;
  2848.    strcpy(DP.FD.fieldname,fieldname); /* fieldname to get info on
  2849. rstat = BULLET(&DP);
  2850. if rstat == 0 {
  2851.    /* DP.FD.fieldname is set to field name
  2852.    /* DP.FD.fieldtype is set to field type
  2853.    /* DP.FD.fieldlen is set to field length
  2854.    /* DP.FD.fielddc is set to field DC
  2855.    /* error
  2856. See: GetRecordXBsrc
  2857. ~GetRecordXBsrc
  2858. Func: GetRecordXB      Pack: AccessPack         Func:  31/Mid-level
  2859. struct rectype {            /* simple DBF record layout
  2860.         char  tag[1];   <
  2861.         char  code[4];      
  2862. THE FIRST BYTE OF YOUR RECORD TYPES MUST BE TAG! 
  2863.         char  bday[8];      
  2864. }; /* 13 */
  2865. struct rectype recbuff;     /* record has 2 fields, code/C/4.0, bday/D/8.0
  2866. struct accesspack AP;
  2867. AP.func = GETRECORDXB;      /* defined in BULLET.H
  2868. AP.handle = datahandle;     /* handle to get record from
  2869. AP.recno = recnotoget;      /* record number to get
  2870. AP.recptr = recbuff;        /* read record from disk into recbuff
  2871. rstat = BULLET(&AP);
  2872. if (rstat == 0) {
  2873.    /* recbuff.code and .bday set to contents of record number (recnotoget)
  2874.    /* error
  2875. See: AddRecordXBsrc
  2876. ~AddRecordXBsrc
  2877. Func: AddRecordXB      Pack: AccessPack         Func:  32/Mid-level
  2878. struct rectype {            /* simple DBF record layout
  2879.         char  tag[1];   <
  2880.         char  code[4];      
  2881. THE FIRST BYTE OF YOUR RECORD TYPES MUST BE TAG! 
  2882.         char  bday[8];      
  2883. }; /* 13 */
  2884. struct rectype recbuff;     /* record has 2 fields, code/C/4.0, bday/D/8.0
  2885. struct accesspack AP;
  2886. /* be sure to init the tag field to a space (ASCII 32)
  2887. recbuff.tag = " ";
  2888. strcpy(recbuff.code,"1234");
  2889. strcpy(recbuff.bday,"19331122");
  2890. AP.func = ADDRECORDXB;      /* defined in BULLET.H
  2891. AP.handle = datahandle;     /* handle to put record to
  2892. AP.recptr = recbuff;        /* write recbuff to disk
  2893. rstat = BULLET(&AP);
  2894. if (rstat == 0) {
  2895.    /* AP.recno set to record number to used by just written record
  2896. See: UpdateRecordXBsrc
  2897. ~UpdateRecordXBsrc
  2898. Func: UpdateRecordXB   Pack: AccessPack         Func:  33/Mid-level
  2899. /* see GetRecordXBsrc for this source example's preliminary code
  2900. AP.func = GETRECORDXB;          /* first get the record to update
  2901. AP.handle = datahandle;         /* 
  2902. AP.recno = recnotoget;          /* 
  2903.  Do NOT use UpdateRecordXB to change   
  2904. AP.recptr = recbuff;            /* 
  2905.  any field(s) used in a key expression.
  2906. rstat = BULLET(&AP);            /* 
  2907.  Instead use UpdateXB.                 
  2908. if (rstat==0) {                 /* 
  2909.    strcpy(recbuff.dbay,"19591122"); /* change only non-key portions of record
  2910.    AP.func = UPDATERECORDXB;        /* defined in BULLET.H
  2911.    rstat = BULLET(&AP)              /* other AP. values are already set by Get
  2912. if (rstat !=0) ... /* error
  2913. See: DeleteRecordXBsrc  UpdateXB
  2914. ~DeleteRecordXBsrc
  2915. Func: DeleteRecordXB   Pack: AccessPack         Func:  34/Mid-level
  2916. struct accesspack AP;
  2917. AP.func = DELETERECORDXB;     /* defined in BULLET.H
  2918. AP.handle = datahandle;       /* handle of record to delete
  2919. AP.recno = recnotodelete;     /* to determine which record number any record
  2920. rstat = BULLET(&AP);          /* is, use one of the keyed access routines
  2921. if (rstat !=0) ... /* error
  2922. See: UndeleteRecordsrc (XB)
  2923. ~UndeleteRecordsrc (XB)
  2924. Func: UndeleteRecordXB Pack: AccessPack         Func:  35/Mid-level
  2925. struct accesspack AP;
  2926. AP.func = UNDELETERECORDXB;   /* defined in BULLET.H
  2927. AP.handle = datahandle;       /* handle of record to undelete
  2928. AP.recno = recnotoundelete;   /* to determine which record number any record
  2929. rstat = BULLET(&AP);          /* is, use one of the keyed access routines
  2930. if (rstat !=0) ... /* error
  2931. See: PackRecordsXBsrc
  2932. ~PackRecordsXBsrc
  2933. Func: PackRecordsXB    Pack: AccessPack         Func:  36/Mid-level
  2934. struct accesspack AP;
  2935. AP.func = PACKRECORDSXB;      /* defined in BULLET.H
  2936. AP.handle = datahandle;       /* handle of data file to pack
  2937. rstat = BULLET(&AP);
  2938. if (rstat !=0) ... /* error
  2939. See: FirstKeyXBsrc
  2940. ~FirstKeyXBsrc
  2941. Func: FirstKeyXB       Pack: AccessPack         Func:  40/Mid-level
  2942. struct accesspack AP;
  2943. AP.func = FIRSTKEYXB;         /* defined in BULLET.H
  2944. AP.handle = indexhandle;      /* handle to index file to access key from
  2945. AP.keyptr = keybuffer;        /* far pointer to key buffer
  2946. rstat = BULLET(&AP);
  2947. if (rstat==0) {
  2948.    /* keybuff is filled in with the key (for as many bytes as the key length)
  2949.    /* When using the key returned, be aware that if UNIQUE was NOT specified
  2950.    /* then the enumerator word is attached to the end of the key (the right
  2951.    /* two bytes).
  2952.    /* Also, AP.recno is set to the record number of the first key in the index.
  2953.    /* error
  2954. See: EqualKeyXBsrc
  2955. ~EqualKeyXBsrc
  2956. Func: EqualKeyXB       Pack: AccessPack         Func:  41/Mid-level
  2957. struct accesspack AP;
  2958. AP.func = EQUALKEYXB;         /* defined in BULLET.H
  2959. AP.handle = indexhandle;      /* handle to index file to find key from
  2960. AP.keyptr = keybuffer;        /* far pointer to key buffer (include enumerator
  2961. rstat = BULLET(&AP);          /* if non-UNQIUE key) (double NULL good start)
  2962. if (rstat==0) {
  2963.    /* the key matched exactly (including enumerator, if present)
  2964.    /* keybuff is NOT ALTERED
  2965.    /* AP.recno is set to the record number of that key
  2966.    if (rstat == 200) {
  2967.       AP.func = NEXTKEYXB     /* if not found, get following key and check the
  2968.       rstat = BULLET(&AP)     /* key proper (key less the enumerator bytes)
  2969.       if (rstat==0) {         /* (i.e., it may be proper key but enumerator=1)
  2970.          /* see NextKeyXBsrc for continuation
  2971. See: NextKeyXBsrc
  2972. ~NextKeyXBsrc
  2973. Func: NextKeyXB        Pack: AccessPack         Func:  42/Mid-level
  2974. /* see EqualKeyXBsrc for preliminary code
  2975. AP.func = NEXTKEYXB;           /* defined in BULLET.H
  2976. rstat = BULLET(&AP);           /* KEYLEN assumed to equal actual key length...
  2977. if (rstat==0) {                /* ...as returned by StatKXB
  2978.    if (IndexFileIsNotUnique) {
  2979.        if (KeyProperMatchesKeyToFind) {
  2980.           /* found a match to the key proper
  2981. This code example follows up on the EqualKeyXBsrc example. See EqualKeyXB for
  2982. more information on finding partial keys.
  2983. See: PrevKeyXBsrc  EqualKeyXBsrc
  2984. ~PrevKeyXBsrc
  2985. Func: PrevKeyXB        Pack: AccessPack         Func:  43/Mid-level
  2986. struct accesspack AP;
  2987. /* assume code has already executed to locate a key--this code then gets the
  2988. /* key before that one
  2989. AP.func = PREVKEYXB;          /* defined in BULLET.H
  2990. AP.handle = indexhandle;      /* handle to index file to access key from
  2991. AP.keyptr = keybuff;          /* far pointer to key buffer
  2992. rstat = BULLET(&AP);
  2993. if (rstat==0) {
  2994.    /* keybuff is filled in with the key (for as many bytes as the key length).
  2995.    /* Also, AP.recno is set to the record number of the key.
  2996.    /* error
  2997. See: LastKeyXBsrc
  2998. ~LastKeyXBsrc
  2999. Func: LastKeyXB        Pack: AccessPack         Func:  44/Mid-level
  3000. struct accesspack AP;
  3001. AP.func = LASTKEYXB;          /* defined in BULLET.H
  3002. AP.handle = indexhandle;      /* handle to index file to access key from
  3003. AP.keyptr = keybuff;          /* far pointer to key buffer
  3004. rstat = BULLET(&AP);
  3005. if (rstat==0) {
  3006.    /* keybuff is filled in with the key (for as many bytes as the key length).
  3007.    /* Also, AP.recno is set to the record number of the last key.
  3008.    /* error
  3009. See: StoreKeyXBsrc
  3010. ~StoreKeyXBsrc
  3011. Func: StoreKeyXB       Pack: AccessPack         Func:  45/Mid-level
  3012. struct accesspack AP;
  3013. /* Assume record has been added to data file (AddRecordXB, returning recno2use)
  3014. /* and key has been built (BuildKeyXB returning keytoadd[]).
  3015.               
  3016. AP.func = STOREKEYXB;         /* defined in BULLET.H
  3017. AP.handle = indexhandle;      /* handle to index file to insert key into
  3018. AP.recno = recno2use;         /* associate this record number with key
  3019. AP.keyptr = keytoadd;         /* far pointer to key buffer
  3020. rstat = BULLET(&AP);
  3021. if (rstat==0) {
  3022.    /* key added
  3023.    if (rstat==201) {
  3024.       /* key already exists, you need to construct a unique enumerator--
  3025.       /* provided file wasn't created for UNIQUE keys...INSTEAD USE InsertXB!
  3026.    else
  3027.       /* other error
  3028. See: DeleteKeyXBsrc  InsertXB
  3029. ~DeleteKeyXBsrc
  3030. Func: DeleteKeyXB      Pack: AccessPack         Func:  46/Mid-level
  3031. struct accesspack AP;
  3032. AP.func = DELETEKEYXB;         /* defined in BULLET.H
  3033. AP.handle = indexhandle;       /* handle to index file of key to delete
  3034. AP.keyptr = keybuffer;         /* far pointer to key buffer (incl enum)
  3035.                                /* (this key is searched for exactly)
  3036. rstat = BULLET(&AP);           /* if exact match found the key is deleted!
  3037. if (rstat==0) {
  3038.    /* key deleted permanently
  3039. if (rstat==200) {
  3040.    /* key as stated was not in the index file--if the index is not UNQIUE then
  3041.    /* you must supply the exact enumerator along with the key proper to delete
  3042.    /* --you can use the CurrentKeyXB routine to obtain the exact current key
  3043.    /* other error
  3044. See: BuildKeyXBsrc
  3045. ~BuildKeyXBsrc
  3046. Func: BuildKeyXB       Pack: AccessPack         Func:  47/Mid-level
  3047. struct accesspack AP;
  3048. /* Assume record has been built and is ready to be added to the data file. The
  3049. /* record is in the variable recbuff.
  3050. AP.func = BUILDKEYXB;        /* defined in BULLET.H
  3051. AP.handle = indexhandle;     /* handle to index file key is to be built for
  3052. AP.recptr = recbuff;         /* far pointer to data record buffer
  3053. AP.keyptr = keybuff;         /* far pointer to key buffer
  3054. rstat = BULLET(&AP)
  3055. if (rstat==0) {
  3056.    /* key built okay so can do a AddRecordXB followed by a StoreKeyXB
  3057.    /* but, again, InsertXB takes care of all this detail and then some--use it
  3058.    /* error
  3059. See: CurrentKeyXBsrc
  3060. ~CurrentKeyXBsrc
  3061. Func: CurrentKeyXB     Pack: AccessPack         Func:  48/Mid-level
  3062. struct accesspack AP;
  3063. AP.func = CURRENTKEYXB;         /* defined in BULLET.H
  3064. AP.handle = indexhandle;        /* handle to index file
  3065. AP.keyptr = keybuff;            /* far pointer to key buffer
  3066. rstat = BULLET(&AP);
  3067. if (rstat==0) {
  3068.    /* keybuff set to current key (valid only for KeyLen bytes)
  3069.    /* Also, AP.recno is set to the record number of the key.
  3070.    /* error
  3071. See: GetFirstXBsrc
  3072. ~GetFirstXBsrc
  3073. Func: GetFirstXB       Pack: AccessPack         Func:  60/High-level
  3074. struct accesspack AP;
  3075. AP.func = GETFIRSTXB;           /* defined in BULLET.H
  3076. AP.handle = indexhandle;        /* handle to index file to access key from
  3077. AP.recptr = recbuff;            /* far pointer to record buffer
  3078. AP.keyptr = keybuff;            /* far pointer to key buffer
  3079. rstat = BULLET(&AP);
  3080. if (rstat==0) {
  3081.    /* keybuff is filled in with the key (for as many bytes as the key length)
  3082.    /* recbuff is filled in with the data record
  3083.    /* AP.recno is set to the record number of the first key in the index.
  3084.    /* error
  3085. See: GetEqualXBsrc
  3086. ~GetEqualXBsrc
  3087. Func: GetEqualXB       Pack: AccessPack         Func:  61/High-level
  3088. struct accesspack AP;
  3089. AP.func = GETEQUALXB;           /* defined in BULLET.H
  3090. AP.handle = indexhandle;        /* handle to index file to access key from
  3091. AP.recptr = recbuff;            /* far pointer to record buffer
  3092. AP.keyptr = keybuff;            /* far pointer to key buffer
  3093. rstat = BULLET(&AP);
  3094. if (rstat==0) {
  3095.    /* recbuff and AP.recno filled as expected (keybuff remains the same)
  3096.    if (rstat==200) {
  3097.       AP.func = GETNEXTXB;  /* if not found, can get following key--the next
  3098.       rstat = BULLET(&AP);  /* key would logically follow the key not found
  3099.    else
  3100.       /* error
  3101. See: GetNextXBsrc
  3102. ~GetNextXBsrc
  3103. Func: GetNextXB        Pack: AccessPack         Func:  62/High-level
  3104. struct accesspack AP;
  3105. AP.func = GETNEXTXB;            /* defined in BULLET.H
  3106. AP.handle = indexhandle;        /* handle to index file to access key from
  3107. AP.recptr = recbuff;            /* far pointer to record buffer
  3108. AP.keyptr = keybuff;            /* far pointer to key buffer
  3109. rstat = BULLET(&AP);
  3110. if (rstat==0) {
  3111.    /* keybuff is filled in with the next key (as many bytes as the key length)
  3112.    /* recbuff is filled in with the data record
  3113.    /* AP.recno is set to the record number of the next key in the index
  3114.    /* This key is made the current key so GETNEXTXB again gets next, and so on
  3115.    /* error
  3116. See: GetPrevXBsrc
  3117. ~GetPrevXBsrc
  3118. Func: GetPrevXB        Pack: AccessPack         Func:  63/High-level
  3119. struct accesspack AP;
  3120. AP.func = GETPREVXB;            /* defined in BULLET.H
  3121. AP.handle = indexhandle;        /* handle to index file to access key from
  3122. AP.recptr = recbuff;            /* far pointer to record buffer
  3123. AP.keyptr = keybuff;            /* far pointer to key buffer
  3124. rstat = BULLET(&AP);
  3125. if (rstat==0) {
  3126.    /* keybuff is filled in with the prev key (as many bytes as the key length)
  3127.    /* recbuff is filled in with the data record
  3128.    /* AP.recno is set to the record number of the prev key in the index
  3129.    /* This key is made the current key so GETPREVXB again gets prev, and so on
  3130.    /* error
  3131. See: GetLastXBsrc
  3132. ~GetLastXBsrc
  3133. Func: GetLastXB        Pack: AccessPack         Func:  64/High-level
  3134. struct accesspack AP;
  3135. AP.func = GETLASTXB;            /* defined in BULLET.H
  3136. AP.handle = indexhandle;        /* handle to index file to access key from
  3137. AP.recptr = recbuff;            /* far pointer to record buffer
  3138. AP.keyptr = keybuff;            /* far pointer to key buffer
  3139. rstat = BULLET(&AP);
  3140. if (rstat==0) {
  3141.    /* keybuff is filled in with the key (for as many bytes as the key length)
  3142.    /* recbuff is filled in with the data record
  3143.    /* AP.recno is set to the record number of the last key in the index.
  3144.    /* error
  3145. See: InsertXBsrc
  3146. ~InsertXBsrc
  3147. Func: InsertXB         Pack: AccessPack         Func:  65/High-level
  3148. struct accesspack AP[3];   /* array of 3 access packs, 1 for each index file
  3149.                            /* keybuff and recbuff previously defined
  3150. for (i=0,i<3,i++) {        /* 3=number of related indexes to maintain
  3151.    AP[i].func = INSERTXB;
  3152.    AP[i].handle = indexhandle[i]; /* each index file's handle
  3153.    AP[i].recptr = recbuff;
  3154.    AP[i].keyptr = keybuff;
  3155.    AP[i].nextptr = &AP[i+1];    /* point to NEXT access pack
  3156. AP[2].nextptr = NULL;           /* reset last access pack to end-link value
  3157. rstat = BULLET(&AP);
  3158. if (rstat==0) {                 /* if rstat=0 must still check AP[1].stat
  3159.    if (AP[0].stat != 0) {       /* error when adding data record
  3160.       /* error }
  3161.    trueerror = AP[rstat-1].stat; /* returned rstat is array index of bad pack
  3162.                                  /* -1 since C packs are 0 based.
  3163. See: UpdateXBsrc
  3164. ~UpdateXBsrc
  3165. Func: UpdateXB         Pack: AccessPack         Func:  66/High-level
  3166. struct accesspack AP[3];   /* array of 3 access packs, 1 for each index file
  3167.                            /* keybuff and recbuff previously defined
  3168. for (i=0,i<3,i++) {        /* 3=number of related indexes to maintain
  3169.    AP[i].func = UPDATEXB;
  3170.    AP[i].handle = indexhandle[i]; /* each index file's handle
  3171.    AP[i].recno = recordnumbertoupdate; /* the record number to update
  3172.    AP[i].recptr = recbuff;
  3173.    AP[i].keyptr = keybuff;
  3174.    AP[i].nextptr = &AP[i+1];    /* point to NEXT access pack
  3175. AP[2].nextptr = NULL;           /* reset last access pack to end-link value
  3176. rstat = BULLET(&AP);
  3177. if (rstat==0) {                 /* if rstat=0 must still check AP[1].stat
  3178.    if (AP[0].stat != 0) {       /* error when adding data record
  3179.       /* error }
  3180.    trueerror = AP[rstat-1].stat; /* returned rstat is array index of bad pack
  3181.                                  /* -1 since C packs are 0 based.
  3182. See: ReindexXBsrc
  3183. ~ReindexXBsrc
  3184. Func: ReindexXB        Pack: AccessPack         Func:  67/High-level
  3185. struct accesspack AP[3];   /* array of 3 access packs, 1 for each index file
  3186.                            /* keybuff and recbuff previously defined
  3187. for (i=0,i<3,i++) {        /* 3=number of related indexes to maintain
  3188.    AP[i].func = REINDEXB;
  3189.    AP[i].handle = indexhandle[i]; /* each index file's handle
  3190.    AP[i].nextptr = &AP[i+1];    /* point to NEXT access pack
  3191. AP[2].nextptr = NULL;           /* reset last access pack to end-link value
  3192. rstat = BULLET(&AP);
  3193. if (rstat !=0) {
  3194.    trueerror = AP[rstat-1].stat;  /* returned rstat is array index of bad pack
  3195.                                   /* -1 since C packs are 0 based.
  3196. See: LockXBsrc
  3197. ~LockXBsrc
  3198. Func: LockXB           Pack: AccessPack         Func:  80/Network
  3199. struct accesspack AP[3];   /* array of 3 access packs, 1 for each index file
  3200. for (i=0,i<3,i++) {        /* 3=number of related indexes to maintain
  3201.    AP[i].func = LOCKXB;
  3202.    AP[i].handle = indexhandle[i]; /* each index file's handle
  3203.    AP[i].nextptr = &AP[i+1];    /* point to NEXT access pack
  3204. AP[2].nextptr = NULL;           /* reset last access pack to end-link value
  3205. rstat = BULLET(&AP);
  3206. if (rstat > 3) {                /* if rstat > 3 (> number of packs) then the...
  3207.    trueerror = AP[2].stat;      /* ...lock failed on the data file
  3208. else                            /* and the error code is in the last pack
  3209.    if (rstat !=0) {
  3210.       trueerror = AP[rstat-1].stat  /*...lock failed on index file # rstat
  3211.                                     /* -1 since C packs are 0 based.
  3212. The Lock routines use a different method to identify the bad pack when the   
  3213. failure was caused by the data file. See above.                              
  3214. See: UnlockXBsrc
  3215. ~UnlockXBsrc
  3216. Func: UnlockXB         Pack: AccessPack         Func:  81/Network
  3217. struct accesspack AP[3];   /* array of 3 access packs, 1 for each index file
  3218. for (i=0,i<3,i++) {        /* 3=number of related indexes to maintain
  3219.    AP[i].func = UNLOCKXB;
  3220.    AP[i].handle = indexhandle[i]; /* each index file's handle
  3221.    AP[i].nextptr = &AP[i+1];    /* point to NEXT access pack
  3222. AP[2].nextptr = NULL;           /* reset last access pack to end-link value
  3223. rstat = BULLET(&AP);
  3224. if (rstat > 3) {                /* if rstat > 3 (> number of packs) then the...
  3225.    trueerror = AP[2].stat;      /* ...unlock failed on the data file
  3226. else                            /* and the error code is in the last pack
  3227.    if (rstat !=0) {
  3228.       trueerror = AP[rstat-1].stat  /*...unlock failed on index file # rstat
  3229.                                     /* -1 since C packs are 0 based.
  3230. The Lock routines use a different method to identify the bad pack when the   
  3231. failure was caused by the data file. See above.                              
  3232. See: LockKeyXBsrc
  3233. ~LockKeyXBsrc
  3234. Func: LockKeyXB        Pack: AccessPack         Func:  82/Network
  3235. struct accesspack AP[3];   /* array of 3 access packs, 1 for each index file
  3236. for (i=0,i<3,i++) {        /* 3=number of related indexes to maintain
  3237.    AP[i].func = LOCKKEYXB;
  3238.    AP[i].handle = indexhandle[i]; /* each index file's handle
  3239.    AP[i].nextptr = &AP[i+1];    /* point to NEXT access pack
  3240. AP[2].nextptr = NULL;           /* reset last access pack to end-link value
  3241. rstat = BULLET(&AP);
  3242. if (rstat !=0) {
  3243.    trueerror = AP[rstat-1].stat  /*...lock failed on index file # rstat
  3244.                                  /* -1 since C packs are 0 based.
  3245.                          /*--if rstat > packs (3) then failed on last internal
  3246.                          /*--ReadKHXB...This is EXTREMELY unlikely
  3247. See: UnlockKeyXBsrc
  3248. ~UnlockKeyXBsrc
  3249. Func: UnlockKeyXB      Pack: AccessPack         Func:  83/Network
  3250. struct accesspack AP[3];   /* array of 3 access packs, 1 for each index file
  3251.                            /* keybuff and recbuff previously defined
  3252. for (i=0,i<3,i++) {        /* 3=number of related indexes to maintain
  3253.    AP[i].func = UNLOCKKEYXB;
  3254.    AP[i].handle = indexhandle[i]; /* each index file's handle
  3255.    AP[i].nextptr = &AP[i+1];    /* point to NEXT access pack
  3256. AP[2].nextptr = NULL:           /* reset last access pack to end-link value
  3257. rstat = BULLET(&AP);
  3258. if (rstat !=0) {
  3259.    trueerror = AP[rstat-1].stat  /*...lock failed on index file # rstat
  3260.                                  /* -1 since C packs are 0 based.
  3261. See: LockDataXBsrc
  3262. ~LockDataXBsrc
  3263. Func: LockDataXB       Pack: AccessPack         Func:  84/Network
  3264. struct accesspack AP;
  3265. AP.func = LOCKDATAXB;         /* defined in BULLET.H
  3266. AP.handle = datahandle;       /* handle of data file to lock
  3267. AP.recno = 0L;                /* =0 to lock all or, set to actual record number
  3268. rstat = BULLET(&AP);          /*    to lock as in AP.recno = lockthisrec
  3269. if (rstat !=0) ... /* error
  3270. See: UnlockDataXBsrc
  3271. ~UnlockDataXBsrc
  3272. Func: UnlockDataXB     Pack: AccessPack         Func:  85/Network
  3273. struct accesspack AP;
  3274. AP.func = UNLOCKDATAXB;       /* defined in BULLET.H
  3275. AP.handle = datahandle;       /* handle of data file to unlock
  3276. AP.recno = 0L;                /* =0 to unlock all or, set to actual record num
  3277. rstat = BULLET(&AP);          /*    to unlock as in AP.recno = lockthisrec
  3278. if (rstat !=0) ... /* error
  3279.                               /* note: you cannot unlock parts of a file with
  3280.                               /* 1 single unlock (where AP.recno=0). Instead,
  3281.                               /* you must unlock each record individually--
  3282.                               /* that is, if you made any single-record locks
  3283. See: DriveRemoteXBsrc
  3284. ~DriveRemoteXBsrc
  3285. Func: DriveRemoteXB    Pack: RemotePack         Func:  86/Network
  3286. struct remotepack RP;
  3287. RP.func = DRIVEREMOTEXB;      /* defined in BULLET.H
  3288. RP.handle = drive2check;      /* drive to check (0=default, 1=A:,2=B:,3=C:...)
  3289. rstat = BULLET(&RP);
  3290. if (rstat==0) {
  3291.   /* RP.isremote set to 0 if drive local, 1 if remote
  3292.   /* RP.flags set to DX register as returned by DOS
  3293.   /* RP.isshare set to 0 if SHARE.EXE is not loaded, non-zero SHARE installed
  3294.   /* error  (like invalid drive)
  3295. See: FileRemoteXBsrc
  3296. ~FileRemoteXBsrc
  3297. Func: FileRemoteXB     Pack: RemotePack         Func:  87/Network
  3298. struct remotepack RP;
  3299. RP.func = FILEREMOTEXB;       /* defined in BULLET.H
  3300. RP.handle = filehandle;       /* file handle to check
  3301. rstat = BULLET(&RP);
  3302. if (rstat==0) {
  3303.    /* RP.isremote set to 0 if file local, 1 if remote
  3304.    /* RP.flags set to DX register as returned by DOS
  3305.    /* RP.isshare set to 0 if SHARE.EXE is not loaded, non-zero SHARE installed
  3306.    /* error  (like invalid handle)
  3307. See: SetRetriesXBsrc
  3308. ~SetRetriesXBsrc
  3309. Func: SetRetriesXB     Pack: SetRetriesPack     Func:  88/Network
  3310. struct setretriespack SRP;
  3311. SRP.func = SETRETRIESXB;
  3312. SRP.mode = 1;            /* 1=set to user values, 0=set DOS default
  3313. SRP.pause = 5000;        /* do 5,000 loops between retries
  3314. SRP.retries = 5;         /* try 5 times before giving up with error
  3315. rstat = BULLET(&SRP);
  3316. if (rstat !=0) ... /* error
  3317. See: DeleteFileDOSsrc
  3318. ~DeleteFileDOSsrc
  3319. Func: DeleteFileDOS    Pack: DOSFilePack        Func: 100/DOS
  3320. struct dosfilepack DFP;
  3321. DFP.func = DELETEFILEDOS;       /* defined in BULLET.H
  3322. DFP.filenameptr = filename;
  3323. rstat = BULLET(&DFP);
  3324. if (rstat !=0) ... /* error
  3325. See: RenameFileDOSsrc
  3326. ~RenameFileDOSsrc
  3327. Func: RenameFileDOS    Pack: DOSFilePack        Func: 101/DOS
  3328. struct dosfilepack DFP;
  3329. DFP.func = RENAMEFILEDOS;       /* defined in BULLET.H
  3330. DFP.filenameptr = orgfilename;
  3331. DFP.newnameptr = newfilename;
  3332. rstat = BULLET(&DFP);
  3333. if (rstat !=0) ... /* error
  3334. See: CreateFileDOSsrc
  3335. ~CreateFileDOSsrc
  3336. Func: CreateFileDOS    Pack: DOSFilePack        Func: 102/DOS
  3337. struct dosfilepack DFP;
  3338. DFP.func = CREATEFILEDOS;       /* defined in BULLET.H
  3339. DFP.filenameptr = filename;
  3340. DFP.attr = 0;                   /* normal file directory attribute
  3341. rstat = BULLET(&DFP);
  3342. if (rstat !=0) ... /* error
  3343. See: AccessFileDOSsrc
  3344. ~AccessFileDOSsrc
  3345. Func: AccessFileDOS    Pack: DOSFilePack        Func: 103/DOS
  3346. struct dosfilepack DFP;
  3347. DFP.func = ACCESSFILEDOS;       /* defined in BULLET.H
  3348. DFP.filenameptr = filename;
  3349. DFP.asmode = 0x42;              /* attempt R/W DENY NONE access
  3350. rstat = BULLET(&DFP);
  3351. if (rstat !=0) ... /* error
  3352. See: OpenFileDOSsrc
  3353. ~OpenFileDOSsrc
  3354. Func: OpenFileDOS      Pack: DOSFilePack        Func: 104/DOS
  3355. struct dosfilepack DFP;
  3356. DFP.func = OPENFILEDOS;         /* defined in BULLET.H
  3357. DFP.filenameptr = filename;
  3358. DFP.ASmode = 0x42;              /* open in R/W DENY NONE access
  3359. rstat = BULLET(&DFP);
  3360. if (rstat !=0) ... /* error else DFP.handle set to handle of open file
  3361. See: SeekFileDOSsrc
  3362. ~SeekFileDOSsrc
  3363. Func: SeekFileDOS      Pack: DOSFilePack        Func: 105/DOS
  3364. struct dosfilepack DFP;
  3365. DFP.func = SEEKFILEDOS;         /* defined in BULLET.H
  3366. DFP.handle = handle;
  3367. DFP.seekoffset = 0L;            /* position 0 relative EOF (get length of file)
  3368. DFP.method = 2;                 /* seek from END of file
  3369. rstat = BULLET(&DFP);
  3370. if (rstat==0) {
  3371.    /* DFP.SeekOffset set to absolute current offset
  3372.    /* --in this case, the DFP.seekoffset equals then length of the file
  3373.    /* error
  3374. See: ReadFileDOSsrc
  3375. ~ReadFileDOSsrc
  3376. Func: ReadFileDOS      Pack: DOSFilePack        Func: 106/DOS
  3377. struct dosfilepack DFP;
  3378. DFP.func = READFILEDOS;         /* defined in BULLET.H
  3379. DFP.handle = handle;
  3380. DFP.bytes = bytes2read;         /* 16-bit value, in this case 512 since that's
  3381. DFP.bufferptr = dosbuff;        /* the size of dosbuff
  3382. rstat = BULLET(&DFP);
  3383. if (rstat==0) {
  3384.    if (DFP.bytes != bytes2read) { /* check if EOF processed
  3385.       /* hit EOF before reading all 512 bytes
  3386.    else
  3387.       /* ReadBuff filled with 512 bytes of data read from the current disk pos
  3388.       /* disk position moved to the last byte read + 1
  3389.    /* error
  3390. See: ExpandFileDOSsrc
  3391. ~ExpandFileDOSsrc
  3392. Func: ExpandFileDOS    Pack: DOSFilePack        Func: 107/DOS
  3393. struct dosfilepack DFP;
  3394. DFP.func = EXPANDFILEDOS;       /* defined in BULLET.H
  3395. DFP.handle = handle;
  3396. DFP.seekoffset = bytes2expandby;
  3397. rstat = BULLET(&DFP);
  3398. if (rstat==0) {
  3399.    /* file expanded by number of bytes specified
  3400.    /* error
  3401. See: WriteFileDOSsrc
  3402. ~WriteFileDOSsrc
  3403. Func: WriteFileDOS     Pack: DOSFilePack        Func: 108/DOS
  3404. struct dosfilepack DFP;
  3405. DFP.func = WRITEFILEDOS;        /* defined in BULLET.H
  3406. DFP.handle = handle;
  3407. DFP.bytes = bytes2write;        /* 16-bit value, in this case 512 since that's
  3408. DFP.buffptr = dosbuff;          /* the size of dosbuff
  3409. rstat = BULLET(&DFP);
  3410. if (rstat=0xFFFE)               /* -2 that is
  3411.    /* disk full
  3412.    if (rstat !=0) ... /* error
  3413. Unlike ReadFileDOS, if the number of bytes actually written does not equal
  3414. bytes2write, the WriteFileDOS routine returns a DISK FULL error code (-2).
  3415. See: CloseFileDOSsrc
  3416. ~CloseFileDOSsrc
  3417. Func: CloseFileDOS     Pack: DOSFilePack        Func: 109/DOS
  3418. struct dosfilepack DFP;
  3419. DFP.func = CLOSEFILEDOS;        /* defined in BULLET.H
  3420. DFP.handle =handle2close;
  3421. rstat = BULLET(&DFP);
  3422. if (rstat !=0) ... /* error
  3423. See: MakeDirDOSsrc
  3424. ~MakeDirDOSsrc
  3425. Func: MakeDirDOS       Pack: DOSFilePack        Func: 110/DOS
  3426. struct dosfilepack DFP;
  3427. DFP.func = MAKEDIRDOS;          /* defined in BULLET.H
  3428. DFP.filenameptr = newdirectoryname;
  3429. rstat = BULLET(&DFP);
  3430. if (rstat !=0) ... /* error
  3431. See: DeleteFileDOSsrc
  3432.