While trying to add a second query to my DQBATCH input with comments to separate and explain them, I received an error
*/ ------------------- THIS IS A COMMENT LINE -----------------/*
DQ801E - THE FIRST COMMAND IN YOUR QUERY IS NOT RECOGNIZABLE TO DATAQUERY
Why is this error saying my command is wrong? Is there some problem with my comments, or how can I use comments here?
Component : CA Dataquery for CA Datacom
The problem here involves the location of your comments.
The DQBATCH processor considers a comment to be part of the query text. In this situation, there is a comment entered, and then an OPTION statement following it. Since OPTION is a setup command and not a valid query function (like FIND or COUNT) Error DQ801E is produced. The documentation for CA Dataquery comments (*/ and /* - Begin and End Comments) indicates that a comment needs to be in proximity to the query text (which is defined as everything after the OPTION statements, and before the EXECUTE statement). In other words, you cannot place a comment as the first card in SYSIN (SIGN/ON must be the first card), nor before any OPTION commands. Following the OPTION QUERYLANG= as the last non-query command, you could enter comments, as long as they had a continuation in column 72. You can even enter a comment after the last line of the query and before the EXEC if the continuation marks were properly entered.
It is also possible to stack two separate queries in the input, using continuation as appropriate, but the comments need to be in the proper location. Here is a sample of stacked queries with lots of comments:
//SYSIN DD *
SIGN/ON DATACOM-INSTALL PASSWORD NEWUSER
*/ COMMENT 1 /* $
*/ COMMENT 2 /* $
FIND ALL PERSONNEL WITH STATE-ADDRESS = 'IL' $
*/ COMMENT 3 /* $
PRINT NUMBER, NAME, CITY-ADDRESS, STATE-ADDRESS, SOCIAL-SECURITY $
*/ COMMENT 4 /*
*/ COMMENT 5 /* $
*/ COMMENT 6 /* $
SELECT NUMBER, NAME, CITY_ADDRESS, STATE_ADDRESS, SOCIAL_SECURITY $
FROM SYSUSR.PERSONNEL WHERE STATE_ADDRESS = 'IL' $
*/ COMMENT 4 /*
All of the purple text above is associated with the first query, and all the green text is associated with the second query.
The key things to remember are:
1. Comments are considered query text and can only be entered where actua query functions and statements are allowed.
2. All query text - comments, commands, statements - must have a continuation character, other than the last line.