Skip to content

Commit a6417f2

Browse files
committed
synchronise binaries
1 parent 8893dfe commit a6417f2

File tree

6 files changed

+53
-15
lines changed

6 files changed

+53
-15
lines changed

bin/aix/mqsmfcsv

100 Bytes
Binary file not shown.

bin/linux/mqsmfcsv

0 Bytes
Binary file not shown.

bin/win/mqsmfcsv.exe

0 Bytes
Binary file not shown.

src/mqsmf.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ int main( int argc, char *argv[] )
268268
/* amount. */
269269
/********************************************************************/
270270
nextLength = conv16(pSMFRecord->Header.SMFLEN) - 4;
271+
if (debugLevel >=3)
272+
printf(" NextLen = %d bytes \n",nextLength);
273+
271274
bytesRead = fread(&pSMFRecord->Header.SMFRECFLG, 1, nextLength , fp);
272275
if (bytesRead != nextLength)
273276
{
@@ -296,6 +299,9 @@ int main( int argc, char *argv[] )
296299
nextLength = conv16(nextLength);
297300
fread(&pSMFRecord->Header.SMFSEG ,1,2,fp);
298301

302+
if (debugLevel >=3)
303+
printf(" NextLen = %d bytes \n",nextLength);
304+
299305
if (offset+nextLength > sizeof(dataBuf))
300306
{
301307
printf("SMF record appears to be too large for buffer\n");
@@ -308,6 +314,9 @@ int main( int argc, char *argv[] )
308314

309315
}
310316

317+
if (debugLevel >=3)
318+
printf("Read a full record of %d bytes \n",offset);
319+
311320
totalRecords++;
312321

313322
/*********************************************************************/
@@ -399,6 +408,9 @@ int main( int argc, char *argv[] )
399408
hund);
400409
}
401410

411+
if (debugLevel >= 2)
412+
printDEBUG("FULL RECORD",dataBuf,offset);
413+
402414
if (recordType == 116 || recordType == 115)
403415
{
404416
/*******************************************************************/
@@ -444,7 +456,7 @@ int main( int argc, char *argv[] )
444456
/*********************************************************************/
445457
/* One we know how many sections there are, copy the triplet values */
446458
/* into a local array, doing the endianness conversion on the way. */
447-
/* That makes it look at bit easier rather than than having convxxx */
459+
/* That makes it look a bit easier rather than than having convxxx */
448460
/* function calls everywhere else. */
449461
/*********************************************************************/
450462
for (i=0;i<sectionCount;i++)
@@ -454,8 +466,6 @@ int main( int argc, char *argv[] )
454466
triplet[i].n = conv16(pSMFRecord->s[i].n);
455467
}
456468

457-
if (debugLevel >= 2)
458-
printDEBUG("FULL RECORD",dataBuf,offset);
459469

460470
/*********************************************************************/
461471
/* And now we can start formatting the actual data. */

src/smfDDL.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ void openDDL(char *name)
4040

4141
void closeDDL(void)
4242
{
43-
fprintf(fp,");\n\n");
44-
fflush(fp);
43+
if (fp)
44+
{
45+
fprintf(fp,");\n\n");
46+
fflush(fp);
47+
}
4548
return;
4649
}
4750

@@ -52,25 +55,26 @@ void printDDL(char *name, int type, int len)
5255
char nameCopy[COL_HEAD_LEN]; /* Cannot modify fixed strings, have to copy input*/
5356

5457
if (!fp)
55-
return;
58+
return;
59+
5660
strncpy(nameCopy,name,sizeof(nameCopy)-1);
5761

5862
switch (type)
5963
{
6064
case DDL_I:
61-
fprintf(fp,"%s \"%s\" \t INTEGER\n",comma,format(nameCopy));
65+
fprintf(fp,"%s %s \t INTEGER\n",comma,format(nameCopy));
6266
break;
6367
case DDL_I64:
64-
fprintf(fp,"%s \"%s\" \t BIGINT\n",comma,format(nameCopy));
68+
fprintf(fp,"%s %s \t BIGINT\n",comma,format(nameCopy));
6569
break;
6670
case DDL_C:
67-
if (!strcmp(name,"Date")) /* special case for CommonHeader field */
71+
if (!strcmp(name,"Date")) /* special case for CommonHeader field*/
6872
{
69-
fprintf(fp,"%s \"%s\" \t DATE \n",comma,format(nameCopy));
73+
fprintf(fp,"%s %s \t DATE \n",comma,format(nameCopy));
7074
}
7175
else
7276
{
73-
fprintf(fp,"%s \"%s\" \t CHAR(%d)\n",comma,format(nameCopy),len);
77+
fprintf(fp,"%s %s \t CHAR(%d)\n",comma,format(nameCopy),len);
7478
}
7579
break;
7680
case DDL_SUS:
@@ -81,12 +85,12 @@ void printDDL(char *name, int type, int len)
8185

8286
p2 = strstr(nameCopy,"(S)");
8387
if (p2) *p2 = 0;
84-
fprintf(fp,"%s \"%s_s\" \t INTEGER\n",comma,format(nameCopy));
88+
fprintf(fp,"%s %s_s \t INTEGER\n",comma,format(nameCopy));
8589

8690
p = p+1;
8791
p2 = strstr(p,"(US)");
8892
if (p2) *p2 = 0;
89-
fprintf(fp,"%s \"%s_us\" \t INTEGER\n",comma,format(p));
93+
fprintf(fp,"%s %s_us \t INTEGER\n",comma,format(p));
9094
break;
9195

9296
case DDL_DATETIME:
@@ -97,12 +101,12 @@ void printDDL(char *name, int type, int len)
97101

98102
p2 = strstr(nameCopy," (DATE)");
99103
if (p2) *p2 = 0;
100-
fprintf(fp,"%s \"%s_Date\" \t DATE\n",comma,format(nameCopy));
104+
fprintf(fp,"%s %s_Date \t DATE\n",comma,format(nameCopy));
101105

102106
p = p+1;
103107
if (p2) p2 = strstr(p," (TIME)");
104108
*p2 = 0;
105-
fprintf(fp,"%s \"%s_Time\" \t CHAR(19)\n",comma,format(p));
109+
fprintf(fp,"%s %s_Time \t CHAR(19)\n",comma,format(p));
106110
break;
107111
}
108112

testing/testdb2.bat

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
db2 connect to mydb
2+
db2 -tf c:\temp\smf\out\smf-mqtables.ddl
3+
4+
db2 load client from c:\temp\smf\out\SMF-Q5ST.csv of del insert into mqsmf.Q5ST
5+
db2 load client from c:\temp\smf\out\SMF-QEST.csv of del insert into mqsmf.QEST
6+
db2 load client from c:\temp\smf\out\SMF-QIST.csv of del insert into mqsmf.QIST
7+
8+
db2 load client from c:\temp\smf\out\SMF-QJST.csv of del insert into mqsmf.QJST
9+
db2 load client from c:\temp\smf\out\SMF-QLST.csv of del insert into mqsmf.QLST
10+
11+
db2 load client from c:\temp\smf\out\SMF-QMAC.csv of del insert into mqsmf.QMAC
12+
db2 load client from c:\temp\smf\out\SMF-QMST.csv of del insert into mqsmf.QMST
13+
db2 load client from c:\temp\smf\out\SMF-QPST.csv of del insert into mqsmf.QPST
14+
db2 load client from c:\temp\smf\out\SMF-QSST.csv of del insert into mqsmf.QSST
15+
db2 load client from c:\temp\smf\out\SMF-QTST.csv of del insert into mqsmf.QTST
16+
db2 load client from c:\temp\smf\out\SMF-WQ.csv of del insert into mqsmf.WQ
17+
db2 load client from c:\temp\smf\out\SMF-WTAS.csv of del insert into mqsmf.WTAS
18+
db2 load client from c:\temp\smf\out\SMF-WTID.csv of del insert into mqsmf.WTID
19+
db2 load client from c:\temp\smf\out\SMF-QESD.csv of del insert into mqsmf.QESD
20+
db2 load client from c:\temp\smf\out\SMF-QCTDSP.csv of del insert into mqsmf.QCTDSP
21+
db2 load client from c:\temp\smf\out\SMF-QCTDNS.csv of del insert into mqsmf.QCTDNS
22+
db2 load client from c:\temp\smf\out\SMF-QCTADP.csv of del insert into mqsmf.QCTADP
23+
db2 load client from c:\temp\smf\out\SMF-QCST.csv of del insert into mqsmf.QCST
24+
db2 load client from c:\temp\smf\out\SMF-QCCT.csv of del insert into mqsmf.QCCT

0 commit comments

Comments
 (0)