Skip to content

Commit 5ddf434

Browse files
committed
Updates for MQ 9.3.1
1 parent d2f7e7a commit 5ddf434

21 files changed

+207
-52
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
History (newest at top)
33
=======================
44

5+
Oct 2022 (v5.4.1)
6+
* Update for MQ V9.3.1
7+
* Extended QQST structure in the 115 records
8+
* Add config option (-g) to print timestamps in GMT.
9+
* Default prints as localtime
10+
511
Jul 2022 (v5.4)
612
* Update for MQ V9.3.0
713
* New QQST structure in the 115 records

bin/aix/convH

312 Bytes
Binary file not shown.

bin/aix/mqsmfcsv

2.58 KB
Binary file not shown.

bin/linux/convH

48 Bytes
Binary file not shown.

bin/linux/mqsmfcsv

4.37 KB
Binary file not shown.

bin/win/convH.exe

-133 KB
Binary file not shown.

bin/win/mqsmfcsv.exe

1 KB
Binary file not shown.

src/M

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plat=`uname`
44

55
if [ -z "$VERS" ]
66
then
7-
VERS="930"
7+
VERS="931"
88
fi
99

1010
if [ "$plat" = "AIX" ]

src/Makefile.gcc.win

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CC=i686-w64-mingw32-gcc
33
# CFLAGS= -I. -m32 -fpack-struct=8 -DPLATFORM_WINDOWS
44
CFLAGS= -I. -m32 -DPLATFORM_WINDOWS
55
PLATFLAGS=
6-
VERS=930
6+
VERS=931
77
SRC = mqsmf.c \
88
smfDDL.c \
99
smfDate.c \
@@ -54,7 +54,7 @@ all: sizeTest shipTest
5454

5555
sizeTest: mqsmfcsv.exe
5656
./mqsmfcsv.exe -v > sizes.tmp
57-
diff -b sizes.tmp sizes.master
57+
diff -b sizes.tmp sizes.master.$(VERS)
5858

5959
shipTest: mqsmfcsv.exe
6060
cd ../testing/shipTest;./shipTest.sh csv sql json

src/Makefile.unix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ tests: all
5454

5555
sizeTest: mqsmfcsv
5656
./mqsmfcsv -v > sizes.tmp
57-
diff -b sizes.tmp sizes.master
57+
diff -b sizes.tmp sizes.master.$(VERS)
5858

5959
shipTest: mqsmfcsv
6060
cd ../testing/shipTest;./shipTest.sh csv sql json

src/Makefile.win

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CFLAGS=-nologo /D_CRT_SECURE_NO_WARNINGS /Zp1 /J /O2 /DPLATFORM_WINDOWS
2-
VERS=930
2+
VERS=931
33
SRC = mqsmf.c \
44
smfDDL.c \
55
smfDate.c \
@@ -46,7 +46,7 @@ HDR = mqsmfstrucW.h \
4646

4747
checkSize: mqsmfcsv.exe
4848
mqsmfcsv.exe -v > sizes.tmp
49-
diff -b sizes.master sizes.tmp
49+
diff -b sizes.tmp sizes.master.$(VERS)
5050

5151
mqsmfcsv.exe: $(SRC) $(HDR) Makefile.win
5252
rm -f $@

src/convH64.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
/* breaking compilation or the sizeTest build rule. */
6060
/**********************************************************************/
6161
#define ZLONGLONG "long long "
62-
#define ZSHORTINT "short int "
62+
#define ZSHORTINT1 "short int "
63+
#define ZSHORTINT2 "short int " /* one version of the header had extra spaces */
6364
#define ZEXTRAINT " int "
6465
#define ZLONGINT1 "long int "
6566
#define ZLONGINT2 "long int "
@@ -275,14 +276,37 @@ void datatypeReplace(char *line) {
275276
}
276277

277278
/* And then the "short" ones */
278-
p = strstr(line,ZSHORTINT);
279+
p = strstr(line,ZSHORTINT1);
279280
if (p) {
280281
p2 = strstr(line,UNSIGNED);
281282
if (p2) {
282283
memcpy(p2,UNSIGNED_BLANK,strlen(UNSIGNED));
283-
memcpy(p,REPLACE_UINT16,strlen(ZSHORTINT));
284+
memcpy(p,REPLACE_UINT16,strlen(ZSHORTINT1));
284285
} else {
285-
memcpy(p,REPLACE_INT16,strlen(ZSHORTINT));
286+
memcpy(p,REPLACE_INT16,strlen(ZSHORTINT1));
287+
p2 = strstr(line,SIGNED);
288+
if (p2) {
289+
memcpy(p2,SIGNED_BLANK,strlen(SIGNED));
290+
}
291+
}
292+
293+
/*************************************************************/
294+
/* We may now have a line "uint16_t int qwsx0r5n" so get rid */
295+
/* of the extraneous "int" */
296+
/*************************************************************/
297+
p = strstr(line,ZEXTRAINT);
298+
if (p) {
299+
memcpy(p,REPLACE_EXTRAINT,strlen(ZEXTRAINT));
300+
}
301+
}
302+
p = strstr(line,ZSHORTINT2);
303+
if (p) {
304+
p2 = strstr(line,UNSIGNED);
305+
if (p2) {
306+
memcpy(p2,UNSIGNED_BLANK,strlen(UNSIGNED));
307+
memcpy(p,REPLACE_UINT16,strlen(ZSHORTINT2));
308+
} else {
309+
memcpy(p,REPLACE_INT16,strlen(ZSHORTINT2));
286310
p2 = strstr(line,SIGNED);
287311
if (p2) {
288312
memcpy(p2,SIGNED_BLANK,strlen(SIGNED));

src/mqsmf.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ BOOL printHeaders = TRUE;
121121
BOOL useRDW = TRUE;
122122
BOOL streamOutput = FALSE;
123123
BOOL streamInput = TRUE;
124+
BOOL localTime = TRUE; /* Print timestamps in localtime rather than CUT */
124125
char *ddlTemplateOpen = NULL;
125126
char *ddlTemplateClose = NULL;
126127
char *ddlQuote = "\"";
@@ -246,7 +247,7 @@ int main( int argc, char *argv[] )
246247
/******************************************************************/
247248
/* Parse command-line parameters */
248249
/******************************************************************/
249-
while((c = mqgetopt(argc, argv, "ab:cd:e:f:h:i:m:o:p:rst:vy:")) != EOF)
250+
while((c = mqgetopt(argc, argv, "ab:cd:e:f:g:h:i:m:o:p:rst:vy:")) != EOF)
250251
{
251252
switch(c)
252253
{
@@ -291,6 +292,12 @@ int main( int argc, char *argv[] )
291292
} else if (strstr(mqoptarg,"CSV"))
292293
outputFormat = OF_CSV;
293294
break;
295+
case 'g':
296+
for (i=0;i<strlen(mqoptarg);i++)
297+
mqoptarg[i] = toupper(mqoptarg[i]);
298+
if (!strcmp(mqoptarg,"YES"))
299+
localTime = FALSE;
300+
break;
294301
case 'h':
295302
for (i=0;i<strlen(mqoptarg);i++)
296303
mqoptarg[i] = toupper(mqoptarg[i]);
@@ -1465,12 +1472,13 @@ static void Usage(void)
14651472
fprintf(infoStream," [-b Db2 | MySQL ] \n");
14661473
fprintf(infoStream," [-p <template DDL file prefix> ] \n");
14671474
fprintf(infoStream," [-e <template DDL file ending> ] \n");
1468-
fprintf(infoStream," [-r] [-c] [-t <ticker>] [-y AMS Record Type]\n");
1475+
fprintf(infoStream," [-r] [-c] [-t <ticker>] [-g yes|no] [-y AMS Record Type]\n");
14691476
fprintf(infoStream," -a Append to files if they exist. Default is overwrite.\n");
14701477
fprintf(infoStream," -b <Database> Database DDL format can be Db2 or MySQL. Default is Db2.\n");
14711478
fprintf(infoStream," -c Recover after aborted run by using the checkpoint.\n");
14721479
fprintf(infoStream," -d <Level> Debug by dumping binary records (Level = 1 or 2).\n");
14731480
fprintf(infoStream," -f File formats. Default to RDW for input, CSV for output.\n");
1481+
fprintf(infoStream," -g yes|no Print timestamps in GMT/CUT. Default (no) converts to localtime.\n");
14741482
fprintf(infoStream," -h yes|no Print column headers for new output files. Default is yes.\n");
14751483
fprintf(infoStream," -i <Input file> Default is to read from stdin.\n");
14761484
fprintf(infoStream," -m <Max records> End after formatting M records. Default to process all.\n");

src/mqsmf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ extern char *formatDDL (char *);
218218
extern char *formatDDLMaxLength (char *,int);
219219
extern void addIndex (char *);
220220

221+
extern int fieldWidth(char *strings[]);
222+
221223
extern void jsonNew(FILE *,char *);
222224
extern void jsonDump(FILE *, columnHeader_t **);
223225
extern columnHeader_t *jsonFormatHeader(BOOL,char *);
@@ -512,6 +514,7 @@ extern unsigned char EBCDIC_TO_ASCII[];
512514
extern int debugLevel;
513515
extern BOOL addEquals;
514516
extern BOOL printHeaders;
517+
extern BOOL localTime;
515518
extern unsigned int recordType;
516519
extern unsigned short recordSubType;
517520
extern commonFields_t commonF;

src/mqsmfstrucU.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file was generated from cqsdsmfc.h version 930
2+
* This file was generated from cqsdsmfc.h version 931
33
* by the convH program (convH64.c) in the src directory
44
* Do not try to edit this header manually.
55
*
@@ -638,16 +638,24 @@ uint16_t qqstll;
638638
char qqsteyec[4];
639639
char qqstqnam[48];
640640
uint32_t qqstflag;
641-
signed short int qqstpsid;
642-
signed short int qqstbpid;
641+
int16_t qqstpsid;
642+
int16_t qqstbpid;
643643
char qqstqsgn[4];
644644
char qqstcfst[12];
645-
int32_t qqstdpth;
645+
int32_t qqstdpth;
646+
uint32_t qqstopct;
647+
uint32_t qqstipct;
648+
uint32_t qqstmage;
649+
uint32_t qqstqtst;
650+
uint32_t qqstqtlt;
651+
uint64_t qqstlput;
652+
uint64_t qqstlget;
646653
} qqst;
647654
#define QQSTIDV 0xD80F
648655
#define QQSTEYEV "QQST"
649656
#define QQSTDISP 0x80000000
650657
#define QQSTPART 0x40000000
658+
#define QQSTUNCM 0x20000000
651659
#if defined(__cplusplus)
652660
}
653661
#endif

src/mqsmfstrucW.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file was generated from cqsdsmfc.h version 930
2+
* This file was generated from cqsdsmfc.h version 931
33
* by the convH program (convH64.c) in the src directory
44
* Do not try to edit this header manually.
55
*
@@ -638,16 +638,24 @@ uint16_t qqstll;
638638
char qqsteyec[4];
639639
char qqstqnam[48];
640640
uint32_t qqstflag;
641-
signed short int qqstpsid;
642-
signed short int qqstbpid;
641+
int16_t qqstpsid;
642+
int16_t qqstbpid;
643643
char qqstqsgn[4];
644644
char qqstcfst[12];
645-
int32_t qqstdpth;
645+
int32_t qqstdpth;
646+
uint32_t qqstopct;
647+
uint32_t qqstipct;
648+
uint32_t qqstmage;
649+
uint32_t qqstqtst;
650+
uint32_t qqstqtlt;
651+
uint64_t qqstlput;
652+
uint64_t qqstlget;
646653
} qqst;
647654
#define QQSTIDV 0xD80F
648655
#define QQSTEYEV "QQST"
649656
#define QQSTDISP 0x80000000
650657
#define QQSTPART 0x40000000
658+
#define QQSTUNCM 0x20000000
651659
#if defined(__cplusplus)
652660
}
653661
#endif

src/sizes.master renamed to src/sizes.master.930

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ qlst : 32
1414
qmac : 48
1515
qmst : 104
1616
qpst : 104
17-
qqst : 84
17+
qqst : 84
1818
qsgm : 48
1919
qsph : 88
2020
qsrs : 232

src/sizes.master.931

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
q5st : 672
2+
qcct : 48
3+
qct_dsp : 36
4+
qct_adp : 32
5+
qct_ssl : 48
6+
qct_dns : 48
7+
qcst : 324
8+
qest : 4104
9+
qesd : 336
10+
qist : 80
11+
qis1 : 104
12+
qjst : 596
13+
qlst : 32
14+
qmac : 48
15+
qmst : 104
16+
qpst : 104
17+
qqst : 120
18+
qsgm : 48
19+
qsph : 88
20+
qsrs : 232
21+
qsst : 72
22+
qtst : 96
23+
qwac : 176
24+
qwhc : 92
25+
qwhs : 52
26+
wtas : 2344
27+
wtid : 208
28+
qwst : 28
29+
qws0 : 96
30+
qws1 : 72
31+
qws5 : 16
32+
qws8 : 16
33+
qws9 : 16
34+
qwsx : 48
35+
qwas : 28
36+
qwa0 : 56
37+
wq : 2788
38+
wq->maxqdpth: 588
39+
wq->z__001 : 594
40+
qqst->qqstdpth : 80

src/smfDate.c

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -127,31 +127,42 @@ void convDate(unsigned long long stcki, char *dt[2])
127127
}
128128
else
129129
{
130-
s = stck - EPOCH1970; /* Make relative to our epoch instead of z/OS 1900*/
131-
s = s / 4096; /* Convert stck to microsecs*/
132-
sec = (time_t)(s / 1000000); /* Split into two parts*/
133-
usec = s % 1000000;
130+
s = stck - EPOCH1970; /* Make relative to our epoch instead of z/OS 1900*/
131+
s = s / 4096; /* Convert stck to microsecs*/
132+
sec = (time_t)(s / 1000000); /* Split into two parts*/
133+
usec = s % 1000000;
134134

135-
t = localtime(&sec); /* Turn seconds into tm structure...*/
135+
if (localTime)
136+
{
137+
t = localtime(&sec); /* Turn seconds into tm structure...*/
138+
}
139+
else
140+
{
141+
t = gmtime(&sec);
142+
}
136143

137-
offset1 = strftime(stckDate,sizeof(stckDate)-1,tf.fmtDate,t); /* ...and format it*/
138-
offset2 = strftime(stckTime,sizeof(stckTime)-1,tf.fmtTime,t); /* ...and format it*/
139-
if (offset1 == 0 || offset2 == 0 || stck < EPOCH1970)
140-
{
141-
/***********************************************************************/
142-
/* There seem to be occasions where the timestamp is not a proper */
143-
/* value - perhaps when there has been no work done for the activity */
144-
/* being recorded. So we put a hardcoded value into the string to make */
145-
/* those times (MQ bugs?) easy to recognise. */
146-
/***********************************************************************/
147-
strcpy(stckTime,tf.epochTime);
148-
strcpy(stckDate,tf.epochDate);
149-
}
150-
else
151-
sprintf(&stckTime[offset2],"%s%6.6d%s",tf.decimal,usec,(outputFormat==OF_JSON)?"":"\""); /* Add on usec value*/
144+
offset1 = strftime(stckDate,sizeof(stckDate)-1,tf.fmtDate,t); /* ...and format it*/
145+
offset2 = strftime(stckTime,sizeof(stckTime)-1,tf.fmtTime,t); /* ...and format it*/
146+
if (offset1 == 0 || offset2 == 0 || stck < EPOCH1970)
147+
{
148+
/***********************************************************************/
149+
/* There seem to be occasions where the timestamp is not a proper */
150+
/* value - perhaps when there has been no work done for the activity */
151+
/* being recorded. So we put a hardcoded value into the string to make */
152+
/* those times (MQ bugs?) easy to recognise. */
153+
/***********************************************************************/
154+
strcpy(stckTime,tf.epochTime);
155+
strcpy(stckDate,tf.epochDate);
156+
}
157+
else
158+
{
159+
sprintf(&stckTime[offset2],"%s%6.6d%s",tf.decimal,usec,(outputFormat==OF_JSON)?"":"\""); /* Add on usec value*/
160+
}
152161
}
162+
153163
dt[0] = stckDate;
154164
dt[1] = stckTime;
165+
155166
return;
156167
}
157168

@@ -166,9 +177,9 @@ void calcYMD(int year,int dayOfYear,int *mon,int *day)
166177
int isLeapYear = FALSE;
167178
int i;
168179

169-
if (((year % 4 == 0) &&
170-
(year % 100 != 0)) ||
171-
(year % 400 == 0))
180+
if (((year % 4 == 0) &&
181+
(year % 100 != 0)) ||
182+
(year % 400 == 0))
172183
isLeapYear = TRUE;
173184

174185
if (isLeapYear)

src/smfPrint.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,20 @@ void smfPrintStop(FILE *fp, BOOL newFile, BOOL *first, columnHeader_t **h)
274274
break;
275275
}
276276
}
277+
278+
279+
int fieldWidth(char *s[])
280+
{
281+
int rc = 0;
282+
int idx = 0;
283+
int l = 0;
284+
while (s[idx])
285+
{
286+
l = strlen(s[idx++]);
287+
if (l > rc)
288+
{
289+
rc = l;
290+
}
291+
}
292+
return rc;
293+
}

0 commit comments

Comments
 (0)