Run the DMQUERY utility in batch mode through CANDE or through a Work Flow Language (WFL) job.
| Note: | Make sure to add SW1=TRUE as part of the WFL RUN statement to direct the DMQUERY utility to run in batch mode. |
The following lists an example of running the DMQUERY utility in batch mode through CANDE:
RUN *SYSTEM/MCPSQL/DMQUERY;
FILE FIL = MCPSQL/DMQUERY/DB1/SELECT/NEWDMQUERYRESULTS;
FILE CARD = MCPSQL/DMQUERY/DB1/SELECT/INPUT;The following lists two examples of running the DMQUERY utility in batch mode through a WFL job.
Example 1
BEGIN JOB RUN/DMQUERY1;
TASK T;
RUN *SYSTEM/MCPSQL/DMQUERY [T]; SW1=TRUE;
FILE FIL = MCPSQL/DMQUERY/DB1/SELECT/NEWDMQUERYRESULTS
ON PACK1;
FILE CARD = MCPSQL/DMQUERY/DB1/SELECT/INPUT ON PACK2;
END JOB.Example 2
BEGIN JOB MCPSQL/DMQUERY2;
RUN *SYSTEM/MCPSQL/DMQUERY ON DISK;SW1=TRUE;
FILE CARD(KIND=READER);
DATA CARD
SET DEST=FILE, QGRAPH TRUE;
OPEN DB1(USERCODE=USER1, FAMILYNAME=PACK1, MODE=INQUIRY);
SELECT COUNT(*) FROM DS1;
CLOSE DB1;
BYE
?
END JOB;The following lists a sample input CARD file for the DMQUERY utility:
100 % Route all output to a file 110 SET DEST=FILE; 120 130 % Write statement to output as well as return data 140 SET ECHO; 150 160 % Produce a query graphic for each SQL statement 170 % Limit queries to return at most 5000 records 180 SET QGRAPH=TRUE, LIMIT=5000; 200 300 % Open database DB1 400 OPEN DB1; 450 500 % Find record 600 SELECT employee_name from ds1 where employee_nbr=67; 610 620 % Add record, you can continue a command on the next line 630 INSERT into ds1 (employee_nbr, employee_name, employee_age) 635 VALUES (44, 'Bob Smith', 33); 640 650 % Complete update by ending transaction 660 COMMIT WORK; 670 960 % Close database 970 CLOSE DB1; 975 980 % End DMQUERY session 990 BYE;

