|
|
| Author |
Message |
EnjoyMF
Active User
Joined: 27 May 2005 Posts: 92
|
|
|
|
Hi friends
i need some clarification on restriction in using redefines with commarea
01 ws-commarea
05 field1 pic x(10)
05 field2 pic x(10)
05 field3 pic x(100)
05 field4 redefines field3
i called subprogram1 with field1, filed2,filled3( the data will be populated
into field3 by subprogram & it worked fine
But when i called subprogram2 with field1, filed2,filled4( the data will be populated
into field4 by subprogram..,the data is not populated
there is no error or abend at runtime or complile time
if if define them seperatly like
01 ws-commarea
05 area1
10 field1 pic x(10)
10 field2 pic x(10)
10 field3 pic x(100)
05 area2
10 field1 pic x(10)
10 field2 pic x(10)
10 field4 pic x(100)
and pass to subprograms..both are working fine
MY Query is CAN we use the redefines like the above
Regards
prasad |
|
| Back to top |
|
 |
References
|
|
 |
mallikiran
Active User
Joined: 07 Sep 2005 Posts: 52
|
|
|
|
Internally, how data is passed using COMMAREA depends on whether you call your program using LINK or XCTL.
If you use LINK, then the COMMAREA is passed by reference, i.e. the address of the variable mentioned in COMMAREA(WS-XXX) is passed.
If you use XCTL, then the COMMAREA is passed by content, i.e. the entire COMMAREA is copied into a different storage area within CICS and this address is assigned to the COMMAREA in the called program. This is why LENGTH is a compulsary field when using COMMAREA with XCTL (as CICS needs to know how much data it should copy).
This is to explain how COMMAREA works.
About your question regarding redefines. There is no restriction about redefines because ultimately all CICS does is passes the address (if LINK is used) or copies the entire data content (if XCTL) is used.
If you are using XCTL and the data is not available in the called program, check if the data was available in the calling program in the first place. If it is, then check the LENGTH value you are using.
If you are using LINK, again check if the data was present in the calling program first. If it is, then there is no way that it is not available in the second program because both programs reference the same data area. |
|
| Back to top |
|
 |
|
|
|