home *** CD-ROM | disk | FTP | other *** search
- $! DEMO1.DCL HOST CONTROL OF REFLECTION FILE TRANSFER
- $!
- $! This file, once transferred to the VAX, must be renamed changing
- $! the .DCL extension to a .COM extension.
- $!
- $! This procedure demonstrates host control of Reflection file transfer.
- $!
- $! 1. Determine if VAXLINK is available on the VAX.
- $! 2. Determine if Reflection is there and working correctly.
- $! 3. Ask the user what he wants to do.
- $! 4. Ask for a filename.
- $! 5. Verify that the file is there.
- $! 6. Do the file transfer
- $!
- $! How it works:
- $! When Reflection receives the sequence ESC&oB <string><cr> from the host,
- $! <string> is assumed to be a command language command and is passed to
- $! the Reflection command interpreter. When the command completes
- $! Reflection sends a completion code of S<cr> or F<cr> to indicate
- $! if the command succeeded or failed. The sequence Esc&oC<string><cr>
- $! works the same way except that sending of completion codes can be
- $! suppressed with the Reflection set command "SET DISABLE-COMP-CODES YES".
- $! Esc&oF never returns a completion code.
- $!
- $! Read the Command Language Manual for more detail.
- $!
- $!**************************************************************************
- $!
- $! Initialization - Set up some useful symbols
- $!
- $ ESC[0,8]=%X1B
- $ CURSOR_UP=ESC+"M"
- $ POSITION=ESC+"[22;1H"
- $ CLEAR_LINE=ESC+"[2K"
- $ HOME_AND_CLEAR=ESC+"[H"+ESC+"[2J"
- $!
- $! Define the WRQ command escape sequences.
- $!
- $ WRQB=ESC+"&oB"
- $ WRQC=ESC+"&oC"
- $ CMD=POSITION+WRQC
- $!
- $! 1. Check that the file transfer program VAXLINK is there. It should be
- $! set up as a system wide foreign command. If not then look for it in
- $! in the current directory. If it's not there then exit.
- $!
- $ if f$type(vaxlink) .nes. "" then goto vaxlink_ok
- $ x1 = f$search("vaxlink.exe")
- $ if x1 .nes. "" then goto vaxlink_sym
- $ write sys$output "The file transfer program vaxlink is not available"
- $ exit
- $VAXLINK_SYM:
- $ x1 = "$"+x1
- $ vaxlink :== 'x1
- $VAXLINK_OK:
- $!
- $! 2. Determine if Reflection is there and working correctly.
- $! Try to disable WRQC type completion codes. At the same time check
- $! to see if the user is using a terminal or if his copy of Reflection
- $! is busy. We write "Please press return" and then erase it if all goes
- $! well. However if it's not Reflection, the user must press Return to
- $! exit.
- $!
- $ write sys$output HOME_AND_CLEAR
- $ write sys$output WRQB+"set disable-comp-codes yes"
- $ write sys$output CURSOR_UP+CLEAR_LINE
- $ inquire completion_code "Please press return"
- $ if completion_code .eqs. "S" then goto good_Reflection
- $ if completion_code .eqs. "F" then goto busy_Reflection
- $NOT_REFLECTION:
- $!
- $! Something is wrong. Reflection isn't responding to commands.
- $! The user will have to press Return to continue.
- $! This would happen if you were using a terminal instead of Reflection.
- $!
- $ write sys$output "You must be running Reflection to use this procedure"
- $ exit
- $BUSY_REFLECTION:
- $!
- $! If Reflection is already executing a command file it won't respond
- $! to commands from the host.
- $!
- $ write sys$output HOME_AND_CLEAR+"Reflection is not responding correctly"
- $ exit
- $!
- $GOOD_REFLECTION:
- $!
- $! Set up Reflection
- $!
- $ write sys$output HOME_AND_CLEAR
- $ write sys$output CMD+"let v9 = value(literal-escape)"
- $ write sys$output CMD+"let v8 = value(quiet-command)"
- $ on control_y then goto exit
- $ write sys$output CMD+"set literal-escape '~'"
- $ write sys$output CMD+"set quiet-command yes"
- $ write sys$output CMD+"continue on"
- $!
- $! 3. Determine what the user wants to do
- $!
- $MAINLOOP:
- $ write sys$output HOME_AND_CLEAR
- $ type sys$input
- What do you want to do?
- 1. Send a file from the VAX to the PC.
- 2. Send a file from the PC to the VAX.
- 3. Exit.
- $ inquire answer "Enter your choice"
- $ if answer .eq. 1 then goto send_to_pc
- $ if answer .eq. 2 then goto send_to_vax
- $ if answer .eq. 3 then goto exit
- $ goto mainloop
- $!
- $! Get a file name, check to see if it exists and then transfer it.
- $! The define for $file is used because a fully qualified VMS file name
- $! might be too long for a Reflection command string.
- $!
- $SEND_TO_PC:
- $ inquire vax_file "Enter VAX file name"
- $ vax_file = f$search(vax_file)
- $ if vax_file .eqs."" then goto no_such_file
- $ f_name = f$extract(0,8,f$parse(vax_file,,,"name"))
- $ f_type = f$extract(0,4,f$parse(vax_file,,,"type"))
- $ pc_file = f_name + f_type
- $ define $file 'vax_file
- $ r_command = WRQB+"receive "+pc_file+" from $file ascii delete"
- $ write sys$output r_command
- $ read/prompt="" sys$input host_startup_seq
- $ write sys$output POSITION+CLEAR_LINE
- $ if host_startup_seq .eqs."F" then goto startup_error
- $ define sys$input/user_mode sys$command
- $! replace the next line with "$ vaxlink e" if you have an 8 bit data path.
- $ vaxlink
- $ deassign $file
- $ write sys$output POSITION+CLEAR_LINE
- $ read/prompt="" sys$command completion_code
- $ if completion_code .eqs. "F" then goto transfer_error
- $ goto mainloop
- $!
- $SEND_TO_VAX:
- $!
- $! Get the file name, check to see if it exists on the PC and then
- $! transfer it.
- $!
- $ inquire pc_file "Enter PC file name"
- $ write sys$output CMD+"let v1= exist('"+pc_file+"')"
- $ write sys$output CMD+"transmit v1&'^m'"
- $ write sys$output POSITION+CLEAR_LINE
- $ read/prompt="" sys$command answer
- $ if answer .eqs. "0" then goto no_such_file
- $ write sys$output POSITION+WRQB+"send "+pc_file+" ascii"
- $ read/prompt="" sys$command host_startup_seq
- $ write sys$output POSITION+CLEAR_LINE
- $ if host_startup_seq.eqs."F" then goto startup_error
- $ define sys$input/user_mode sys$command
- $! replace the next line with "$ vaxlink e" if you have an 8 bit data path.
- $ vaxlink
- $ write sys$output POSITION+CLEAR_LINE
- $ read/prompt="" sys$command completion_code
- $ if completion_code.nes."S" then goto transfer_error
- $ goto mainloop
- $!
- $NO_SUCH_FILE:
- $ write sys$output POSITION
- $ inquire answer "That file was not found, please press return"
- $ goto mainloop
- $STARTUP_ERROR:
- $ write sys$output POSITION
- $ inquire answer "File transfer didn't get started, please press return"
- $ goto mainloop
- $TRANSFER_ERROR:
- $ write sys$output POSITION
- $ inquire answer "The file transfer was not successful, please press return"
- $ goto mainloop
- $EXIT:
- $! write sys$output CMD+"continue off"
- $! write sys$output CMD+"set literal-escape $9"
- $! write sys$output CMD+"set quiet-command $8"
- $ exit