home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pc3270sa.zip / vbdde / fsesexxf.frm < prev    next >
Text File  |  2002-02-28  |  13KB  |  428 lines

  1. VERSION 4.00
  2. Begin VB.Form FormSessExMacroXfer 
  3.    Caption         =   "File transfer"
  4.    ClientHeight    =   4104
  5.    ClientLeft      =   3144
  6.    ClientTop       =   2652
  7.    ClientWidth     =   6024
  8.    BeginProperty Font 
  9.       name            =   "MS Sans Serif"
  10.       charset         =   0
  11.       weight          =   700
  12.       size            =   7.8
  13.       underline       =   0   'False
  14.       italic          =   0   'False
  15.       strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    Height          =   4428
  19.    Left            =   3096
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form2"
  22.    ScaleHeight     =   4104
  23.    ScaleWidth      =   6024
  24.    Top             =   2376
  25.    Width           =   6120
  26.    Begin VB.ComboBox SessionIdList 
  27.       BackColor       =   &H00FFFFC0&
  28.       ForeColor       =   &H00000000&
  29.       Height          =   288
  30.       ItemData        =   "FSESEXXF.frx":0000
  31.       Left            =   1320
  32.       List            =   "FSESEXXF.frx":0052
  33.       Sorted          =   -1  'True
  34.       Style           =   2  'Dropdown List
  35.       TabIndex        =   2
  36.       Top             =   480
  37.       Width           =   492
  38.    End
  39.    Begin VB.CommandButton ExitDlg 
  40.       Cancel          =   -1  'True
  41.       Caption         =   "E&xit"
  42.       Height          =   372
  43.       Left            =   4200
  44.       TabIndex        =   18
  45.       Top             =   3600
  46.       Width           =   852
  47.    End
  48.    Begin VB.CommandButton Execute 
  49.       Caption         =   "&Execute"
  50.       Default         =   -1  'True
  51.       Height          =   372
  52.       Left            =   960
  53.       TabIndex        =   17
  54.       Top             =   3600
  55.       Width           =   852
  56.    End
  57.    Begin VB.TextBox OptionText 
  58.       BackColor       =   &H00FFFFC0&
  59.       ForeColor       =   &H00000000&
  60.       Height          =   492
  61.       Left            =   3240
  62.       MultiLine       =   -1  'True
  63.       ScrollBars      =   1  'Horizontal
  64.       TabIndex        =   16
  65.       Text            =   "FSESEXXF.frx":00A4
  66.       Top             =   2760
  67.       Width           =   2292
  68.    End
  69.    Begin VB.Frame HostTypeFrame 
  70.       Caption         =   "Host type"
  71.       ForeColor       =   &H80000008&
  72.       Height          =   612
  73.       Left            =   3000
  74.       TabIndex        =   6
  75.       Top             =   840
  76.       Width           =   2604
  77.       Begin VB.OptionButton CICSOption 
  78.          Caption         =   "&CICS"
  79.          ForeColor       =   &H80000008&
  80.          Height          =   252
  81.          Left            =   1728
  82.          TabIndex        =   9
  83.          Top             =   240
  84.          Width           =   780
  85.       End
  86.       Begin VB.OptionButton VMOption 
  87.          Caption         =   "&VM"
  88.          ForeColor       =   &H80000008&
  89.          Height          =   255
  90.          Left            =   960
  91.          TabIndex        =   8
  92.          Top             =   240
  93.          Value           =   -1  'True
  94.          Width           =   735
  95.       End
  96.       Begin VB.OptionButton MVSOption 
  97.          Caption         =   "&MVS"
  98.          ForeColor       =   &H80000008&
  99.          Height          =   252
  100.          Left            =   96
  101.          TabIndex        =   7
  102.          Top             =   240
  103.          Width           =   780
  104.       End
  105.    End
  106.    Begin VB.TextBox HOSTfileText 
  107.       BackColor       =   &H00FFFFC0&
  108.       ForeColor       =   &H00000000&
  109.       Height          =   492
  110.       Left            =   480
  111.       MultiLine       =   -1  'True
  112.       ScrollBars      =   1  'Horizontal
  113.       TabIndex        =   14
  114.       Top             =   2760
  115.       Width           =   2292
  116.    End
  117.    Begin VB.Frame Frame1 
  118.       Caption         =   "Xfer type"
  119.       ForeColor       =   &H80000008&
  120.       Height          =   612
  121.       Left            =   312
  122.       TabIndex        =   3
  123.       Top             =   840
  124.       Width           =   2604
  125.       Begin VB.OptionButton ReceiveOption 
  126.          Caption         =   "&Receive"
  127.          ForeColor       =   &H80000008&
  128.          Height          =   252
  129.          Left            =   960
  130.          TabIndex        =   5
  131.          Top             =   240
  132.          Width           =   1164
  133.       End
  134.       Begin VB.OptionButton SendOption 
  135.          Caption         =   "&Send"
  136.          ForeColor       =   &H80000008&
  137.          Height          =   252
  138.          Left            =   96
  139.          TabIndex        =   4
  140.          Top             =   240
  141.          Value           =   -1  'True
  142.          Width           =   780
  143.       End
  144.    End
  145.    Begin VB.TextBox PCfileText 
  146.       BackColor       =   &H00FFFFC0&
  147.       BeginProperty Font 
  148.          name            =   "System"
  149.          charset         =   0
  150.          weight          =   700
  151.          size            =   9.6
  152.          underline       =   0   'False
  153.          italic          =   0   'False
  154.          strikethrough   =   0   'False
  155.       EndProperty
  156.       ForeColor       =   &H00000000&
  157.       Height          =   492
  158.       Left            =   480
  159.       MultiLine       =   -1  'True
  160.       ScrollBars      =   1  'Horizontal
  161.       TabIndex        =   11
  162.       Top             =   1800
  163.       Width           =   3972
  164.    End
  165.    Begin VB.TextBox DataText 
  166.       BackColor       =   &H00C0FFFF&
  167.       Height          =   288
  168.       Left            =   2880
  169.       TabIndex        =   19
  170.       Top             =   3720
  171.       Visible         =   0   'False
  172.       Width           =   204
  173.    End
  174.    Begin VB.Frame Frame2 
  175.       Caption         =   "&PC File Name"
  176.       Height          =   852
  177.       Left            =   360
  178.       TabIndex        =   10
  179.       Top             =   1560
  180.       Width           =   5292
  181.       Begin VB.CommandButton BrowseCommand 
  182.          Caption         =   "&Browse"
  183.          Height          =   492
  184.          Left            =   4200
  185.          TabIndex        =   12
  186.          Top             =   240
  187.          Width           =   972
  188.       End
  189.    End
  190.    Begin VB.Frame Frame3 
  191.       Caption         =   "&Host File Name"
  192.       Height          =   852
  193.       Left            =   360
  194.       TabIndex        =   13
  195.       Top             =   2520
  196.       Width           =   2532
  197.    End
  198.    Begin VB.Frame Frame4 
  199.       Caption         =   "&Options"
  200.       Height          =   852
  201.       Left            =   3120
  202.       TabIndex        =   15
  203.       Top             =   2520
  204.       Width           =   2532
  205.    End
  206.    Begin VB.Frame Frame5 
  207.       Caption         =   "Input Parameters"
  208.       Height          =   3372
  209.       Left            =   120
  210.       TabIndex        =   0
  211.       Top             =   120
  212.       Width           =   5772
  213.       Begin VB.OptionButton AS400Option 
  214.          Caption         =   "AS/400"
  215.          Height          =   252
  216.          Left            =   4200
  217.          TabIndex        =   21
  218.          Top             =   360
  219.          Width           =   1212
  220.       End
  221.       Begin VB.OptionButton A390Option 
  222.          Caption         =   "A/390"
  223.          Height          =   252
  224.          Left            =   2880
  225.          TabIndex        =   20
  226.          Top             =   360
  227.          Value           =   -1  'True
  228.          Width           =   1332
  229.       End
  230.       Begin VB.Label Label1 
  231.          Caption         =   "Session &Id"
  232.          Height          =   252
  233.          Left            =   240
  234.          TabIndex        =   1
  235.          Top             =   360
  236.          Width           =   972
  237.       End
  238.    End
  239.    Begin MSComDlg.CommonDialog BrowsePCFileDialog 
  240.       Left            =   3480
  241.       Top             =   3600
  242.       _Version        =   65536
  243.       _ExtentX        =   677
  244.       _ExtentY        =   677
  245.       _StockProps     =   0
  246.    End
  247. End
  248. Attribute VB_Name = "FormSessExMacroXfer"
  249. Attribute VB_Creatable = False
  250. Attribute VB_Exposed = False
  251.  
  252. Private Sub A390Option_Click()
  253.   HostTypeFrame.Enabled = True
  254.   MVSOption.Enabled = True
  255.   VMOption.Enabled = True
  256.   CICSOption.Enabled = True
  257. End Sub
  258.  
  259. Private Sub AS400Option_Click()
  260.   HostTypeFrame.Enabled = False
  261.   MVSOption.Enabled = False
  262.   VMOption.Enabled = False
  263.   CICSOption.Enabled = False
  264. End Sub
  265.  
  266. Private Sub BrowseCommand_Click()
  267. On Error GoTo BrowseErrorHandler
  268.  
  269.   BrowsePCFileDialog.Filter = "All Files (*.*)|*.*"
  270.   BrowsePCFileDialog.FilterIndex = 1
  271.   BrowsePCFileDialog.CancelError = True
  272.   
  273.   If SendOption.Value = True Then
  274.     BrowsePCFileDialog.DialogTitle = "Choose PC file to Send"
  275.     BrowsePCFileDialog.Flags = cdlOFNHideReadOnly Or cdlOFNPathMustExist Or cdlOFNFileMustExist Or cdlOFNLongNames
  276.     BrowsePCFileDialog.ShowOpen
  277.   Else ' ReceiveOption.Value = True
  278.     BrowsePCFileDialog.DialogTitle = "Choose PC file name for file being received"
  279.     BrowsePCFileDialog.Flags = cdlOFNOverwritePrompt Or cdlOFNHideReadOnly Or cdlOFNPathMustExist Or cdlOFNLongNames
  280.     BrowsePCFileDialog.ShowSave
  281.   End If
  282.   
  283.   PCfileText.Text = BrowsePCFileDialog.filename
  284. Exit Sub
  285.  
  286. BrowseErrorHandler:
  287.   If Err = 32755 Then
  288.     ' User Canceled Save As Dialog
  289.   Else
  290.     MsgBox "Error Number " & Err & " while Browsing for PC file name."
  291.   End If
  292.   
  293. End Sub
  294.  
  295.  
  296. Private Sub Execute_Click()
  297.    FunctionComp = True
  298.    
  299.    OldMousePointer = MousePointer
  300.    MousePointer = 11 ' Hour Glass Mouse Pointer
  301.    
  302.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  303.    
  304.    If DisplayType$ = "NONE" Then
  305.       MousePointer = OldMousePointer
  306.       MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  307.       Exit Sub
  308.    End If
  309.    
  310.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  311.    If Len(temp$) > 0 Then
  312.       Topic$ = "Session" + SessionIdList.Text
  313.    Else
  314.       MousePointer = OldMousePointer
  315.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  316.       Exit Sub
  317.    End If
  318.    CommandString$ = GetSessExXferData()
  319.  
  320. On Error GoTo ErrHandler
  321.  
  322.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  323.                                 'DoEvents function each time before
  324.                                 'starting DDE conversation.
  325.    DataText.LinkTimeout = -1
  326.    DataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  327.    DataText.LinkMode = COLD
  328.    DataText.LinkExecute CommandString$
  329.    DataText.LinkMode = NONE
  330.  
  331.    MousePointer = OldMousePointer
  332.    If FunctionComp = True Then
  333.       MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  334.       EndStatus$ = MSG_OK
  335.    Else
  336.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  337.       EndStatus$ = MSG_NG
  338.    End If
  339.    TempLogData$ = Time$ + ":Session Execute Macro : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  340.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """""" + Chr$(13) + Chr$(10) + Chr$(9)
  341.    TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  342.    TempLogData$ = TempLogData$ + "Command = " + """" + CommandString$ + """" + Chr$(13) + Chr$(10)
  343.    LogData$(LogEnd) = TempLogData$
  344.    UpdateLogPointer
  345.    Loged = True
  346.    Exit Sub
  347.  
  348. ErrHandler:
  349.    FunctionComp = False
  350.    Resume Next
  351. End Sub
  352.  
  353. Private Sub ExitDlg_Click()
  354.     Hide
  355. End Sub
  356.  
  357. Private Sub Form_Load()
  358.   SessionIdList.ListIndex = 0
  359.   OptionText.Text = "ASCII CRLF"
  360.   AdjustForNT351 FormSessExMacroXfer
  361. End Sub
  362.  
  363. Private Function GetSessExXferData() As String
  364.    Dim HostType As String
  365.  
  366.    If SendOption.Value = True Then
  367.       XferType$ = "SEND"
  368.    Else
  369.       XferType$ = "RECEIVE"
  370.    End If
  371.  
  372.    If A390Option.Value = True Then
  373.       If MVSOption.Value = True Then
  374.          HostType = "MVS"
  375.       ElseIf VMOption.Value = True Then
  376.          HostType = "VM"
  377.       Else
  378.          HostType = "CICS"
  379.       End If
  380.    End If
  381.  
  382.    temp$ = RTrim$(LTrim$(PCfileText.Text))
  383.    If Left$(temp$, 1) = """" Then
  384.       PCfile$ = temp$
  385.    Else
  386.       PCfile$ = """" + temp$ + """"
  387.    End If
  388.  
  389.    temp$ = RTrim$(LTrim$(HOSTfileText.Text))
  390.    If Left$(temp$, 1) = """" Then
  391.       HOSTfile$ = temp$
  392.    Else
  393.       HOSTfile$ = """" + temp$ + """"
  394.    End If
  395.  
  396.    temp$ = RTrim$(LTrim$(OptionText.Text))
  397.    If Left$(temp$, 1) = """" Then
  398.       OptionData$ = Mid$(temp$, 2, Len(temp$) - 2)
  399.    Else
  400.       OptionData$ = temp$
  401.    End If
  402.             
  403.    temp$ = RTrim$(LTrim$(OptionData$))
  404.  
  405.    If (Left$(temp$, 3) <> "MVS") And (Left$(temp$, 2) <> "VM") And (Left$(temp$, 4) <> "CICS") Then
  406.       OptionData$ = """" + HostType + " " + OptionData$ + """"
  407.    Else
  408.       OptionData$ = """" + OptionData$ + """"
  409.    End If
  410.  
  411.    GetSessExXferData = "[" + XferType$ + "(" + PCfile$ + ", " + HOSTfile$ + ", " + OptionData$ + ")]"
  412. End Function
  413.  
  414. Private Sub UpdateLogPointer()
  415.     LogEnd = LogEnd + 1
  416.     If LogEnd = MAXLOGNUM + 1 Then
  417.        LogEnd = 0
  418.     End If
  419.  
  420.     If LogTop = LogEnd Then
  421.        LogTop = LogTop + 1
  422.        If LogTop = MAXLOGNUM + 1 Then
  423.           LogTop = 0
  424.        End If
  425.     End If
  426. End Sub
  427.  
  428.