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
 

 

Variable's memory occupatioon

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
HozE

New User


Joined: 21 Feb 2007
Posts: 6
Location: Mumbai

PostPosted: Tue Dec 18, 2007 4:48 pm    Post subject: Variable's memory occupatioon
Reply with quote

hi ALL,

I recently came across a variable defined as SPPPP99999

Any comments on how much memory will be occupied???
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Tue Dec 18, 2007 10:03 pm    Post subject:
Reply with quote

Hello,

As this is something i'd not seen before, thought i'd give it a try.

Don't know what i expected, but what i got would not have been what i expected<g>. Maybe i've just done it "wrong".

The code
Code:
  01  SP9WORK.                       BLW=00000+098         0CL5
      05 SP9 PIC SPPPP99999.         BLW=00000+098,0000000 5C
   

 000-MOVEM.                         
     MOVE SPACES TO SP9WORK.         
     MOVE 123 TO SP9.               
     DISPLAY SP9WORK.               
     DISPLAY SP9.                   
     MOVE SPACES TO SP9WORK.         
     MOVE 987654321 TO SP9.         
     DISPLAY SP9WORK.               
     DISPLAY SP9.                   



The output
Code:
0000{   
0000{   
0000{   
0000{   
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Dec 18, 2007 10:32 pm    Post subject: Re: Variable's memory occupatioon
Reply with quote

HozE wrote:
hi ALL,

I recently came across a variable defined as SPPPP99999

Any comments on how much memory will be occupied???


It would be 5 bytes, the S shares a the byte with the last 9, and the Ps don't take up any bytes. Never have used the P except for training classes.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Dec 18, 2007 11:32 pm    Post subject:
Reply with quote

Hello,

Thoughts about how i got all zeros in the result?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Dec 19, 2007 12:05 am    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

Thoughts about how i got all zeros in the result?


With the P on the left SPPPP99999 is a very small number with the decimal point before the leftmost P (.000099999).

Code:
5.3.11.1.1 P symbol 

 Because the scaling position character P implies an assumed decimal point (to the left of the Ps, if the Ps are leftmost PICTURE characters; to the right of the Ps, if the Ps are rightmost PICTURE characters), the assumed decimal point symbol, V, is redundant as either the leftmost or rightmost character within such a PICTURE description.
In certain operations that reference a data item whose PICTURE character-string contains the symbol P, the algebraic value of the data item is used rather than the actual character representation of the data item. This algebraic value assumes the decimal point in the prescribed location and zero in place of the digit position specified by the symbol P. The size of the value is the number of digit positions represented by the PICTURE character-string. These operations are any of the following:
 
Any operation requiring a numeric sending operand.
A MOVE statement where the sending operand is numeric and its PICTURE character-string contains the symbol P.
A MOVE statement where the sending operand is numeric-edited and its PICTURE character-string contains the symbol P and the receiving operand is numeric or numeric-edited.
A comparison operation where both operands are numeric.
In all other operations the digit positions specified with the symbol P are ignored and are not counted in the size of the operand.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Dec 19, 2007 12:31 am    Post subject: Reply to: Variable's memory occupatioon
Reply with quote

Thanks Craig icon_smile.gif

'Preciat it.

Gee, i could've found it if i'd looked icon_redface.gif

d
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 Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Not enough virtual memory is availabl... Vinay Pushpala IBM Tools 16 Tue Sep 13, 2016 4:37 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am


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