Skip to content

Commit 710f61f

Browse files
committed
Initial drop
1 parent b131901 commit 710f61f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3777
-0
lines changed

CLA.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
IBM Contributor License Agreement
2+
=================================
3+
4+
Version 1.0.0 January 14, 2014
5+
6+
In order for You (as defined below) to make intellectual property Contributions (as defined below) now or in the future to IBM GitHub repositories,
7+
You must agree to this Contributor License Agreement ("CLA").
8+
9+
Please read this CLA carefully before accepting its terms. By accepting the CLA, You are agreeing to be bound by its terms.
10+
If You submit a Pull Request against an IBM repository on GitHub You must include in the Pull Request a statement of Your acceptance of this CLA.
11+
12+
As used in this CLA:
13+
(i) "You" (or "Your") shall mean the entity that is making this Agreement with IBM;
14+
(ii)"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is submitted by You to IBM for inclusion in,
15+
or documentation of, any of the IBM GitHub repositories;
16+
(iii) "Submit" (or "Submitted") means any form of communication sent to IBM (e.g. the content You post in a GitHub Issue or submit as part of a GitHub Pull Request).
17+
18+
This agreement applies to all Contributions You Submit.
19+
20+
This CLA, and the license(s) associated with the particular IBM GitHub repositories You are contributing to, provides a license to Your Contributions to IBM and downstream consumers,
21+
but You still own Your Contributions, and except for the licenses provided for in this CLA, You reserve all right, title and interest in Your Contributions.
22+
23+
IBM requires that each Contribution You Submit now or in the future comply with the following four commitments.
24+
25+
1) You will only Submit Contributions where You have authored 100% of the content.
26+
2) You will only Submit Contributions to which You have the necessary rights. This means that if You are employed You have received the necessary permissions from Your employer to make the
27+
Contributions.
28+
3) Whatever content You Contribute will be provided under the license(s) associated with the particular IBM GitHub repository You are contributing to.
29+
4) You understand and agree that IBM GitHub repositories and Your contributions are public, and that a record of the contribution (including all personal information You submit with it)
30+
is maintained indefinitely and may be redistributed consistent with the license(s) involved.
31+
You will promptly notify the Eclipse Foundation if You become aware of any facts or circumstances that would make these commitments inaccurate in any way.
32+
To do so, please create an Issue in the appropriate GitHub repository.

README.txt

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
README for mqsmfcsv
2+
===================
3+
4+
This package has been created to simplify the job
5+
of doing your own analysis of MQ SMF records from a z/OS system,
6+
by making it easy to import formatted records into
7+
a database or spreadsheet.
8+
9+
The program takes the data from a z/OS file, and runs on
10+
a Windows or Unix system, creating standard CSV
11+
(comma-separated value) output files.
12+
13+
Unlike packages such as SupportPac MP1B, there is no interpretation
14+
at all of the SMF data. That can be done by your own spreadsheet or
15+
database programs and macros.
16+
17+
This makes the code for the program
18+
very easy to understand; all the structures in the SMF records
19+
are printed directly.
20+
21+
22+
Usage
23+
=====
24+
Collect the MQ SMF data in the usual way.
25+
Dump that data to a z/OS file using a tool such as ...
26+
Then download that file to
27+
28+
The output files are written to a directory that you name
29+
on the command line. There is one file for each type of
30+
element - QPST, WTID etc. The files contain a line of
31+
column headers, followed by the actual data with each
32+
field separated by a comma. Spreadsheets such as LibreOffice
33+
or Excel can then import the data directly.
34+
35+
No attempt is made to explain the column headers; these come
36+
straight from the field names. More information can be found in
37+
the csqdsmfc.h header file or the product documentation.
38+
39+
Date and time are split into separate columns; the time
40+
includes a microsecond portion which is separated using ',' as using '.'
41+
as the decimal point seems to confuse the automatic importers on
42+
several spreadsheets. There is no information directly available about
43+
timezone offsets, so it is possible that the timestamps could be either
44+
GMT (CUT) or localtime, depending on system configurations.
45+
46+
Durations are split into separate columns for
47+
seconds and microseconds. This is shown in the column headings.
48+
49+
Options
50+
=======
51+
52+
printf("Usage: mqsmfcsv [-o <output dir>] [-a] [ -d <level> ]\n");
53+
printf(" [ -i <input file> [-m <max records>] [-r ] [-t <ticker>]\n");
54+
printf(" -a Append to existing files if they exist. Default is overwrite\n");
55+
printf(" -d <level> Debug by dumping binary records (level = 1 or 2)\n");
56+
printf(" -i <Input file> Default is to read from stdin\n");
57+
printf(" -m <Max records> End after formatting M records. Default to process all\n");
58+
printf(" -o <Directory> Where to put output files\n");
59+
printf(" -r Do not print '=' on numeric-looking strings\n");
60+
printf(" -t <Ticker> Print progress message every T records\n");
61+
62+
Design and Development
63+
======================
64+
65+
Binaries are provided for some platforms. For other
66+
platforms, you will need to compile the code yourself.
67+
Familiarity with Makefiles and compiling C programs is
68+
assumed.
69+
70+
First, you need to get a copy of the MQ product-provided
71+
header file on z/OS that defines the structures for SMF
72+
elements. This is called csqdsmfc.h and can be found on your
73+
z/OS installation. Download a copy of that to your system.
74+
75+
Using the provided Makefiles as a template, set the
76+
appropriate compilation options for your platform.
77+
For Unix platforms, the "M" script may be a convenient
78+
way to override options in the Makefile, as most Unix
79+
platforms are likely to be very similar in how to build
80+
programs.
81+
82+
The Makefiles take the z/OS header file and make some
83+
minor transformations so that it is suitable for
84+
compiling on other platforms.
85+
86+
Note that the mqsmfcsv program needs to be compiled with
87+
fixed datatype sizes - in particular, "int" is 32-bit, and
88+
"long long" is used to represent a 64-bit value. Generally
89+
this means that the program itself is compiled as 32-bit.
90+
91+
The current version of this program was developed based on the
92+
MQ V8 SMF structures; it will run against data
93+
generated by older queue managers
94+
but will not compile if an older version of csqdsmfc.h is used.
95+
96+
Each data structure is formatted by its own function, contained in
97+
the print*.c modules. Most of these are very straightforward to
98+
understand. Some common macros defined in mqsmf.h make it
99+
easy to add each field from the structure; they also simplify handling
100+
common fields that need to be printed on every type of SMF element.
101+
102+
A few special cases exist, such as handling bitfields or arrays. But
103+
again, the code where these are used ought to be obvious, and can be
104+
used as strategies for handling new types of SMF element.
105+
106+
Sample data
107+
===========
108+
The package includes a tiny amount of sample data that can be used to
109+
demonstrate the formatting.
110+
111+
112+
113+
downloading ...
114+
115+
116+
Sequential, Variable Length Records
117+
118+
The following is a sample FTP script to retrieve (or GET) a sequential file with variable-length records from a Mainframe system to a Windows system. This FTP script is for using at the client or Windows system.
119+
120+
userid
121+
password
122+
CD ..
123+
PWD
124+
BINARY
125+
QUOTE SITE RDW
126+
GET mainframe.dataset.name drive:\directory\filename.ext
127+
QUIT
128+
129+
The file must be transferred in BINARY. This will maintain the EBCDIC-encoding and the mainframe
130+
numeric formats for packed-decimal, binary and zoned-decimal data.
131+
132+
One of the following FTP statements must be used prior to a GET or PUT statement in order to
133+
download the Record-Descriptor-Word (RDW) and the possible Block-Descriptor-Word (BDW). The BDW and
134+
RDW are in binary format so it is critical to download in binary even if the records in the file
135+
are all text strings. Prior to a GET use one of the following statements.
136+
QUOTE SITE RDW
137+
or
138+
LITERAL SITE RDW
139+
140+
If the FTP process is to be executed on the mainframe the GET statement will need to be replaced
141+
with a PUT and the QUOTE or LITERAL statement will need to be replaced with the following statement.
142+
143+
LOCSITE RDW
144+
145+
Once the file is transferred it is a mirror of the mainframe format with EBCDIC-encoding. Each
146+
record is preceded by the Record Descriptor Word (RDW) and possible Block Descriptor Word (BDW) and
147+
must be converted to a Micro Focus formatted sequential file with variable length records. This
148+
process is described in the following sections of this document.

bin/aix/convH

5.88 KB
Binary file not shown.

bin/aix/mqsmfcsv

397 KB
Binary file not shown.

bin/linux/convH

8.7 KB
Binary file not shown.

bin/linux/mqsmfcsv

242 KB
Binary file not shown.

bin/win/convH.exe

60.5 KB
Binary file not shown.

bin/win/mqsmfcsv.exe

427 KB
Binary file not shown.

src/M

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/ksh
2+
3+
plat=`uname`
4+
5+
if [ "$plat" = "AIX" ]
6+
then
7+
flags="-q32 "
8+
cc="xlc"
9+
else
10+
flags="-m32 "
11+
cc="gcc"
12+
fi
13+
14+
export PLATFLAGS=$flags CC=$cc
15+
make -e -f Makefile.unix $*
16+
17+

src/Makefile.unix

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
CC=cc
3+
CFLAGS= -I.
4+
PLATFLAGS=
5+
SRC = mqsmf.c \
6+
smfDate.c \
7+
smfConv.c \
8+
printDEBUG.c \
9+
printQ5ST.c \
10+
printQCST.c \
11+
printQCTADP.c \
12+
printQCTDNS.c \
13+
printQCTDSP.c \
14+
printQCTSSL.c \
15+
printQCCT.c \
16+
printQESD.c \
17+
printQEST.c \
18+
printQIST.c \
19+
printQJST.c \
20+
printQLST.c \
21+
printQMAC.c \
22+
printQMST.c \
23+
printQPST.c \
24+
printQSGM.c \
25+
printQSPH.c \
26+
printQSRS.c \
27+
printQSST.c \
28+
printQTST.c \
29+
printWQ.c \
30+
printWTAS.c \
31+
printWTID.c
32+
33+
HDR = mqsmfstruc.h \
34+
mqsmf.h
35+
36+
mqsmfcsv: $(SRC) $(HDR) Makefile.unix dummy
37+
$(CC) $(PLATFLAGS) -o $@ $(SRC) $(CFLAGS)
38+
-rm -f out/*
39+
-rm -f SMF-*
40+
-mkdir out >/dev/null 2>&1 || true
41+
$@ -i data/TEST116.dat -o out -m 200 -d 2
42+
$@ -i data/TEST115.dat -o out -a -d 2
43+
44+
mqsmfstruc.h: csqdsmfc.h convH
45+
convH < csqdsmfc.h > $@
46+
47+
convH: convH.c
48+
$(CC) -o $@ convH.c
49+
50+
51+
dummy:

src/Makefile.win

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
CFLAGS=-nologo /D_CRT_SECURE_NO_WARNINGS /Zp1 /J
2+
SRC = mqsmf.c \
3+
smfDate.c \
4+
smfConv.c \
5+
printDEBUG.c \
6+
printQ5ST.c \
7+
printQCST.c \
8+
printQCCT.c \
9+
printQCTADP.c\
10+
printQCTDNS.c\
11+
printQCTDSP.c\
12+
printQCTSSL.c\
13+
printQESD.c \
14+
printQEST.c \
15+
printQIST.c \
16+
printQJST.c \
17+
printQLST.c \
18+
printQMAC.c \
19+
printQMST.c \
20+
printQPST.c \
21+
printQSGM.c \
22+
printQSPH.c \
23+
printQSRS.c \
24+
printQSST.c \
25+
printQTST.c \
26+
printWQ.c \
27+
printWTAS.c \
28+
printWTID.c
29+
30+
HDR = mqsmfstruc.h \
31+
mqsmf.h
32+
33+
INDIR=y:\\metaylor\\mf\\L\\smf
34+
# INDIR=c:\\temp
35+
OUTDIR=c:\\temp\\smf
36+
37+
mqsmfcsv.exe: $(SRC) $(HDR) Makefile.win dummy
38+
rm -f $@
39+
$(CC) $(SRC) -I. /Fe$@ $(CFLAGS)
40+
$(INDIR)\\test
41+
cd $(INDIR)
42+
del /q *.obj
43+
44+
mqsmfstruc.h: csqdsmfc.h convH
45+
convH < csqdsmfc.h > $@
46+
47+
convH: convH.c
48+
$(CC) /Fe$@ convH.c
49+
50+
51+
dummy:
52+

src/convH.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright (c) 2016 IBM Corporation and other Contributors.
3+
*
4+
* All rights reserved. This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License v1.0
6+
* which accompanies this distribution, and is available at
7+
* http://www.eclipse.org/legal/epl-v10.html
8+
*
9+
* Contributors:
10+
* Mark Taylor - Initial Contribution
11+
*/
12+
13+
#include <stdio.h>
14+
#include <string.h>
15+
16+
/*
17+
* This is a very simple filter to take the product-provided
18+
* header file from z/OS and strip a few things that are
19+
* problematic on other platform compilers.
20+
*
21+
* It means we don't need to keep a variant copy
22+
* of the header in sync when new versions come out.
23+
*
24+
* In particular, get rid of the z/OS format for
25+
* the pragmas, and also the trigraph at the top
26+
* of the file.
27+
*
28+
* If the contents of the header file change, this
29+
* filter may need to be updated to match.
30+
*/
31+
int main(int argc, char **argv)
32+
{
33+
char line[256] = {0};
34+
char *c;
35+
36+
/******************************************************/
37+
/* Need a portable pragma that works on all platforms */
38+
/******************************************************/
39+
printf("#pragma pack(1)\n");
40+
41+
/******************************************************/
42+
/* Then copy stdin to stdout, stripping just a few */
43+
/* lines. */
44+
/******************************************************/
45+
do
46+
{
47+
c = fgets(line,sizeof(line)-1,stdin);
48+
if (c)
49+
{
50+
if (strstr(line,"pragma"))
51+
continue;
52+
/****************************************************/
53+
/* Can't just put "??=" in here as it's converted */
54+
/* into a trigraph and no longer matches. */
55+
/****************************************************/
56+
else if (strstr(line,"\?\?="))
57+
continue;
58+
else
59+
{
60+
printf(line);
61+
if (line[strlen(line)-1] != '\n')
62+
printf("\n");
63+
}
64+
}
65+
} while (c);
66+
67+
fflush(stdout);
68+
return 0;
69+
}

src/m.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PATH=%PATH%;c:\program files (x86)\microsoft visual studio 11.0\vc
2+
vcvarsall
3+
nmake -f Makefile.win

0 commit comments

Comments
 (0)