I was facing sql code -804 while executing a query from cobol db2 program. The explanation for this sql code on ibm site was described as following
AN ERROR WAS FOUND IN THE APPLICATION PROGRAM INPUT PARAMETERS FOR THE SQL STATEMENT, REASON reason
but I could not find any issues with the sql statement in my application program(cobol cics) so I googled further and found that the above sql error -804 can occur if the sqlca area is overlapped by other variables.
This was the problem with my code, I had used an array at the top of sqlca copybook which overflowed into the sqlca area and caused this issue. So if you are stuck with sql code -804 and there is no issue with your sql in the program go look for overflow issues in the program.