Skip to content

Commit

Permalink
Updates for MQ 9.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ibmmqmet committed Oct 17, 2022
1 parent d2f7e7a commit 5ddf434
Show file tree
Hide file tree
Showing 21 changed files with 207 additions and 52 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
History (newest at top)
=======================

Oct 2022 (v5.4.1)
* Update for MQ V9.3.1
* Extended QQST structure in the 115 records
* Add config option (-g) to print timestamps in GMT.
* Default prints as localtime

Jul 2022 (v5.4)
* Update for MQ V9.3.0
* New QQST structure in the 115 records
Expand Down
Binary file modified bin/aix/convH
Binary file not shown.
Binary file modified bin/aix/mqsmfcsv
Binary file not shown.
Binary file modified bin/linux/convH
Binary file not shown.
Binary file modified bin/linux/mqsmfcsv
Binary file not shown.
Binary file modified bin/win/convH.exe
Binary file not shown.
Binary file modified bin/win/mqsmfcsv.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion src/M
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plat=`uname`

if [ -z "$VERS" ]
then
VERS="930"
VERS="931"
fi

if [ "$plat" = "AIX" ]
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.gcc.win
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CC=i686-w64-mingw32-gcc
# CFLAGS= -I. -m32 -fpack-struct=8 -DPLATFORM_WINDOWS
CFLAGS= -I. -m32 -DPLATFORM_WINDOWS
PLATFLAGS=
VERS=930
VERS=931
SRC = mqsmf.c \
smfDDL.c \
smfDate.c \
Expand Down Expand Up @@ -54,7 +54,7 @@ all: sizeTest shipTest

sizeTest: mqsmfcsv.exe
./mqsmfcsv.exe -v > sizes.tmp
diff -b sizes.tmp sizes.master
diff -b sizes.tmp sizes.master.$(VERS)

shipTest: mqsmfcsv.exe
cd ../testing/shipTest;./shipTest.sh csv sql json
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.unix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ tests: all

sizeTest: mqsmfcsv
./mqsmfcsv -v > sizes.tmp
diff -b sizes.tmp sizes.master
diff -b sizes.tmp sizes.master.$(VERS)

shipTest: mqsmfcsv
cd ../testing/shipTest;./shipTest.sh csv sql json
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CFLAGS=-nologo /D_CRT_SECURE_NO_WARNINGS /Zp1 /J /O2 /DPLATFORM_WINDOWS
VERS=930
VERS=931
SRC = mqsmf.c \
smfDDL.c \
smfDate.c \
Expand Down Expand Up @@ -46,7 +46,7 @@ HDR = mqsmfstrucW.h \

checkSize: mqsmfcsv.exe
mqsmfcsv.exe -v > sizes.tmp
diff -b sizes.master sizes.tmp
diff -b sizes.tmp sizes.master.$(VERS)

mqsmfcsv.exe: $(SRC) $(HDR) Makefile.win
rm -f $@
Expand Down
32 changes: 28 additions & 4 deletions src/convH64.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
/* breaking compilation or the sizeTest build rule. */
/**********************************************************************/
#define ZLONGLONG "long long "
#define ZSHORTINT "short int "
#define ZSHORTINT1 "short int "
#define ZSHORTINT2 "short int " /* one version of the header had extra spaces */
#define ZEXTRAINT " int "
#define ZLONGINT1 "long int "
#define ZLONGINT2 "long int "
Expand Down Expand Up @@ -275,14 +276,37 @@ void datatypeReplace(char *line) {
}

/* And then the "short" ones */
p = strstr(line,ZSHORTINT);
p = strstr(line,ZSHORTINT1);
if (p) {
p2 = strstr(line,UNSIGNED);
if (p2) {
memcpy(p2,UNSIGNED_BLANK,strlen(UNSIGNED));
memcpy(p,REPLACE_UINT16,strlen(ZSHORTINT));
memcpy(p,REPLACE_UINT16,strlen(ZSHORTINT1));
} else {
memcpy(p,REPLACE_INT16,strlen(ZSHORTINT));
memcpy(p,REPLACE_INT16,strlen(ZSHORTINT1));
p2 = strstr(line,SIGNED);
if (p2) {
memcpy(p2,SIGNED_BLANK,strlen(SIGNED));
}
}

/*************************************************************/
/* We may now have a line "uint16_t int qwsx0r5n" so get rid */
/* of the extraneous "int" */
/*************************************************************/
p = strstr(line,ZEXTRAINT);
if (p) {
memcpy(p,REPLACE_EXTRAINT,strlen(ZEXTRAINT));
}
}
p = strstr(line,ZSHORTINT2);
if (p) {
p2 = strstr(line,UNSIGNED);
if (p2) {
memcpy(p2,UNSIGNED_BLANK,strlen(UNSIGNED));
memcpy(p,REPLACE_UINT16,strlen(ZSHORTINT2));
} else {
memcpy(p,REPLACE_INT16,strlen(ZSHORTINT2));
p2 = strstr(line,SIGNED);
if (p2) {
memcpy(p2,SIGNED_BLANK,strlen(SIGNED));
Expand Down
12 changes: 10 additions & 2 deletions src/mqsmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ BOOL printHeaders = TRUE;
BOOL useRDW = TRUE;
BOOL streamOutput = FALSE;
BOOL streamInput = TRUE;
BOOL localTime = TRUE; /* Print timestamps in localtime rather than CUT */
char *ddlTemplateOpen = NULL;
char *ddlTemplateClose = NULL;
char *ddlQuote = "\"";
Expand Down Expand Up @@ -246,7 +247,7 @@ int main( int argc, char *argv[] )
/******************************************************************/
/* Parse command-line parameters */
/******************************************************************/
while((c = mqgetopt(argc, argv, "ab:cd:e:f:h:i:m:o:p:rst:vy:")) != EOF)
while((c = mqgetopt(argc, argv, "ab:cd:e:f:g:h:i:m:o:p:rst:vy:")) != EOF)
{
switch(c)
{
Expand Down Expand Up @@ -291,6 +292,12 @@ int main( int argc, char *argv[] )
} else if (strstr(mqoptarg,"CSV"))
outputFormat = OF_CSV;
break;
case 'g':
for (i=0;i<strlen(mqoptarg);i++)
mqoptarg[i] = toupper(mqoptarg[i]);
if (!strcmp(mqoptarg,"YES"))
localTime = FALSE;
break;
case 'h':
for (i=0;i<strlen(mqoptarg);i++)
mqoptarg[i] = toupper(mqoptarg[i]);
Expand Down Expand Up @@ -1465,12 +1472,13 @@ static void Usage(void)
fprintf(infoStream," [-b Db2 | MySQL ] \n");
fprintf(infoStream," [-p <template DDL file prefix> ] \n");
fprintf(infoStream," [-e <template DDL file ending> ] \n");
fprintf(infoStream," [-r] [-c] [-t <ticker>] [-y AMS Record Type]\n");
fprintf(infoStream," [-r] [-c] [-t <ticker>] [-g yes|no] [-y AMS Record Type]\n");
fprintf(infoStream," -a Append to files if they exist. Default is overwrite.\n");
fprintf(infoStream," -b <Database> Database DDL format can be Db2 or MySQL. Default is Db2.\n");
fprintf(infoStream," -c Recover after aborted run by using the checkpoint.\n");
fprintf(infoStream," -d <Level> Debug by dumping binary records (Level = 1 or 2).\n");
fprintf(infoStream," -f File formats. Default to RDW for input, CSV for output.\n");
fprintf(infoStream," -g yes|no Print timestamps in GMT/CUT. Default (no) converts to localtime.\n");
fprintf(infoStream," -h yes|no Print column headers for new output files. Default is yes.\n");
fprintf(infoStream," -i <Input file> Default is to read from stdin.\n");
fprintf(infoStream," -m <Max records> End after formatting M records. Default to process all.\n");
Expand Down
3 changes: 3 additions & 0 deletions src/mqsmf.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ extern char *formatDDL (char *);
extern char *formatDDLMaxLength (char *,int);
extern void addIndex (char *);

extern int fieldWidth(char *strings[]);

extern void jsonNew(FILE *,char *);
extern void jsonDump(FILE *, columnHeader_t **);
extern columnHeader_t *jsonFormatHeader(BOOL,char *);
Expand Down Expand Up @@ -512,6 +514,7 @@ extern unsigned char EBCDIC_TO_ASCII[];
extern int debugLevel;
extern BOOL addEquals;
extern BOOL printHeaders;
extern BOOL localTime;
extern unsigned int recordType;
extern unsigned short recordSubType;
extern commonFields_t commonF;
Expand Down
16 changes: 12 additions & 4 deletions src/mqsmfstrucU.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file was generated from cqsdsmfc.h version 930
* This file was generated from cqsdsmfc.h version 931
* by the convH program (convH64.c) in the src directory
* Do not try to edit this header manually.
*
Expand Down Expand Up @@ -638,16 +638,24 @@ uint16_t qqstll;
char qqsteyec[4];
char qqstqnam[48];
uint32_t qqstflag;
signed short int qqstpsid;
signed short int qqstbpid;
int16_t qqstpsid;
int16_t qqstbpid;
char qqstqsgn[4];
char qqstcfst[12];
int32_t qqstdpth;
int32_t qqstdpth;
uint32_t qqstopct;
uint32_t qqstipct;
uint32_t qqstmage;
uint32_t qqstqtst;
uint32_t qqstqtlt;
uint64_t qqstlput;
uint64_t qqstlget;
} qqst;
#define QQSTIDV 0xD80F
#define QQSTEYEV "QQST"
#define QQSTDISP 0x80000000
#define QQSTPART 0x40000000
#define QQSTUNCM 0x20000000
#if defined(__cplusplus)
}
#endif
Expand Down
16 changes: 12 additions & 4 deletions src/mqsmfstrucW.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file was generated from cqsdsmfc.h version 930
* This file was generated from cqsdsmfc.h version 931
* by the convH program (convH64.c) in the src directory
* Do not try to edit this header manually.
*
Expand Down Expand Up @@ -638,16 +638,24 @@ uint16_t qqstll;
char qqsteyec[4];
char qqstqnam[48];
uint32_t qqstflag;
signed short int qqstpsid;
signed short int qqstbpid;
int16_t qqstpsid;
int16_t qqstbpid;
char qqstqsgn[4];
char qqstcfst[12];
int32_t qqstdpth;
int32_t qqstdpth;
uint32_t qqstopct;
uint32_t qqstipct;
uint32_t qqstmage;
uint32_t qqstqtst;
uint32_t qqstqtlt;
uint64_t qqstlput;
uint64_t qqstlget;
} qqst;
#define QQSTIDV 0xD80F
#define QQSTEYEV "QQST"
#define QQSTDISP 0x80000000
#define QQSTPART 0x40000000
#define QQSTUNCM 0x20000000
#if defined(__cplusplus)
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/sizes.master → src/sizes.master.930
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ qlst : 32
qmac : 48
qmst : 104
qpst : 104
qqst : 84
qqst : 84
qsgm : 48
qsph : 88
qsrs : 232
Expand Down
40 changes: 40 additions & 0 deletions src/sizes.master.931
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
q5st : 672
qcct : 48
qct_dsp : 36
qct_adp : 32
qct_ssl : 48
qct_dns : 48
qcst : 324
qest : 4104
qesd : 336
qist : 80
qis1 : 104
qjst : 596
qlst : 32
qmac : 48
qmst : 104
qpst : 104
qqst : 120
qsgm : 48
qsph : 88
qsrs : 232
qsst : 72
qtst : 96
qwac : 176
qwhc : 92
qwhs : 52
wtas : 2344
wtid : 208
qwst : 28
qws0 : 96
qws1 : 72
qws5 : 16
qws8 : 16
qws9 : 16
qwsx : 48
qwas : 28
qwa0 : 56
wq : 2788
wq->maxqdpth: 588
wq->z__001 : 594
qqst->qqstdpth : 80
57 changes: 34 additions & 23 deletions src/smfDate.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,31 +127,42 @@ void convDate(unsigned long long stcki, char *dt[2])
}
else
{
s = stck - EPOCH1970; /* Make relative to our epoch instead of z/OS 1900*/
s = s / 4096; /* Convert stck to microsecs*/
sec = (time_t)(s / 1000000); /* Split into two parts*/
usec = s % 1000000;
s = stck - EPOCH1970; /* Make relative to our epoch instead of z/OS 1900*/
s = s / 4096; /* Convert stck to microsecs*/
sec = (time_t)(s / 1000000); /* Split into two parts*/
usec = s % 1000000;

t = localtime(&sec); /* Turn seconds into tm structure...*/
if (localTime)
{
t = localtime(&sec); /* Turn seconds into tm structure...*/
}
else
{
t = gmtime(&sec);
}

offset1 = strftime(stckDate,sizeof(stckDate)-1,tf.fmtDate,t); /* ...and format it*/
offset2 = strftime(stckTime,sizeof(stckTime)-1,tf.fmtTime,t); /* ...and format it*/
if (offset1 == 0 || offset2 == 0 || stck < EPOCH1970)
{
/***********************************************************************/
/* There seem to be occasions where the timestamp is not a proper */
/* value - perhaps when there has been no work done for the activity */
/* being recorded. So we put a hardcoded value into the string to make */
/* those times (MQ bugs?) easy to recognise. */
/***********************************************************************/
strcpy(stckTime,tf.epochTime);
strcpy(stckDate,tf.epochDate);
}
else
sprintf(&stckTime[offset2],"%s%6.6d%s",tf.decimal,usec,(outputFormat==OF_JSON)?"":"\""); /* Add on usec value*/
offset1 = strftime(stckDate,sizeof(stckDate)-1,tf.fmtDate,t); /* ...and format it*/
offset2 = strftime(stckTime,sizeof(stckTime)-1,tf.fmtTime,t); /* ...and format it*/
if (offset1 == 0 || offset2 == 0 || stck < EPOCH1970)
{
/***********************************************************************/
/* There seem to be occasions where the timestamp is not a proper */
/* value - perhaps when there has been no work done for the activity */
/* being recorded. So we put a hardcoded value into the string to make */
/* those times (MQ bugs?) easy to recognise. */
/***********************************************************************/
strcpy(stckTime,tf.epochTime);
strcpy(stckDate,tf.epochDate);
}
else
{
sprintf(&stckTime[offset2],"%s%6.6d%s",tf.decimal,usec,(outputFormat==OF_JSON)?"":"\""); /* Add on usec value*/
}
}

dt[0] = stckDate;
dt[1] = stckTime;

return;
}

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

if (((year % 4 == 0) &&
(year % 100 != 0)) ||
(year % 400 == 0))
if (((year % 4 == 0) &&
(year % 100 != 0)) ||
(year % 400 == 0))
isLeapYear = TRUE;

if (isLeapYear)
Expand Down
17 changes: 17 additions & 0 deletions src/smfPrint.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,20 @@ void smfPrintStop(FILE *fp, BOOL newFile, BOOL *first, columnHeader_t **h)
break;
}
}


int fieldWidth(char *s[])
{
int rc = 0;
int idx = 0;
int l = 0;
while (s[idx])
{
l = strlen(s[idx++]);
if (l > rc)
{
rc = l;
}
}
return rc;
}
Loading

0 comments on commit 5ddf434

Please sign in to comment.