Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Call by content

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Call by content
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: 276
Location: Bang,iflex

PostPosted: Tue Dec 11, 2007 12:56 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue Dec 11, 2007 1:20 pm    Post subject: Reply to: Call by content
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
This topic is locked: you cannot edit posts or make replies. Get and display content of an address... lind sh CICS 1 Mon Aug 08, 2016 9:18 am
No new posts Is possible to call subprogram from c... cmsmoon COBOL Programming 3 Fri Aug 05, 2016 6:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us