The system time value is the number of deci-microseconds since midnight on 17-Nov-1858 (local time) - the local time equivalent of the origin of Modified Julian Date (gosh). The temperature values are quoted in tenths of a degree. The record length is 8 (32-bit words) and that there are 4320 (= 3 x 60 x 24) records in each file, i.e. one for every 20 seconds in a day. There is no padding. There are no end-of-record markers. With the following code, I have attempted to decode from binary to ascii, but with no success. Any ideas? Thanks in advance, Stacy.SysTim int(8) deci-microseconds since midnight on 17-Nov-1858 +AEST Record_No int(2) = # of 20-secs since midnight + 1 WndSpdMax int(2) km/h WndSpdAvg int(2) km/h WindDir int(2) degrees [0..540] AirPress int(2) millibars (hectopascals) RainBuckets int(2) tips in the preceeding 20 seconds - 1 tip = 0.2m +m RelHumid int(2) % OutTemp int(2) degrees-celsius InTemp int(2) " MaserTemp int(2) " CbnTemp int(2) " ExtrTemp int(2) "
#!/usr/local/gnu/bin/perl $template="i8 i2 i2 i2 i2 i2 i2 i2 i2 i2 i2 i2 i2"; $recordsize=length(pack($template, ( ))); open(FILE,"$ARGV[0]") or die "unable to open file: $!"; while(read(FILE,$record,$recordsize)) { @fields = unpack($template,$record); print $fields[0], "\n"; } close(FILE); exit 0;
In reply to Unpack for VMS binary files by maderman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |