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
 
Move 9(4) to S9(4)

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

New User


Joined: 06 Dec 2006
Posts: 1
Location: Bangalore

PostPosted: Thu Dec 21, 2006 12:36 pm    Post subject: Move 9(4) to S9(4)
Reply with quote

05 A Pic S9(4) comp
05 B Pic X(4)
Move " 3000" to B.
Move B To A.
What is the value of A of executing the above statement.
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Dec 21, 2006 3:32 pm    Post subject:
Reply with quote

If the move worked (a redefine would be easier in this case) a would equal 4092653808 which is the decimal value of 11110011111100001111000011110000 which is the binary value of F3F0F0F0 which is the hec value of 3000 which is the character value of 4092653808.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Dec 21, 2006 9:34 pm    Post subject: Re: Move 9(4) to S9(4)
Reply with quote

Hello suresh.gb,

Quote:

05 A Pic S9(4) comp
05 B Pic X(4)
Move " 3000" to B.
Move B To A.
What is the value of A of executing the above statement.


The compiler is probably to smart for its own good. It will make the assumption that you are moving numeric data and convert the char string ?3000? to binary on the move.

The Field ?A? will have a value of 3000, hex value x?0BB8?.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Dec 22, 2006 1:23 am    Post subject:
Reply with quote

Hello,

This code
Code:

  01  SOMESTUFF.             
      05 A PIC S9(4) COMP.   
      05 B PIC X(4).         

    MOVE "3000" TO B.         
    MOVE B TO A.             
    DISPLAY 'A=' A.           
    DISPLAY 'B=' B.           
    DISPLAY ' '.             


returns
Code:

A=3000
B=3000
       


Interestingly, this code
Code:

    MOVE "00AB" TO B.     
    MOVE B TO A.           
    DISPLAY 'A=' A.       
    DISPLAY 'B=' B.       
    DISPLAY ' '.           

returns
Code:

A=0012 
B=00AB 
       


while this code
Code:

    MOVE "00@\" TO B. 
    MOVE B TO A.       
    DISPLAY 'A=' A.   
    DISPLAY 'B=' B.   
    DISPLAY ' '.       

returns an 0C7.
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 Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 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

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