The following is a sample base JCL to query the CA7 R12.0 database. This JCL can be tailored to your needs.
//STEP1 EXEC PGM=DBSQLPR
//STEPLIB DD DISP=SHR,DSN=CUSLIB
// DD DISP=SHR,DSN=CAAXLOAD
//SYSPRINT DD SYSOUT=*
//STDOUT DD SYSOUT=*
//OPTIONS DD *
PRTWIDTH=255
INPUTWIDTH=70
ROWLIMIT=5000
AUTHID=MFWA
NOTYPE
//SYSIN DD *
The database SQL table names can be found in CAL2OPTN(AL2SQLD)
The following link will also list out the options for the OPTIONS DD:
https://docops.ca.com/ca-datacom/15-0/en/using/using-sql/dbsqlpr-utility-execute-sql-through-ca-datacom-db