Here are a few – of many sites with code available.
if you have TAATOOL it contains a command for this.
Problems with your code
1. All DCL including DCLF must be before any commands
2. CVTOUTQ appears to convert the actural spool files to physical files not a list of spool files.
3. Could to use WRKSPLF or WRKOTUQ command to get a spool file listing all spool files in outq
4. Could use CVTOUTQ or CPYSPLF to copy that file to a physical file
5. Then you receive the rows as a long string and need to parse them into fields — lots of work