home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / EASL2PRF.ZIP / HOSTFDB.INC < prev    next >
Text File  |  1990-06-15  |  6KB  |  162 lines

  1. application RECEIVEFILE
  2.  
  3. boolean HostListFound is false
  4. string FileListLine
  5. string ListHostFileName ListHostFileType ListHostFileMode
  6. integer FileCtr
  7.  
  8. #
  9. # Dialog Box Object Definition(s)
  10. #
  11. invisible textual region HostFileListTR
  12.     window size 80 columns 24 lines
  13.     at 10 10 in PrimaryWindow
  14.  
  15.  
  16. enabled invisible modeless dialog box HostFileListDB
  17.     size 200 110
  18.     at position 78 40
  19.     dialog border
  20.     title bar "Host File Names"
  21.     system menu
  22.  
  23. enabled visible static text HostFileListST1
  24.     size 81 8
  25.     at position 28 89
  26.     in HostFileListDB
  27.     left align
  28.     top align
  29.     text "Select a Host File:"
  30.  
  31. enabled visible list box HostFileListLB
  32.     size 170 58
  33.     at position 15 27
  34.     in HostFileListDB
  35.  
  36. enabled visible default push button OK
  37.     size 38 12
  38.     at position 6 4
  39.     in HostFileListDB
  40.     group is Actions
  41.     text "~OK"
  42.  
  43. enabled visible cancel push button Cancel
  44.     size 38 12
  45.     at position 56 4
  46.     in HostFileListDB
  47.     group is Actions
  48.     text "Cancel"
  49.  
  50. #
  51. # Subroutine Definition(s)
  52. #
  53.  
  54. subroutine ProcessHostFileListDB( boolean : DidOKCUA ) is
  55.     begin guarded
  56.         response to start
  57.            if (not HostListFound) then
  58.                copy true to HostListFound
  59.                read file "CMS$LIST.PRN" into HostFileListTR
  60.                copy "CMS$LIST.PRN" to FileName
  61.                copy "read-only" to Access
  62.                call Open(FileID,FileName,Access)
  63.                for FileCtr = 1 to bottom of HostFileListTR loop
  64.                   append "█" to InitMsg
  65.                   change InitializeST text to InitMsg 
  66.                   call ReadLineNumber(FileID,FileCtr,FileListLine)
  67.                   extract from FileListLine
  68.                      skip to 8
  69.                      take word ListHostFileName
  70.                      take word ListHostFileType
  71.                      take word ListHostFileMode
  72.                   if (ListHostFileType != "OFSLOGfl") then
  73.                      add to HostFileListLB
  74.                         insert ListHostFileName " " ListHostFileType " " ListHostFileMode
  75.                   end if
  76.                end loop
  77.                call Close(FileID)
  78.                copy "/C erase CMS$LIST.PRN\n" to Parms 
  79.                start local RECEIVEFILE "cmd.exe" Parms
  80.                    begin
  81.                        response to line "IBM Operating" from RECEIVEFILE
  82.                           # do nothing
  83.                        response to line "<DIR>" from RECEIVEFILE
  84.                           # do nothing
  85.                        response to line "ERASE" from RECEIVEFILE
  86.                           # do nothing
  87.                        response to timeout 1 
  88.                             leave block
  89.                    end
  90.                 stop RECEIVEFILE
  91.             end if
  92.             make InitializeDB invisible
  93.             make HostFileListDB visible
  94.  
  95.         response to OK in HostFileListDB
  96.             copy true to DidOKCUA
  97.             make HostFileListDB invisible
  98.             leave block
  99.         response to Cancel in HostFileListDB
  100.             copy false to DidOKCUA
  101.             make HostFileListDB invisible
  102.             leave block
  103.     end
  104.  
  105.                               # This routine transfers the file 
  106. action TransferFromHost is    # & calls other routines to read list
  107.     copy "Getting List of Host Files.\n" to InitMsg
  108.     change InitializeST text to InitMsg
  109.     make InitializeDB visible
  110.     action Init3270                       # get the list of host files    
  111.     copy "LISTF * * A (EXEC" to Keystrokes
  112.     action EnterString
  113.     action DefineWatch                    # wait for response 
  114.       copy 60 to SettleTime
  115.       action WatchForNoX
  116.     action WatchAndWait
  117.     if (WatchGaveUp) then
  118.       # error
  119.     else
  120.         action Stop3270
  121.         # set up HostFileName and HostOptions
  122.         copy "CMS$LIST.PRN" to ChosenPCFileName
  123.         copy "CMS EXEC A " to HostFileName      # build the host name VM Style
  124.         copy " (ASCII CRLF" to HostOptions      # converting to ASCII
  125.                                                       # build send command
  126.         copy ChosenPCFileName to SendCommand
  127.         append " " HostFileName to SendCommand
  128.         append " " HostOptions to SendCommand         
  129.                                                       # get ready to start a 
  130.                                                       # command processor and 
  131.                                                       # pass the RECEIVE command 
  132.                                                       # it for file transfer
  133.         copy "/C start \"ReceiveFile\" /C receive " SendCommand to Parms 
  134.         start local RECEIVEFILE "cmd.exe" Parms
  135.         begin                                         # respond to messages from
  136.                                                       # the SEND command
  137.                 response to char "File transfer is complete." from RECEIVEFILE
  138.                         # add to list box
  139.                         copy false to DidOKCUA
  140.                         stop RECEIVEFILE
  141.                         call ProcessHostFileListDB(DidOKCUA)
  142.                         leave block
  143.                 response to line "TRANS03" from RECEIVEFILE
  144.                         copy ReplyToMessage(" ","File Transfer Complete",MessageOK,1,MessageIconExclamation) to TempX
  145.                         stop RECEIVEFILE
  146.                         leave block
  147.                 response to line "TRANS026" from RECEIVEFILE  # bad message from SEND
  148.                         copy ReplyToMessage(" ","File Transfer returned message TRANS026",MessageOK,1,MessageIconExclamation) to TempX
  149.                         stop RECEIVEFILE
  150.                         leave block
  151.  
  152.                 response to char "Number of" from RECEIVEFILE
  153.                         append "█" to InitMsg
  154.                         change InitializeST text to InitMsg 
  155.                 response to timeout 60    # from RECEIVEFILE
  156.                         copy ReplyToMessage(" ","File Transfer Timed Out.",MessageOK,1,MessageIconExclamation) to TempX
  157.                         stop RECEIVEFILE
  158.                         leave block
  159.  
  160.         end
  161.    end if
  162.