Skip to content

Add new zss /jes end point for submitting jcl to jes#402

Open
joepun76 wants to merge 16 commits intozowe:v2.x/stagingfrom
joepun76:jesSubmit
Open

Add new zss /jes end point for submitting jcl to jes#402
joepun76 wants to merge 16 commits intozowe:v2.x/stagingfrom
joepun76:jesSubmit

Conversation

@joepun76
Copy link
Copy Markdown
Contributor

@joepun76 joepun76 commented Feb 1, 2022

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Change in a documentation
  • Refactor the code
  • Chore, repository cleanup, updates the dependencies.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

PR Checklist

Please delete options that are not relevant.

  • If the changes in this PR are meant for the next release / mainline, this PR targets the "staging" branch.
  • My code follows the style guidelines of this project (see: Contributing guideline)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • video or image is included if visual changes are made
  • Relevant update to CHANGELOG.md
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works, or describe a test method below

Testing

Further comments

Add new end point /jes to submit jcl to jes (both jes2 and jes3 are support) with JOBID returned.

Signed-off-by: joepun76 <jouphpun76@gmail.com>
@joepun76 joepun76 changed the title initial Add new zss /jes end point for submitting jcl to jes Feb 1, 2022
Copy link
Copy Markdown
Contributor

@ifakhrutdinov ifakhrutdinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at my comments. FYI, I'm still reviewing jesService.c and jesrequestjson.c.

Comment thread c/dsutils.c Outdated
@@ -0,0 +1,417 @@
#ifdef METTLE
/* HAS NOT BEEN COMPILED WITH METTLE BEFORE */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this comment? Perhaps #error Metal C is not supported or something similar would be better?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced comment with #error Metal C is not supported

Comment thread c/dsutils.c
#ifdef METTLE
/* HAS NOT BEEN COMPILED WITH METTLE BEFORE */
#else
#include <stdbool.h>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all these includes? For example, stdarg.h and bpxnet.h aren't needed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary includes

Comment thread c/dsutils.c
@@ -0,0 +1,417 @@
#ifdef METTLE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file needs the copyright at the top and at the bottom (and any others without one).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Included copyright at the top and at the bottom

Comment thread h/dsutils.h Outdated
int getMaxRecordLength(char *dscb);

int obtainDSCB1(const char *dsname, unsigned int dsnameLength,
const char *volser, unsigned int volserLength,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad formatting.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected formatting

Comment thread h/dsutils.h
Comment on lines +19 to +26
#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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only used in datasetjson.c, why do we need to expose them in a header?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are used in dsutils.c as well

Comment thread h/dsutils.h
typedef struct Volser_tag {
char value[6]; /* space-padded */
} Volser;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide doc for these new public functions? See examples in zowe-common-c/h/resmgr.h or other similar files.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Included comments similar to zowe-common-c/h/resmgr.h

Comment thread h/dsutils.h Outdated
char value[6]; /* space-padded */
} Volser;

int getVolserForDataset(const DatasetName *dataset, Volser *volser);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that these are public, should we use a prefix for function names?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used prefix "dsutils"

Comment thread h/dsutils.h Outdated
} Volser;

int getVolserForDataset(const DatasetName *dataset, Volser *volser);
char getRecordLengthType(char *dscb);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good practise to use const for arguments you're not mutating, the definitions will need those too.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used const

Comment thread c/dsutils.c Outdated
/*
Dataset only, no wildcards or pds members accepted - beware that this should be wrapped with authentication
*/
int getVolserForDataset(const DatasetName *dataset, Volser *volser) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the content of this file the same as the one you removed from datasetjson.c?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's the same except that I removed the 'static' in front of the functions.

Comment thread h/jesrequestsjson.h Outdated
#define __JESREQUESTSJSON__ 1


#include "stcbase.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown

@ojcelis ojcelis May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this .h file and merged the changes to jesService.h. Only needed declarations were included to get .c file clean compiled

Comment thread c/jesrequestsjson.c Outdated


void responseWithJobDetails(HttpResponse* response, char* jobID, int jsonMode) {
#ifdef __ZOWE_OS_ZOS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done once in the beginning of this source other than in every function?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this .c file and merged the changes to jesService.c. Updated the code based on this review point

Comment thread c/jesrequestsjson.c Outdated
#define NATIVE_CODEPAGE CCSID_EBCDIC_1047
#endif


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason of having a separate source for this functionality as opposed to putting it into jesService.c?

Copy link
Copy Markdown

@ojcelis ojcelis May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes that are in jesrequestsjson.c were merged into jesService.c. Please check jesService.c for succeeding review points on jesrequestsjson.c

Comment thread c/jesrequestsjson.c Outdated

jsonStart(jPrinter);

jsonAddUnterminatedString(jPrinter, "jobId", jobID, 8);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if jobID is smaller than 8 bytes?

Copy link
Copy Markdown

@ojcelis ojcelis May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code to pass what is the exact bytes of the jobID

Comment thread c/jesrequestsjson.c Outdated
#else /* not __ZOWE_OS_ZOS */

/* Currently nothing else has "datasets" */
/* TBD: Is it really necessary to provide this empty array?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What array?

Copy link
Copy Markdown

@ojcelis ojcelis May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted the comment

Comment thread c/jesrequestsjson.c Outdated
}

int bufferSize = recordLength+1;
char buffer[bufferSize];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use DATA_STREAM_BUFFER_SIZE + 1, otherwise you may end up with VLAs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code based on the comment

Comment thread c/jesrequestsjson.c Outdated
// 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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you print the actual error code?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added error number in the log

Comment thread c/jesrequestsjson.c Outdated
}
}
else {
zowelog(NULL, LOG_COMP_RESTDATASET, ZOWE_LOG_DEBUG, "UPDATE DATASET: body was not JSON!\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use this component if it's not related to data sets?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the correct component

Comment thread c/jesrequestsjson.c Outdated

char *outACB = NULL;
RPLCommon *rpl = NULL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issues as in responseWithSubmitJCLContents

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Included checking of rc

Comment thread c/jesService.c Outdated
setResponseStatus(response, 405, "Method Not Allowed");
addStringHeader(response, "Server", "jdmfws");
addStringHeader(response, "Transfer-Encoding", "chunked");
addStringHeader(response, "Allow", "GET, PUT, DELETE");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we allow GET and PUT?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only PUT, updated the code

1000TurquoisePogs and others added 6 commits March 21, 2022 17:10
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
Signed-off-by: Aditya Ranshinge <aranshinge@rocketsoftware.com>
…intf-with-zowelog

configure log component
@joepun76 joepun76 assigned joepun76 and unassigned joepun76 Mar 30, 2022
@ojcelis ojcelis self-assigned this Apr 13, 2022
ojcelis added 2 commits May 9, 2022 15:56
Signed-off-by: Oscar Jr Celis <ojcelisibm@Oscars-MacBook-Pro.local>
Signed-off-by: ojelis <oscarjay07@yahoo.com>
@JoeNemo JoeNemo changed the base branch from v1.x/staging to v2.x/staging May 25, 2022 15:08
Comment thread h/dsutils.h Outdated
* @return lrecl return the length of a dataset
* 0 this function encountered error
*/
int dsutilsGetLreclOrRespondError(HttpResponse *response, const DatasetName *dsn, const char *ddPath);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated dsutils and jesService.

Comment thread h/dsutils.h Outdated
* @return lrecl return the length of a dataset
* 0 this function encountered error
*/
int dsutilsGetLreclOrRespondError(HttpResponse *response, const DatasetName *dsn, const char *ddPath);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated dustils and jesService.

ojcelis and others added 7 commits June 15, 2022 12:15
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

5 participants