Top
PowerBSORT V7.0 User's Guide
FUJITSU Software

A.3.13 Sorting the NetCOBOL indexed file

The following program is an example of describing the code to sort the existing NetCOBOL indexed fixed length file "c:\sortcob" of which the record length is 20 bytes in ascending order to make ASCII code in 3 bytes from the 5th byte of the record as a key field and output the result to the NetCOBOL indexed file "c:\sortout".

Private Sub Command1_Click()
  'Specify not to display the error message.
  PowerBSORT1.DispMessage = False
  'The sort processing is specified.
  PowerBSORT1.DisposalNumber = 0
  'The input file name is specified.
  PowerBSORT1.InputFiles = "c:\sortcob"
  'NetCOBOL indexed fixed length file is specified for each input file type.
  PowerBSORT1.InputFileType = 4
  'Output file name is specified.
  PowerBSORT1.OutputFile = "c:\sortout"
  'NetCOBOL indexed file is specified for each output file type.
  PowerBSORT1.OutputFileType = 3
  'Specify to sort ASCII code in 3 bytes from the 5th byte of the
  'record in ascending order as a key field.
  PowerBSORT1.KeyCmdStr = "4.3asca"
  'Specify 3 bytes from the 5th byte as a main key of NetCOBOL indexed file.
  PowerBSORT1.FjcobPrimeKey = "D(4,3)"
  'The record length is 20 bytes.
  PowerBSORT1.MaxRecordLength = 20
  'Sort processing 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