View previous topic :: View next topic |
Author |
Message |
TexasRanger Beginner

Joined: 05 Feb 2004 Posts: 10 Topics: 4
|
Posted: Thu Oct 21, 2004 5:00 am Post subject: Memory Values Displaced - Calling - Called Programs |
|
|
Hello,
I am getting an error that is driving me crazy about some data passed from a calling program to a called program. I used 2 different approaches that should work, but none of them works. See below
ALL VARIABLES HAS BEEN INITIALIZED PREVIOUSLY.
OPTION 1 (THE VARIABLE CA-QBEC999-01 IN THE LINKAGE SECTION DOES NOT COINTAINS THE SUPPOSED VALUES )
CALLING PROGRAM.
WORKING-STORAGE
01 VA-QBEC999.
COPY QBEC999.
01 VA-BGEC076.
COPY BGEC076.
02 VA-BG9C0760-QBEC999 PIC X(50).
PROCEDURE DIVISION
MOVE VA-QBEC999 TO VA-BG9C0760-QBEC999
CALL CA-BG9C0760 USING VA-BGEC076
CALLED PROGRAM
LINKAGE SECTION.
*
01 VA-LINKAGEAREA.
COPY BGEC076.
*
01 CA-QBEC999-01.
COPY QBEC999.
OPTION 2 (I GET A 0C7 ERROR)
CALLING PROGRAM
WORKING STORAGE
01 VA-QBEC999.
COPY QBEC999.
01 VA-BGEC076.
CALLED PROGRAM
Same as previously |
|
Back to top |
|
 |
TexasRanger Beginner

Joined: 05 Feb 2004 Posts: 10 Topics: 4
|
Posted: Thu Oct 21, 2004 5:02 am Post subject: |
|
|
FOR OPTION 2 WAS:
OPTION 2 (I GET A 0C7 ERROR)
CALLING PROGRAM
WORKING STORAGE
01 VA-QBEC999.
COPY QBEC999.
01 VA-BGEC076.
COPY BGEC076.
CALL CA-BG9C0760 USING VA-BGEC076 VA-QBEC999
CALLED PROGRAM
LINKAGE SECTION.
*
01 VA-LINKAGEAREA.
COPY BGEC076.
*
01 CA-QBEC999-01.
COPY QBEC999. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Oct 21, 2004 5:50 am Post subject: |
|
|
TexasRanger,
First S0C7 is a data exception error and it has got nothing to do with your memory.
Approach 1 will fail if you try to use variables of CA-QBEC999-01 in the subroutine as no value has been passed for this and the results will be unpredictable.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
TexasRanger Beginner

Joined: 05 Feb 2004 Posts: 10 Topics: 4
|
Posted: Thu Oct 21, 2004 6:16 am Post subject: |
|
|
Hi Kolusu,
Thanks, for approach one is what happens. I try to use values of CA-QBEC999-01. The fact is that I guess those values have been already populated in the "MOVE VA-QBEC999 TO VA-BG9C0760-QBEC999".
I have even used the debugger to test that, and the 01 VA-BGEC076 cointains all the data (also expected lenght) that is required in the linkage section of the called program. That is what drives me crazy!!! As soon as I get into the first line of code of the called program I check the value of variables in the linkage section, 01 VA-LINKAGEAREA cointains expected data but CA-QBEC999-01 does not. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Oct 21, 2004 7:55 am Post subject: |
|
|
Texasranger,
Here is sample
Calling Program.
Code: |
WORKING-STORAGE SECTION.
01 VA-QBEC999.
COPY QBEC999.
01 VA-BGEC076.
COPY BGEC076.
02 VA-BG9C0760-QBEC999 PIC X(50).
PROCEDURE DIVISION.
MOVE VA-QBEC999 TO VA-BG9C0760-QBEC999
CALL CA-BG9C0760 USING VA-BGEC076
|
Called Program.
Code: |
Linkage SECTION.
01 VA-BGEC076.
COPY BGEC076.
02 VA-BG9C0760-QBEC999 PIC X(50).
PROCEDURE DIVISION USING VA-BGEC076.
|
Does your code look like this ?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
TexasRanger Beginner

Joined: 05 Feb 2004 Posts: 10 Topics: 4
|
Posted: Thu Oct 21, 2004 9:24 am Post subject: |
|
|
KInd of. The difference in the called program is the Linkage. The copy QBEC999 is defined with a level 02 and has 50 bytes lenght as well all of them picture X
LINKAGE SECTION.
01 VA-LINKAGEAREA.
COPY BGEC076.
01 CA-QBEC999-01.
COPY QBEC999. |
|
Back to top |
|
 |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Fri Oct 22, 2004 2:30 am Post subject: |
|
|
I do not quite understand the problem. Are the calling and the called programs using the same number/type of records?
A called program will retain the variables in their last used state if it is not coded with INITIAL option (something like this):
Code: |
ID DIVISION.
PROGRAM-ID. CALDPROG IS INITIAL.
|
_________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
 |
SureshKumar Intermediate
Joined: 23 Jan 2003 Posts: 211 Topics: 21
|
Posted: Fri Oct 22, 2004 9:47 am Post subject: |
|
|
Cogito-Ergo-Sum,
I don't think the linkage section will be corrupted, may be the working storage. One of the options that may be looked up is the 01 levels in the Linkage, its advisible to have the longer of the two first followed by the shorter one. A shorter 01 followed by a longer 01 can cause problems. Thanks |
|
Back to top |
|
 |
|
|