Writing binary file...


Question

Here is my problem. MERVA/2 reads in a Binary file that has the following constraints. The first four bytes are a header piece in hex where the first two bytes are the length of the message in hex and then the first and second bytes are transposed. As for the third and fourth bytes they are zeros. Finally, the rest of the message in the SWIFT format. It should look something like:

 

AE00{1:F01NBKCUS44AXXX0423001036}{2:I700HNBKTWTPX640N}{4:... The "AE00" is the four byte header and {1:F01NBKCUS44.... is the SWIFT message format.

I don't have a problem creating the SWIFT message format piece, but I am having trouble getting the four byte header correct and writing the binary file so it can be uploaded.

Answer

From: Shamil Salakhetdinov >shamil@marta.darts.spb.ru<
To: ACCESS-L >ACCESS-L@PEACH.EASE.LSOFT.COM<
Subject: Re: Writing Binary file...
Date: 17 November 1998 1:05

Shawn,
HTCHY,

  Dim intFn As Integer
  Dim strFilePath As String
  Dim strOutBuf As String
  
  strFilePath = "c:\temp\Swift.dat"
  
  intFn = FreeFile
  Open strFilePath For Binary Access Write As #intFn
  
  strOutBuf = Chr(&HAE) & Chr(0) & _
              "{1:F01NBKCUS44AXXX0423001036}{2:I700HNBKTWTPX640N}"
  Put #intFn, , strOutBuf
  
  Close #intFn

Best wishes,
Shamil


HOME    TOPICS

Copyright © 1998–1999 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: October 10, 2006

Published also here at 4TOPS: Writing binary file...