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

will Size of load module change,when sizeof var increses?


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

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Feb 28, 2007 3:24 pm
Reply with quote

Hi,
I have this code
Code:

 WORKING-STORAGE SECTION.                           
  01  ABHI.                                         
    05  DUMMY-F         PIC X(5).

 

suppose I increased the picture clause of the variable. Will the size of load module change?
I compiled program and I got size of load 11C0.
Then I changed pic clause to X(500) it remained same.
When I changed pic clause to X(5000) size came 11D8.
Can anybody explain why this happened?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 28, 2007 3:44 pm
Reply with quote

Working storage is imbeded in the load module. If you increase the size of WS you will increase the size of the load module.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Wed Feb 28, 2007 3:51 pm
Reply with quote

Bill, TS increased the size of a variable from 5 to 500 but no changes in size. My guess is the compiler allocates blocks and not bits.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Feb 28, 2007 3:53 pm
Reply with quote

In first case it has not increased? why?
When I increased it from 500 to 5000. Size difference is
11D8- 11C0 = 18H = 24 bytes.
I was expecting load module size should increase in both the cases also in second case it should increase by 4500 bytes?
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Wed Feb 28, 2007 3:56 pm
Reply with quote

Hi Abijit,
Why do u think that the size of the load module would increase, load module is one which contains the machine code for a given program , its size is only dependent apon the size of the program, the memory space allocation of variables would be done only during the run time and yes the load module willl tell the CPU main memory , how much space should be allocated for each and every variable during the run time , if u r using cobol analyse the usage of PICTURE clause for data declaration, u would find it interesting, the conclusion is the load module size is not dependent ionthe variable size that u have defined in the program.

Thamilzan.
Back to top
View user's profile Send private message
arindam111

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Wed Feb 28, 2007 3:58 pm
Reply with quote

Size will be changed.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Feb 28, 2007 4:12 pm
Reply with quote

As I have exerimentally found that size of load module changes when we increase the pic clause.
Now as prav_06 says
"space allocation of variables would be done only during the run time"
I wanted to see the assembly listing of the program. Can anybody tell me how can I see that?
I am using CWPCMAIN COMPUWARE/COBOL COMPILER.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 28, 2007 4:14 pm
Reply with quote

Bitneuker wrote:
Bill, TS increased the size of a variable from 5 to 500 but no changes in size. My guess is the compiler allocates blocks and not bits.
Quote:
I compiled program and I got size of load 11C0.
Then I changed pic clause to X(500) it remained same.
When I changed pic clause to X(5000) size came 11D8.
Curious icon_confused.gif
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Wed Feb 28, 2007 4:26 pm
Reply with quote

Did the size of the object change (the number of lines)?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Feb 28, 2007 5:08 pm
Reply with quote

Yes. It has changed.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Wed Feb 28, 2007 5:13 pm
Reply with quote

In both cases?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Feb 28, 2007 5:25 pm
Reply with quote

No. from 5 to 500 no change, from 500 to 50000 it did.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Wed Feb 28, 2007 7:00 pm
Reply with quote

So you have a larger object which logically results in a larger loadmodule. I've no intention to try and explain the increase why it's grown by x'18'.
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Wed Feb 28, 2007 9:07 pm
Reply with quote

Hi all,
Load module is to tell what the machine should do, and it gives the instruction to the i-o devices to accept or display data, consider this

Code:
     ACCEPT A.
    * A is defined as PIC X(50) For PGM 1.


and

Code:
     ACCEPT A.
    * A is defined as PIC X(5000) For PGM 2.


and lets consider that these two progs. have the same functionality with the same lines of code. For each prog. a load module would be created, and when these progs are executed (Runtime), the system encounters i-o instruction of ACCEPT A. PGM1 would be expecting 50 bytes of data from the user and PGM2 would be expecting 5000 bytes of data, during this the load module would just tell the i-o device to accept n number of bytes, where n=50 for PGM1 and n=5000 for PGM2, during the run time the load module would just pass the number of bytes to be allocated in the real memory , so when executing the instruction to accept, the corresponding machine instruction size in both the load modules will be same. Instead of sayin

Quote:
ACCEPT 2 DIGITS. for PGM1 its gonna say ACCEPT 4 DIGITS for PGM2

2- > No digits in 50
4- > No digits in 5000
.

This is my understanding. Please correct me if I am wrong.

Thamilzan.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Feb 28, 2007 9:44 pm
Reply with quote

Bitneuker wrote:
So you have a larger object which logically results in a larger loadmodule. I've no intention to try and explain the increase why it's grown by x'18'.
Did a little experimenting and it did not make sense until, working an 0C7, noticed this in the AbendAid print: "Because the program is re-entrant, Working-Storage is located outside of the program."

My testing changed a little when I had a value on the storage, but not by more that a couple dozen bytes. I might try later without rent....
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 28, 2007 9:57 pm
Reply with quote

Hello,

When you change the size of working storage, load module size may or may not change. Look at the linkedt and for each of the compiles and see if the actual object size for the module changed (it will when more/less object space is needed - not all changes result in an object length change). The length of the object module is only part of the overall length of the load module.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Mar 01, 2007 11:52 am
Reply with quote

Quote:

When you change the size of working storage, load module size may or may not change.


I am totally confused now. icon_question.gif [/quote]
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Thu Mar 01, 2007 3:00 pm
Reply with quote

Bill,

A couple of dozen bytes is the 24 bytes TS mentioned icon_wink.gif Co-incident icon_question.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 01, 2007 9:43 pm
Reply with quote

Hi Abhijit,

To better understand how the object module size varies, do some research on how an object module is constructed. There are 4 types of object records - ESD, TXT, RLD, and END.

The entries you will be interested in are the TXT entries.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Mar 02, 2007 1:42 pm
Reply with quote

Quote:

To better understand how the object module size varies, do some research on how an object module is constructed. There are 4 types of object records - ESD, TXT, RLD, and END.


Dick,
Thanks for inputs. I will surely find out more about the process. icon_smile.gif

If the above question is asked at an interview, what is the answer?
i will say 'YES' after this discussion.
Does anyone want to differ icon_question.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 02, 2007 9:11 pm
Reply with quote

Hello,

I'm not sure that "yes" is an answer to this
Quote:
Can anybody explain why this happened?


If they ask if the size of the module will change, one correct answer is "possibly, but not necessarily".
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 Load new table with Old unload - DB2 DB2 6
No new posts How to load to DB2 with column level ... DB2 6
No new posts REASON 00D70014 in load utility DB2 6
No new posts Using Java/C/C++ to retrieve dataset ... Java & MQSeries 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
Search our Forums:

Back to Top