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
 

 

Why Moving to s9(9)v IS TAKING - AS 0'S

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

New User


Joined: 19 Feb 2008
Posts: 5
Location: India

PostPosted: Mon Jun 16, 2008 7:59 pm    Post subject: Why Moving to s9(9)v IS TAKING - AS 0'S
Reply with quote

Hi all,

i have these two variables :

WS-NUM1 9(9) VALUE 07-7-1297.
WS-NUM2 S9(9)V COMP-3.

now if i do the following move

MOVE ws-NUM1 to WS-NUM2 it is giving me the following results- :

WS-NUM2 = 070701297 i.e. it is replacing all the - in WS-NUM1 by spaces.

Can anyone please explain why this is happening.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Jun 16, 2008 8:05 pm    Post subject:
Reply with quote

A dash is x'60' so rather than abending it is taking the numeric portion of what is suppose to be zoned decimal. GIGO
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Mon Jun 16, 2008 8:34 pm    Post subject:
Reply with quote

The compiler probably generates a ZAP instruction to move the data to the COMP-3 field. ZAP instructions assume the zones are valid and converts only the value parts of each byte -- as long as the last 4 bits of the byte are in the 0 to 9 range you won't get an abend.

If you know you've got bad data, you should be coding
Code:

IF WS-NUM1 NUMERIC
    MOVE WS-NUM1 TO WS-NUM2
ELSE ....
Back to top
View user's profile Send private message
udit_adhlakha

New User


Joined: 19 Feb 2008
Posts: 5
Location: India

PostPosted: Tue Sep 09, 2008 6:41 pm    Post subject:
Reply with quote

Robert Sample wrote:
The compiler probably generates a ZAP instruction to move the data to the COMP-3 field. ZAP instructions assume the zones are valid and converts only the value parts of each byte -- as long as the last 4 bits of the byte are in the 0 to 9 range you won't get an abend.

If you know you've got bad data, you should be coding
Code:

IF WS-NUM1 NUMERIC
    MOVE WS-NUM1 TO WS-NUM2
ELSE ....


Forgot to mention but the suggestion that was provided did work. Many thanks.
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 Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts Moving character data to smallint in db2 rikdeb DB2 5 Thu Jul 14, 2016 12:38 am
No new posts MOVING COMP-3 into binary akodakka COBOL Programming 2 Tue Dec 01, 2015 5:02 pm
No new posts CICS- Moving to High availability vicky10001 CICS 8 Fri Oct 23, 2015 7:49 pm
No new posts What is the best way for moving from ... Hooman24 All Other Mainframe Topics 0 Sun Apr 26, 2015 6:36 pm


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