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
 
Compute statement with Cobol Z/os 5.2

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

New User


Joined: 03 Dec 2012
Posts: 41
Location: India

PostPosted: Fri May 11, 2018 8:02 pm    Post subject: Compute statement with Cobol Z/os 5.2
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: 276
Location: Cincinnati OH USA

PostPosted: Fri May 11, 2018 8:14 pm    Post subject:
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: 8356
Location: Dubuque, Iowa, USA

PostPosted: Fri May 11, 2018 8:54 pm    Post subject: Reply to: Compute statement with Cobol Z/os 5.2
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    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 SQL IN predicate using COBOL table jerryte DB2 16 Fri Jun 29, 2018 10:30 pm
No new posts Converting SAS code to Cobol or Easyt... Ashish.Raghav All Other Mainframe Topics 6 Fri Jun 29, 2018 6:01 pm
No new posts Can we use a file both as input and o... Chiku kumar COBOL Programming 11 Thu Jun 28, 2018 3:30 pm
No new posts Varying List Select SQL Query In DB2 ... NikhilGuptaGaya DB2 5 Wed Jun 27, 2018 11:01 pm
This topic is locked: you cannot edit posts or make replies. Need help - DB2 Dynamic SQL Program e... NikhilGuptaGaya DB2 6 Sat Jun 23, 2018 1:58 pm

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