Add new zss /jes end point for submitting jcl to jes#402
Add new zss /jes end point for submitting jcl to jes#402joepun76 wants to merge 16 commits intozowe:v2.x/stagingfrom
Conversation
ifakhrutdinov
left a comment
There was a problem hiding this comment.
Please have a look at my comments. FYI, I'm still reviewing jesService.c and jesrequestjson.c.
| @@ -0,0 +1,417 @@ | |||
| #ifdef METTLE | |||
| /* HAS NOT BEEN COMPILED WITH METTLE BEFORE */ | |||
There was a problem hiding this comment.
Do we need this comment? Perhaps #error Metal C is not supported or something similar would be better?
There was a problem hiding this comment.
Replaced comment with #error Metal C is not supported
| #ifdef METTLE | ||
| /* HAS NOT BEEN COMPILED WITH METTLE BEFORE */ | ||
| #else | ||
| #include <stdbool.h> |
There was a problem hiding this comment.
Do we need all these includes? For example, stdarg.h and bpxnet.h aren't needed.
| @@ -0,0 +1,417 @@ | |||
| #ifdef METTLE | |||
There was a problem hiding this comment.
The file needs the copyright at the top and at the bottom (and any others without one).
There was a problem hiding this comment.
Included copyright at the top and at the bottom
| int getMaxRecordLength(char *dscb); | ||
|
|
||
| int obtainDSCB1(const char *dsname, unsigned int dsnameLength, | ||
| const char *volser, unsigned int volserLength, |
| #define INDEXED_DSCB 96 | ||
|
|
||
| static char defaultDatasetTypesAllowed[3] = {'A','D','X'}; | ||
| static char *defaultCSIFields[] ={ "NAME ", "TYPE ", "VOLSER "}; | ||
| static int defaultCSIFieldCount = 3; | ||
|
|
||
| const int DSCB_TRACE = FALSE; | ||
|
|
There was a problem hiding this comment.
These are only used in datasetjson.c, why do we need to expose them in a header?
| typedef struct Volser_tag { | ||
| char value[6]; /* space-padded */ | ||
| } Volser; | ||
|
|
There was a problem hiding this comment.
Can you provide doc for these new public functions? See examples in zowe-common-c/h/resmgr.h or other similar files.
There was a problem hiding this comment.
Included comments similar to zowe-common-c/h/resmgr.h
| char value[6]; /* space-padded */ | ||
| } Volser; | ||
|
|
||
| int getVolserForDataset(const DatasetName *dataset, Volser *volser); |
There was a problem hiding this comment.
Now that these are public, should we use a prefix for function names?
| } Volser; | ||
|
|
||
| int getVolserForDataset(const DatasetName *dataset, Volser *volser); | ||
| char getRecordLengthType(char *dscb); |
There was a problem hiding this comment.
It's a good practise to use const for arguments you're not mutating, the definitions will need those too.
| /* | ||
| Dataset only, no wildcards or pds members accepted - beware that this should be wrapped with authentication | ||
| */ | ||
| int getVolserForDataset(const DatasetName *dataset, Volser *volser) { |
There was a problem hiding this comment.
Is the content of this file the same as the one you removed from datasetjson.c?
There was a problem hiding this comment.
Yes, it's the same except that I removed the 'static' in front of the functions.
| #define __JESREQUESTSJSON__ 1 | ||
|
|
||
|
|
||
| #include "stcbase.h" |
There was a problem hiding this comment.
Why do you need all these headers here? Also, you can always use forward declaration for things like HttpResponse and void including unnecessary headers.
For example,
void respondWithSubmitDataset(struct HttpResponse_tag* response,
const char* absolutePath,
int jsonMode);There was a problem hiding this comment.
Removed this .h file and merged the changes to jesService.h. Only needed declarations were included to get .c file clean compiled
|
|
||
|
|
||
| void responseWithJobDetails(HttpResponse* response, char* jobID, int jsonMode) { | ||
| #ifdef __ZOWE_OS_ZOS |
There was a problem hiding this comment.
Can this be done once in the beginning of this source other than in every function?
There was a problem hiding this comment.
Removed this .c file and merged the changes to jesService.c. Updated the code based on this review point
| #define NATIVE_CODEPAGE CCSID_EBCDIC_1047 | ||
| #endif | ||
|
|
||
|
|
There was a problem hiding this comment.
What is the reason of having a separate source for this functionality as opposed to putting it into jesService.c?
There was a problem hiding this comment.
All changes that are in jesrequestsjson.c were merged into jesService.c. Please check jesService.c for succeeding review points on jesrequestsjson.c
|
|
||
| jsonStart(jPrinter); | ||
|
|
||
| jsonAddUnterminatedString(jPrinter, "jobId", jobID, 8); |
There was a problem hiding this comment.
What if jobID is smaller than 8 bytes?
There was a problem hiding this comment.
Updated the code to pass what is the exact bytes of the jobID
| #else /* not __ZOWE_OS_ZOS */ | ||
|
|
||
| /* Currently nothing else has "datasets" */ | ||
| /* TBD: Is it really necessary to provide this empty array? |
| } | ||
|
|
||
| int bufferSize = recordLength+1; | ||
| char buffer[bufferSize]; |
There was a problem hiding this comment.
Just use DATA_STREAM_BUFFER_SIZE + 1, otherwise you may end up with VLAs.
| // empty record | ||
| /* jsonAddString(jPrinter, NULL, ""); */ | ||
| } else if (ferror(in)) { | ||
| zowelog(NULL, LOG_COMP_RESTDATASET, ZOWE_LOG_DEBUG, "Error reading DSN=%s, rc=%d\n", filename, bytesRead); |
There was a problem hiding this comment.
Can you print the actual error code?
| } | ||
| } | ||
| else { | ||
| zowelog(NULL, LOG_COMP_RESTDATASET, ZOWE_LOG_DEBUG, "UPDATE DATASET: body was not JSON!\n"); |
There was a problem hiding this comment.
Why do we use this component if it's not related to data sets?
|
|
||
| char *outACB = NULL; | ||
| RPLCommon *rpl = NULL; | ||
|
|
There was a problem hiding this comment.
Same issues as in responseWithSubmitJCLContents
| setResponseStatus(response, 405, "Method Not Allowed"); | ||
| addStringHeader(response, "Server", "jdmfws"); | ||
| addStringHeader(response, "Transfer-Encoding", "chunked"); | ||
| addStringHeader(response, "Allow", "GET, PUT, DELETE"); |
There was a problem hiding this comment.
Do we allow GET and PUT?
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
Signed-off-by: Aditya Ranshinge <aranshinge@rocketsoftware.com>
Fix collision with debug ifdef
…intf-with-zowelog configure log component
Signed-off-by: ojelis <oscarjay07@yahoo.com>
| * @return lrecl return the length of a dataset | ||
| * 0 this function encountered error | ||
| */ | ||
| int dsutilsGetLreclOrRespondError(HttpResponse *response, const DatasetName *dsn, const char *ddPath); |
There was a problem hiding this comment.
The "respond" functions and the functions with http related code don't seem to belong here.
The name dsutils implies some generic data set utils, but the source contains http service speicific code . Did you intend that?
| * @return lrecl return the length of a dataset | ||
| * 0 this function encountered error | ||
| */ | ||
| int dsutilsGetLreclOrRespondError(HttpResponse *response, const DatasetName *dsn, const char *ddPath); |
There was a problem hiding this comment.
The "respond" functions and the functions with http related code don't seem to belong here.
The name dsutils implies some generic data set utils, but the source contains http service speicific code . Did you intend that?
Signed-off-by: ojelis <oscarjay07@yahoo.com>
Signed-off-by: ojelis <oscarjay07@yahoo.com>
Signed-off-by: ojcelis <oscarjay07@yahoo.com>
Signed-off-by: ojcelis <oscarjay07@yahoo.com>
Signed-off-by: ojcelis <oscarjay07@yahoo.com>
Signed-off-by: joepun76 jouphpun76@gmail.com
Proposed changes
This PR addresses Issue: [Link to Github issue within https://github.com/zowe/zlux/issues if any]
This PR depends upon the following PRs:
Type of change
Please delete options that are not relevant.
PR Checklist
Please delete options that are not relevant.
Testing
Further comments
Add new end point /jes to submit jcl to jes (both jes2 and jes3 are support) with JOBID returned.