View previous topic :: View next topic
|
Author |
Message |
shuklas
New User
Joined: 21 Dec 2006 Posts: 20 Location: London
|
|
|
|
Hi,
I had seen a situation where the calling program (A) is having a commarea of 9K and called program (B) of commarea of 30K.
When the call return from called program (B) having a commarea of 30K we will pass DFHCOMMAREA back to called program (A) having commarea of 9K,since there is a mismatch in commarea so ideally program should fail but to my surprise program is working fine.
Can anybody help me out in this why this programs are working fine?
Regards,
Shirish Shukla |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please remove your email address from your signature. I've removed it from the original post, but not your profile.
Is the commarea the same in both modules for the first 9k? Does the called module use all 30k or only the first 9 sometimes? |
|
Back to top |
|
|
shuklas
New User
Joined: 21 Dec 2006 Posts: 20 Location: London
|
|
|
|
Hi,
The email and contact number removed.
The commarea is same in both the modules for the first 9K.
Called module uses anything from 105 to 30K,this is a router program that will call different program depending on the calling modules so we had kept the commarea as 30105.
First 105 is common for all modules called.remaining is variable for different programs.
Hope this help. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I believe that as long as the called module uses only up to the length of the calling module, there will not be an error as no foul has been committed.
If the called module tries to use more than the 9k, beware. It may work or it may abend. |
|
Back to top |
|
|
shuklas
New User
Joined: 21 Dec 2006 Posts: 20 Location: London
|
|
|
|
I think there is some confusion in the way we both had interpreted the problem.
Actually Program A is passing commarea as 9K using DFHCOMMAREA and call Program B which accept this commarea in 30105 variable.
Structure of this commarea of Program B is:
DHFCOMMAREA.
15 COPY BOOKC. Length of 105
15 Variablec PIC X(30000).
and we also have WS-COMMAREA.
WS-COMMAREA.
15 COPY BOOKC. Length of 105
15 WS-Variablec PIC X(30000).
When the call is sent back from Program B to Program A we will pass
WS-COMMAREA to DFHCOMMAREA this mean
We are trying to move length 30105 to length 9000 variable.
This will work fine untill the 9000 is allocated and the memory can take 30105 of data.
and it will fail when the 9000 of DFHCOMMAREA is allocated and the 30105 is beyond the valid boundary of the data. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Returning from a call, nothing gets sent back. |
|
Back to top |
|
|
Johnson_Jiang
New User
Joined: 05 Apr 2007 Posts: 11 Location: China,ShenZhen
|
|
|
|
Hi, all,
I think maybe the problem is the compiling option problem. Pls make sure that you have used the compile option TRUNC:
//XXXXX EXEC ... PARM='TRUNC(OPT)'
If you didn't use this option, when you trace the program, you can find that the commarea length is truncated and less than 9K. The result is unsure. I'm not sure about the exact number on when to use this option(maybe it is 10K?), but just try it and you will get the proper result. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The code already gives the proper result. . . .
Quote: |
Can anybody help me out in this why this programs are working fine?
|
|
|
Back to top |
|
|
rahuindo
New User
Joined: 09 Apr 2008 Posts: 83 Location: Chennai
|
|
|
|
I wanted to thank Johnson_Jiang. I was facing this issue of truncated WS-COMMAREA (though the length was >10000, it was always returning the COMMAREA upto 2500 bytes) and was clueless about the problem. But when I implemented the solution provided, I was able to correct it. Thanks a lot |
|
Back to top |
|
|
|