Skip to content

Commit

Permalink
Add cpvbuss tool to convert z/OS VBS to USS file format
Browse files Browse the repository at this point in the history
  • Loading branch information
ibmmqmet committed Jul 18, 2018
1 parent dc550f9 commit ec0cd12
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ May 2018 (v4.1.0)
Jun 2018 (v4.2.0)
* Visual Studio 2017 compiler warnings fixed
* -f sql was not setting correct internal flags

Jul 2018 (v4.3.0)
* Add command for converting VBS dataset to USS on z/OS
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/mqsmfcsv.exe
Binary file not shown.
Binary file modified mqsmfcsv.doc
Binary file not shown.
Binary file added src/cpvbuss
Binary file not shown.
95 changes: 95 additions & 0 deletions src/cpvbuss.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright (c) 2016,2018 IBM Corporation and other Contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Douglas Burns
*/

/***************************************************************************/
/* This program is to be run on z/OS if the file transfer mechanism to get */
/* the SMF data to the workstation platform does not support VBS datasets. */
/* */
/* For example sftp works from USS files and the SMF dataset needs to be */
/* converted before sftp can process the z/OS file. */
/***************************************************************************/
#include <stdio.h>
#include <unistd.h>

#define BUFFERLENGTH 10485760 /* Max length of record accepted */

/**********************************************************************/
/* Function name: main */
/* */
/* Description: Reads the specified dataset and writes the */
/* contents */
/* */
/* Receives: Two parameters - SMF VBS dataset to read */
/* USS file to write */
/* */
/* */
/**********************************************************************/
int main(int argc, char *argv[] )
{
char inputDatasetName[4096];
char escapedInputDatasetName[4096];
char outputFileName[4096];

FILE *inputFile;
FILE *outputFile;

char databuffer[BUFFERLENGTH];

int dataLength = 0;
int recordCount = 0;

/* */
/* Handle the arguments passed */
/* */
if (argc < 3) { /* need prog name + two parm */
printf("\n%s called with incorrect arguments\n",argv[0] );
printf(" expected parms are DATASETNAME FILENAME\n ");
printf(" where\n");
printf(" DATASETNAME = name of input dataset\n");
printf(" FILENAME = name of output file\n");
return(4);
}
strcpy(inputDatasetName, argv[1]);
strcpy(outputFileName, argv[2]);

strcpy(escapedInputDatasetName, "//'");
strcat(escapedInputDatasetName, inputDatasetName);
strcat(escapedInputDatasetName, "'");

/* Open input file */
if ((inputFile = fopen(escapedInputDatasetName, "rb, type=record, recfm=*")) == NULL) {
printf("Could not open dataset: %S\n", inputDatasetName);
return(4);
}

/* Open output file */
if ((outputFile = fopen(outputFileName, "wb")) == NULL) {
printf("Could not open file: %S\n", outputFileName);
return(4);
}

/* Read in the data */
while (dataLength = fread(&databuffer, 1, BUFFERLENGTH, inputFile)) {
recordCount++;

/* Write the data */
fwrite(&databuffer, 1, dataLength, outputFile);
}

/* Close files */
fclose(inputFile);
fclose(outputFile);

printf("\n *** %d records written. ***\n", recordCount);

printf("\n");
}
2 changes: 1 addition & 1 deletion src/smfDDL.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void closeDDL(char *name)
{
char *c = indexSet[i];
if (c) {
fprintf(fp,"CREATE INDEX %s_%s ON %s.%s(%s);\n",name,c,schema,name,c);
fprintf(fp,"CREATE INDEX %s.%s_%s ON %s.%s(%s);\n",schema,name,c,schema,name,c);
}
}
fprintf(fp,"\n");
Expand Down

0 comments on commit ec0cd12

Please sign in to comment.