if i want to execute below sql statement in a subprogram :
FETCH ABSOLUTE :START-ROW-POS
and if I declare host variable START-ROW-POS in LINKAGE section, and I pass a value to it from main program, SQLCODE of above sql statement after execution is always 100. (but actually, if START-ROW-POS is received by SQL, a record can be retrieved.)
while if I declare host variable START-ROW-POS in WORKING STORAGE SECTION , and I move a value to it from a linkage section variable, above SQL statement can be executed as expected.
confused by this phenomena, can anybody explain???
in addition, variables declared in linkage section have no addressability?
See if this gives you anything to start your research with.
In addition, Linkage Section data has addressability for each that you give addressability. Your PROCEDURE DIVISION USING gives addressability to each 01 (or, never done it, 77) named. You may also get addressability using SET, but start slowly, and don't imagine that SET will help you with your particular problem. Concentrate on the above topic, and understanding that.
Joined: 29 Oct 2010 Posts: 112 Location: Puerto Rico
Good day to all!
I just want to add that working-storage is a local storage to each individual program. The Linkage section is your dynamic storage which you need to set addressability like Bill mention in your sub-programs in order to have accessibility to the variables in your sub-programs.