View previous topic :: View next topic
|
Author |
Message |
k.junaid83
New User
Joined: 19 Apr 2006 Posts: 22 Location: bangalore
|
|
|
|
Hi All,
I am passing some values from one cobol program to another one using CALL BY CONTENT.But the feilds in the called program are not populating as Expected.Below is call statement which am using in the calling program.
CALL 'PUTPGM' USING BY CONTENT
'POGMNAME'
'0000-MAINLINE SECTION'
'BEGIN'
The linkage section in the called program is declared as
77 WS-PGM-NAME PIC X(08).
77 WS-PGM-SECTION PIC X(45).
77 WS-PGM-STATE PIC X(05).
I did put some display statement for the above feilds , the results are
POGMNAME
0000-MAINLINE SECTION BEGIN o
BEGIN
The problem is with the 2nd feild WS-PGM-SECTION who's length is varying (Max=45).
Why i am gettin extra text for the 2nd feild and how to get rid of it?
Thanks in Advance |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
Your second field may conain garbage value, just exped it check the value before you populating value in it, as you have given memory size as 45, it may contain previous value in the memory.
check the content of the variables. |
|
Back to top |
|
|
k.junaid83
New User
Joined: 19 Apr 2006 Posts: 22 Location: bangalore
|
|
|
|
Hi vasanth,
I believe that its not because of the garbage value.I tried after initializing the variables with SPACES the result was the same.
Thanks |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the issue is that the linkage section has variables with a length of :
8 bytes,
45 bytes,
5 bytes
the data You are sending by content is moved ( casually ) to adjacent storage
locations with the following layout
8 bytes, 21 bytes, 5 bytes
the second parameter is mapped to the starting address of the
21 bytes area for 45 bytes of length... so You get 24 bytes of garbage
what You get after the 21 bytes of data is random and is determined
at compile time by the allocation strategy of the compiler
i used the terms casual/random in generic sense,
it looks random, but is repeatable, You could predict it if You knew the
storage allocation algorithm of Your compiler |
|
Back to top |
|
|
|