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
 

 

COBOL MOVE from 9(10) to 9(10)

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

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Wed Mar 04, 2009 5:24 pm    Post subject: COBOL MOVE from 9(10) to 9(10)
Reply with quote

Hi,
I guess i miss something in the below issue and here goes the problem,there is a zero coming in the last digit of the move from 9(10) to 9(10).Not sure how it comes?

This is the COBOL declaration

Code:
05 WS-BULKCPY-SUBMITTED-AMT1   PIC 9(10)  VALUE ZEROS.

05 BULKCPY-SUBMITTED-AMT1      PIC 9(10)  VALUE ZEROS.



This is the programming code

Code:
DISPLAY 'QUEUE SUB AMT : ' , WS-BULKCPY-SUBMITTED-AMT1   
                                                         
 INITIALIZE BULKCPY-SUBMITTED-AMT1                       
                                                         
 DISPLAY 'SUB AMT-BM:' , BULKCPY-SUBMITTED-AMT1 
                                                         
 MOVE WS-BULKCPY-SUBMITTED-AMT1 TO                       
                    BULKCPY-SUBMITTED-AMT1               
                               
 DISPLAY 'SUB AMT:' , BULKCPY-SUBMITTED-AMT1   




Output is

Code:
QUEUE SUB AMT : 100               
SUB AMT-BM:0000000000   
SUB AMT:100      0   


HEX ON Ouptut is

Code:
QUEUE SUB AMT : 100                     
DECEC4EEC4CDE474FFF444444444444444444444
84545024201430A01000000000000000000000000

SUB AMT-BM:0000000000
EEC4CDE6CD7FFFFFFFFFF
2420143024A0000000000

SUB AMT:100      0     
EEC4CDE7FFF444444F44444
2420143A100000000000000
Back to top
View user's profile Send private message

Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Wed Mar 04, 2009 5:44 pm    Post subject: Reply to: COBOL MOVE from 9(10) to 9(10)
Reply with quote

Muthuvel,
Any idea why
Code:
DISPLAY 'QUEUE SUB AMT : ' , WS-BULKCPY-SUBMITTED-AMT1
is displayed as
Code:
QUEUE SUB AMT : 100
and not as
Code:
QUEUE SUB AMT : 000000100

Secondly, did you try expediting the code and moving 100 to BULKCPY-SUBMITTED-AMT1 field and displaying the same.

Not sure if this will actually help you ..just trying to open few doors.
WTF
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Mar 04, 2009 5:51 pm    Post subject: Re: COBOL MOVE from 9(10) to 9(10)
Reply with quote

muthuvel wrote:
there is a zero coming in the last digit of the move from 9(10) to 9(10).Not sure how it comes?
Since the receiving field has no sign specified, COBOL is setting the half byte to a 'F', insuring a positive sign.
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Wed Mar 04, 2009 6:00 pm    Post subject:
Reply with quote

The input file to this has the number as 100 in 9(10) with right justified data and i tried previously to move 100 directly and the output that occured was

Code:
QUEUE SUB AMT : 100           
SUB AMT-BM:0000000000
SUB AMT:0000000100   


My understanding is ,when you move from a variable A to variable B provided both are of same data type and same type ,the move is similar to copy.Am I right?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Mar 04, 2009 6:12 pm    Post subject:
Reply with quote

muthuvel wrote:
My understanding is ,when you move from a variable A to variable B provided both are of same data type and same type ,the move is similar to copy.Am I right?
Half way.....
Packed decimal is always ZAPed (zero and add packed), but display character and numeric is MVCed (moved).
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Mar 04, 2009 6:21 pm    Post subject:
Reply with quote

As you've defined the code, there's no reason for the behavior that you're seeing. I ran a test with using Enterprise COBOL 3.4 of:
Code:
01  WS-VARIABLES.
    05 WS-BULKCPY-SUBMITTED-AMT1   PIC 9(10)  VALUE ZEROS.
    05 BULKCPY-SUBMITTED-AMT1      PIC 9(10)  VALUE ZEROS.
PROCEDURE DIVISION.
S1000-MAIN       SECTION.
    MOVE 100                    TO  WS-BULKCPY-SUBMITTED-AMT1.
    DISPLAY 'QUEUE SUB AMT : '  WS-BULKCPY-SUBMITTED-AMT1.

    INITIALIZE BULKCPY-SUBMITTED-AMT1.

    DISPLAY 'SUB AMT-BM:'  BULKCPY-SUBMITTED-AMT1.

    MOVE WS-BULKCPY-SUBMITTED-AMT1 TO
                    BULKCPY-SUBMITTED-AMT1.

    DISPLAY 'SUB AMT:' BULKCPY-SUBMITTED-AMT1.
and got results of
Code:
 QUEUE SUB AMT : 0000000100
 SUB AMT-BM:0000000000
 SUB AMT:0000000100
Either the variables aren't defined as you have them, or the code isn't as you have it. The behavior you posted is what I would expect if the sending variable was defined as X(03) or possibly X(10), not 9(10).
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Mar 04, 2009 6:32 pm    Post subject:
Reply with quote

Robert wrote:
As you've defined the code, there's no reason for the behavior that you're seeing.
Not quite, since the OP has shown that WS-BULKCPY-SUBMITTED-AMT1 contains:
Code:
100                     
FFF4444444
1000000000
Which perfectly explains this behavior.....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Mar 04, 2009 6:37 pm    Post subject:
Reply with quote

You're right, CICS Guy -- so I think the question becomes, why that value in WS-BULKCPY-SUBMITTED-AMT1?
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Wed Mar 04, 2009 7:00 pm    Post subject: Reply to: COBOL MOVE from 9(10) to 9(10)
Reply with quote

As Rob and CICS guy said,though the input passed was numbers it was passed as right justified to my input part (making it to be alphanumeric format) , which caused the problem.

When I received it in alphanumeric format X(10) and moved to 9(10) ,it got solved.

Thanks Folks !!!
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 RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm


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