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

Compute statement with Cobol Z/os 5.2


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

New User


Joined: 03 Dec 2012
Posts: 46
Location: India

PostPosted: Fri May 11, 2018 8:02 pm
Reply with quote

Alphanumeric to Numeric move...
Alphanumeric value in Numeric field used in computation working perfectly fine.. actual it should abend?

Example:

05 WS-COUNT PIC 9(3) Value 0.
05 WS-COUNT1 PIC 9(3) Value 0.
05 WS-ALPHA PIC X(3) Value 'BBC'.

Move WS-ALPHA to WS-COUNT

COMPUTE WS-COUNT1 = (40 + WS-COUNT)


Not understanding the Move rules here, please advise?
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Fri May 11, 2018 8:14 pm
Reply with quote

What results when you try it? Provide HEX display of fields before and after the MOVE and COMPUTE.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri May 11, 2018 8:54 pm
Reply with quote

Quote:
actual it should abend?
Actually, no it should not abend. From the Enterprise COBOL Language Reference manual, referring to numeric or numeric-edited receiving fields:
Quote:
When the category of the sending item is alphanumeric, alphanumeric-edited,
national, or national-edited, the data is moved as if the sending item were
described as an unsigned integer.
So the behavior you are seeing is normal and expected PER THE MANUAL.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top