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
 

 

Variable movement in COBOL

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

Active User


Joined: 18 Jun 2007
Posts: 210
Location: Cochin/Kerala/India

PostPosted: Tue Jun 17, 2008 8:48 pm    Post subject: Variable movement in COBOL
Reply with quote

Hi All,
In a cobol program i declared 3 variables as follows,

05 WS-A PIC X(02) VALUE '12'.
05 WS-B PIC X(06) VALUE SPACES.
05 WS-C PIC 9(06) VALUE ZEROES.

AFTER THE BELOW OPERATION WHAT SHOULD BE THE VALUE IN EACH VARIABLES?

MOVE WS-A TO WS-B.
MOVE WS-B TO WS-C.

I got values as,
WS-A : 12
WS-B: '12 '(12 and 4 spaces)
WS-C:'12 0'(12,3 SPACES and one zero)

Any one explain to me Why i got this value in WS-C??
Regards,
Bipin Peter
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: Tue Jun 17, 2008 9:55 pm    Post subject:
Reply with quote

Hello,

Quote:
Why i got this value in WS-C??
Not to sound trite, but because that is the way it works. . . And it is not intuitive.

When you moved the x(6) to the 9(6), the "12" and the spaces were moved. When the value was "received" the system forced an "F" sign over the low order digit of the 9(6), creating an x'F0" (instead of the x'40' of the low-order space).
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


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