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: 282
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: 8404
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 how to use RDZ for converting cobol c... balajiChid CICS 1 Tue Oct 09, 2018 8:40 pm
No new posts COBOL - JSON GENERATE husni1972 COBOL Programming 1 Fri Aug 17, 2018 3:29 am
No new posts Create view statement from SYSIBM.SYS... andrea DB2 5 Thu Aug 02, 2018 9:30 pm
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

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