Please enable JavaScript to view this site.

A-Shell Reference

A-Shell supports AMOS-style filenames up to 72 characters long with an eight character extension—i.e., 72.8. But if that is not enough, since ASB automatically recognizes as native any filename containing a slash, you can easily transcend the size limitation as long as you can establish the absolute or relative directory name. For example, a common requirement is to archive files by date—e.g., transaction batches, posting journals, report images, etc. Coming up with a sensible naming scheme can be a challenge even using the expanded 72.8 format. But it becomes much easier when you eliminate the name length restrictions entirely. For example, you can retain the original filenames and just prepend a date, e.g. "20030408-journl.dat". If the file was known to be in the current directory, you could later reference it with:

Open #1, "./20030408-journl.dat", input    ! (Unix)

Open #1, ".\20030408-journl.dat", input    ! (Windows)

Of course if you are planning on archiving a lot of files, putting them all in the current directory wouldn’t be wise. Instead, you could use MX_MKPATH to create arbitrarily named subdirectories (perhaps based on the file type and/or date) and then store the files in those subdirectories. Under Windows, you could take this one step further and use a Windows File Open dialog box (MX_GETOFD) to allow the user to select (and create) arbitrary directories, returning the directory names to the application, which would then remember and use them for storing and retrieving these archived files. A variation of this approach to the use of native directory names would be to make them subdirectories of a particular AMOS-style directory, which you could retrieve the native equivalent of using MX_FSPEC.

The main problems to watch out for when using native directory and file names have to do with the DIR command and case sensitivity. In the default display modes, DIR only displays the first six characters of a filename, and it folds them to upper case. (With the /L {##.#} switch, or if SET LONGDIR is established, it displays ## characters plus the extension, but still folds them to upper case.)This can be confusing and annoying if your directories have a mixture of upper and lower case files and/or long filenames. Fortunately, there is a DIR switch /NA{tive} which forces it to display fully-qualified native filespecs in their proper case, which pretty much eliminates the problem.

When referencing native filenames within your programs, the simplest approach is to stick with all lower case. This will work under Windows (where it doesn’t matter) and Unix (where it does). If you use a mixture of upper and loser case, you can run into the extremely frustrating situation where DIR shows one (or more) copies of the file present, but OPEN (and other file access statements in BASIC) cannot find it.

Filename case can be altered during transfer between systems, so pay particular attention when transferring files to Unix. Many file transfer programs have an option to fold filenames to lower case during the transfer, which would be wise to use. If you end up with upper case filenames on your Unix system anyway, see Folding Filenames to Lower Case for information on converting them in place.

History

2019 July, A-Shell 6.5.1662:  Increase filename size limit from 10.3 to 72.8.