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: 42
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: 289
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: 8454
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 Odd bit of COBOL socker_dad COBOL Programming 3 Tue Jul 09, 2019 4:46 am
No new posts Regarding mroe data to be processed i... vinu78 DB2 3 Mon May 27, 2019 7:31 pm
No new posts S0C7 abend while running a Cobol Program amitc23 COBOL Programming 2 Tue May 07, 2019 4:06 pm
No new posts SQLCODE -950 in PREPARE statement ... PeD DB2 2 Sat Apr 20, 2019 7:00 pm
No new posts Can we pass cobol pointer to cobol-db... rohanthengal DB2 4 Tue Mar 19, 2019 1:04 pm

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