home *** CD-ROM | disk | FTP | other *** search
/ Sams Cobol 24 Hours / Sams_Cobol_24_Hours.iso / Cobol32 / PowerOCX / bsrtocx.z / sample2.frm < prev    next >
Text File  |  1997-05-14  |  12KB  |  401 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "PowerBSORT OCX Sample"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1665
  7.    ClientTop       =   2610
  8.    ClientWidth     =   5640
  9.    Height          =   5250
  10.    Icon            =   "sample2.frx":0000
  11.    Left            =   1605
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3008.248
  16.    ScaleMode       =   0  'User
  17.    ScaleWidth      =   4727.548
  18.    Top             =   2265
  19.    Width           =   5760
  20.    Begin VB.Frame Frame1 
  21.       Caption         =   "Input File"
  22.       Height          =   1392
  23.       Left            =   60
  24.       TabIndex        =   9
  25.       Top             =   900
  26.       Width           =   5508
  27.       Begin VB.TextBox Text4 
  28.          Alignment       =   1  'Right Justify
  29.          Height          =   288
  30.          HelpContextID   =   1380
  31.          Left            =   1350
  32.          TabIndex        =   16
  33.          Text            =   "Text4"
  34.          Top             =   990
  35.          Width           =   768
  36.       End
  37.       Begin VB.ComboBox ItypeCombo 
  38.          Height          =   300
  39.          HelpContextID   =   1350
  40.          Left            =   1080
  41.          Style           =   2  'Dropdown List
  42.          TabIndex        =   14
  43.          Top             =   630
  44.          Width           =   4335
  45.       End
  46.       Begin VB.CommandButton InCommand 
  47.          Caption         =   "..."
  48.          Height          =   255
  49.          Left            =   5130
  50.          TabIndex        =   12
  51.          Top             =   270
  52.          Width           =   255
  53.       End
  54.       Begin VB.TextBox Text1 
  55.          Height          =   285
  56.          HelpContextID   =   1340
  57.          Left            =   1080
  58.          TabIndex        =   11
  59.          Text            =   "Text1"
  60.          Top             =   300
  61.          Width           =   3975
  62.       End
  63.       Begin VB.Label la_InputFiles 
  64.          Caption         =   "FileNames:"
  65.          Height          =   255
  66.          Left            =   120
  67.          TabIndex        =   10
  68.          Top             =   270
  69.          Width           =   855
  70.       End
  71.       Begin VB.Label la_InputFileType 
  72.          Caption         =   "FileType:"
  73.          Height          =   255
  74.          Left            =   120
  75.          TabIndex        =   13
  76.          Top             =   630
  77.          Width           =   735
  78.       End
  79.       Begin VB.Label la_RecordLen 
  80.          Caption         =   "Record Length:"
  81.          Height          =   255
  82.          Left            =   120
  83.          TabIndex        =   15
  84.          Top             =   990
  85.          Width           =   1335
  86.       End
  87.    End
  88.    Begin VB.Frame Frame2 
  89.       Caption         =   "Output File"
  90.       Height          =   1032
  91.       Left            =   60
  92.       TabIndex        =   17
  93.       Top             =   2340
  94.       Width           =   5508
  95.       Begin VB.TextBox Text2 
  96.          Height          =   288
  97.          HelpContextID   =   1390
  98.          Left            =   1080
  99.          TabIndex        =   19
  100.          Text            =   "Text1"
  101.          Top             =   240
  102.          Width           =   3975
  103.       End
  104.       Begin VB.ComboBox OtypeCombo 
  105.          Height          =   300
  106.          HelpContextID   =   1400
  107.          Left            =   1080
  108.          Style           =   2  'Dropdown List
  109.          TabIndex        =   22
  110.          Top             =   600
  111.          Width           =   4335
  112.       End
  113.       Begin VB.CommandButton OutCommand1 
  114.          Caption         =   "..."
  115.          Height          =   255
  116.          Left            =   5130
  117.          TabIndex        =   20
  118.          Top             =   240
  119.          Width           =   255
  120.       End
  121.       Begin VB.Label la_OutputFile 
  122.          Caption         =   "FileName:"
  123.          Height          =   255
  124.          Left            =   120
  125.          TabIndex        =   18
  126.          Top             =   240
  127.          Width           =   855
  128.       End
  129.       Begin VB.Label la_OutputFileType 
  130.          Caption         =   "FileType:"
  131.          Height          =   255
  132.          Left            =   90
  133.          TabIndex        =   21
  134.          Top             =   600
  135.          Width           =   735
  136.       End
  137.    End
  138.    Begin VB.Frame Frame3 
  139.       Caption         =   "Key fields"
  140.       Height          =   864
  141.       Left            =   60
  142.       TabIndex        =   23
  143.       Top             =   3420
  144.       Width           =   5508
  145.       Begin VB.TextBox Text3 
  146.          Height          =   285
  147.          HelpContextID   =   1360
  148.          Left            =   1080
  149.          TabIndex        =   25
  150.          Text            =   "Text1"
  151.          Top             =   180
  152.          Width           =   4335
  153.       End
  154.       Begin VB.Label la_Keys 
  155.          Caption         =   "Keys:"
  156.          Height          =   255
  157.          Left            =   120
  158.          TabIndex        =   24
  159.          Top             =   240
  160.          Width           =   735
  161.       End
  162.       Begin VB.Label Label1 
  163.          Caption         =   "Description Form: pos.len typ opt [pos.len typ opt] ..."
  164.          Height          =   252
  165.          Left            =   1080
  166.          TabIndex        =   26
  167.          Top             =   540
  168.          Width           =   4092
  169.       End
  170.    End
  171.    Begin VB.Frame Frame4 
  172.       Caption         =   "Feature"
  173.       Height          =   672
  174.       HelpContextID   =   1240
  175.       Left            =   60
  176.       TabIndex        =   0
  177.       Top             =   120
  178.       Width           =   3900
  179.       Begin VB.OptionButton Opt_Copy 
  180.          Caption         =   "Copy"
  181.          Height          =   312
  182.          HelpContextID   =   1240
  183.          Left            =   2460
  184.          TabIndex        =   3
  185.          Top             =   240
  186.          Width           =   972
  187.       End
  188.       Begin VB.OptionButton Opt_Merge 
  189.          Caption         =   "Merge"
  190.          Height          =   285
  191.          HelpContextID   =   1240
  192.          Left            =   1200
  193.          TabIndex        =   2
  194.          Top             =   240
  195.          Width           =   855
  196.       End
  197.       Begin VB.OptionButton Opt_Sort 
  198.          Caption         =   "Sort"
  199.          Height          =   285
  200.          HelpContextID   =   1240
  201.          Left            =   120
  202.          TabIndex        =   1
  203.          Top             =   240
  204.          Value           =   -1  'True
  205.          Width           =   855
  206.       End
  207.    End
  208.    Begin VB.CommandButton Command1 
  209.       Caption         =   "OK"
  210.       Height          =   432
  211.       Left            =   3060
  212.       TabIndex        =   28
  213.       Top             =   4380
  214.       Width           =   1188
  215.    End
  216.    Begin VB.CommandButton Command2 
  217.       Caption         =   "Cancel"
  218.       Height          =   432
  219.       Left            =   4380
  220.       TabIndex        =   29
  221.       Top             =   4380
  222.       Width           =   1188
  223.    End
  224.    Begin VB.Frame Frame5 
  225.       Caption         =   "Return code"
  226.       Height          =   792
  227.       Left            =   4080
  228.       TabIndex        =   4
  229.       Top             =   60
  230.       Width           =   1488
  231.       Begin VB.Label la_Detail 
  232.          Caption         =   "Detail:"
  233.          Height          =   252
  234.          Left            =   180
  235.          TabIndex        =   7
  236.          Top             =   480
  237.          Width           =   612
  238.       End
  239.       Begin VB.Label la_Error 
  240.          Caption         =   "Error:"
  241.          Height          =   252
  242.          Left            =   180
  243.          TabIndex        =   5
  244.          Top             =   240
  245.          Width           =   612
  246.       End
  247.       Begin VB.Label la_DetailVal 
  248.          Caption         =   "Label4"
  249.          Height          =   252
  250.          Left            =   780
  251.          TabIndex        =   8
  252.          Top             =   480
  253.          Width           =   552
  254.       End
  255.       Begin VB.Label la_ErrorVal 
  256.          Caption         =   "Label4"
  257.          Height          =   252
  258.          Left            =   780
  259.          TabIndex        =   6
  260.          Top             =   240
  261.          Width           =   552
  262.       End
  263.    End
  264.    Begin PowerBSORT_Lib.PowerBSORT PowerBSORT1 
  265.       Left            =   240
  266.       Top             =   4350
  267.       _Version        =   65536
  268.       _ExtentX        =   741
  269.       _ExtentY        =   741
  270.       _StockProps     =   0
  271.    End
  272.    Begin MSComDlg.CommonDialog CommonDialog1 
  273.       Left            =   720
  274.       Top             =   4320
  275.       _ExtentX        =   847
  276.       _ExtentY        =   847
  277.       _Version        =   327680
  278.    End
  279.    Begin VB.Label Label2 
  280.       AutoSize        =   -1  'True
  281.       Caption         =   "For Help, press F1"
  282.       Height          =   192
  283.       Left            =   120
  284.       TabIndex        =   27
  285.       Top             =   4560
  286.       Width           =   1320
  287.    End
  288. End
  289. Attribute VB_Name = "Form1"
  290. Attribute VB_Creatable = False
  291. Attribute VB_Exposed = False
  292.  
  293.  
  294. Option Explicit
  295. Const col_BackNormal = &HFFFFFF
  296. Const col_TextNormal = &H0
  297. Const col_BackOK = &HFF0000
  298. Const col_TextOK = &HFFFFFF
  299. Const col_BackErr = &HFF
  300. Const col_TextErr = &HFFFFFF
  301. Private Sub AfterAction()
  302.   Dim ErrCode, ErrDetail As Long
  303.   Dim col_Back, col_Text As Long
  304.   
  305.   ErrCode = PowerBSORT1.ErrorCode
  306.   ErrDetail = PowerBSORT1.ErrorDetail
  307.   la_ErrorVal.Caption = CStr(ErrCode)
  308.   la_DetailVal.Caption = CStr(ErrDetail)
  309.   If ErrCode = 0 Then
  310.     col_Back = col_BackOK
  311.     col_Text = col_TextOK
  312.   Else
  313.     col_Back = col_BackErr
  314.     col_Text = col_TextErr
  315.   End If
  316.   la_Error.ForeColor = col_Text
  317.   la_Error.BackColor = col_Back
  318.   la_ErrorVal.ForeColor = col_Text
  319.   la_ErrorVal.BackColor = col_Back
  320.   la_Detail.ForeColor = col_Text
  321.   la_Detail.BackColor = col_Back
  322.   la_DetailVal.ForeColor = col_Text
  323.   la_DetailVal.BackColor = col_Back
  324. End Sub
  325. Private Sub BeforeAction()
  326.   la_Error.ForeColor = col_TextNormal
  327.   la_Error.BackColor = col_BackNormal
  328.   la_ErrorVal.ForeColor = col_TextNormal
  329.   la_ErrorVal.BackColor = col_BackNormal
  330.   la_Detail.ForeColor = col_TextNormal
  331.   la_Detail.BackColor = col_BackNormal
  332.   la_DetailVal.ForeColor = col_TextNormal
  333.   la_DetailVal.BackColor = col_BackNormal
  334. End Sub
  335.  
  336. Private Sub Command1_Click()
  337.   BeforeAction
  338.   '--- START ---
  339.   PowerBSORT1.InputFiles = Text1.Text
  340.   PowerBSORT1.InputFileType = ItypeCombo.ListIndex
  341.   PowerBSORT1.OutputFile = Text2.Text
  342.   PowerBSORT1.OutputFileType = OtypeCombo.ListIndex
  343.   PowerBSORT1.KeyCmdStr = Text3.Text
  344.   PowerBSORT1.MaxRecordLength = Val(Text4.Text)
  345.   If Opt_Sort.Value = True Then
  346.     PowerBSORT1.DisposalNumber = 0
  347.   End If
  348.   If Opt_Merge.Value = True Then
  349.     PowerBSORT1.DisposalNumber = 1
  350.   End If
  351.   If Opt_Copy.Value = True Then
  352.     PowerBSORT1.DisposalNumber = 2
  353.   End If
  354.   PowerBSORT1.Action
  355.   '--- END ---
  356.   AfterAction
  357. End Sub
  358.  
  359. Private Sub Command2_Click()
  360.   Unload Me
  361. End Sub
  362.  
  363. Private Sub Form_Load()
  364.   App.HelpFile = "..\..\psocx.hlp"
  365.   Text1.Text = ""
  366.   Text2.Text = ""
  367.   Text3.Text = ""
  368.   Text4.Text = 100
  369.   la_ErrorVal.Caption = ""
  370.   la_DetailVal.Caption = ""
  371.   ItypeCombo.AddItem "Text File", 0
  372.   ItypeCombo.AddItem "Binary fixed length file", 1
  373.   ItypeCombo.AddItem "COBOL85 sequential fixed length file", 2
  374.   ItypeCombo.AddItem "COBOL85 sequential variable length file", 3
  375.   ItypeCombo.AddItem "COBOL85 relative fixed length file", 4
  376.   ItypeCombo.AddItem "COBOL85 relative variable length file", 5
  377.   ItypeCombo.ListIndex = 0
  378.   OtypeCombo.AddItem "Text File", 0
  379.   OtypeCombo.AddItem "Binary file", 1
  380.   OtypeCombo.AddItem "COBOL85 sequential file", 2
  381.   OtypeCombo.AddItem "COBOL85 relative file", 3
  382.   OtypeCombo.ListIndex = 0
  383. End Sub
  384.  
  385. Private Sub Form_Unload(Cancel As Integer)
  386.   Unload Me
  387. End Sub
  388.  
  389. Private Sub InCommand_Click()
  390.     CommonDialog1.FilterIndex = 1
  391.     CommonDialog1.ShowOpen
  392.     Text1.Text = CommonDialog1.filename
  393. End Sub
  394.  
  395. Private Sub OutCommand1_Click()
  396.     CommonDialog1.FilterIndex = 1
  397.     CommonDialog1.ShowOpen
  398.     Text2.Text = CommonDialog1.filename
  399. End Sub
  400.  
  401.