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
 
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: 213
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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 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. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

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