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

  1. boolean PROFSListFound is false AsciiFlag is false
  2. integer PROFCtr DocIndex
  3. string PROFSDocNumber[254]
  4. string PROFSFrom RFTTest
  5. string PROFSTo TempString
  6. string PROFSSubject[254]
  7. string PROFSIndexLine
  8.  
  9. #
  10. # Dialog Box Object Definition(s)
  11. #
  12. invisible textual region PROFSFileListTR
  13.     window size 80 columns 24 lines
  14.     at 10 10 in PrimaryWindow
  15.  
  16.  
  17. enabled invisible modeless dialog box PROFSFileListDB
  18.     size 300 150
  19.     at position 78 40
  20.     dialog border
  21.     title bar "PROFS Documents"
  22.     system menu
  23.  
  24. enabled visible static text PROFSFileListST1
  25.     size 140 8
  26.     at position 15 130
  27.     in PROFSFileListDB
  28.     left align
  29.     top align
  30.     text "Select a PROFS Document:"
  31.  
  32. enabled visible list box PROFSFileListLB
  33.     size 250 100
  34.     at position 15 27
  35.     in PROFSFileListDB
  36.  
  37. enabled visible default push button OK
  38.     size 38 12
  39.     at position 6 4
  40.     in PROFSFileListDB
  41.     group is Actions
  42.     text "~OK"
  43.  
  44. enabled visible cancel push button Cancel
  45.     size 38 12
  46.     at position 56 4
  47.     in PROFSFileListDB
  48.     group is Actions
  49.     text "Cancel"
  50.  
  51. enabled invisible modal dialog box GetPROFSFileDB
  52.     size 264 110
  53.     at position 50 40
  54.     dialog border
  55.     title bar "Specify PC File Name"
  56.     system menu
  57.  
  58. enabled visible static text GetPROFSHostFileNameST
  59.     size 198 8
  60.     at position 12 83
  61.     in GetPROFSFileDB
  62.     left align
  63.     top align
  64.     text "Host File Name:"
  65.  
  66. enabled visible static text GetPROFSPCFileNameST
  67.     size 86 8
  68.     at position 11 59
  69.     in GetPROFSFileDB
  70.     right align
  71.     top align
  72.     text "Enter PC File Name:"
  73.  
  74. enabled visible entry field GetPROFSPCFileNameEF
  75.     size 150 12
  76.     at position 102 57
  77.     in GetPROFSFileDB
  78.     text size 30 columns
  79.     left align
  80.  
  81. enabled visible default push button OK
  82.     size 38 12
  83.     at position 6 4
  84.     in GetPROFSFileDB
  85.     group is Actions
  86.     text "~OK"
  87.  
  88. enabled visible cancel push button Cancel
  89.     size 38 12
  90.     at position 56 4
  91.     in GetPROFSFileDB
  92.     group is Actions
  93.     text "Cancel"
  94.  
  95. #
  96. # Subroutine Definition(s)
  97. #
  98.  
  99. subroutine ProcessGetPROFSFileDB( boolean : DidOKCUA ) is
  100.     begin guarded
  101.         response to start
  102.             make GetPROFSFileDB visible
  103.         response to OK in GetPROFSFileDB
  104.             copy true to DidOKCUA
  105.             make GetPROFSFileDB invisible
  106.             leave block
  107.         response to Cancel in GetPROFSFileDB
  108.             copy false to DidOKCUA
  109.             make GetPROFSFileDB invisible
  110.             leave block
  111.     end
  112.  
  113.  
  114. #
  115. # Subroutine Definition(s)
  116. #
  117.  
  118. subroutine ProcessPROFSFileListDB( boolean : DidOKCUA ) is
  119.     begin guarded
  120.         response to start
  121.            if (not PROFSListFound) then
  122.                copy true to PROFSListFound
  123.                clear PROFSFileListTR
  124.                read file "OFSINDEX.OFD" into PROFSFileListTR
  125.                copy "OFSINDEX.OFD" to FileName
  126.                copy "read-only" to Access
  127.                call Open(FileID, FileName, Access)
  128.  
  129.                for PROFCtr = 1 to (bottom of PROFSFileListTR)loop
  130.                     append "█" to InitMsg
  131.                     change InitializeST text to InitMsg 
  132.                     call ReadLineNumber(FileID,PROFCtr,PROFSIndexLine)
  133.                     extract from PROFSIndexLine
  134.                         take 12 PROFSDocNumber[PROFCtr]
  135.                         skip to 66
  136.                         take to 120 PROFSSubject[PROFCtr]
  137.                      if (PROFSSubject[PROFCtr] = " ") then
  138.                         copy "NO SUBJECT" to PROFSSubject[PROFCtr]
  139.                      end if
  140.                      add to PROFSFileListLB
  141.                         insert PROFSSubject[PROFCtr]   # PROFSDocNumber[PROFCtr]
  142.                end loop
  143.                call Close(FileID)
  144.                copy "/C erase OFSINDEX.OFD\n" to Parms 
  145.                start local RECEIVEFILE "cmd.exe" Parms
  146.                    begin
  147.                        response to line "IBM Operating" from RECEIVEFILE
  148.                           # do nothing
  149.                        response to line "<DIR>" from RECEIVEFILE
  150.                           # do nothing
  151.                        response to line "ERASE" from RECEIVEFILE
  152.                           # do nothing
  153.                        response to timeout 1 
  154.                             leave block
  155.                    end
  156.                stop RECEIVEFILE
  157.             end if
  158.            make InitializeDB invisible
  159.             make PROFSFileListDB visible
  160.  
  161.         response to OK in PROFSFileListDB
  162.             copy true to DidOKCUA
  163.             make PROFSFileListDB invisible
  164.             leave block
  165.         response to Cancel in PROFSFileListDB
  166.             copy false to DidOKCUA
  167.             make PROFSFileListDB invisible
  168.             leave block
  169.     end
  170.  
  171.                                               # This routine transfers the file 
  172. action TransferFromPROFS is                        # & calls other routines to read list
  173.     set pointer to SPTR_WAIT
  174.     copy "Getting List of PROFS Documents.\n" to InitMsg
  175.     change InitializeST text to InitMsg
  176.     make InitializeDB visible
  177.         # set up HostFileName and HostOptions
  178.         copy "OFSINDEX.OFD" to ChosenPCFileName
  179.         copy "OFSINDEX OFSDATA " to HostFileName      # build the host name VM Style
  180.         copy " (ASCII CRLF" to HostOptions      # converting to ASCII
  181.                                                       # build send command
  182.         copy ChosenPCFileName to SendCommand
  183.         append " " HostFileName to SendCommand
  184.         append " " HostOptions to SendCommand         
  185.                                                       # get ready to start a 
  186.                                                       # command processor and 
  187.                                                       # pass the RECEIVE command 
  188.                                                       # it for file transfer
  189.         copy "/C start \"ReceiveFile\" /C receive " SendCommand to Parms 
  190.         start local RECEIVEFILE "cmd.exe" Parms
  191.         begin                                         # respond to messages from
  192.                                                       # the SEND command
  193.                 response to char "File transfer is complete." from RECEIVEFILE
  194.                         # add to list box
  195.                         copy false to DidOKCUA
  196.                         stop RECEIVEFILE
  197.                         leave block
  198.                 response to line "TRANS03" from RECEIVEFILE
  199.                         copy ReplyToMessage(" ","File Transfer Complete",MessageOK,1,MessageIconExclamation) to TempX
  200.                         stop RECEIVEFILE
  201.                         leave block
  202.                 response to line "TRANS026" from RECEIVEFILE  # bad message from SEND
  203.                         copy ReplyToMessage(" ","File Transfer returned message TRANS026",MessageOK,1,MessageIconExclamation) to TempX
  204.                         stop RECEIVEFILE
  205.                         leave block
  206.                 response to char "Number of" from RECEIVEFILE
  207.                         append "█" to InitMsg
  208.                         change InitializeST text to InitMsg 
  209.                 response to timeout 60     # from RECEIVEFILE
  210.                         copy ReplyToMessage(" ","File Transfer Timed Out.",MessageOK,1,MessageIconExclamation) to TempX
  211.                         stop RECEIVEFILE
  212.                         leave block
  213.         end
  214.         set pointer to SPTR_ARROW
  215.  
  216. action GetPROFSFile is
  217.         set pointer to SPTR_WAIT
  218.         copy "Getting PROFS Document.\n" to InitMsg
  219.         change InitializeST text to InitMsg
  220.         make InitializeDB visible
  221.         # set up HostFileName and HostOptions
  222.                                                       # build send command
  223.         copy ChosenPCFileName to SendCommand
  224.         append " " HostFileName to SendCommand
  225.         append " " HostOptions to SendCommand         
  226.                                                       # get ready to start a 
  227.                                                       # command processor and 
  228.                                                       # pass the RECEIVE command 
  229.                                                       # it for file transfer
  230.         copy "/C start \"ReceiveFile\" /C receive " SendCommand to Parms 
  231.         start local RECEIVEFILE "cmd.exe" Parms
  232.         begin                                         # respond to messages from
  233.                                                       # the SEND command
  234.                 response to char "File transfer is complete." from RECEIVEFILE
  235.                         stop RECEIVEFILE
  236.                         make InitializeDB invisible
  237.                         copy ReplyToMessage(ChosenPCFileName,"File Transfer Complete",MessageOK,1,MessageIconExclamation) to TempX
  238.                         leave block
  239.                 response to line "TRANS03" from RECEIVEFILE
  240.                         stop RECEIVEFILE
  241.                         make InitializeDB invisible
  242.                         copy ReplyToMessage(ChosenPCFileName,"File Transfer Complete",MessageOK,1,MessageIconExclamation) to TempX
  243.                         leave block
  244.                 response to line "TRANS026" from RECEIVEFILE  # bad message from SEND
  245.                         stop RECEIVEFILE
  246.                         make InitializeDB invisible
  247.                         copy ReplyToMessage(" ","File Transfer returned message TRANS026",MessageOK,1,MessageIconExclamation) to TempX
  248.                         leave block
  249.                 response to char "Number of" from RECEIVEFILE
  250.                         append "█" to InitMsg
  251.                         change InitializeST text to InitMsg 
  252.                 response to timeout 60  # from RECEIVEFILE
  253.                         copy ReplyToMessage(" ","File Transfer Timed Out.",MessageOK,1,MessageIconExclamation) to TempX
  254.                         stop RECEIVEFILE
  255.                         leave block
  256.        end
  257.         set pointer to SPTR_ARROW
  258.  
  259. action GetPROFSDoc is
  260.         set pointer to SPTR_WAIT
  261.         action Init3270
  262.         copy selected line from PROFSFileListLB to DocIndex
  263.         copy "PRGFRPRF " to Keystrokes
  264.         append PROFSDocNumber[DocIndex] to Keystrokes
  265.         action EnterString
  266.  
  267.         action DefineWatch                    # wait for response from EPQPCPRF
  268.           copy 22 to WatchRow
  269.           copy 2 to WatchCol
  270.           copy "PF12=END" to WatchChar
  271.           copy 300 to SettleTime
  272.           action WatchForChar
  273.           action WatchForNoX
  274.           action WatchAndWait
  275.        if (WatchGaveUp) then
  276.            set pointer to SPTR_ARROW
  277.            # error
  278.        else
  279.            # we made it to the download screen.  read screen variables 
  280.            # that will be used for downloading.
  281.            action ScanScreen
  282.                
  283.               copy 13 to FieldNumber      # Host File Name
  284.               action ReadField 
  285.               copy FieldText to HostFileName
  286.               copy 16 to FieldNumber      # Host File Type
  287.               action ReadField 
  288.               append " " FieldText to HostFileName
  289.               extract from FieldText
  290.                  take 3 RFTTest
  291.               if (RFTTest = "RFT") then
  292.                  copy false to AsciiFlag
  293.               else
  294.                  copy true to AsciiFlag
  295.               end if
  296.           # we have the name of the Host File, now we need the name 
  297.           # of the PC file.  Call a Dialog Box for this info
  298.           copy text of GetPROFSHostFileNameST to TempString
  299.           append " " HostFileName to TempString 
  300.           
  301.           change GetPROFSHostFileNameST text to TempString
  302.           set pointer to SPTR_ARROW
  303.           copy false to DidOKCUA
  304.           call ProcessGetPROFSFileDB (DidOKCUA)
  305.           if (DidOKCUA) then 
  306.                 copy text of GetPROFSPCFileNameEF to ChosenPCFileName
  307.                   # get the host file mode and complete the download request
  308.               copy 19 to FieldNumber      # Host File Mode
  309.               action ReadField 
  310.               append " " FieldText to HostFileName
  311.               if (AsciiFlag) then 
  312.                   copy " (ASCII CRLF" to HostOptions
  313.               else
  314.                   copy " " to HostOptions
  315.               end if
  316.               action Stop3270
  317.               action GetPROFSFile
  318.           end if
  319.          # clear out the host screen
  320.         action Init3270
  321.         copy 12 to PFkeyNumber
  322.         action PressPFkey
  323.         action Stop3270
  324.       end if
  325.