How do I move a PIC X field to a PIC S9 COMP-3 field in COBOL?

2.2k Views Asked by At

My situation is as follows.

I'm reading input from a file into the following working storage field: WORKING-STORAGE SECTION.

01 WORK-FIELDS. 05 W1-INPUT. 10 TESTCASE-NUMBER PIC X(02). 10 PIC X(01). 10 TESTCASE-ID PIC X(18). 10 PIC X(01). 10 TESTCASE-CONTENT PIC X(20).

Depending on what the TESTCASE-ID contains, I have to eventually move the content of the TESTCASE-CONTENT field into either the AMOUNT-DECIMAL-FORMAT or the AMOUNT-DECIMAL-NUMBER field in the following copybook:

05 (*)AMOUNT. 10 AMOUNT-DECIMAL-FORMAT PIC S9(18) COMP-3. 10 AMOUNT-DECIMAL-NUMBER PIC S9(01) COMP-3. 10 AMOUNT-IN-XML-FORMAT PIC N(20).

I then have to do a call to another program which will process these parameters and fill the AMOUNT-IN-XML-FORMAT field.

Anyway, so my question is: What's the best way to move the content of my PIC X field into my S9 COMP-3 field?

Thanks in advance for your time!

0

There are 0 best solutions below