Stuck

General Questions and comments

Moderators: IMC, Club Staff

User avatar
dstocks
National Vice President
Posts: 9529
jedwabna poszewka promocja
Joined: Fri Jun 24, 2005 5:00 pm
Location: Utopia
Contact:

Stuck

Post by dstocks »

OK,

After searching for the last 5 hrs, I have decided I need some help. Im looking at trying to get the data and images out of CAPS so I can do some analysis on it. Trouble is, im stuffed if I can work out the format of the database and image libraries (yet). Thought someone out there may be able to make a suggestion or two (or may even know). Database files are .DAT and .IDX and images are in a single file with a .IMG extension. Any ideas.......
Complete FTO (http://www.completefto.com.au/completefto.asp)
    Image
    If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
    User avatar
    dstocks
    National Vice President
    Posts: 9529
    Joined: Fri Jun 24, 2005 5:00 pm
    Location: Utopia
    Contact:

    More Info

    Post by dstocks »

    OK, have sorted a couple of additional things out:

    - Images are delimited by markers US CAPS uses MM_1 between images within the .IMG Archive and Japan CAPS uses IMG1.

    - The data within the .DAT is supposedly fixed width column data. I have found a C program that will process the eclipse data. Anyone conversant with C by any chance?????
    Complete FTO (http://www.completefto.com.au/completefto.asp)
      Image
      If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
      Camo
      Grease Monkey
      Posts: 382
      Joined: Sun Apr 17, 2005 5:00 pm
      Location: Melbourne

      Post by Camo »

      I have some friends that are, but i'm a bit nub =)
      User avatar
      dstocks
      National Vice President
      Posts: 9529
      Joined: Fri Jun 24, 2005 5:00 pm
      Location: Utopia
      Contact:

      Well,

      Post by dstocks »

      Well, if i can get this modified a little, ill be able to get all vin/chassis numbers (for all FTO's) together with colour codes, model and transmission types and option. This will allow us to get the production numbers verified and generate some interesting information relating to the number of FTO's produced each year in each of the colours and with what options. Even commented code would help. Unfortunately, cant post the data due to the size of the file. Code follows:

      Code: Select all

      /* Mike's Mitsu VIN Dump source code. */
      /* Source Code Copyright 2001 Michael A. Reid. All rights reserved. */
      
      /* mvdnotes.txt:
      
      ---------------------------------------------------------------------------------------------
      Nagoya, Japan Plant 91-99 and 3000GT/Stealth 91-99
      databases and MVD utility.
      
      Text Copyright 2001 Michael A. Reid. All rights reserved.
      
      ---------------------------------------------------------
      FILES
      
      The files are:
      
      mvdnotes.txt- These notes.
      
      3s9199      - 3000GT/Stealth production 91-99
                      comma delimited database file.
      3s9199.mdb  - 3000GT/Stealth production 91-99
                      Microsoft Access 97 database file.
      
      na9199      - Nagoya plant production 91-99
                      comma delimited database file.
      
      mvd.c       - Mike's Mitsu VIN Dump source code.
      mvd.exe     - Mike's Mitsu VIN Dump Win32 executable.
      
      
      
      ---------------------------------------------------------
      COMMA DELIMITED DATABASE FILES
      
      NOTE the following observed limitations with this data:
      
      (1) As many as 3500 or so VINs may be missing from the
          1991 model year. Most of these missing VINs were
          manufactured before Sept. of 1991 with VIN serial
          numbers of less than 004400. These may represent
          vehicles for which data was lost or may simply be
          unused VINs.
      
      (2) In the 1995 model year, 550 VINs are missing and
          since no 1995 Stealth R/T Turbo's are in these
          file and they do exist, it is presumed that all of
          these may be 1995 Stealth R/T Turbo's.
      
      (3) In the 1997 model year, 561 VINs are missing and
          they all seem to occur from 96/10/1 to 97/01/3.
          In this time period, only one vehicle is listed.
          If this data was lost, it appears that the loss
          is shared by 3000GTs of all models.
      
      These missing VIN counts do not include VIN serial
      numbers from 000001 to 000100, which appear to always
      be reserved for pre-production vehicles. The serial
      number 000000 is never used.
      
      
      
      The comma delimited database files are "3s9199" and
      "na9199" and contain data on the 151,454 known
      Stealth's and 3000GT's and the 236,589 known Nagoya,
      Japan 1991-1999 produced vehicles respectively.
      
      These comma delimited database files should be
      importable into most databases using an Import
      command. The layout of the files is as follows:
      
      Each vehicle is represented by one record in the
      database and 85 bytes is consumed by each record:
      83 bytes of data followed by 2 bytes for a carriage
      return and a line feed control character.
      
      Each line/record contains 10 fixed length fields and
      looks like this:
      
      ---------------------------------------------------------------------------------------------
      "MY000002","JB3XE74C5MY000002","TT","Z16A","MNGFL2D","EQU","RA8","08H","90041","91"
      
      The fields are:
      (1)   8 chars   "YPS"               Year Plant Serial, derived from VIN.
      (2)  17 chars   "VIN"               "Vin-No" in CAPS. Vehicle Identification Number
      (3)   2 chars   "Model"             My defined model abbreviation, derived from VIN.
      (4)   4 chars   "ModelCode"         "Model" in CAPS. Indicates 2WD, 4WD, or 4WD/4WS only.
      (5)   7 chars   "Classification"    "Classification" in CAPS. Indicates real chassis model.
      (6)   3 chars   "Equipment"         "Option" in CAPS. Equipment code.
      (7)   3 chars   "Exterior"          "Exterior" in CAPS. Exterior color code.
      (8)   3 chars   "Interior"          "Interior" in CAPS. Interior color code.
      (9)   5 chars   "DateMfr"           Displayed by CAPS, with no name. Date of manufacture.
      (10)  2 chars   "MY"                Model Year from CAPS database.
      ---------------------------------------------------------------------------------------------
      
      
      All of the fields except (1) and (3) are extracted
      verbatim with no corrections or modifications from
      the CAPS database, except that in cases where fields
      were missing or unknown, they were replaced with
      placeholder values of "XX" for (3), "EQU" for (6),
      "EXT" for (7), or "INT" for (8).
      
      
      Only upper case letters ('A'-'Z') and numbers
      ('0'-'9') exist in these records. The records
      are sorted on the first field, the derived "YPS".
      
      The (1) "YPS" (Year code, Plant Code, Serial number)
      field was derived from the last 8 digits/characters
      of the VIN, substituting "0" for "8" in the first
      digit/character of the last 6. This allows the Spyder
      models to be sorted with the non-Spyder models.
      
      This sorting generally follows date of manufacture.
      I.E., the first vehicle built for 91 should be at the
      beginning of the file, and the last built for 99
      should be at the end. Sometimes, however, serial
      numbers were assigned slightly out of order relative
      to the manufacture date.
      
      The contents of the fields provided by the CAPS
      database will be documented later.
      
      The one added derived field besides (1) "YPS" is (3)
      "Model". This field was derived from a VIN mapping,
      and although it's possible that some of these
      mappings are incorrect, I'm reasonably confident they
      were done correctly. The contents for this field are:
      
      "XX"    Unknown (used for na9199 only)
      "SB"    Dodge Stealth Base
      "ES"    Dodge Stealth ES
      "RT"    Dodge Stealth R/T
      "RL"    Dodge Stealth R/T Luxury
      "TT"    Dodge Stealth R/T Turbo
      "3B"    Mitsubishi 3000GT Base
      "SL"    Mitsubishi 3000GT SL
      "VR"    Mitsubishi 3000GT VR-4
      "SS"    Mitsubishi 3000GT SL Spyder
      "VS"    Mitsubishi 3000GT VR-4 Spyder
      
      
      
      ---------------------------------------------------------
      CAPS DATABASE AND MVD UTILITY
      
      
      The database files were derived from the Mitsubishi
      VIN database included in the Mitsu CAPS (Computer
      Automated Parts Search) program.
      
      The CAPS program is used by dealers to determine
      which parts are applicable to specific vehicles. The
      program is over 100 Megabytes, but can be downloaded
      from http://www.stealth-3000gt.st/FAQ-CAPS.htm . It
      is NOT neccessary to download or install CAPS to use
      the database files here.
      
      
      If CAPS is installed, the original VIN database
      can be found in the files C:\PASEN\SHARYO.IDX
      (the VIN index) and C:\PASEN\SHARYO.DAT (the
      data). The files are both dated Sept. 16, 1999
      and are 69,386,240 and 114,974,720 bytes
      respectively.
      
      
      These files appear to include most Mitsubishi
      and partner company VINs from some unknown model
      year to the 1999 model year. Some VINs from the 2000
      model year are also included. There appears to be
      3,218,325 unique VINs referenced in these files.
      
      
      The original VIN database was analyzed and a
      software utility written to extract and perform some
      interpretation on the Nagoya, Japan plant production
      data for the model years 1991 to 1999.
      
      The source code for this utility is in the file
      "mvd.c" (Mike's Mitsu VIN Dump) and a Windows MS-DOS
      window Win32 text mode executable file "mvd.exe".
      The executable can be built from the source code using
      MSVC with the command "cl mvd.c". This utility is NOT
      needed to use the database files here.
      
      The source code, like so much source code, is somewhat
      messy and not the best example of finely engineered
      software. It works, however.
      
      With Mitsu's CAPS loaded. or at least if the files
      C:\PASEN\SHARYO.IDX and C:\PASEN\SHARYO.DAT are
      present, the utility can be used as follows:
      
      
      The following command will count the number of
      Dodge Stealth R/T Turbo's:
      
      MVD JB3??74
      
      The following command will count the number of
      Dodge Stealth R/T Turbo's and create a comma
      delimited database file named "tt9199":
      
      MVD JB3??74 S > tt9199
      
      
      
      Here are some other VIN wildcards as they were used
      for Model translations:
      
      ???????????     Unknown                         XX
      
      JB3??44????     Dodge Stealth Base              SB
      
      JB3XD54B???     Dodge Stealth ES                ES
      JB3BM54J???
      
      JB3XD64B???     Dodge Stealth R/T               RT
      JB3BM64J???
      JB3AM54J???
      JB3AM84J???
      
      JB3AM64J???     Dodge Stealth R/T Luxury        RL
      
      JB3??74????     Dodge Stealth R/T Turbo         TT
      
      JA3XD54B???     Mitsubishi 3000GT Base          3B
      JA3BM54J???
      JA3AM54J?R?
      JA3AM84J?S?
      JA3AM84J?T?
      JA3AM44H???
      
      JA3??64????     Mitsubishi 3000GT SL            SL
      JA3AM54J?S?
      JA3AM54J?T?
      JA3AM84J?V?
      JA3AM84J?W?
      JA3AM84J?X?
      
      JA3??74????     Mitsubishi 3000GT VR-4          VR
      
      JA3A?65????     Mitsubishi 3000GT SL Spyder     SS
      
      JA3A?75????     Mitsubishi 3000GT VR-4 Spyder   VS
      
      
      
      ---------------------------------------------------------------------------------------------
      
      
      */
      
      
      #include <stdio.h>
      
      int isVinAscii (char VinChar)
      {
      if ( isVinCharUpper(VinChar) || isVinCharLower(VinChar) )
          return (1);
      if ( isVinDigit(VinChar) )
          return (1);
      if ( isVinPunc(VinChar) )
          return (1);
      return (0);
      }
      
      int isVinPunc (char VinChar)
      {
      if ( VinChar=='~' || VinChar=='`' || VinChar=='!' || VinChar=='@' || VinChar=='#' || VinChar=='$' || VinChar=='%' || VinChar=='^' || VinChar=='&' )
          return (1);
      if ( VinChar=='*' || VinChar=='(' || VinChar==')' || VinChar=='-' || VinChar=='_' || VinChar=='=' || VinChar=='+' || VinChar=='[' || VinChar=='{' )
          return (1);
      if ( VinChar==']' || VinChar=='}' || VinChar=='\\'/*92*/ || VinChar=='|' || VinChar==';' || VinChar==':' || VinChar==/*'\''*/39 || VinChar=='"' || VinChar==',' )
          return (1);
      if ( VinChar=='<' || VinChar=='.' || VinChar=='>' || VinChar=='/' || VinChar=='?' || VinChar==' ' )
          return (1);
      return (0);
      }
      
      int isVinChar (char VinChar)
      {
      if ( isVinCharUpper(VinChar) || isVinCharLower(VinChar) )
          return (1);
      return (0);
      }
      
      int isVinCharUpper (char VinChar)
      {
      if (VinChar >= 'A' && VinChar <= 'Z')
          return (1);
      return (0);
      }
      
      int isVinCharLower (char VinChar)
      {
      if (VinChar >= 'a' && VinChar <= 'z')
          return (1);
      return (0);
      }
      
      int isVinDigit (char VinChar)
      {
      if (VinChar >= '0' && VinChar <= '9')
          return (1);
      return (0);
      }
      
      int isVinDigitSpace (char VinChar)
      {
      if (VinChar >= '0' && VinChar <= '9')
          return (1);
      if (VinChar == ' ')
          return (1);
      return (0);
      }
      
      /* Globals */
      #define MAX_FILE_BUF     4194304    //262144     //32768   //1024
      unsigned char file_buf[MAX_FILE_BUF];
      FILE * file_han;
      FILE * file_han2;
      int file_bytes_read = 0;
      int offset_buf = 0;
      int offset_file = 0;
      int offset_file_buf = 0;
      int bytes_in_buffer = 0;
      
      unsigned char current_vin[256] = "";
      
      unsigned char * GetNextVIN (unsigned char FirstChar)
      {
      while (1)
          {
          if (bytes_in_buffer==0)
              {
              //fprintf (stderr,"\nInitial Read\n");
              file_bytes_read = fread (file_buf, sizeof (char), MAX_FILE_BUF, file_han);
              if (file_bytes_read==0)
                  {
                  fclose (file_han);
                  //fprintf (stderr,"\nEnd of c:\\pasen\\sharyo.idx file.\n");
                  return (NULL); //exit (0);
                  }
              bytes_in_buffer = file_bytes_read;
              offset_buf = 0;
              offset_file = 0;
              offset_file_buf = 0;
              }
          for (; /*offset_buf < bytes_in_buffer*/; offset_buf++)
              {
              if (offset_buf+21 > bytes_in_buffer)    /* If we don't have at least 21 bytes left */
                  {
                  //fprintf (stderr,"\nRead: Bytes In Buffer: %d  Current Offset: %d  Bytes Read: %d\n", bytes_in_buffer, offset_buf, file_bytes_read);
                  memcpy (file_buf, &file_buf[offset_buf], bytes_in_buffer-offset_buf);
                  file_bytes_read = fread (file_buf+bytes_in_buffer-offset_buf, sizeof (char), MAX_FILE_BUF-(bytes_in_buffer-offset_buf), file_han);
                  if (file_bytes_read==0)
                      {
                      fclose (file_han);
                      //fprintf (stderr,"\nEnd of c:\\pasen\\sharyo.idx file.\n");
                      return (NULL); //exit (0);
                      }
                  offset_file_buf += offset_buf;
                  offset_file = offset_file_buf;
      
                  bytes_in_buffer += (file_bytes_read-offset_buf);
                  offset_buf = 0;
                  if (bytes_in_buffer < 21)
                      {
                      fprintf (stderr,"\nError: < 21 bytes in buffer\n");
                      return (NULL); //exit (-1);
                      }
                  //fprintf (stderr,"\n      Bytes In Buffer: %d  Current Offset: %d  Bytes Read: %d\n", bytes_in_buffer, offset_buf, file_bytes_read);
                  }
              //if (1) //file_buf[offset_buf]==FirstChar)
              if ( isVinAscii(file_buf[offset_buf+0]) &&
                   isVinAscii(file_buf[offset_buf+1]) &&
                   isVinAscii(file_buf[offset_buf+2]) &&
                   isVinAscii(file_buf[offset_buf+3]) &&
                   isVinAscii(file_buf[offset_buf+4]) &&
                   isVinAscii(file_buf[offset_buf+5]) &&
                   isVinAscii(file_buf[offset_buf+6]) &&
                   isVinAscii(file_buf[offset_buf+7]) &&
                   isVinAscii(file_buf[offset_buf+8]) &&
                   isVinAscii(file_buf[offset_buf+9]) &&
                   isVinAscii(file_buf[offset_buf+10]) )
                  {
                  if ( isVinDigitSpace(file_buf[offset_buf+11]) &&
                       isVinDigitSpace(file_buf[offset_buf+12]) &&
                       isVinDigitSpace(file_buf[offset_buf+13]) &&
                       isVinDigitSpace(file_buf[offset_buf+14]) &&
                       isVinDigitSpace(file_buf[offset_buf+15]) &&
                       isVinDigitSpace(file_buf[offset_buf+16]) &&
                       (file_buf[offset_buf+20] <= 6)
                       )
                      {
                      offset_file = offset_file_buf + offset_buf;
      
                      offset_buf += 21;
                      /*return (&file_buf[offset_buf-21]);*/
                      memcpy (current_vin, &file_buf[offset_buf-21], 21);
                      return (&current_vin[0]);
                      }
                  }
              }
      
          return (NULL);
          }
      }
      
      
      unsigned char * get_model (unsigned char * VinPtr)
      {
      //int Ctr;
      
      if (VinPtr[10] != 'Y')
          return ("XX");  // Unknown if not Yagoya
      
      switch (VinPtr[9])
          {
          case 'M':
          case 'N':
          case 'P':
          case 'R':
          case 'S':
          case 'T':
          case 'V':
          case 'W':
          case 'X':
              break;
          default:
              return ("XX");  // Unknown if not 91-99
          }
      
      if ( (strncmp(VinPtr, "JB3", 3)) && (strncmp(VinPtr, "JA3", 3)) )
          return ("XX");      // Unknown if not JB3 or JA3
      
      
      
      if ( (!strncmp(VinPtr, "JB3", 3)) && (!strncmp(VinPtr+5, "44", 2)) )
          return ("SB");  // Dodge Stealth Base
      
      if ( (!strncmp(VinPtr, "JB3XD54B", 8)) || (!strncmp(VinPtr, "JB3BM54J", 8)) )
          return ("ES");  // Dodge Stealth ES
      
      if ( (!strncmp(VinPtr, "JB3XD64B", 8)) || (!strncmp(VinPtr, "JB3BM64J", 8)) ||
           (!strncmp(VinPtr, "JB3AM54J", 8)) || (!strncmp(VinPtr, "JB3AM84J", 8)) )
          return ("RT");  // Dodge Stealth R/T
      
      if (!strncmp(VinPtr, "JB3AM64J", 8))
          return ("RL");  // Dodge Stealth R/T Luxury
      
      if ( (!strncmp(VinPtr, "JB3", 3)) && (!strncmp(VinPtr+5, "74", 2)) )
          return ("TT");  // Dodge Stealth R/T Turbo
      
      if ( (!strncmp(VinPtr, "JA3XD54B", 8)) || (!strncmp(VinPtr, "JA3BM54J", 8)) ||
           (!strncmp(VinPtr, "JA3AM54J", 8) && VinPtr[9]=='R') || (!strncmp(VinPtr, "JA3AM84J", 8) && VinPtr[9]=='S') ||
           (!strncmp(VinPtr, "JA3AM84J", 8) && VinPtr[9]=='T') || (!strncmp(VinPtr, "JA3AM44H", 8)) )
          return ("3B");  // Mitsubishi 3000GT Base
      
      if ( (!strncmp(VinPtr, "JA3", 3) && (!strncmp(VinPtr+5, "64", 2))) || (!strncmp(VinPtr, "JA3AM54J", 8) && VinPtr[9]=='S') ||
           (!strncmp(VinPtr, "JA3AM54J", 8) && VinPtr[9]=='T') || (!strncmp(VinPtr, "JA3AM84J", 8) && VinPtr[9]=='V') ||
           (!strncmp(VinPtr, "JA3AM84J", 8) && VinPtr[9]=='W') || (!strncmp(VinPtr, "JA3AM84J", 8) && VinPtr[9]=='X') )
          return ("SL");  // Mitsubishi 3000GT SL
      
      if ( (!strncmp(VinPtr, "JA3", 3)) && (!strncmp(VinPtr+5, "74", 2)) )
          return ("VR");  // Mitsubishi 3000GT VR-4
      
      if ( (!strncmp(VinPtr, "JA3A", 4)) && (!strncmp(VinPtr+5, "65", 2)) )
          return ("SS");  // Mitsubishi 3000GT SL Spyder
      
      if ( (!strncmp(VinPtr, "JA3A", 4)) && (!strncmp(VinPtr+5, "75", 2)) )
          return ("VS");  // Mitsubishi 3000GT VR-4 Spyder
      
      
      return ("XX");
      }                
      
      
      
      
      
      
      // #define MAX_VINS    400000     //60000  // Max between 400k and 410k
      // unsigned char VIN_Storage[MAX_VINS][18] = {0};
      
      int main (int argc, char **argv)
      {
      /*int in_vin_len;*/
      unsigned char in_vin[18] = "?????????????????";
      int Ctr, Ctr2;
      unsigned char * VinPtr = NULL;
      int NumVins = 0;
      unsigned char FirstChar = 'J';
      unsigned DataIndex = 0;
      unsigned char DataBuf[256] = {0};
      unsigned char StringBuf[256] = {0};
      int data_bytes_read = 0;
      unsigned char * DataPtr = NULL;
      int DataFormat = 0; // Early Format = 1, 95 and Later Format = 2
      int NumMajorFields = 0;
      
      if (argc < 2)
          {
          fprintf (stderr,"\nVIN argument required\n");
          return (-1);
          }
      if ( (strlen(argv[1]) <= 0) || (strlen(argv[1]) > 17) )
          {
          fprintf (stderr,"\nVIN argument must have 1-17 chars: Eg: J????????????????\n");
          return (-1);
          }
      //strncpy (in_vin, argv[1], 18);
      memcpy (in_vin, argv[1], strlen(argv[1]));
      
      for (Ctr=0; Ctr<17; Ctr++)
          in_vin[Ctr] = toupper(in_vin[Ctr]);
      FirstChar = in_vin[0];
      
      
      file_han = fopen ("c:\\pasen\\sharyo.idx", "rb");
      if (file_han==NULL)
          {
          fprintf (stderr,"\nError opening c:\\pasen\\sharyo.idx file.\n");
          return (-1);
          }
      
      if ( fseek (file_han, 0xB1800, SEEK_SET ) )
          {
          fprintf (stderr,"\nError positioning c:\\pasen\\sharyo.idx file.\n");
          return (-1);
          }
      
      file_han2 = fopen ("c:\\pasen\\sharyo.dat", "rb");
      if (file_han2==NULL)
          {
          fprintf (stderr,"\nError opening c:\\pasen\\sharyo.dat file.\n");
          return (-1);
          }
      
      while ( (VinPtr = GetNextVIN (FirstChar)) != NULL)          /* Get next VIN while some still remain */
          {
          for (Ctr=0; Ctr<17; Ctr++)                              /* For all VIN digits/letters */
              {
              if ( in_vin[Ctr]!='?' && in_vin[Ctr]!=VinPtr[Ctr])  /* If not a matching VIN, get next VIN */
                  break;
              if (Ctr>=16)                                        /* If all VIN digits/letters match...*/
                  {
                  NumVins++;
                  if (argc>2)
                      {
                      /*
                      for (Ctr2=0; Ctr2<17; Ctr2++)
                          {
                          if (Ctr2 == 8)                  // If check digit
                              printf ("?");
                          else
                              printf ("%c", VinPtr[Ctr2]);
                          if (Ctr2 == 16)
                              //printf (" (%c)  %p", VinPtr[8], offset_file);
                              printf (" (%c)", VinPtr[8]);
                          }
                      */
      
                      printf ("\"");
                      for (Ctr2=9; Ctr2<17; Ctr2++)
                          if (Ctr2 == 11)
                              {
                              if (VinPtr[Ctr2] == '8')
                                  printf ("0");
                              else
                                  printf ("%c", VinPtr[Ctr2]);        // YearPlantSerial
                              }
                          else
                              printf ("%c", VinPtr[Ctr2]);        // YearPlantSerial
                      printf ("\",\"");
                      for (Ctr2=0; Ctr2<17; Ctr2++)
                          printf ("%c", VinPtr[Ctr2]);            // VIN
                      printf ("\",");
      
                      printf ("\"%s\",", get_model (VinPtr));     // Model Abbrev.
      
                      DataIndex = VinPtr[20];
                      DataIndex *= 256;
                      DataIndex += VinPtr[19];
                      DataIndex *= 256;
                      DataIndex += VinPtr[18];
                      DataIndex *= 256;
                      DataIndex += VinPtr[17];
                      DataIndex -= 1;
                      //printf ("  %p", DataIndex);
                      //printf ("  %x %x %x %x %x", DataIndex, VinPtr[20], VinPtr[19], VinPtr[18], VinPtr[17]);
      
                      if ( fseek (file_han2, DataIndex, SEEK_SET ) )
                          {
                          fprintf (stderr,"\nError positioning c:\\pasen\\sharyo.dat file.\n");
                          return (-1);
                          }
                      data_bytes_read = fread (DataBuf, sizeof (char), 255, file_han2);
                      if (data_bytes_read==0)
                          {
                          //fclose (file_han);
                          fprintf (stderr,"\nUnexpected end of c:\\pasen\\sharyo.dat file.\n");
                          return (-1);
                          }
                      if (data_bytes_read < DataBuf[0])
                          {
                          //fclose (file_han);
                          fprintf (stderr,"\nUnexpected end (2) of c:\\pasen\\sharyo.dat file.\n");
                          return (-1);
                          }
      
                      //printf ("    %2.2d %2.2d", DataBuf[0], DataBuf[1]);
                      //printf ("  %2.2d", DataBuf[0]);
                      if (DataBuf[1] != 0)
                          {
                          fprintf (stderr,"\n! Databuf[1] = %2.2d", DataBuf[1]);
                          exit (-1);
                          }
                      DataFormat = 0; // Default - Unknown
                      switch (DataBuf[0])
                          {
                          case 32:
                              DataFormat = 1;
                              //printf ("  1");
                              break;
                          case 38:
                              DataFormat = 3;
                              //printf ("  3");
                              break;
                          case 30:
                              DataFormat = 4;
                              //printf ("  4");
                              break;
                          case 35:
                              DataFormat = 5;
                              //printf ("  5");
                              break;
                          case 37:
                              DataFormat = 6;
                              //printf ("  6");
                              break;
                          default:
                              //printf ("  %2.2d", DataBuf[0]);
                              fprintf (stderr,"\n! Databuf[0] = %2.2d", DataBuf[0]);
                              //DataPtr = &DataBuf[2];
                              //printf ("  %2.2d \"", *DataPtr);
                              //memset (StringBuf, 0, 256);
                              //memcpy (StringBuf, DataPtr+1, (*DataPtr)+1 );
                              //printf ("%s\"", StringBuf);
                              //DataPtr += (*DataPtr) + 2;
                              //exit (-1);
                              break;
                          }
      
                      DataPtr = &DataBuf[2];
                      NumMajorFields = 0;
                      while ((unsigned char)(DataPtr-DataBuf) < DataBuf[0])
                          {
                          switch (DataFormat)
                              {
                              case 1:
                              case 2:
                                  //printf ("  %2.2d \"", *DataPtr);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          if (*DataPtr != 4)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[5] != 'C')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[5] = %c", DataFormat, NumMajorFields+1, DataPtr[5]);
                                              exit (-1);
                                              }
                                          break;
                                      case 1:
                                          if (*DataPtr != 12)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[13] != 'E' && DataPtr[13] != 'H')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[13] = %c", DataFormat, NumMajorFields+1, DataPtr[13]);
                                              exit (-1);
                                              }
                                          break;
                                      case 2:
                                          if (*DataPtr != 8 && *DataPtr != 5)     // !! Note sub-format
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (*DataPtr == 8 && DataPtr[9] != 'M')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[9] = %c", DataFormat, NumMajorFields+1, DataPtr[9]);
                                              exit (-1);
                                              }
                                          if (*DataPtr == 5 && DataPtr[6] != 'K')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[6] = %c", DataFormat, NumMajorFields+1, DataPtr[6]);
                                              exit (-1);
                                              }
                                          break;
                                      case 3:
                                          DataFormat = 2; // !!!!
                                          if (*DataPtr != 2)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          break;
                                      default:
                                          fprintf (stderr,"\n! More than 4 fields");
                                          exit (-1);
                                          break;
                                      }
                                  memset (StringBuf, 0, 256);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\",", StringBuf);        // Model
                                          break;
                                      case 1:
                                          memcpy (StringBuf, DataPtr+1, 7 );
                                          printf ("\"%s\",", StringBuf);        // Classifi
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+10, 3 );
                                          printf ("\"%s\",", StringBuf);        // EQU
                                          printf ("\"EXT\",");                  // EXT
                                          printf ("\"INT\",");                  // INT
                                          break;
                                      case 2:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\",", StringBuf);         // DMFre
                                          break;
                                      case 3:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\"", StringBuf);         // MY
                                          break;
                                      }
                                  DataPtr += (*DataPtr) + 2;
                                  NumMajorFields++;
                                  break;
      
                              case 3:
                                  //printf ("  %2.2d \"", *DataPtr);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          if (*DataPtr != 4)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[5] != 'C')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[5] = %c", DataFormat, NumMajorFields+1, DataPtr[5]);
                                              exit (-1);
                                              }
                                          break;
                                      case 1:
                                          if (*DataPtr != 25)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[26] != 'K')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[26] = %c", DataFormat, NumMajorFields+1, DataPtr[26]);
                                              exit (-1);
                                              }
                                          break;
                                      case 2:
                                          if (*DataPtr != 2)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          break;
                                      default:
                                          fprintf (stderr,"\n! More than 3 fields");
                                          exit (-1);
                                          break;
                                      }
                                  memset (StringBuf, 0, 256);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\",", StringBuf);        // Model
                                          break;
                                      case 1:
                                          memcpy (StringBuf, DataPtr+1, 7 );
                                          printf ("\"%s\",", StringBuf);        // Classifi
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+10, 3 );
                                          printf ("\"%s\",", StringBuf);        // EQU
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+14, 3 );
                                          printf ("\"%s\",", StringBuf);        // EXT
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+18, 3 );
                                          printf ("\"%s\",", StringBuf);        // INT
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+21, 5 );
                                          printf ("\"%s\",", StringBuf);        // DMFre
                                          break;
                                      case 2:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\"", StringBuf);         // MY
                                          break;
                                      }
                                  DataPtr += (*DataPtr) + 2;
                                  NumMajorFields++;
                                  break;
      
                              case 4:
                                  //printf ("  %2.2d \"", *DataPtr);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          if (*DataPtr != 4)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[5] != 'C')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[5] = %c", DataFormat, NumMajorFields+1, DataPtr[5]);
                                              exit (-1);
                                              }
                                          break;
                                      case 1:
                                          if (*DataPtr != 9)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[7] != 'M')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[7] = %c", DataFormat, NumMajorFields+1, DataPtr[7]);
                                              exit (-1);
                                              }
                                          break;
                                      case 2:
                                          DataPtr++;  // !!!! Note extra char with 'H'
                                          if (*DataPtr != 5)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[6] != 'K')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[6] = %c", DataFormat, NumMajorFields+1, DataPtr[6]);
                                              exit (-1);
                                              }
                                          break;
                                      case 3:
                                          if (*DataPtr != 2)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          break;
                                      default:
                                          fprintf (stderr,"\n! More than 4 fields");
                                          exit (-1);
                                          break;
                                      }
                                  memset (StringBuf, 0, 256);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\",", StringBuf);        // Model
                                          break;
                                      case 1:
                                          memcpy (StringBuf, DataPtr+1, 7 );
                                          printf ("\"%s\",", StringBuf);        // Classifi
                                          printf ("\"EQU\",");                  // EQU
                                          printf ("\"EXT\",");                  // EXT
                                          printf ("\"INT\",");                  // INT
                                          break;
                                      case 2:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\",", StringBuf);        // DMFre
                                          break;
                                      case 3:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\"", StringBuf);         // MY
                                          break;
                                      }
                                  DataPtr += (*DataPtr) + 2;
                                  NumMajorFields++;
                                  break;
      
                              case 5:
                                  //printf ("  %2.2d \"", *DataPtr);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          if (*DataPtr != 4)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[5] != 'C')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[5] = %c", DataFormat, NumMajorFields+1, DataPtr[5]);
                                              exit (-1);
                                              }
                                          break;
                                      case 1:
                                          if (*DataPtr != 12)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[13] != 'E')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[13] = %c", DataFormat, NumMajorFields+1, DataPtr[13]);
                                              exit (-1);
                                              }
                                          break;
                                      case 2:
                                          if (*DataPtr != 8)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[9] != 'K')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[9] = %c", DataFormat, NumMajorFields+1, DataPtr[9]);
                                              exit (-1);
                                              }
                                          break;
                                      case 3:
                                          if (*DataPtr != 2)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          break;
                                      default:
                                          fprintf (stderr,"\n! More than 4 fields");
                                          exit (-1);
                                          break;
                                      }
                                  memset (StringBuf, 0, 256);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\",", StringBuf);        // Model
                                          break;
                                      case 1:
                                          memcpy (StringBuf, DataPtr+1, 7 );
                                          printf ("\"%s\",", StringBuf);        // Classifi
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+10, 3 );
                                          printf ("\"%s\",", StringBuf);        // EQU
                                          printf ("\"EXT\",");                  // EXT
                                          break;
                                      case 2:
                                          memcpy (StringBuf, DataPtr+1, 3 );
                                          printf ("\"%s\",", StringBuf);        // INT
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+4, 5 );
                                          printf ("\"%s\",", StringBuf);         // DMFre
                                          break;
                                      case 3:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\"", StringBuf);         // MY
                                          break;
                                      }
                                  DataPtr += (*DataPtr) + 2;
                                  NumMajorFields++;
                                  break;
      
      
      
                              case 6:
                                  //printf ("  %2.2d \"", *DataPtr);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          if (*DataPtr != 4)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[5] != 'C')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[5] = %c", DataFormat, NumMajorFields+1, DataPtr[5]);
                                              exit (-1);
                                              }
                                          break;
                                      case 1:
                                          if (*DataPtr != 9)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[7] != 'M' && DataPtr[7] != 'D')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[7] = %c", DataFormat, NumMajorFields+1, DataPtr[7]);
                                              exit (-1);
                                              }
                                          break;
                                      case 2:
                                          if (*DataPtr != 13)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          if (DataPtr[14] != 'K')
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, DataPtr[14] = %c", DataFormat, NumMajorFields+1, DataPtr[14]);
                                              exit (-1);
                                              }
                                          break;
                                      case 3:
                                          if (*DataPtr != 2)
                                              {
                                              fprintf (stderr,"\n! Fmt = %d, Fld = %d, *DataPtr = %2.2d", DataFormat, NumMajorFields+1, *DataPtr);
                                              exit (-1);
                                              }
                                          break;
                                      default:
                                          fprintf (stderr,"\n! More than 4 fields");
                                          exit (-1);
                                          break;
                                      }
                                  memset (StringBuf, 0, 256);
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\",", StringBuf);        // Model
                                          break;
                                      case 1:
                                          memcpy (StringBuf, DataPtr+1, 7 );
                                          printf ("\"%s\",", StringBuf);        // Classifi
                                          printf ("\"EQU\",");                  // EQU
                                          break;
                                      case 2:
                                          memcpy (StringBuf, DataPtr+2, 3 );
                                          printf ("\"%s\",", StringBuf);        // EXT
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+6, 3 );
                                          printf ("\"%s\",", StringBuf);        // INT
                                          memset (StringBuf, 0, 256);
                                          memcpy (StringBuf, DataPtr+9, 5 );
                                          printf ("\"%s\",", StringBuf);         // DMFre
                                          break;
                                      case 3:
                                          memcpy (StringBuf, DataPtr+1, (*DataPtr) );
                                          printf ("\"%s\"", StringBuf);         // MY
                                          break;
                                      }
                                  DataPtr += (*DataPtr) + 2;
                                  NumMajorFields++;
                                  break;
      
                              default:
                                  printf ("  %2.2d", *DataPtr);
                                  memset (StringBuf, 0, 256);
                                  memcpy (StringBuf, DataPtr+1, (*DataPtr)+1 );
                                  printf ("  \"%s\"", StringBuf);
      
                                  switch (NumMajorFields)
                                      {
                                      case 0:
                                          fprintf (stderr,"  ");
                                          for (Ctr2=0; Ctr2<17; Ctr2++)
                                              fprintf (stderr,"%c", VinPtr[Ctr2]);
                                          break;
                                      default:
                                          break;
                                      }
                                  fprintf (stderr,"  %2.2d", *DataPtr);
                                  fprintf (stderr,"  \"%s\"", StringBuf);
      
      
                                  DataPtr += (*DataPtr) + 2;
                                  NumMajorFields++;
                                  break;
      
                              }
      
                          }
      
                      switch (DataFormat)
                          {
                          case 1:
                              printf ("\n");
                              //printf (" Fmt1 Flds = %d\n", NumMajorFields);
                              break;
                          case 2:
                              printf ("\n");
                              //printf (" Fmt2 Flds = %d\n", NumMajorFields);
                              break;
                          case 3:
                              printf ("\n");
                              //printf (" Fmt3 Flds = %d\n", NumMajorFields);
                              break;
                          case 4:
                              printf ("\n");
                              //printf (" Fmt4 Flds = %d\n", NumMajorFields);
                              break;
                          case 5:
                              printf ("\n");
                              //printf (" Fmt5 Flds = %d\n", NumMajorFields);
                              break;
                          case 6:
                              printf ("\n");
                              //printf (" Fmt6 Flds = %d\n", NumMajorFields);
                              break;
                          default:
                              printf ("\n");
                              //printf (" Fmt? Flds = %d\n", NumMajorFields);
                              break;
                          }
                      }
      
                  }
              }
      
          }
      
      /*
      
      Formats for sharyo.dat for Nagoya 91-99:
      
      
      91: 27207
        830   JA3XD54B0MY000209  1  "Z11A"  "MRPML2M  A11"      "90073"  "91" Fmt2 Flds = 4
      26355   JA3XD54B0MY009721  3  "Z11A"  "MRXML2M  A91 W75 09U90103"  "91" Fmt3 Flds = 3
          5   JA3XD54B6MY000070  4  "Z11A"  "MNPML7M  "         "90043"  "91" Fmt4 Flds = 4
         17   JA3XD54B5MY000058  6  "Z11A"  "MRPML2M  " " RA8 03H90041"  "91" Fmt6 Flds = 4
      
      92: 68523
      68505   JA3XC47S0NY000110  3  "F16A"  "TRHEL2M  A06 RA5 23H91021"  "92" Fmt3 Flds = 3
         16   JA3XC57B0NY020038  5  "F16A"  "TRXML2M  B67"   "44S91081"  "92" Fmt5 Flds = 4
          2   JA3XC47S6NY000094  6  "F16A"  "TRHEL2M  " " AA1 31X91021"  "92" Fmt6 Flds = 4
      
      93: 47379
      47374   JA3BM54J0PY001639  3  "Z11A"  "MNXML2M  A82 G84 10H92061"  "93" Fmt3 Flds = 3
          5   JA3BM64J5PY000024  6  "Z11A"  "MRPML7M  " " XA2 03H92061"  "93" Fmt6 Flds = 4
      
      94: 41752
      41745   JA3AM54J0RY000375  3  "Z11A"  "MNXML2M  A80 G84A19H93061"  "94" Fmt3 Flds = 3
          7   JA3AN74K2RY039132  6  "Z16A"  "MJGFL7M  " " W29B29H94031"  "94" Fmt6 Flds = 4
      
      95: 31758
      31742   JA3AM54J0SY000107  3  "Z11A"  "MRPML2M  A62 B34B42D94061"  "95" Fmt3 Flds = 3
         16   JA3AM65J3SY800002  6  "Z11A"  "BRPML7M  " " Y99A37H94051"  "95" Fmt6 Flds = 4
      
      96:  6095
       6092   JA3AM54J0TY000206  3  "Z11A"  "MRPML2M  A04 R71A14E95061"  "96" Fmt3 Flds = 3
          1   JA3AN74K1TY000006  5  "Z16A"  "MJGFL7M  05Z"   "13E95061"  "96" Fmt5 Flds = 4
          2   JA3AM54J1TY006189  6  "Z11A"  "MRPML7M  " " R71A14X96041"  "96" Fmt6 Flds = 4
      
      97:  5850
       5844   JA3AM44H0VY000104  3  "Z11A"  "MRHEL2M  A06 G84A57E96051"  "97" Fmt3 Flds = 3
          6   JA3AM44H1VY000015  6  "Z11A"  "MNHEL7M  " " R71A47X96051"  "97" Fmt6 Flds = 4
      
      98:  4758
       4758   JA3AM44H0WY000105  3  "Z11A"  "MNHEL7M  A00 W75A85S97061"  "98" Fmt3 Flds = 3
      
      99:  3267
       3266   JA3AM44H0XY000106  3  "Z11A"  "MRHEL2M  A01 X08A93E98061"  "99" Fmt3 Flds = 3
          1   JA3AN74K6XY001108  6  "Z16A"  "MJGFL7M  " " W75A95F98093"  "99" Fmt6 Flds = 4
      
      
      
      
      Formats:
      
      Num     VIN                   Model   Classifi  Opt Ext IntDOMfe    MY
                                            cation    Equ
      ---------------------------------------------------------------------------------------
      2:
        830   JA3XD54B0MY000209  1  "Z11A"  "MRPML2M  A11"      "90073"  "91" Fmt2 Flds = 4
      
      
      3:
      26355   JA3XD54B0MY009721  3  "Z11A"  "MRXML2M  A91 W75 09U90103"  "91" Fmt3 Flds = 3
      68505   JA3XC47S0NY000110  3  "F16A"  "TRHEL2M  A06 RA5 23H91021"  "92" Fmt3 Flds = 3
      47374   JA3BM54J0PY001639  3  "Z11A"  "MNXML2M  A82 G84 10H92061"  "93" Fmt3 Flds = 3
      41745   JA3AM54J0RY000375  3  "Z11A"  "MNXML2M  A80 G84A19H93061"  "94" Fmt3 Flds = 3
      31742   JA3AM54J0SY000107  3  "Z11A"  "MRPML2M  A62 B34B42D94061"  "95" Fmt3 Flds = 3
       6092   JA3AM54J0TY000206  3  "Z11A"  "MRPML2M  A04 R71A14E95061"  "96" Fmt3 Flds = 3
       5844   JA3AM44H0VY000104  3  "Z11A"  "MRHEL2M  A06 G84A57E96051"  "97" Fmt3 Flds = 3
       4758   JA3AM44H0WY000105  3  "Z11A"  "MNHEL7M  A00 W75A85S97061"  "98" Fmt3 Flds = 3
       3266   JA3AM44H0XY000106  3  "Z11A"  "MRHEL2M  A01 X08A93E98061"  "99" Fmt3 Flds = 3
      
      
      4:
          5   JA3XD54B6MY000070  4  "Z11A"  "MNPML7M  "         "90043"  "91" Fmt4 Flds = 4
      
      
      5:
         16   JA3XC57B0NY020038  5  "F16A"  "TRXML2M  B67"   "44S91081"  "92" Fmt5 Flds = 4
          1   JA3AN74K1TY000006  5  "Z16A"  "MJGFL7M  05Z"   "13E95061"  "96" Fmt5 Flds = 4
      
      
      6:
         17   JA3XD54B5MY000058  6  "Z11A"  "MRPML2M  " " RA8 03H90041"  "91" Fmt6 Flds = 4
          2   JA3XC47S6NY000094  6  "F16A"  "TRHEL2M  " " AA1 31X91021"  "92" Fmt6 Flds = 4
          5   JA3BM64J5PY000024  6  "Z11A"  "MRPML7M  " " XA2 03H92061"  "93" Fmt6 Flds = 4
          7   JA3AN74K2RY039132  6  "Z16A"  "MJGFL7M  " " W29B29H94031"  "94" Fmt6 Flds = 4
         16   JA3AM65J3SY800002  6  "Z11A"  &quot
      Last edited by dstocks on Tue May 08, 2007 9:04 pm, edited 1 time in total.
      Complete FTO (http://www.completefto.com.au/completefto.asp)
        Image
        If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
        User avatar
        dstocks
        National Vice President
        Posts: 9529
        Joined: Fri Jun 24, 2005 5:00 pm
        Location: Utopia
        Contact:

        Smileys

        Post by dstocks »

        Just noticed the smileys have appeared in the code in place of some of the symbols. If you need me to decode these let me know......
        Complete FTO (http://www.completefto.com.au/completefto.asp)
          Image
          If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
          User avatar
          Bennoz
          National President
          Posts: 23676
          Joined: Fri Jan 21, 2005 6:00 pm
          Location: Sydney
          Contact:

          Post by Bennoz »

          Good lord 8O

          btw Dwayne, if you use the tags around that code it will stop the smilies coming up.
          User avatar
          dstocks
          National Vice President
          Posts: 9529
          Joined: Fri Jun 24, 2005 5:00 pm
          Location: Utopia
          Contact:

          Thanks

          Post by dstocks »

          Thanks Bennoz, wasnt aware of that one.

          Code isnt quite as bad as it looks, there are a lot of comments in there. I can sort of follow it, but not enough yet to modify it. It outputs all eclipse data, but when I try it on DE3A instead of the series starting with J that they use, it gets 2000 odd records through before it stops.

          link to the code download is here:

          http://www.stealth316.com/2-production.htm

          Oh and hopefully the caps option codes are on the way. Have contacted Mitsubishi and they have sent a request off for me.
          Complete FTO (http://www.completefto.com.au/completefto.asp)
            Image
            If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
            User avatar
            jonowong
            Oldtimer
            Posts: 3420
            Joined: Thu Jan 15, 2004 6:00 pm
            Location: Sydney

            Post by jonowong »

            omfg... i have no idea whats happening
            User avatar
            dstocks
            National Vice President
            Posts: 9529
            Joined: Fri Jun 24, 2005 5:00 pm
            Location: Utopia
            Contact:

            why

            Post by dstocks »

            Thats why I NEEEEEEEEED a C programmer.

            But basically, its getting a byte offset from the sharyo.idx file and using that to locate the applicable data in the sharyo.dat file (I think).

            If only it was written in VB id have a chance........:cry:
            Complete FTO (http://www.completefto.com.au/completefto.asp)
              Image
              If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
              eThix
              Veteran Mechanic
              Posts: 1046
              Joined: Mon Feb 12, 2007 6:00 pm
              Location: Brisbane

              Post by eThix »

              lol ok i don't under stand what your asking..... but if you make it simple i will ask my mates at work (game programmers)
              User avatar
              messy
              Grease Monkey
              Posts: 269
              Joined: Sat Jan 28, 2006 6:00 pm

              Post by messy »

              longest post award..

              it hurt my head until i found my PgDn button 8O
              User avatar
              dstocks
              National Vice President
              Posts: 9529
              Joined: Fri Jun 24, 2005 5:00 pm
              Location: Utopia
              Contact:

              Simple

              Post by dstocks »

              OK, simple.........Do my best.

              The C program listed above pulls the following information out of CAPS:

              "MY000002","JB3XE74C5MY000002","TT","Z16A","MNGFL2D","EQU","RA8","08H","90041","91"

              (1) 8 chars "YPS" Year Plant Serial, derived from VIN.
              (2) 17 chars "VIN" "Vin-No" in CAPS. Vehicle Identification Number
              (3) 2 chars "Model" My defined model abbreviation, derived from VIN.
              (4) 4 chars "ModelCode" "Model" in CAPS. Indicates 2WD, 4WD, or 4WD/4WS only.
              (5) 7 chars "Classification" "Classification" in CAPS. Indicates real chassis model.
              (6) 3 chars "Equipment" "Option" in CAPS. Equipment code.
              (7) 3 chars "Exterior" "Exterior" in CAPS. Exterior color code.
              (8) 3 chars "Interior" "Interior" in CAPS. Interior color code.
              (9) 5 chars "DateMfr" Displayed by CAPS, with no name. Date of manufacture.
              (10) 2 chars "MY" Model Year from CAPS database.

              Now, there are several problems with this:

              - It has been designed to work for the Eclipse and not the FTO (hence the Vin starting with J).

              - It has been designed to work on the American CAPS database, not the Japanese one (There are 3 different ones - US, Europe and Japan)

              So, as a result, I am able to get some FTO data out, but it crashes about 1600 records into the extract. The program above does quite a bit of fancy filtering during the extraction process. What would be great is if it was simplified to just extract all the data (in the format above) and I can take it from there.

              The database files this works on are too large to post up. Here is where I downloaded them from:


              http://translate.google.com/translate?h ... DcountryRU

              I believe that the FTO info is contained on CD 3 of the Japanese CAPS download (and the 2 files the program works on are sharyo.dat and sharyo.idx).

              BTW, for those of you that already have CAPS, this is a more recent version of the one you probably have as the one that was floating around was 2.61 and this is 3.33. You also need to download jcaps350eng.rar and fiddle with the result to get english to appear. If anyone ends up downloading and gets stuck, I can help.
              Complete FTO (http://www.completefto.com.au/completefto.asp)
                Image
                If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
                User avatar
                kazbah
                National Secretary
                Posts: 2475
                Joined: Sat Apr 26, 2003 5:00 pm
                Location: Stiff Clutch...
                Contact:

                Post by kazbah »

                I've been waiting so long to use this so Dwayne please forgive me but.....
                Image
                Teh Ban Queen!
                User avatar
                Lemo
                Apprentice
                Posts: 90
                Joined: Thu Apr 06, 2006 5:00 pm
                Location: Canberra - Belco

                Post by Lemo »

                Righto thats a nice amount of code, let me see if me and my mates can't do something with this for you Mr Stocks.
                User avatar
                dstocks
                National Vice President
                Posts: 9529
                Joined: Fri Jun 24, 2005 5:00 pm
                Location: Utopia
                Contact:

                Nahhh

                Post by dstocks »

                Nahhhh, not Blokey stuff, geeky stuff - get it right :wink:

                And Lemo, I need all the help I can get!. So anything you can swing for me would be fantastic
                Complete FTO (http://www.completefto.com.au/completefto.asp)
                  Image
                  If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
                  User avatar
                  Lemo
                  Apprentice
                  Posts: 90
                  Joined: Thu Apr 06, 2006 5:00 pm
                  Location: Canberra - Belco

                  Post by Lemo »

                  So you want it changed so that it extracts information for models starting with DE3A and you need it to use the Japanese database instead of the American one?

                  Correct dstocks?

                  If so It shouldn't be TOO hard to modify, but no promises yet as I still have to look over it in more detail with my mate.
                  User avatar
                  dstocks
                  National Vice President
                  Posts: 9529
                  Joined: Fri Jun 24, 2005 5:00 pm
                  Location: Utopia
                  Contact:

                  Yep

                  Post by dstocks »

                  So you want it changed so that it extracts information for models starting with DE3A
                  Even simpler than that really. Extract everything. Ill pull it into something like access and write some code to manipulate later. FTO would be DE3A, DE2A and whatever the GS is, but if I pull all the data out, can be sure that I done miss any.

                  The bit im stuck on is decoding the byte offset stuff. If I actually understood how that stuff worked, I could probably do it myself. Unfotunately, never dug quite that deep into file formats and how they are put together.
                  you need it to use the Japanese database instead of the American one?
                  Correct. At the moment, if I run it against the Japanese one, it bugs out before finishing.

                  If its possible to write something that can be used to generically extract from not only this table, but the others as well, even better!. Or even if it can be simplified so that all the pattern matching stuff is cut out and it just outputs everything, I can tweak it to maybe operate with the other tables through trial and error.
                  Complete FTO (http://www.completefto.com.au/completefto.asp)
                    Image
                    If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
                    User avatar
                    dstocks
                    National Vice President
                    Posts: 9529
                    Joined: Fri Jun 24, 2005 5:00 pm
                    Location: Utopia
                    Contact:

                    OK

                    Post by dstocks »

                    OK, an update.

                    Have managed to work enough of the C++ out to write my own code. Have managed to link VINS to manufacture dates, model numbers, colour codes and options.

                    Can now say that I will be able to provide some tables very soon listing number of cars produced per year in each model, each colour etc. Will also look into producing a VIN lookup online that will display this info for any VIN typed in.
                    Complete FTO (http://www.completefto.com.au/completefto.asp)
                      Image
                      If you are trying to contact me and not getting a quick answer, its because im disorganised. Hassle me and ill get back to you
                      User avatar
                      FtoSam
                      Oldtimer
                      Posts: 3924
                      Joined: Wed Jul 13, 2005 5:00 pm
                      Location: Brisbane West
                      Contact:

                      Post by FtoSam »

                      8O 8O 8O 8O 8O

                      FTOian of the year award +1!!! 8)
                      Image

                      If you need good deal on photography, let me know.
                      User avatar
                      aza013
                      NSW Coordinator
                      Posts: 9089
                      Joined: Mon Mar 26, 2007 5:00 pm
                      Location: The Shire
                      Contact:

                      Post by aza013 »

                      dstocks mate you are doing a supper job on this and your other site :D 8) keep it up :wink:
                      Post Reply