I work with COBOL using RPP EDI(It uses Eclipse as environment). The task is simple but, for some reason, it is not working in RPP (If I do it using COBOL in Mainframe direcyly, it does work). I need to add +1 to a variable (called: File Sequence Number) of a table. The field of the table is set as Char (who knows why?) and the temporary variable of the sequence number is defined as Numeric:
DB30-BA3511 PIC X(10) ->this is the DB field
WS-FILE-SEQ-NUM PIC 9(10) ->this is the temporary variable
The tasks is simple and it would work in almost every language, but for some reason here it is not behaving as expected. This is what it does in RPP: When I move the DB field value (currently as '1' in the DB) to the local variable WS-FILE-SEQ-NUM, it is saved as 1000000000 instead of 0000000001 so when I add +1 the result is: 1000000001 instead of 0000000002 (or just 2)
MOVE DB30-BA3511 TO WS-FILE-SEQ-NUM
ADD +1 TO WS-FILE-SEQ-NUM
MOVE WS-FILE-SEQ-NUM TO DD30-BA3511
I tried the following without success:
- Using REDEFINES
- Instead of using PIC 9 I tried with PIC S9 (with and without COMP)
and some other things that I don't even remember because I've been struggling with this for days
Any ideas ? thank you in advance!
COMP(orUSAGE COMP) won't be the correct one butUSAGE DISPLAY. I don't think this will help in this case as the problem is in your DB30-BA3511 field. Therefore we'd need to see how the data gets in there, not what happens afterwards (theADDis obviously working fine).