Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: missing error (return code) for unknown fields #94

Open
GitMensch opened this issue Jun 5, 2023 · 0 comments
Open

bug: missing error (return code) for unknown fields #94

GitMensch opened this issue Jun 5, 2023 · 0 comments

Comments

@GitMensch
Copy link
Contributor

GitMensch commented Jun 5, 2023

given

           EXEC SQL  FETCH SOMETHING INTO :FIELD END-EXEC.
      *
           IF SQLCODE = 0

resulted in

OCESQL*    EXEC SQL  FETCH SOMETHING INTO :FIELD END-EXEC.
OCESQL     CALL "OCESQLStartSQL"
OCESQL     END-CALL
      *
           IF SQLCODE = 0

The reason in this case was that FIELD was not contained in the variables visible to the parser (copybook instead of SQL INCLUDE, possibly because of missing support for #91).
The code generation should raise a clear error here "unknown bind variable :FIELD".

... rechecking the code - this happens here:

com_sprintf(buff,sizeof(buff), "OCESQL%5sCALL \"OCESQLStartSQL\"\nOCESQL%5sEND-CALL\n"," "," ");
fputs(buff, outfile);
host_list = list->host_list;
int count = 0;
if(host_list){
iret = gethostvarianttype(host_list->hostreference, &type, &digits, &scale);
if(iret != 0){
printmsg("%s:%d\n", host_list->hostreference,iret);
memset(buff, 0, sizeof(buff));
com_sprintf(buff,sizeof(buff), "E%03d",iret);
printerrormsg(host_list->hostreference, host_list->lineno,
buff);
return;

and there is indeed an output:

00234:E001:FIELD is not defined in the working-storage !

... but as ocesql still returns 0 and the message is placed to stdout this is easy to miss

@GitMensch GitMensch changed the title bug: missing error for unkown fields bug: missing error (return code) for unknown fields Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant