Scenarios like importing bank statement(BAI2) where single file comes from  bank for different bank account ,you have to spilt file in to different file and import those in respective bank account. Following piece of code is going to help you to store files in blob storage and get the file id , name etc. for use  later to spilt those file and import those in bank account.

You can utilize existing data management framework capabilities for this purpose, more information is present  on the this link.

Following piece of code helps you to upload the file to blob storage and store file ID , URL and name for later use. You can directly get file from bank SFTP and upload it to blob storage.

List bankFiles;
private void uploadFilesToBlobStorage(Filename      _downlodedFile)
    {
        
        InteropPermission                       interopPermission;
        System.IO.Stream                        fileStream;
        FileUploadTemporaryStorageResult        fileUploadResult;
        Filename                                uploadFileName;
        str                                     uploadFileURL;
        SharedServiceUnitFileID                 uploadFileID;
        ;

        fileStream= new System.IO.FileStream(_downlodedFile, System.IO.FileMode::Open, System.IO.FileAccess::Read);

        container splitFileName = Docu::splitFilename(_downlodedFile);

        fileUploadResult = File::SendFileToTempStore_GetResult(fileStream, conPeek(splitFileName, 1) + "." + conPeek(splitFileName, 2));

        if (fileUploadResult != null && fileUploadResult.getUploadStatus())
        {
            uploadFileURL = fileUploadResult.getDownloadUrl();
            uploadFileName = fileUploadResult.getFileName();
            uploadFileID = fileUploadResult.getFileId();

            bankFiles.addEnd([uploadFileID, uploadFileName]);           
        }        
    }

Once you  upload the file the next part is splitting and importing this  file in respective company . Following piece of code is helpful in splitting file  by account number and import those in respective bank account by company. You can apply transforms as well , if needed.

ListEnumerator bankFileEnumerators = bankFiles.getEnumerator();

 while (bankFileEnumerators.moveNext())
 {
	[bankStatementToImportFileId, bankStatementFileName] = bankFileEnumerators.current();



DMFLocalFilePath transformedFile = this.applyTransforms(bankStatementToImportFileId, definitionGroup);

            SharedServiceUnitURL transformedFileLocation = DMFStagingWriter::getSharedFilePath(transformedFile);
            BankStatementFileImportProcessor fileImportProcessor = this.initializeFileImportProcessor();
            BankStatementFileImportProcessorResult fileImportProcessorResult = fileImportProcessor.process(transformedFileLocation, '');
            List bankStatementsByBankAccountTableAndFileId = fileImportProcessorResult.parmBankStatementsByBankAccountTableAndFileId();
ListEnumerator bankStatementsByFileAndBankAccountEnumerator = bankStatementsByBankAccountTableAndFileId.getEnumerator();
            while (bankStatementsByFileAndBankAccountEnumerator.moveNext())
            {
                BankStatementUploadData uploadData = bankStatementsByFileAndBankAccountEnumerator.current();
                BankAccountTable bankAccountTable = uploadData.parmBankAccountTable();
                bankStatementToImportFileId = uploadData.parmFileId();

                // Check if bank reconciliation is enabled
                if(bankAccountTable.BankReconciliationEnabled)
                {
                    changecompany(bankAccountTable.company())
                    {
                        this.bankAccount = bankAccountTable.AccountID;
		              }
      }		
}
}

The above piece of code shows only how to spilt the file to be imported on different bank accounts not importing in to bank account.