IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
Reply with quote

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

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: 148
Location: Ottawa Canada

PostPosted: Fri Jul 06, 2007 7:52 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top