What platform are you running your code on? Because if you're using a z/OS-based system, your SELECT statements are completely wrong. DATABASE-CUSTLOGIC is not a valid name for your data set: the DATABASE- will be ignored as a label, but the CUSTLOGIC has too many characters (you are limited to 8 for your DD name). Furthermore, we'd need to see the JCL you are using to execute your program.
If you're not running your code on a system z machine, why are you posting on a forum that is exclusively for zArchitecture systems?