Cursors can be declared in both working-storage & procedure
division, Agreed.
But is there any difference? If could you please suggest
what is the difference.
TIA
Answer Posted / budgobbel
In CICS programs, data is passed in the Communications Area (CA) via the Linkage Section.
If your cursor is predicated (WHERE clause) on a field in the CA, you could code your cursor early in the Procedure Division prior to any open cursor logic. This will avoid using additional variables, and MOVE statements.
If you keep your cursor in the Working Storage area, you cannot use fields in the Linkage section as host variables, because the DB2 pre-compiler will see the cursor first, and NOT have a resolution for the host variable (it hasn't seen the Linkage Section, yet).
It mostly is up to you, unless your shop is a stickler on variables and locations, etc.
Also, over the years I have seen shops become more code-it-and-load-it in philosophy. Very sad.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
How is a typical db2 batch pgm executed?
What are the various data types available in db2?
what is the sqlcode -501
What action db2 takes when a program aborts in the middle of a transaction?
How can record locking be achieved in those DB2 versions which do not support it?
What is cursor with hold option in db2?
What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?
Which component is responsible for db2 startup and shutdown?
Can we delete records from view?
What is null in db2?
Which is faster delete or truncate?
What is a plan and package in db2?
How do you find the maximum value in a column in db2?
Mention the definition of cobol in varchar field.
run jcl for cobol+db2 pgm?.. //jobcard //step001 exec pgm=ikjeft01 //systin dd * DSNSYSTEM(--------) RUN PROGRAM(MYPGMNAME) PLAN(-----), LIB(-------), PARMS(------) /* WHAT WILL U GIVE INSIDE THE BRACKETS... WHAT IS PLAN,PACKAGE,BIND?..PLAN N PACAKGES ARE GENERATED BY ?...