IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Call by content


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
k.junaid83

New User


Joined: 19 Apr 2006
Posts: 22
Location: bangalore

PostPosted: Tue Dec 11, 2007 12:34 pm
Reply with quote

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

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Tue Dec 11, 2007 12:56 pm
Reply with quote

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
View user's profile Send private message
k.junaid83

New User


Joined: 19 Apr 2006
Posts: 22
Location: bangalore

PostPosted: Tue Dec 11, 2007 1:08 pm
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Dec 11, 2007 1:20 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Reformat and relocate content DFSORT/ICETOOL 4
No new posts Batch call online program, EXCI task ... CICS 3
No new posts CSQBGET - Call giving completion code... COBOL Programming 3
Search our Forums:

Back to Top