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
 

 

Redefine Numeric to Alphanumeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Redefine Numeric to Alphanumeric
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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Mon Oct 06, 2014 9:49 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Oct 06, 2014 9:49 pm    Post subject: Reply to: Redefinition of numeric to alphanumeric
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    Post subject: Reply to: Redefinition of numeric to alphanumeric
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Mon Oct 06, 2014 11:13 pm    Post subject: Reply to: Redefinition of numeric to alphanumeric
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    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 move a long alphanumeric data ... lind sh COBOL Programming 5 Mon Dec 05, 2016 7:51 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts alphanumeric sequence generation sivaprasad.gadhi COBOL Programming 6 Wed Mar 30, 2016 3:03 am


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