In the link provided by u, All gave their assumptions but none are confident. Can somebody else please give the exact answer here.
You are right, a lot of assumptions, some wrong. But it all boils down to:
A static cursor needs to be declared before it is opened. The DB2 preprocesser needs to see it before it generates the code for accessing it. .........the declaration generates no executable code in itself so it is usually placed in the data division, that helps keep the procedure division cleaner and easier to see the logic flow.