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
 

 

Display COMP-3 variable in Enterprise COBOL

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

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Apr 19, 2013 6:18 pm    Post subject: Display COMP-3 variable in Enterprise COBOL
Reply with quote

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
View user's profile Send private message

charanmsrit

New User


Joined: 25 Oct 2007
Posts: 80
Location: Australia

PostPosted: Fri Apr 19, 2013 6:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Apr 19, 2013 6:39 pm    Post subject: Reply to: COMP3 question
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Fri Apr 19, 2013 6:52 pm    Post subject: Re: Reply to: COMP3 question
Reply with quote

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
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Apr 19, 2013 6:56 pm    Post subject: Reply to: COMP3 question
Reply with quote

My apologies!!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Apr 19, 2013 7:22 pm    Post subject: Reply to: COMP3 question
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Fri Apr 19, 2013 7:46 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Santoshgude

New User


Joined: 06 May 2013
Posts: 3
Location: INDIA

PostPosted: Wed May 08, 2013 12:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed May 08, 2013 12:43 pm    Post subject: Reply to: COMP3 question
Reply with quote

Quote:
Let me know if you confused.

did You read and try to understand the topic before posting ???

we are not confused... YOU ARE icon_cool.gif

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Wed May 08, 2013 4:45 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Wed May 08, 2013 7:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Wed May 08, 2013 7:21 pm    Post subject: Reply to: COMP3 question
Reply with quote

That's new: somebody is complaining that he is not getting "junk characters"... icon_smile.gif

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
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Thu May 09, 2013 7:33 pm    Post subject:
Reply with quote

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
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
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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