###   Projekte und Informationen rund um den KC85   ### 

 

 

CFOG's PIP, June 1987, Volume 5 No. 8, Whole No. 56, page 4

Automatic File Transfers with MEX

by Daryl Gelbach and Walt Wheeler

[This is the fourth in a series of articles on MEX to be reprinted here. They originally appeared in Y.O.U.r NEWSLETTER, the newsletter of the Yankee Osborne Users Group. -- bhc]

In a previous article we explored the use of the INI.MEX file for setting operating parameters. As we said, this is a special kind of READ command file. It is possible (and desirable!) to use READ command files for other tasks, in particular file transfers. This article will present four command files to demonstrate how MEX can make the task of file transfer easy.

The first example is a simple download file. It is expected that you are in the drive/user area where your target file is.

[These files are set up indented a few spaces. The lines with two periods at the left are comment lines. In your file you'll actually have those at the left margin. They help you keep track of what you have done. The numbers at the left margin are line numbers shown in square brackets in the explanation that follows. -- bhc]

    ..
.. GET1.MEX
.. written 1-12-86
.. modified 1-20-86
..
1 WRT
2 SENDOUT "XMODEM S {1}"
3 SLEEP 3
4 RT {1}

Note the number in curly braces {}. The curly braces indicate that a variable will be read from the command line you type. Thus the file is adapted for multifile use. By turning the MEX EXTEND switch ON [STAT EXTEND ON<cr>], you can exccute a READ file without typing the word READ. This makes for an elegant command. From the MEX command prompt you type.

GET1 fn.t
<cr>

MEX will [1] close any buffer that you have by writing its contents to the disk, [2] activate XMODEM on the remote system telling it to send the fn.t, [3] open a file with the same name on your logged drive/user, [4] tell XMODEM to start sending the file, and return to terminal mode when it's all done.

The second download file adds a drive/user prefix to the target file, allowing XMODEM to cross areas to transfer the file. Again note the numbers in brackets {}. These indicate the position of the variables on your typed command line. This is very important to remember.

    ..
.. GET2.MEX
.. written 1-12-86
.. tested and modified 1-20-86
..
1 WRT
2 SENDOUT "XMODEM S {1}:{2}"
3 SLEEP 3
4 RT {2}

To transfer this file, go to the command prompt and enter:

GET2 du fn.t
<cr>

The drive/user must be separated from the filename by a space and NOT contain the colon. MEX will then be able to set up the file transfer properly and do it.

The only difference in this file is that line [2] specifies the drive and user area from which the file is to be sent This allows you to get a bunch of files from the remote system without changing drive or user area there.

    ..   SEND.MEX
.. written 1-12-86
.. tested and modified 1-20-86
..
1 WRT
2 SENDOUT "XMODEM R {1}
3 SLEEP 3
4 ST {1}

Now you have a READ file we call SEND.MEX! To send a file, go to the command prompt and enter:

SEND fn.t
<cr>

This READ file [1] closes the buffer, [2] sends the command to the remote system to receive the file you are going to send, [3] waits a moment for the remote system to get ready, and [4] sends filename.typ from the current logged drive and user area, then return to terminal mode.

Library file transfers are a little more difficult. There are three variables to enter on your command line. The following file is simply a variation of the above:

    ..   LGET.MEX
.. written 1-13-86
.. modified 1-20-86
..
1 WRT
2 SENDOUT "XMODEM L {1}:{2} {3}"
3 SLEEP 3
4 RT {3}

The command to use this file is:

LGET du lbrname fn.t
<cr>

If you have not engaged the READ extend function, you will have to prefix the command with the word "READ".

This READ file [1] closes the buffer, [2] sends the command to the remote system to send fn.t from lbrname located on the drive and user specified. The READ file continues by [3] waiting a moment for the remote system to get ready, and [4] tells your system to receive filename.typ, then return to terminal mode.

These four examples increase the versatility of MEX for you. This can help reduce the frustration you experience with any RCPM. The true benefit, however, is the time saved. This is enough to make MEX the modem program for you.