Updated December 2009
xcall MIAMEX, MX_EXPFIL, ch, addrecs, status
Note that it is up to you to update any control records or other internal structures to correspond to the new file size. Remember to release your exclusive access after doing so.
Parameters
ch
is the channel number that the file is open (for random exclusive access). If running LOKSER, you should probably open the file for RANDOM (exclusive) before expanding it. If not running LOKSER, you are free to use some other locking scheme. Although the XCALL will not stop you from expanding a file without first gaining exclusive access, you are likely to run into synchronization conflicts with other users who have the file open. For one thing, those users will not be able to access the expanded area (until they close and reopen the file), so if you update a control record they may try to access the new area and get an illegal record number.
addrecs
is the number of logical records to add (addrecs > 0) to or subtract (addrecs < 0) from the file, based on the record size passed in the file open statement. It will be converted to the appropriate number of 512 byte blocks to add or subtract. Added blocks will be filled with ]]] characters.
status
returns the new total number of logical records in the file if the operation is successful. 0 indicates a parameter or other configuration error trapped by the XCALL (generally accompanied by a displayed message.) <0 indicates an operating system error number, which you can retrieve the message for using MIAMEX,86,STATUS,MSG
History
2009 December, A-Shell 5.1.1167: Add ability to reduce file size.
2004 June, A-Shell 4.9.893: Routine added to A-Shell as expand-only file function.