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: 208
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 Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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