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
 

 

Have to move value of 10220 to s9(04) binary field

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

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Fri Jul 06, 2007 6:37 pm    Post subject: Have to move value of 10220 to s9(04) binary field
Reply with quote

Could any pls help me on the below issue.

I have to move value of 10220 to s9(04) binary field.
I read in the cobol book that s9(04) binary can accomodate nbrs range from -32000 to +32000.
But when tried to move 10220 in this field..Data is getting truncated and saving only 4 digits like 0220.
Is there any way to accomodate this requirement instead of increasing the size of the receIving field.

Please advice.
Back to top
View user's profile Send private message

prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Fri Jul 06, 2007 6:55 pm    Post subject:
Reply with quote

please refer to the following link, you may find your answer:

http://ibmmainframes.com/viewtopic.php?t=21648&highlight=9999&sid=16f4784a6a022e73196dcd9b95cec9e3
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Fri Jul 06, 2007 7:52 pm    Post subject:
Reply with quote

The compile TRUNC option is key to your question.

Our shop has a standard that says we have to use TRUNC(OPT). This standard was based on some performance benchmarks that showed that TRUNC(OPT) runs significantly faster than the others. I am a bit skeptical about this but no big deal I guess...

Using TRUNC(OPT), this is what we observe...

The MOVE statement can safely move the value 12345 into a PIC S9(4) COMP field. However, the COMPUTE statement will truncate any result back to 4 digits. Very weird.
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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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