Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

A.3.4 Merge processing (text file)

The following program is an example of describing the code to merge the text files "c:\mergein1.txt" and "c:\mergein2.txt" in which ASCII code in 10 bytes from the 20th byte of the record have been already sorted in ascending order as a key field and of which the record length is 120 bytes and output the result to the text file "c:\mergeout.txt".

Private Sub Command1_Click()
  'Specify not to display the error message.
  PowerBSORT1.DispMessage = False
  'The merge processing is specified.
  PowerBSORT1.DisposalNumber = 1
  'A field is specified in the column position.
  PowerBSORT1.FieldDefinition = 1
  'The input file name is specified.
  PowerBSORT1.InputFiles = "c:\mergein1.txt c:\mergein2.txt"
  'Text is specified for each input file type.
  PowerBSORT1.InputFileType = 0
  'The output file name is specified.
  PowerBSORT1.OutputFile = "c:\mergeout.txt"
  'Text is specified for each output file type.
  PowerBSORT1.OutputFileType = 0
  'ASCII code in 10 bytes from the 10th byte of the record
  'has been sorted in ascending order as a key field already.
  PowerBSORT1.KeyCmdStr = "19.10asca"
  'The maximum record length is 120 bytes.
  PowerBSORT1.MaxRecordLength = 120
  'DLL of PowerBSORT is called and executed.
  PowerBSORT1.Action
  'Processing for when an error is found.
  if PowerBSORT1.ErrorCode <> 0 Then
    Msgbox "An error was found in PowerBSORT." & " ErrorDetail=" & PowerBSORT1.ErrorDetail
    Exit Sub
  End If
End Sub