Introduction:
I have a very simple SQL SELECT request that spans three lines of input, as follows:
SELECT *
FROM DIR_TABLE
;
When I submit the SQL request using the CA Datacom DBSQLPR utility, the result is condition code 0020 due to a syntax error, as follows:
INPUT STATEMENT:
SELECT * 00520140
FROM DIR_TABLE 00520240
;
___________SQL ERROR SUMMARY START___________
SQLCODE = -20, SQLSTATE=42601
MESSAGE = BAD SYNTAX: <00520140>
WHEN THE ERROR OCCURRED, THE SYNTAX BELOW HAD BEEN PARSED:
SELECT * SELECT * 00520140 00520140
FROM DIR_TABLE
____________SQL ERROR SUMMARY END____________
Question:
Why does CA Datacom DBSQLPR utility give syntax error: SQLCODE = -20, SQLSTATE=42601 MESSAGE = SYNTAX-LAST TOKEN(S): ?
Answer:
The syntax error is due to the sequence numbers. The clue is in the "00520140" which shows that the input has sequence numbers in positions 73-80.
There is no need to edit and remove the sequence numbers. You can provide the DBSQLPR parameter INPUTWIDTH=72. INPUTWITH is used to limit the length of the input of the DBSQLPR control cards.
Additional Information:
Refer to the section "DBUTLTY Reference"https://docops.ca.com/ca-datacom/15-0/en/reference/dbutlty-reference for all the options and parameters that are supported in the CA Datacom® Core - 15.0 .