The following program is an example of describing the code to sort the existing text file "c:\sortin.txt" of which the maximum record length is 120 bytes in ascending order to make the ASCII code in 10 bytes from the 20th byte of the record as a key field 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 'The field is specified in the column position. PowerBSORT1.FieldDefinition = 1 'The input file name is specified. PowerBSORT1.InputFiles = "c:\sortin.txt" 'Text is specified for each input file type. PowerBSORT1.InputFileType = 0 'The output file name is specified. PowerBSORT1.OutputFile = "c:\sortout.txt 'Text is specified for each output file type. PowerBSORT1.OutputFileType = 0 'ASCII code in 10 bytes from the 20th byte of the record is 'specified to be sorted in ascending order as a key field. 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