Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Moving Alphanumeric to COMP-3

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 11, 2008 5:53 pm    Post subject: Moving Alphanumeric to COMP-3
Reply with quote

Hi,

I am attempting to move a alphanumeric to comp-3 and am successfull with the movement. What is weird is that the storage in comp-3 is similar to comp and defeats the purpose of using comp-3. I am not sure if i am missing something very basic , please can you clarify.

Source code:

Code:

IDENTIFICATION DIVISION.                     
PROGRAM-ID. SIGNTEST.                         
AUTHOR.     XXXXXXXXXXXXXX.                   
                                             
ENVIRONMENT DIVISION.                         
DATA DIVISION.                               
WORKING-STORAGE SECTION.                     
                                             
 01  WS-ALPHA.                               
         15 WS-ALPHA-SIGN  PIC X(01).         
         15 WS-ALPHA-INT   PIC X(02).         
         15 FILLER         PIC X(01).         
         15 WS-ALPHA-DEC   PIC X(02).         
 01  WS-COMP3  PIC  S9(2)V99 USAGE IS COMP-3.
 01  WS-COMP   PIC  +ZZ.99 .                 
PROCEDURE DIVISION.                           
0000-MAIN-PARA.                               
     MOVE  '-02.34'       TO WS-ALPHA.   
     PERFORM 1000-ACCEPTDATA-PARA                   
     STOP RUN                                       
     .                                             
1000-ACCEPTDATA-PARA.                               
     MOVE WS-ALPHA  TO WS-COMP                     
     DISPLAY "COMP-"     WS-COMP                   
     MOVE WS-COMP  TO WS-COMP3                     
     DISPLAY "COMP3-"     WS-COMP3.                 
1000-ACCEPTDATA-EXIT-PARA.                         
        EXIT                                           
        .


Output from spool looks like this.

Code:

COMP--02.34
CDDD66FF4FF
36470002B34
-----------
COMP3-023M
CDDDF6FFFD
3647300234
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 Jun 11, 2008 6:12 pm    Post subject:
Reply with quote

When you display a COMP-3 field it is translated to character (zoned decimal) in order to make it displayable. If you redefine ws-comp3 as ws-compx pic x(3) and display ws-compx you will see (in hex mode) the actual packed decimal (comp-3) value.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jun 11, 2008 6:17 pm    Post subject:
Reply with quote

If you would bother to read any of the 10 or 15 threads that have been posted here for the last week or so, about the same subject, you could have learned that the DISPLAY command will convert comp, comp-3 to 'read able' format.

Since the compiler will generate instructions to allow this type of silliness, your conversion moves have been executed correctly.

everything is ok except your understanding of computers.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 11, 2008 6:23 pm    Post subject:
Reply with quote

Bingo. Thats the answer . Changed to the code to test this and you are right.

I knew it had to be something as simple as that. Feel like a real jerk now but what the heck , as long as i don't ask .. it wouldn't have got cleared.

Thanks Craig.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 11, 2008 6:29 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
If you would bother to read any of the 10 or 15 threads that have been posted here for the last week or so, about the same subject, you could have learned that the DISPLAY command will convert comp, comp-3 to 'read able' format.

Since the compiler will generate instructions to allow this type of silliness, your conversion moves have been executed correctly.

everything is ok except your understanding of computers.


If you had read my post correctly, my question was not about displaying the comp or comp3 in readable format.

If all programmers understood computers perfectly we wouldn't have a forum here for people to post their questions and experts answering them.

Though you may/may not have intended i find sarcastic rudeness in your post.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jun 11, 2008 7:05 pm    Post subject:
Reply with quote

no, your question was why did both appear to be the same when you displayed them. so, you did not know that the display command performed as it did. otherwise you would not have posted the question.

and I did not say that you lacked perfect understanding of computers, I just said you did not understand them enough, nor did you bother to search the forum before posting your question.

by the way, proper construction of your sentence in english would be:

Though you may (or may not) have intended to be so, I found the sarcasm in your post to be rude.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 11, 2008 7:11 pm    Post subject:
Reply with quote

I disagree again. My question was "What is weird is that the storage in comp-3 is similar to comp and defeats the purpose of using comp-3." and not as you had stated.

Thanks for correcting my english and i am happy you got my point out of it.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jun 11, 2008 7:52 pm    Post subject:
Reply with quote

Manu,

anybody who would say that the storage in comp-3 is similar to comp,
attracts my attention because of the obvious lack of understanding of something.

you based your comment on the results of the display command, and managed to talk yourself into a false trail.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 11, 2008 8:13 pm    Post subject:
Reply with quote

Hi Dick,

I understand the concepts of comp and comp-3 but have never attempted to display it in the past. This is my first attempt to do it and hence it seemed like both were 'stored' similarly although the fact was that both were only 'displayed' similarly . I got the point when Craq mentioned it. But what provoked me is your unwarranted comments attempting to ridicule my knowledge on computers which has allowed this conversation to grow to this extent.

May be you are used to throw in a bit of sarcasm in your posts and i am ok with it as long as it doesn't insult or offend an individual.

May be you are that way and i am this way. Period.
Please can we stop this conversation from growing.

Peace.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Jun 11, 2008 8:20 pm    Post subject:
Reply with quote

Manu you were referring to your WS variables WS-COMP3 and WS-COMP writing it down as comp-3 and comp.

Now as a COBOL programmer what does comp-3 and comp refer to ?

have a look back at your quote

Quote:


What is weird is that the storage in comp-3 is similar to comp and defeats the purpose of using comp-3.


Now you decide who is right and who is wrong ....
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 11, 2008 8:26 pm    Post subject:
Reply with quote

Thanks for attempting to mediate but Craq and Dick understood what i meant when i said comp and comp-3 there. So the whole conversation is not on that. I am sorry but i am in no mood to continue on this topic. I had a query which was resolved long back and i expected that to be the end of it but had gone this far.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    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 Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us