Skip to content

Commit ec0cd12

Browse files
committed
Add cpvbuss tool to convert z/OS VBS to USS file format
1 parent dc550f9 commit ec0cd12

File tree

10 files changed

+99
-1
lines changed

10 files changed

+99
-1
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,6 @@ May 2018 (v4.1.0)
7777
Jun 2018 (v4.2.0)
7878
* Visual Studio 2017 compiler warnings fixed
7979
* -f sql was not setting correct internal flags
80+
81+
Jul 2018 (v4.3.0)
82+
* Add command for converting VBS dataset to USS on z/OS

bin/aix/convH

0 Bytes
Binary file not shown.

bin/aix/mqsmfcsv

0 Bytes
Binary file not shown.

bin/linux/convH

48 Bytes
Binary file not shown.

bin/linux/mqsmfcsv

20 Bytes
Binary file not shown.

bin/win/mqsmfcsv.exe

-77 KB
Binary file not shown.

mqsmfcsv.doc

2.5 KB
Binary file not shown.

src/cpvbuss

76 KB
Binary file not shown.

src/cpvbuss.c

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright (c) 2016,2018 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+
* Douglas Burns
11+
*/
12+
13+
/***************************************************************************/
14+
/* This program is to be run on z/OS if the file transfer mechanism to get */
15+
/* the SMF data to the workstation platform does not support VBS datasets. */
16+
/* */
17+
/* For example sftp works from USS files and the SMF dataset needs to be */
18+
/* converted before sftp can process the z/OS file. */
19+
/***************************************************************************/
20+
#include <stdio.h>
21+
#include <unistd.h>
22+
23+
#define BUFFERLENGTH 10485760 /* Max length of record accepted */
24+
25+
/**********************************************************************/
26+
/* Function name: main */
27+
/* */
28+
/* Description: Reads the specified dataset and writes the */
29+
/* contents */
30+
/* */
31+
/* Receives: Two parameters - SMF VBS dataset to read */
32+
/* USS file to write */
33+
/* */
34+
/* */
35+
/**********************************************************************/
36+
int main(int argc, char *argv[] )
37+
{
38+
char inputDatasetName[4096];
39+
char escapedInputDatasetName[4096];
40+
char outputFileName[4096];
41+
42+
FILE *inputFile;
43+
FILE *outputFile;
44+
45+
char databuffer[BUFFERLENGTH];
46+
47+
int dataLength = 0;
48+
int recordCount = 0;
49+
50+
/* */
51+
/* Handle the arguments passed */
52+
/* */
53+
if (argc < 3) { /* need prog name + two parm */
54+
printf("\n%s called with incorrect arguments\n",argv[0] );
55+
printf(" expected parms are DATASETNAME FILENAME\n ");
56+
printf(" where\n");
57+
printf(" DATASETNAME = name of input dataset\n");
58+
printf(" FILENAME = name of output file\n");
59+
return(4);
60+
}
61+
strcpy(inputDatasetName, argv[1]);
62+
strcpy(outputFileName, argv[2]);
63+
64+
strcpy(escapedInputDatasetName, "//'");
65+
strcat(escapedInputDatasetName, inputDatasetName);
66+
strcat(escapedInputDatasetName, "'");
67+
68+
/* Open input file */
69+
if ((inputFile = fopen(escapedInputDatasetName, "rb, type=record, recfm=*")) == NULL) {
70+
printf("Could not open dataset: %S\n", inputDatasetName);
71+
return(4);
72+
}
73+
74+
/* Open output file */
75+
if ((outputFile = fopen(outputFileName, "wb")) == NULL) {
76+
printf("Could not open file: %S\n", outputFileName);
77+
return(4);
78+
}
79+
80+
/* Read in the data */
81+
while (dataLength = fread(&databuffer, 1, BUFFERLENGTH, inputFile)) {
82+
recordCount++;
83+
84+
/* Write the data */
85+
fwrite(&databuffer, 1, dataLength, outputFile);
86+
}
87+
88+
/* Close files */
89+
fclose(inputFile);
90+
fclose(outputFile);
91+
92+
printf("\n *** %d records written. ***\n", recordCount);
93+
94+
printf("\n");
95+
}

src/smfDDL.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void closeDDL(char *name)
111111
{
112112
char *c = indexSet[i];
113113
if (c) {
114-
fprintf(fp,"CREATE INDEX %s_%s ON %s.%s(%s);\n",name,c,schema,name,c);
114+
fprintf(fp,"CREATE INDEX %s.%s_%s ON %s.%s(%s);\n",schema,name,c,schema,name,c);
115115
}
116116
}
117117
fprintf(fp,"\n");

0 commit comments

Comments
 (0)