sorry It seems like I have two parts - how to put just the results of a query into a SYSOUT or OUTPUT file.
And how to format a numerical result, like COUNT(*) to Decimal rather than Hex.
This code gives a hex value in bytes 1 through 3 on the output file (I also tried doing NOECHO to see what shows up in the SYSLST)
SET USER '****** '
SET ACCESS OLQ
SET DICTNAME ' '
SET UNDERLINE '-'
SIGNON SS subschemaNm SCHEMA schemaNm ( 1)
OPTIONS ALL NOHEADER ECHO NOFILLER FULL PARTIAL INTERRUPT OLQHEADER -
NOPATHSTAT NOSTAT NOCOMMENT VERBOSE NODBKEY PICTURE CODETAB NOSYN
SELECT COUNT(*) FROM 'REC1', 'REC2' -
WHERE ('REC1-REC2') -
AND (DATE-RCVD BETWEEN 130701 AND 140630) OUTPUT OUTFILE
BYE
With hex 0s to the end of the file (00453 hex = 1107 decimal )
00500000000000000000
04300000000000000000
When I don't use the OUTFILE the only difference is the removal of the DD for the OUTFILE and the removal of "OUTPUT OUTFILE" plus adding DISPLAY back in.
SELECT COUNT(*) FROM 'REC1', 'REC2' -
WHERE ('REC1-REC2') -
AND (DATE-RCVD BETWEEN 130701 AND 140630)
DISPLAY
BYE
I tried to turn off the header, qnd echo, etc, because I just want the data field(s) in the output and without the OUTFILE and putting the DISPLAY in, I get execution information as well as the COUNT(*) value of 1107
OLQ 107019 00 Copyright (C) 2010 CA. All rights reserved.
SET USER 'xxxxxxx '
sET ACCESS OLQ
OLQ 092033 00 Processing mode changed to OLQ.
SET DICTNAME ' '
OLQ 092018 00 The default DICTNAME value has been modified.
SET UNDERLINE '-'
OLQ 092027 00 Underline character has been modified to -
SIGNON SS subschemaNm SCHEMA schemaNm( 1)
OLQ 100021 00 Ready to retrieve data from subschema schemaNm
OLQ 100022 00 Schema: schemaNm Version: 1
OPTIONS ALL NOHEADER NOECHO NOFILLER FULL PARTIAL NOINTERRUPT OLQHEADER
NOPATHSTAT NOSTAT NOCOMMENT VERBOSE NODBKEY PICTURE CODETAB NOSYN
1107 <<<< this is the value
END OF REPORT
I CAN write programs to execute the multiple queries and format a file. But these queries are not going to be run very frequently and they are easy to produce with OLQ. I just don't want to have a lot of manual intervention. The users of this information are outside of IT, and are probably going to import this data, along with data from other sources, into spreadsheets.
Thanks!
Cindy