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
 

 

How to display comp-3 value

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

New User


Joined: 30 Jul 2004
Posts: 95

PostPosted: Mon Nov 29, 2004 3:49 pm    Post subject: How to display comp-3 value
Reply with quote

hi,

how to display comp-3 value this question asked in one interview what i told is normally using display statement he didnt agree with that i made argue with this by telling that comp-3 will convert the usage to DISPLAY while diplaying the value.and another this i got is the comp-3 value has to move in to another variable and we have to display which one is correct.

regards,
siva pradeep
Back to top
View user's profile Send private message

jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Tue Nov 30, 2004 1:37 am    Post subject:
Reply with quote

Simply displaying a comp-3 will work out

01 ws-comp3 pic 9(10) comp-3 value 12345.

now display ws-comp3 will give 0000012345

possibly his question might be to avoid those zeros. because in statements it doesnt look good to display zeroes.

this code will give you the answer

01 WS-C1 PIC 9(10) COMP-3 VALUE 12345.
01 WS-R2 PIC X(10).


MOVE WS-C1 TO WS-R2.
DISPLAY 'WS-R2 ' WS-R2.
INSPECT WS-R2 REPLACING LEADING ZEROS BY SPACES.
DISPLAY 'WS-R2 ' WS-R2.
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Tue Nov 30, 2004 2:12 am    Post subject:
Reply with quote

YOU CAN ALSO DO LIKE THIS

01 WS-C2 PIC ZZZZZZZZZ9.
01 WS-C1 PIC 9(10) COMP-3 VALUE 12345.


MOVE WS-C1 TO WS-C2.

DISPLAY 'WS-C2 ' WS-C2.

THIS WILL ALSO GIVE YOU 12345.
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm


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