The following program is an example of describing the code to select 1 option out of the record selection, record reconstruction and record summation and execute it with the existing text file "c:\sortin.txt" of which the record length is 15 bytes and output the result to the text file "c:\sortout.txt".
Private Sub Command1_Click() 'Specify not to display the error message. PowerBSORT1.DispMessage = False 'The sort processing is specified. PowerBSORT1.DisposalNumber = 0 'A field is specified in the column position. PowerBSORT1.FieldDefinition = 1 'The case the record selection is checked. If Option1.Value = True Then 'Specify to select other records than the records in which 3 bytes from the 'head of the record is character string 'DDD' as a selection field. PowerBSORT1.SelCmdStr = "0.3asc.ne.'DDD'" End If 'The case the record reconstruction is checked. If Option2.Value = True Then 'Reconstruct the records in 4 bytes from the 9th byte of the record first, then 5 bytes 'from the 3rd byte and then 3 bytes from the head as a reconstruction field. PowerBSORT1.RconCmdStr = "9.4 3.5 0.3" End If 'The case the record summation is checked. If Option3.Value = True Then 'Specify 4 bytes from the 9th byte of the record as a key field. PowerBSORT1.KeyCmdStr = "9.4asca" 'Specify to summate ASCII code in 4 bytes from 4th byte of the record as a summation field. PowerBSORT1.SumCmdStr = "4.4asc" 'When the specified key fields have the same contents, 'the fields of the summation key is added using the record summation option. PowerBSORT1.HandlingSameKey = 3 End If 'The input file name is specified. PowerBSORT1.InputFiles = "c:\sortin.txt" 'Binary fixed length is specified for each input file type. PowerBSORT1.InputFileType = 0 'The output file name is specified. PowerBSORT1.OutputFile = "c:\sortout.txt" 'Binary fixed length is specified for each output file type. PowerBSORT1.OutputFileType = 0 'The maximum record length is 15 bytes. PowerBSORT1.MaxRecordLength = 15 'The process is 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