It could be defined on the input record as:

05 DEC-PER PIC V99.

01 CONSTANTZ. 05 FIRST-PER-WS PIC V99 VALUE .15. 05 SECOND-PER-WS PIC V99 VALUE .25.

If you define your print line in the WORKING-STORAGE SECTION, the area to print the percentage might look like this.

01 DETAIL-LINE. ... 05 PERCNT-PR PIC 99 VALUE 0. 05 PERCNT-SGN-PR PIC X VALUE "%"

Remember, if you define a line in the WORKING-STORAGE SECTION, when it is time to write it you must say something like WRITE PRINTZ FROM DETAIL-LINE where PRINTZ is defined asthe 01 level of the FD. The reason for this is, all input and output has to go through the file section. You cannot a line set-up in the WORKING-STORAGE SECTION directly.

If you define your print line in the FILE SECTION you cannot use the VALUE clause so the line would look like this. (Remember, the only VALUE allowed in the FILE SECTION is a level 88 value.)

01 PRINTZ. ... 05 PERCNT-PR PIC 99. 05 PERCNT-SGN-PR PIC X.

In the PROCEDURE DIVSION:

In the routine where you are calculating and setting up the line, you would use the following code to do the calculation if the percent came in on the input:

MULTIPLY AMT-WS BY DEC-PER GIVING ANS-WS.

If the decimal was stored in a constant in WORKING-STORAGE, you must determine when to use FIRST-PER-WS and when to use SECOND-PER-WS. I decided that if a field on the input called CODE was equal to A then I would use FIRST-PER-WS otherwise I would use SECOND-PER-WS, therefore the code would be:

IF CODEZ = "A" MULTIPLY AMT-WS BY FIRST-PER-WS GIVING ANS-WS ELSE MULTIPLY AMT-WS BY SECOND-PER-WS GIVING ANS-WS.

Then when you are ready to print the line. you would do the following if the decimal came in on the input:

MULTIPLY DEC-PER BY 100 GIVING PERCNT-PR.

If the decimal was a constant in WORKING-STORAGE, then the code would be:

IF CODEZ = "A" MULTIPLY FIRST-PER-WS BY 100 GIVING PERCNT-PR ELSE MULTIPLY SECOND-PER-WS BY 100 GIVING PERCNT-PR.If the line was set up in WORKING STORAGE with the % in the VALUE clause, then the percent sign is already on the line (just be careful that you don't MOVE SPACES TO DETAIL-LINE or you will wipe it out). If the line was set up in the FILE SECTION you can't have VALUE clauses, so the % is not there and must be moved. The way you do this is to include this move when you are setting up the line:

MOVE "%" to PERCNT-SGN-PR.

On the print line (whether it is set up in the FILE SECTION or the WORKING-STORAGE SECTION), you should define PERCNT-PR with a PICTURE of V99.

05 PERCNT-PR PIC V99.

Now, you do not have to multiply the percent by 100 giving the place on the printline, you can simply move it. If the decimal was .25 the decimal point and the V will line up so the number will move in correctly, but because of the V there will be no actual decimal point on the line and only the 25 will print. The code to move the percent if it came in on the input record would be:

MOVE DEC-PER TO PERCNT-PR.

If the percent was defined as a constant in WORKING-STORAGE the moves would be embedded in an IF and look like this:

IF CODEZ = "A" MOVE FIRST-PER-WS TO PERCNT-PR ELSE MOVE SECOND-PER-WS TO PERCNT-PR.

Again, if the line is defined in the FILE SECTION, you need the code to move the % to the line:

MOVE "%" TO PERCNT-SGN-PR.