Skip to content

Commit 694805c

Browse files
committed
Re-merge sec/microsec fields when in SQL mode
1 parent 604fc19 commit 694805c

File tree

8 files changed

+21
-14
lines changed

8 files changed

+21
-14
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ October 2016
5858
* SMF 115 subtype 231 (CHIN) records do not use same scale for qwhsdurn
5959
(though this seems to be undocumented)
6060

61+
February 2017
62+
* STCK durations printed as just microseconds value when in SQL mode. Still
63+
split as seconds/microseconds otherwise.
64+
6165

6266
Pull requests
6367
=============

bin/aix/mqsmfcsv

12.8 KB
Binary file not shown.

bin/linux/mqsmfcsv

8 KB
Binary file not shown.

bin/win/mqsmfcsv.exe

-62.3 KB
Binary file not shown.

src/mqsmf.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,17 @@ extern char *strCfStatType (int v);
321321
ADDDATA("%s,",convDate(v))
322322

323323
#define ADDSTCK(h,v) \
324+
if (sqlMode) \
325+
sprintf(tmpHead,"%s(US)",h); \
326+
else\
324327
sprintf(tmpHead,"%s(S),%s(US)",h,h); \
325328
ADDHEAD(tmpHead,DDL_SUS,0); \
326329
ADDDATA("%s,",convSecUSec(v))
327330

328331
#define ADDSTCKIDX(h,idx,v) \
332+
if (sqlMode) \
333+
sprintf(tmpHead,"%s{%s}(US)",h,idx); \
334+
else \
329335
sprintf(tmpHead,"%s{%s}(S),%s{%s}(US)",h,idx,h,idx); \
330336
ADDHEAD(tmpHead,DDL_SUS,0); \
331337
ADDDATA("%s,",convSecUSec(v))

src/printWTAS.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void printWTAS(wtas *p)
7979
ADDU32 ("Journal_Write_Count", p->wtasjwn);
8080
ADDU32 ("Journal_Write_Bytes", p->wtasjwb);
8181
ADDSTCK("Journal_Forced_Write_ET", p->wtasjcet);
82-
ADDU32 ("Journal_Fored_Write_Count", p->wtasjcn);
82+
ADDU32 ("Journal_Forced_Write_Count", p->wtasjcn);
8383
ADDU32 ("Task_Suspend_Count", p->wtassusn);
8484
ADDSTCK("Task_Suspend_Time", p->wtassuse);
8585

src/smfConv.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ char *convBin(unsigned char *inbuf, int origlen)
150150
/* DESCRIPTION: */
151151
/* Convert a STCK value into a string showing duration in seconds */
152152
/* and microseconds. The two numbers are comma-separated for use in */
153-
/* the CSV output. The input STCK is assumed to be in z/OS */
153+
/* the CSV output as some spreadsheets had problems with 64-bit */
154+
/* values. But in SQL mode, just print a single number as databases */
155+
/* are able to handle a BIGINT datatype. */
156+
/* The input STCK is assumed to be in z/OS */
154157
/* big-endian format, so must be converted to local endianness first*/
155158
/**********************************************************************/
156159
static char usecBuf[64];
@@ -169,7 +172,10 @@ char *convSecUSec(unsigned long long s)
169172
}
170173

171174
/* Separate fields by ',' for CSV formats */
172-
sprintf(usecBuf,"%u, %u ",sec,usec);
175+
if (sqlMode)
176+
sprintf(usecBuf,"%llu ",s);
177+
else
178+
sprintf(usecBuf,"%u, %u ",sec,usec);
173179

174180
return usecBuf;
175181
}

src/smfDDL.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,10 @@ void printDDL(char *name, int type, int len)
7878
}
7979
break;
8080
case DDL_SUS:
81-
/* Split a heading into sec and usec columns */
82-
/* The CSV heading embeds a ',' to do that on the data */
83-
p = strchr(nameCopy,',');
84-
*p = 0;
85-
86-
p2 = strstr(nameCopy,"(S)");
81+
p2 = strstr(nameCopy,"(US)");
8782
if (p2) *p2 = 0;
88-
fprintf(fp,"%s %s_s \t INTEGER\n",comma,format(nameCopy));
83+
fprintf(fp,"%s %s_us \t BIGINT\n",comma,format(nameCopy));
8984

90-
p = p+1;
91-
p2 = strstr(p,"(US)");
92-
if (p2) *p2 = 0;
93-
fprintf(fp,"%s %s_us \t INTEGER\n",comma,format(p));
9485
break;
9586

9687
case DDL_DATETIME:

0 commit comments

Comments
 (0)