Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Cobol Move query not giving expected value

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

New User


Joined: 21 Nov 2006
Posts: 48
Location: mumbai

PostPosted: Thu Aug 30, 2007 4:52 pm    Post subject: Cobol Move query not giving expected value
Reply with quote

Hi Friends,
this is my code.

Code:

WORKING-STORAGE SECTION.                         
01  GROSS-PAY.                                   
    05  BASIC    PIC 999V9 USAGE COMP VALUE 50. 
    05  ALLOW    PIC 9(3).                       
01  WS-A         PIC 999.                       
PROCEDURE DIVISION.                             
    MOVE ZEROS TO GROSS-PAY.                     
    MOVE BASIC TO WS-A.                         
    DISPLAY 'WS-A ' WS-A.                       
    STOP RUN.         


i should get value of WS-A as 100 but it is not showing it 100.
instead i am getting 218.

i am not getting the reason behind it.

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

amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Thu Aug 30, 2007 4:57 pm    Post subject:
Reply with quote

How it is possible man? You are first using the following code -
Code:
MOVE ZEROS TO GROSS-PAY.

And the variable declaration is -
Code:

01 GROSS-PAY.
     05 BASIC PIC 999V9 USAGE COMP VALUE 50.
     05 ALLOW PIC 9(3).

So all the variables BASIC and ALLOW will be set to zeros. Pls clarify this first!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Thu Aug 30, 2007 5:34 pm    Post subject:
Reply with quote

why do you think that you should have a value of 100?
Back to top
View user's profile Send private message
sudhakar_lendave

New User


Joined: 21 Nov 2006
Posts: 48
Location: mumbai

PostPosted: Thu Aug 30, 2007 5:54 pm    Post subject: Reply to: cobol move query.
Reply with quote

Sorry all for the confusion.
please refer this code

Code:

WORKING-STORAGE SECTION.                         
01  GROSS-PAY.                                   
    05  BASIC    PIC 999V9 USAGE COMP VALUE 50. 
    05  ALLOW    PIC 9(3).                       
01  WS-A         PIC 999.                       
PROCEDURE DIVISION.                             
    MOVE ZEROS TO GROSS-PAY.                     
    ADD 50 TO BASIC.
    MOVE BASIC TO WS-A.                         
    DISPLAY 'WS-A ' WS-A.                       
    STOP RUN.         
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Thu Aug 30, 2007 6:00 pm    Post subject: Re: Reply to: cobol move query.
Reply with quote

sudhakar_lendave wrote:
Sorry all for the confusion.
please refer this code

Code:

WORKING-STORAGE SECTION.                         
01  GROSS-PAY.                                   
    05  BASIC    PIC 999V9 USAGE COMP VALUE 50. 
    05  ALLOW    PIC 9(3).                       
01  WS-A         PIC 999.                       
PROCEDURE DIVISION.                             
    MOVE ZEROS TO GROSS-PAY.                     
    ADD 50 TO BASIC.
    MOVE BASIC TO WS-A.                         
    DISPLAY 'WS-A ' WS-A.                       
    STOP RUN.         


MOVE ZEROS TO GROSS-PAY is an alphanumeric move so you are moving the character '0' to gross-pay not the number 0. Try MOVE ZEROS TO ALLOW instead.
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 How to force a select query to abend neo4u DB2 5 Mon Apr 23, 2018 1:36 pm
No new posts How to display offset thru cobol prog... tvinodkumar7 CICS 1 Sun Apr 22, 2018 8:42 pm
No new posts Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us