MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Memory Values Displaced - Calling - Called Programs

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
TexasRanger
Beginner


Joined: 05 Feb 2004
Posts: 10
Topics: 4

PostPosted: Thu Oct 21, 2004 5:00 am    Post subject: Memory Values Displaced - Calling - Called Programs Reply with quote

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
View user's profile Send private message
TexasRanger
Beginner


Joined: 05 Feb 2004
Posts: 10
Topics: 4

PostPosted: Thu Oct 21, 2004 5:02 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Oct 21, 2004 5:50 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
TexasRanger
Beginner


Joined: 05 Feb 2004
Posts: 10
Topics: 4

PostPosted: Thu Oct 21, 2004 6:16 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Oct 21, 2004 7:55 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
TexasRanger
Beginner


Joined: 05 Feb 2004
Posts: 10
Topics: 4

PostPosted: Thu Oct 21, 2004 9:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Fri Oct 22, 2004 2:30 am    Post subject: Reply with quote

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
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Fri Oct 22, 2004 9:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group