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

Redefine Numeric to Alphanumeric


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Mon Oct 06, 2014 9:16 pm
Reply with quote

Hi

I have a code as below.

Code:
 
10  AMOUNT-CHG           PIC  9(09)V99.
10  AMOUNT-CHG-X        REDEFINES
     AMOUNT-CHG           PIC  X(11).
10  APP-FIELDS     OCCURS 5 TIMES
                              INDEXED BY IDX.
      15  APP-AMT                  PIC S9(09)V99  COMP-3.
10 CHG        PIC  X(01) VALUE 'N'.
    88 CHG-FLG              VALUE 'Y'.


I am moving the value from APP-AMT to AMOUNT-CHG as below:
Code:

IF CHG-FLG (WS-SUB)
   MOVE APP-AMT (IDX) TO
        AMOUNT-CHG
ELSE
   MOVE SPACES            TO AMOUNT-CHG-X
END-IF


But whenever I am moving the values to the AMOUNT-CHG, it is getting populated with 40404040404

Kindly advise and please let me know if further details are required.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2588
Location: NYC,USA

PostPosted: Mon Oct 06, 2014 9:49 pm
Reply with quote

Add display's to ensure
Code:
IF CHG-FLG (WS-SUB)
is ever true?
also is this an array CHG-FLG?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Mon Oct 06, 2014 9:49 pm
Reply with quote

The result is SPACES because APP-AMT (IDX) equals SPACES as well. You have bad data.
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Mon Oct 06, 2014 10:07 pm
Reply with quote

Hi

The flag is true and the source value is a valid value that I see. I have already verified that these fields have values

Regards Suraaj
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Oct 06, 2014 11:13 pm
Reply with quote

I think you've missed Rohit's points.

Your flag is not part of an OCCURS. The code you have shown will not compile.

Whatever the actual code is, your test (despite what you think) is always false, or the code is never executed and the field happens to contain space, and it is unchanged as the code never executes. Or, you are doing it in a loop and only looking at the final value which is always false, so ways sets space.

So show the actual code. We can't really tell, except we know the code is wrong. You have to accept that. Your code can't be right and give an incorrect result.
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 Numeric check w/SyncSort. SYNCSORT 1
No new posts how to get total count from numeric d... SYNCSORT 9
No new posts XML-GENERATE to render edited numeric COBOL Programming 0
No new posts To convert numeric to Packed Decimal DFSORT/ICETOOL 9
No new posts Get next 5 numeric from a string of '... COBOL Programming 4
Search our Forums:

Back to Top