ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

I move pic x to pic 9 and get no mch1202

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I move pic x to pic 9 and get no mch1202

    At our shop, we have multiple platforms that run our software. One being an I-series with OS V5R4M0. We had a discrepancy between platforms in that the windows version had ' 25' [ 3 spaces then 25] and the as400 was giving us '00025' [ 3 zeroes then 25]. I wrote this little program to test the results in the real program because I could not believe that the debugger accepted this.


    blah,blah,blah. beginning of program stuff.........

    WORKING STORAGE.

    01 WS-NUMERIC PIC 9(5).
    01 WS-ALPHA PIC X(5).


    *
    PROCEDURE DIVISION.
    *
    *================================================= ============
    0000-000-MAIN-PROCESS SECTION.
    0000-000-START.
    *================================================= ============
    MOVE ZEROES TO WS-NUMERIC.
    DISPLAY ' WS-NUMERIC IS: ' WS-NUMERIC.
    MOVE ' 25' TO WS-ALPHA.
    DISPLAY ' WS-ALPHA IS: ' WS-ALPHA.
    MOVE WS-ALPHA TO WS-NUMERIC.
    DISPLAY ' WS-NUMERIC IS: ' WS-NUMERIC.


    The results of the display statements are:
    WS-NUMERIC IS: 00000
    WS-ALPHA IS: 25
    WS-NUMERIC IS: 00025

    If the numbers (25) are not in the last two positions of the 5 byte alpha field, it abends ( like I would expect). I cant believe this..... must have living under a rock for that 3 decades.
    Any thoughts???
    Thanks,
    John
    John M. Mauro
    Software Engineer
    nThrive

  • #2
    Re: I move pic x to pic 9 and get no mch1202

    LOL... I believe that the MOVE statement will automatically convert between an alphanumeric and display numeric fields.

    If WS-NUMERIC is defined as signed or packed...its likely to be a problem ;-)

    Comment

    Working...
    X