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 (¤t_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" "