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

Doudt reg move statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
MKP

New User


Joined: 23 Aug 2006
Posts: 12
Location: Chennai

PostPosted: Thu Oct 12, 2006 12:15 pm
Reply with quote

Hi All,

Can anyone tell me the output of this code, and the reason behind that.

Code:
01 Ws-var.
              10  A                     PIC  x(10) values 'ABCDE12345'.
              10 B REDEFINES A OCCURS 5 TIMES PIC X(2).
 
         02    WS-SUB          PIC 99               VALUE ZERO.
         02    NUM1              PIC  99 COMP-3 VALUE ZERO.
         02    NUM2              PIC  99               VALUE ZERO.
 
 
 
             2000-MAIN-PARA.
 
LABELA    MOVE  B(2) TO   NUM2.
LABELB   DISPLAY 'NUM2'    NUM2.
LABELC   MOVE  B(5) TO   NUM1.
LABELD    DISPLAY 'NUM1'    NUM1.
LABELE   MOVE  B(1) TO   NUM1.
LABELF    DISPLAY 'NUM1'    NUM1.
LABELG   MOVE  B(2) TO   NUM1.
LABELH    DISPLAY 'NUM1'    NUM1.
Back to top
View user's profile Send private message
bhavishya_bhandari

New User


Joined: 30 May 2006
Posts: 7

PostPosted: Thu Oct 12, 2006 12:27 pm
Reply with quote

are u trying to move Alphabatic value to numeric ??
it will give S0C7 ..!!
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Oct 12, 2006 12:43 pm
Reply with quote

Hi there ,

It will display

NUM2:C4 because b(2) contain CD & u declare num2 as 99
not sure abt this why it is changiung it to C$.
NUM1:45 because b(5) contain 45
NUM1:12 because b(1) contain AB & u declared it 9(2) comp-3
NUM1:34 because b(2) contain CD & u declared it 9(2) comp-3
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 JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts How to move DB2 Installation HLQ DB2 4
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
Search our Forums:

Back to Top