View previous topic :: View next topic
|
Author |
Message |
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
I am going back to the basics .
I have coded as below and i was expecting the display in a unreadable format as the variable is COMP3 but i am getting the sysout as readable format..any basics that i am missing?
Code: |
01 TEST-DIGIT PIC 9(05).
01 TEST-COMP3 PIC 9(03) COMP-3.
PROCEDURE DIVISION.
MOVE 90 TO TEST-DIGIT
COMPUTE TEST-DIGIT = TEST-DIGIT * 2
MOVE TEST-DIGIT TO TEST-COMP3
DISPLAY TEST-COMP3
INITIALIZE TEST-DIGIT
TEST-COMP3
COMPUTE TEST-COMP3 = 89 * 3
DISPLAY TEST-COMP3
GOBACK. |
|
|
Back to top |
|
|
charanmsrit
New User
Joined: 25 Oct 2007 Posts: 81 Location: Australia
|
|
|
|
Hi,
your terminology "unreadable" is a perception.
have a look at your compile listing and see what assembler instructions are generated by DISPLAY command. that should answer your question. use compiler option LIST |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi i checked my listing but didn't get assember command for thr diaplay all i get from my listing is as below
Code: |
NAME: ENTRY TYPE AMODE C_OFFSET CLASS NAME STATUS
LEARN01 MAIN_EP 31 00000000 B_TEXT |
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
akodakka wrote: |
Hi i checked my listing but didn't get assember command for thr diaplay all i get from my listing is as below
Code: |
NAME: ENTRY TYPE AMODE C_OFFSET CLASS NAME STATUS
LEARN01 MAIN_EP 31 00000000 B_TEXT |
|
RTFM about the display verb for your version of COBOL! |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
My apologies!! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
When you DISPLAY, any COMPUTATIONAL fields will be converted to a "readable" format.
If you want to see the internal format, REDEFINES it as PIC X(of appropriate size) or make it subordinate to a group item. DISPLAY the PIC X field or the group item, and then SET HEX ON when you view the output.
Or search here for the "Junk Buster". |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
There is a link to IBM Manuals at the top of this page. If you click on it, find the Enterprise COBOL Application Programming Reference manual, and read 6.2.10 in this manual on the DISPLAY statement, you will find
Quote: |
If identifier-1 is a binary, internal decimal, or internal floating-point data item, identifier-1 is converted automatically to external format as follows:
Binary and internal decimal items are converted to zoned decimal. Negative signed values cause a low-order sign overpunch.
Internal floating-point numbers are converted to external floating-point numbers for display such that:
A COMP-1 item will display as if it had an external floating-point PICTURE clause of -.9(8)E-99.
A COMP-2 item will display as if it had an external floating-point PICTURE clause of -.9(17)E-99. |
Internal decimal means COMP-3 if you don't know that.
The real question is why you were unable to do this research yourself -- and there are not very many good answers to that question. |
|
Back to top |
|
|
Santoshgude
New User
Joined: 06 May 2013 Posts: 3 Location: INDIA
|
|
|
|
Hi akodakka,
As per my knowledge,If we need to display COMP#3 move into another field then first we need to move to a working variable having COMP3 equalennt length in naormal bytes.Then that working variable you can move to COMP#3 then Display will work ..
Let me know if you confused.
Thanks,
Santosh. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Let me know if you confused. |
did You read and try to understand the topic before posting ???
we are not confused... YOU ARE
You are mixing up two different concepts ,
the use of the DISPLAY clause which as already explained automatically converts numeric fields to a <displayable> format
the process of converting ON YOUR OWN numeric fields to a to a <displayable> format
You should see now how Your comment does not apply to the topic. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Santosh, first your post is poorly written so the meaning of what you are saying is not clear without re-reading it.
Second, you are flat out wrong. Enterprise COBOL will convert a COMP-3 variablle to USAGE DISPLAY when you issue a DISPLAY on that variable without needing to move the COMP-3 variable anywhere. |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
Make the comp-3 variable a part of a larger group, then display that group:
01 Group
05 field1 comp-3.
DISPLAY Group
Then you can play with it. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
That's new: somebody is complaining that he is not getting "junk characters"...
Use signed fields (PIC S9(5) and PIC S9(3)), use positive and negative values, with any luck you will see numbers like '9{' or '9}'. |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
My favorite fix I ever did was because of signed vs unsigned display fields.
The printer ID in a customer shop got moved from alpha to numeric, then back. They would send a print to ID 12345J and it would end up on printer 123451.
That was a lot of fun explaining it to people who didn't know about that kind of thing. |
|
Back to top |
|
|
|