View previous topic :: View next topic
|
Author |
Message |
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
prav_06 Warnings : 1 Active User
Joined: 13 Dec 2005 Posts: 154 Location: The Netherlands
|
|
|
|
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 |
|
|
arindam111
New User
Joined: 29 Nov 2006 Posts: 27 Location: India
|
|
|
|
Size will be changed. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
Did the size of the object change (the number of lines)? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Yes. It has changed. |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
In both cases? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
No. from 5 to 500 no change, from 500 to 50000 it did. |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
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 |
|
|
prav_06 Warnings : 1 Active User
Joined: 13 Dec 2005 Posts: 154 Location: The Netherlands
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
When you change the size of working storage, load module size may or may not change. |
I am totally confused now. [/quote] |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
Bill,
A couple of dozen bytes is the 24 bytes TS mentioned Co-incident |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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.
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 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|