Extract values from a 'binary format' file and create text file with fixed field sizes
<p>I've used JavaScript to get the data through the internet (I'm interfacing with a brokerage firm's API functions), but unlike most of the rest of their API's, this one returns the data in a 'binary' like format.  Here is the layout of the file I get back:</p>

<pre><code>Field --------     Type ------------     Length(8 bit bytes) ---------------       Description

Symbol Count----Integer-------------           4---------------------------                    Number of symbols for which data is being returned. The subsequent sections are repeated this many times

REPEATING SYMBOL DATA

Symbol Length    Short           2                     Length of the Symbol field

Symbol          String        Variable                 The symbol for which the historical data is returned

Error Code        Byte           1                      0=OK, 1=ERROR

Error Length      Short          2                     Only returned if Error Code=1. Length of the Error string

Error Text        String       Variable                Only returned if Error Code=1. The string describing the error

Bar Count        Integer          4                   # of chart bars; only if error code=0

REPEATING PRICE DATA

close             Float            4  

high              Float            4

Low               Float            4  

open              Float            4

volume            Float            4                   in 100's

timestamp         Long             8                   time in milliseconds from 00:00:00 UTC on January 1, 1970

END OF REPEATING PRICE DATA

Terminator        Bytes            2                   0xFF, 0XFF

END OF REPEATING SYMBOL DATA
</code></pre>

<p>As you can see, this file is a mixture of different types of fields.  My requirement is to convert this file from the way it is into a fixed field text file (or CSV file).  I'm not very good at JavaScript, but I know enough to get by.  My main language is MAPPER from Unisys (it is actually called "Business Information Server").  Currently I get all HTTP responses as text files, but this one is a 'binary' file, and MAPPER can not process it because it is a text-based language (a 4GL).  I've spent days trying to find a snippet of JavaScript code that I could use, but to no avail.  I think this is really simple stuff for a guy that knows JavaScript.  </p>
