home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pc3270sa.zip
/
vbdde
/
ffindfld.frm
next >
Wrap
Text File
|
2002-02-28
|
22KB
|
710 lines
VERSION 4.00
Begin VB.Form FormFindField
Caption = "Find Field"
ClientHeight = 5988
ClientLeft = 1632
ClientTop = 1740
ClientWidth = 5784
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 7.8
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 6312
Left = 1584
LinkMode = 1 'Source
LinkTopic = "Form6"
ScaleHeight = 5988
ScaleWidth = 5784
Top = 1464
Width = 5880
Begin VB.ComboBox SessionIdList
BackColor = &H00FFFFC0&
ForeColor = &H00000000&
Height = 288
ItemData = "FFINDFLD.frx":0000
Left = 360
List = "FFINDFLD.frx":0052
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 2
Top = 720
Width = 492
End
Begin VB.TextBox FIndFieldDataText
Height = 372
Left = 5088
TabIndex = 8
Top = 5520
Visible = 0 'False
Width = 300
End
Begin VB.CommandButton ExitDlg
Cancel = -1 'True
Caption = "E&xit"
Height = 372
Left = 3840
TabIndex = 9
Top = 5520
Width = 972
End
Begin VB.CommandButton Execute
Caption = "&Execute"
Default = -1 'True
Height = 372
Left = 672
TabIndex = 7
Top = 5520
Width = 876
End
Begin VB.Frame Frame1
Caption = "Output Information"
ForeColor = &H80000008&
Height = 3612
Left = 120
TabIndex = 10
Top = 1800
Width = 5580
Begin VB.Label FieldDataLabel9
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 28
Top = 3240
Width = 3276
End
Begin VB.Label FieldLabel9
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 26
Top = 3240
Width = 2028
End
Begin VB.Label FieldDataLabel8
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 27
Top = 2880
Width = 3276
End
Begin VB.Label FieldLabel8
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 25
Top = 2880
Width = 2028
End
Begin VB.Label FieldDataLabel7
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 24
Top = 2520
Width = 3276
End
Begin VB.Label FieldLabel7
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 17
Top = 2520
Width = 2028
End
Begin VB.Label FieldDataLabel6
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 23
Top = 2160
Width = 3276
End
Begin VB.Label FieldLabel6
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 16
Top = 2160
Width = 2028
End
Begin VB.Label FieldDataLabel5
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 22
Top = 1800
Width = 3276
End
Begin VB.Label FieldLabel5
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 15
Top = 1800
Width = 2028
End
Begin VB.Label FIeldDataLabel4
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 21
Top = 1440
Width = 3276
End
Begin VB.Label FieldLabel4
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 14
Top = 1440
Width = 2028
End
Begin VB.Label FieldDataLabel3
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 20
Top = 1080
Width = 3276
End
Begin VB.Label FieldLabel3
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 13
Top = 1080
Width = 2028
End
Begin VB.Label FieldDataLabel2
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 19
Top = 720
Width = 3276
End
Begin VB.Label FieldLabel2
ForeColor = &H80000008&
Height = 252
Left = 96
TabIndex = 12
Top = 720
Width = 2028
End
Begin VB.Label FieldDataLabel1
ForeColor = &H80000008&
Height = 252
Left = 2208
TabIndex = 18
Top = 360
Width = 3276
End
Begin VB.Label FieldLabel1
Caption = "Formatted/Unformatted:"
ForeColor = &H80000008&
Height = 252
Index = 0
Left = 120
TabIndex = 11
Top = 360
Width = 2028
End
End
Begin VB.Frame Frame2
Caption = "Input Parameters"
ForeColor = &H80000008&
Height = 1572
Left = 120
TabIndex = 0
Top = 120
Width = 5532
Begin VB.Frame Frame5
Caption = "Session &Id"
Height = 732
Left = 120
TabIndex = 1
Top = 360
Width = 1812
Begin VB.Label SessionTypeLabel
Height = 372
Left = 720
TabIndex = 30
Top = 240
Width = 972
End
End
Begin VB.TextBox FindStartPosText
BackColor = &H00FFFFC0&
ForeColor = &H00000000&
Height = 288
Left = 2160
MaxLength = 4
TabIndex = 4
Top = 360
Width = 492
End
Begin VB.Frame Frame3
Caption = "&Field to Find"
Height = 612
Left = 2040
TabIndex = 5
Top = 840
Width = 3372
Begin VB.ComboBox FindStartPosOption
BackColor = &H00FFFFC0&
Height = 288
ItemData = "FFINDFLD.frx":00A4
Left = 120
List = "FFINDFLD.frx":00C0
TabIndex = 6
Top = 240
Width = 732
End
Begin VB.Label OptionDescription
Height = 252
Left = 960
TabIndex = 29
Top = 240
Width = 2292
End
End
Begin VB.Frame Frame4
Caption = "PS &Position to Start Find"
Height = 612
Left = 2040
TabIndex = 3
Top = 120
Width = 3372
Begin VB.Label RowColumnLabel
Height = 252
Left = 720
TabIndex = 31
Top = 240
Width = 2532
End
End
End
End
Attribute VB_Name = "FormFindField"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private Function Display5250FieldInfo() As Integer
On Error GoTo ErrHandler52
Dim Status As Integer
Status = True
StartPos& = 1
EndPos& = 1
StringLength& = Len(FindFieldDataText.Text)
If Left$(FindFieldDataText.Text, 9) = "Formatted" Then
For i% = 0 To 7
EndPos& = InStr(StartPos&, FindFieldDataText.Text, Chr$(9))
If (EndPos& = StartPos&) Or (EndPos& = 0) Then
Status = False
Exit For
End If
TempData(i%) = Mid$(FindFieldDataText.Text, StartPos&, EndPos& - StartPos&)
StartPos& = EndPos& + 1
Next i%
If (Status = True) And (StringLength& > StartPos&) Then
TempData(8) = Mid$(FindFieldDataText.Text, StartPos&, StringLength&)
Else
Status = False
End If
If Status = True Then
FieldDataLabel1.Caption = TempData(0)
FieldLabel2.Caption = "Field Attribute:"
If Val(TempData(1)) = 0 Then
FieldDataLabel2.Caption = "Not a field attribute byte"
ElseIf Val(TempData(1)) = 1 Then
FieldDataLabel2.Caption = "Field attribute byte"
End If
FieldLabel3.Caption = "Visibility:"
If Val(TempData(2)) = 0 Then
FieldDataLabel3.Caption = "Non display"
ElseIf Val(TempData(2)) = 1 Then
FieldDataLabel3.Caption = "Display"
End If
FieldLabel4.Caption = "Unprotected/Protected:"
If Val(TempData(3)) = 0 Then
FieldDataLabel4.Caption = "Unprotected data field"
ElseIf Val(TempData(3)) = 1 Then
FieldDataLabel4.Caption = "Protected data field"
End If
FieldLabel5.Caption = "Intensity:"
If Val(TempData(4)) = 0 Then
FieldDataLabel5.Caption = "Normal"
ElseIf Val(TempData(4)) = 1 Then
FieldDataLabel5.Caption = "High"
End If
FieldLabel6.Caption = "Field type:"
If Val(TempData(5)) = 0 Then
FieldDataLabel6.Caption = "Alphanumeric"
ElseIf Val(TempData(5)) = 1 Then
FieldDataLabel6.Caption = "Alphabetic only"
ElseIf Val(TempData(5)) = 2 Then
FieldDataLabel6.Caption = "Numeric shift"
ElseIf Val(TempData(5)) = 3 Then
FieldDataLabel6.Caption = "Numeric only"
ElseIf Val(TempData(5)) = 5 Then
FieldDataLabel6.Caption = "Digits only"
ElseIf Val(TempData(5)) = 6 Then
FieldDataLabel6.Caption = "Magnetic stripe reader data only"
ElseIf Val(TempData(5)) = 7 Then
FieldDataLabel6.Caption = "Signed numeric"
End If
FieldLabel7.Caption = "MDT:"
If Val(TempData(6)) = 0 Then
FieldDataLabel7.Caption = "Field has not been modified"
ElseIf Val(TempData(6)) = 1 Then
FieldDataLabel7.Caption = "Field has been modified"
End If
FieldLabel8.Caption = "Field start offset:"
FieldDataLabel8.Caption = TempData(7)
FieldLabel9.Caption = "Field Length:"
FieldDataLabel9.Caption = TempData(8)
End If
Else
FieldDataLabel1.Caption = FindFieldDataText.Text
End If
Display5250FieldInfo = Status
Exit Function
ErrHandler52:
Status = False
Resume Next
End Function
Private Function DisplayFieldInfo() As Integer
On Error GoTo ErrorHandler
Dim Status As Integer
Status = True
StartPos& = 1
EndPos& = 1
StringLength& = Len(FindFieldDataText.Text)
If Left$(FindFieldDataText.Text, 9) = "Formatted" Then
For i% = 0 To 5
EndPos& = InStr(StartPos&, FindFieldDataText.Text, Chr$(9))
If (EndPos& = StartPos&) Or (EndPos& = 0) Then
Status = False
Exit For
End If
TempData(i%) = Mid$(FindFieldDataText.Text, StartPos&, EndPos& - StartPos&)
StartPos& = EndPos& + 1
Next i%
If (Status = True) And (StringLength& > StartPos&) Then
TempData(6) = Mid$(FindFieldDataText.Text, StartPos&, StringLength&)
Else
Status = False
End If
If Status = True Then
FieldDataLabel1.Caption = TempData(0)
FieldLabel2.Caption = "Unprotected/Protected:"
If Val(TempData(1)) = 0 Then
FieldDataLabel2.Caption = "Unprotected data field"
ElseIf Val(TempData(1)) = 1 Then
FieldDataLabel2.Caption = "Protected data field"
End If
FieldLabel3.Caption = "A/N:"
If Val(TempData(2)) = 0 Then
FieldDataLabel3.Caption = "Alphanumeric data"
ElseIf Val(TempData(2)) = 1 Then
FieldDataLabel3.Caption = "Numeric data"
End If
FieldLabel4.Caption = "I/SPD:"
If Val(TempData(3)) = 0 Then
FieldDataLabel4.Caption = "Normal intensity, pen not detectable"
ElseIf Val(TempData(3)) = 1 Then
FieldDataLabel4.Caption = "Normal intensity, pen detectable"
ElseIf Val(TempData(3)) = 2 Then
FieldDataLabel4.Caption = "High intensity, pen detectable"
ElseIf Val(TempData(3)) = 3 Then
FieldDataLabel4.Caption = "Non display, pen not detectable"
End If
FieldLabel5.Caption = "MDT:"
If Val(TempData(4)) = 0 Then
FieldDataLabel5.Caption = "Field has not been modified."
ElseIf Val(TempData(4)) = 1 Then
FieldDataLabel5.Caption = "Field has been modified."
End If
FieldLabel6.Caption = "Field start offset:"
FieldDataLabel6.Caption = TempData(5)
FieldLabel7.Caption = "Field length:"
FieldDataLabel7.Caption = TempData(6)
FieldLabel8.Caption = ""
FieldDataLabel8.Caption = ""
FieldLabel9.Caption = ""
FieldDataLabel9.Caption = ""
End If
Else
FieldDataLabel1.Caption = FindFieldDataText.Text
End If
DisplayFieldInfo = Status
Exit Function
ErrorHandler:
Status = False
Resume Next
End Function
Private Sub Execute_Click()
Dim Status As Integer
On Error GoTo ErrHandler
FunctionComp = True
OldMousePointer = MousePointer
MousePointer = 11 ' Hour Glass Mouse Pointer
ClearForm
DisplayType$ = GetDisplayType$(SessionIdList.Text)
If DisplayType$ = "NONE" Then
MousePointer = OldMousePointer
MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
Exit Sub
End If
Topic$ = "Session" + SessionIdList.Text
Item$ = GetFindFieldItem()
rc = DoEvents() 'If you use VisualBasic V2.0, call
'DoEvents function each time before
'starting DDE conversation.
FindFieldDataText.LinkTimeout = -1
FindFieldDataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
FindFieldDataText.LinkMode = COLD
FindFieldDataText.LinkItem = Item$
FindFieldDataText.LinkRequest
FindFieldDataText.LinkMode = NONE
MousePointer = OldMousePointer
If FunctionComp = True Then
If DisplayType$ = "3270" Then
Status = DisplayFieldInfo()
Else
Status = Display5250FieldInfo()
End If
If Status = True Then
MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
EndStatus$ = MSG_OK
Else
MsgBox MSG_INVALID_DATA, 48, MSG_SAMPLE_PROG
EndStatus$ = MSG_NG
End If
Else
MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
EndStatus$ = MSG_NG
End If
TempLogData$ = Time$ + ":Find Field : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + MSG_ITEM + """" + Item$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
TempLogData$ = TempLogData$ + "Data =" + """" + FindFieldDataText.Text + """" + Chr$(13) + Chr$(10)
LogData$(LogEnd) = TempLogData$
UpdateLogPointer
Loged = True
Exit Sub
ErrHandler:
FunctionComp = False
Resume Next
End Sub
Private Sub ExitDlg_Click()
Hide
End Sub
Private Sub FindStartPosOption_Change()
UpdateOptionDescription
End Sub
Private Sub FindStartPosOption_Click()
UpdateOptionDescription
End Sub
Private Sub FindStartPosOption_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub FindStartPosText_Change()
CleanUpNumberText FindStartPosText
UpdateRowColumnLabel
End Sub
Private Sub FindStartPosText_LostFocus()
length = Len(FindStartPosText.Text)
If length < 4 Then
FindStartPosText.SelStart = 0
FindStartPosText.SelText = Mid("0000", 1, 4 - length)
End If
End Sub
Private Sub Form_Load()
SessionIdList.ListIndex = 0
FindStartPosOption.Text = """NU"""
FindStartPosText = "0000"
End Sub
Private Function GetFindFieldItem() As String
Dim ReturnString As String
ReturnString = "Field"
temp$ = RTrim$(LTrim$(FindStartPosText.Text))
Temp2$ = RTrim$(LTrim$(FindStartPosOption.Text))
If Len(Temp2$) = 0 Then
Temp2$ = """ """
End If
If Len(temp$) > 0 Then
ReturnString = ReturnString + "(" + temp$ + "," + Temp2$ + ")"
End If
GetFindFieldItem = ReturnString
End Function
Private Sub UpdateLogPointer()
LogEnd = LogEnd + 1
If LogEnd = MAXLOGNUM + 1 Then
LogEnd = 0
End If
If LogTop = LogEnd Then
LogTop = LogTop + 1
If LogTop = MAXLOGNUM + 1 Then
LogTop = 0
End If
End If
End Sub
Private Sub ClearForm()
FieldDataLabel1.Caption = ""
FieldLabel2.Caption = ""
FieldDataLabel2.Caption = ""
FieldLabel3.Caption = ""
FieldDataLabel3.Caption = ""
FieldLabel4.Caption = ""
FieldDataLabel4.Caption = ""
FieldLabel5.Caption = ""
FieldDataLabel5.Caption = ""
FieldLabel6.Caption = ""
FieldDataLabel6.Caption = ""
FieldLabel7.Caption = ""
FieldDataLabel7.Caption = ""
FieldLabel8.Caption = ""
FieldDataLabel8.Caption = ""
FieldLabel9.Caption = ""
FieldDataLabel9.Caption = ""
End Sub
Private Sub UpdateOptionDescription()
If FindStartPosOption.Text = """ """ Then
OptionDescription.Caption = "Field at Position"
ElseIf FindStartPosOption.Text = """T """ Then
OptionDescription.Caption = "Field at Position"
ElseIf FindStartPosOption.Text = """P """ Then
OptionDescription.Caption = "Previous Field"
ElseIf FindStartPosOption.Text = """N """ Then
OptionDescription.Caption = "Next Field"
ElseIf FindStartPosOption.Text = """NP""" Then
OptionDescription.Caption = "Next Protected Field"
ElseIf FindStartPosOption.Text = """NU""" Then
OptionDescription.Caption = "Next Unprotected Field"
ElseIf FindStartPosOption.Text = """PP""" Then
OptionDescription.Caption = "Previous Protected Field"
ElseIf FindStartPosOption.Text = """PU""" Then
OptionDescription.Caption = "Previous Unprotected Field"
Else
OptionDescription.Caption = "Error: Unknown"
End If
End Sub
Private Sub SessionIdList_Change()
UpdateSessionTypeLabel
UpdateRowColumnLabel
End Sub
Private Sub SessionIdList_Click()
UpdateSessionTypeLabel
UpdateRowColumnLabel
End Sub
Private Sub UpdateSessionTypeLabel()
SessionType$ = GetDisplayType(SessionIdList.Text)
If SessionType$ = "NONE" Then
SessionTypeLabel.Caption = ""
Else
SessionTypeLabel.Caption = SessionType$ & " Session"
End If
End Sub
Private Sub UpdateRowColumnLabel()
Dim Width As Integer
Dim Height As Integer
Dim Column As Integer
Dim Row As Integer
If FindStartPosText.Text = "" Then
RowColumnLabel.Caption = ""
Else
GetSessionDimensions SessionIdList.Text, Width, Height
If Width <> 0 Then
Column = (CInt(FindStartPosText.Text) Mod Width) + 1
Row = (CInt(FindStartPosText.Text) / Width) + 1
RowColumnLabel.Caption = "Row: " & Row & " Coulmn: " & Column
Else
RowColumnLabel.Caption = ""
End If
End If
End Sub