IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Move 9(4) to S9(4)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 3156
Location: Tucson AZ

PostPosted: Thu Dec 21, 2006 3:32 pm
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
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

Moderator Emeritus


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

PostPosted: Fri Dec 22, 2006 1:23 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts How to move DB2 Installation HLQ DB2 4
No new posts How to move values from single dimens... COBOL Programming 1
No new posts Reading the CSV data in COBOL and mov... COBOL Programming 4
Search our Forums:

Back to Top