What Value Is Stored In Memory?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

What Value Is Stored In Memory?

Postby LockIdea » Tue May 13, 2008 8:29 am

Hi,

"Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8-bit character encoding (code page) used on IBM mainframe operating systems such as z/OS, OS/390, VM and VSE, as well as IBM minicomputer operating systems such as OS/400 and i5/OS (see also Binary Coded Decimal)."

Source: http://en.wikipedia.org/wiki/EBCDIC

Let us consider the below example.

05 Number        PIC 9.
Move 7 to Number.


My question is,

When the Move operation is performed, does the EBCDIC character 7 itself is the value that gets stored in the Memory or will its Base 10 equivalent value of 247 gets stored in the Memory or its Base 16 equivalent value of F7 gets stored in the Memory or its Base 2 equivalent value of 11110111 gets stored in Memory?

Your input is highly appreciated.

Thank You
LockIdea
Reason Is God's Crowning Gift To Man. -Sophocles
User avatar
LockIdea
 
Posts: 4
Joined: Tue May 13, 2008 1:52 am
Location: 127.0.0.1
Has thanked: 0 time
Been thanked: 0 time

Re: What Value Is Stored In Memory?

Postby dick scherrer » Tue May 13, 2008 8:54 am

Hello LockIdea and welcome to the forums,

When 7 is moved to "number", "number" will contain that value (7). Both x'F7' and b'1111 0111' are exactly the same internally (i.e. they are both the same set of 1's and 0's.

If you "look into" memory what you will see is the hexadecimal representation of the memory content. Each byte will be shown as a value between x'00' and x'FF'. The most common way people see "what is in memory" is when a core dump is produced.

If that is not what you are asking, please clarify.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: What Value Is Stored In Memory?

Postby LockIdea » Tue May 13, 2008 5:06 pm

Hi,

Thank You Dick Scherrer for your explanation. I am sorry if I was unable to express my questions clearly. I am definitely making an attempt to improve on my communication skills.

From what I understand from your explanation is, Memory Content of the variable "Number" after the Move operation will be x'F7'. Would that be an accurate statement? If it is, then if I want to display the value of the variable "Number", who/what will dothe conversion from Base16 to EBCDIC for display?

I am not trying to insult anyone's intelligence on these forums with such fundamental questions, but since I want to learn, I would rather learn it correctly.

Thank You
LockIdea
Reason Is God's Crowning Gift To Man. -Sophocles
User avatar
LockIdea
 
Posts: 4
Joined: Tue May 13, 2008 1:52 am
Location: 127.0.0.1
Has thanked: 0 time
Been thanked: 0 time

Re: What Value Is Stored In Memory?

Postby dick scherrer » Tue May 13, 2008 8:02 pm

Hello,

I am sorry if I was unable to express my questions clearly. I am definitely making an attempt to improve on my communication skills.
Not to worry - we work on other than just technical issues :)

I am not trying to insult anyone's intelligence on these forums with such fundamental questions,
I do not believe that anyone would take insult - this forum is for just such questions.

then if I want to display the value of the variable "Number", who/what will dothe conversion from Base16 to EBCDIC for display?
When you issue the DISPLAY for the number you've asked about (pic 9), there is no need for conversion - the number is already stored internally in display format. If your number was packed-decimal or binary, the DISPLAY would convert the number from internal representation to displayable - automatically.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: What Value Is Stored In Memory?

Postby LockIdea » Wed May 14, 2008 1:25 am

dick scherrer wrote: When you issue the DISPLAY for the number you've asked about (pic 9), there is no need for conversion - the number is already stored internally in display format.


Hi,

Thank you Dick Scherrer. I thought the number is stored in Hexadecimal format internally (x'F7') from the previous explanation. I guess, my understanding is incorrect then. Will you be able to clarify?

Thank you
LockIdea
Reason Is God's Crowning Gift To Man. -Sophocles
User avatar
LockIdea
 
Posts: 4
Joined: Tue May 13, 2008 1:52 am
Location: 127.0.0.1
Has thanked: 0 time
Been thanked: 0 time

Re: What Value Is Stored In Memory?

Postby dick scherrer » Wed May 14, 2008 3:06 am

Hello,

I thought the number is stored in Hexadecimal format internally (x'F7')
Yes, it is.

An internal x'F7' is an external (displayable) 7.

I believe you are adding an extra "layer" of difficulty.

"Everything" is stored in hex - each byte must have a value of x'00' thru x'FF'. Every hex value has a corresponding set of ones and zeros (not to be confused with COMP/binary numbers). Some hex bytes are "visable" and others must be converted to be read by the eyes. If you have COMP or COMP-3 numbers, they are not visable as stored, but the DISPLAY command internally converts them to readable in the SYSOUT.

Hopefully, i am understanding the question - if not, please let me know.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: What Value Is Stored In Memory?

Postby LockIdea » Wed May 14, 2008 4:37 am

dick scherrer wrote: Some hex bytes are "visable" and others must be converted to be read by the eyes. If you have COMP or COMP-3 numbers, they are not visable as stored, but the DISPLAY command internally converts them to readable in the SYSOUT.
Hopefully, i am understanding the question - if not, please let me know.


Hi,

I assumed that "ALL" Hex Bytes are Visible. Now I understand that it is not the case. Thank you Dick Scherrer for the explanation. I have a little better understanding now after reading your explanation.

I will read up on COMP and COMP-3 also.

Thank You
LockIdea
Reason Is God's Crowning Gift To Man. -Sophocles
User avatar
LockIdea
 
Posts: 4
Joined: Tue May 13, 2008 1:52 am
Location: 127.0.0.1
Has thanked: 0 time
Been thanked: 0 time

Re: What Value Is Stored In Memory?

Postby dick scherrer » Wed May 14, 2008 4:43 am

You're welcome :)

Someone will be here when there are more questions.

Good luck :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post