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
 

 

moving a s9(09) usage comp to 9(10) variable -urgent

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

New User


Joined: 20 Nov 2005
Posts: 15

PostPosted: Sat Dec 03, 2005 1:23 am    Post subject: moving a s9(09) usage comp to 9(10) variable -urgent
Reply with quote

Hi all,



We have a requirement where we move a s9(09) usage comp variable to 9(10) variable.



The variable declaration are: LS-ITEM-SID PIC S9(09) USAGE COMP.

WS-NUMERIC-SID PIC 9(10) VALUE ZEROES.



The value in LS-ITEM-SID is -2147483507.

Then the following statement is executed:

MOVE LS-ITEM-SID TO WS-NUMERIC-SID



After this statement the value in WS-NUMERIC-SID is 147483507. (Please note that leftmost two is missed).



The same statement is working fine in our client mainframe, but when we run it in our own mainframe the leftmost digit is truncated.

Any idea why this happens?



Thanks in advance.
Senthil Nathan.R
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sat Dec 03, 2005 3:40 am    Post subject: Re: moving a s9(09) usage comp to 9(10) variable -urgent
Reply with quote

I would say the difference is in the compilers. There are some compilers, or compiler versions that will strictly adhere to the picture edit. You have S9(9), a signed 9 digit number. You are trying to use a 10 digit signed number. This will, with some compilers, truncate the value to -147483507. Then when you move it to a 9(10), an unsigned 10 digit number, the result will be 147483507.

The compile I have will honor any number that will fix into a full word +- 2147483647. Even if the picture is defined as a s9(5) comp.
Back to top
View user's profile Send private message
jon_s_rice

Active User


Joined: 24 Mar 2005
Posts: 102
Location: Douglasville, GA USA

PostPosted: Sun Dec 04, 2005 11:34 pm    Post subject:
Reply with quote

When you compile the program use the TRUNC(BIN) option.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Dec 05, 2005 3:46 am    Post subject:
Reply with quote

Hi Nathan,

What is the actual hex value in LS-ITEM-SID?
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
This topic is locked: you cannot edit posts or make replies. Urgent Mainframe Requirments (2-10 yr... Shankar779 Mainframe Jobs 0 Sun Nov 27, 2016 1:48 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


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