View previous topic :: View next topic
|
Author |
Message |
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
For instance,
if i want to execute below sql statement in a subprogram :
Code: |
EXEC SQL
FETCH ABSOLUTE :START-ROW-POS
FROM CURCBKOPCS01
INTO :CBDOPCS-DESC
END-EXEC |
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? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Please review some of your previous posts (as well as others) to the PL/I - Assembler board regarding Assembler questions, concentrating on questions/replies to DSECT's.
Assembler DSECT's (known as Dummy Sections) and COBOL Linkage Sections are very much (but not exactly) the same, but, close enough for general comparison.
Basically, you can't address any piece of storage in a DSECT or Linkage Section until the target storage has been given addressability.
The keyword here is "Dummy". As soon as you can understand this concept, a light bulb will go off in your head and you'll say to yourself "OK, now I've got it".
Good Luck,
Mr. Bill |
|
Back to top |
|
|
Jose Mateo
Active User
Joined: 29 Oct 2010 Posts: 121 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. |
|
Back to top |
|
|
|