Oups... apro in modalità Binary, non random.
Ecco il codice
codice:
Public Const PercorsoInput = "C:\WORK\INPS\F24\FASE2\"
Public Const FileInput = "INPS_FASE1.OUT"
Public Const FileDa = 40000

Structure Record
    <VBFixedString(5171)> Dim Rec As String
End Structure
Dim RC As Record

    Private Sub TastoStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TastoStart.Click
        Dim NumeroDiRecord As Long
        Dim ContatoreFileOutput As Long
        Dim ContatoreRecordOutput As Long
        Dim ContatoreRecordInput As Long
        Dim StringaApp As String

        FileOpen(1, PercorsoInput & FileInput, OpenMode.Binary, , , Len(RC))
        NumeroDiRecord = LOF(1) / Len(RC)
        ContatoreFileOutput = 0
        ContatoreRecordOutput = FileDa
        For ContatoreRecordInput = 1 To NumeroDiRecord
            If ContatoreRecordOutput = FileDa Then
                FileClose(2)
                ContatoreFileOutput = ContatoreFileOutput + 1
                ContatoreRecordOutput = 0
                FileOpen(2, PercorsoInput & Format(ContatoreFileOutput + 20, "0000") & ".F02", OpenMode.Binary, , , Len(RC))
            End If
            FileGet(1, RC)
            FilePut(2, RC)
            ContatoreRecordOutput = ContatoreRecordOutput + 1
            If ContatoreRecordInput Mod 1000 = 0 Then
                Me.Text = ContatoreRecordInput
                Me.Refresh()
            End If
        Next
        FileClose(1)
        FileClose(2)

        MsgBox("FASE 2 TERMINATA. FILE SCRITTI IN OUTPUT: " & ContatoreFileOutput)
        End
    End Sub