SUBTRACT A B FROM C D ---------- Syntax 1
SUBTRACT A B C FROM D GIVING E ---------- Syntax 2
SUBTRACT CORR WS-GR1 TO WS-GR2 ---------- Syntax 3
IDENTIFICATION DIVISION.
PROGRAM-ID. SV.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-N1 PIC 9(5) VALUE 25.
01 WS-N2 PIC 9(3) VALUE 15.
01 WS-N3 PIC 9(4) VALUE 110.
01 WS-N4 PIC 9(3) VALUE 80.
01 WS-NA PIC 9(2) VALUE 12.
01 WS-NB PIC 9(2) VALUE 8.
01 WS-NC PIC 9(3) VALUE 10.
01 WS-ND PIC 9(4) VALUE 90.
01 WS-NE PIC 9(3) VALUE 10.
PROCEDURE DIVISION.
SUBTRACT WS-N1 WS-N2 FROM WS-N3 WS-N4.
SUBTRACT WS-NA WS-NB WS-NC FROM WS-ND GIVING WS-NE.
DISPLAY "WS-NUMBER-1 : " WS-N1
DISPLAY "WS-NUMBER-2 : " WS-N2
DISPLAY "WS-NUMBER-3 : " WS-N3
DISPLAY "WS-NUMBER-4 : " WS-N4
DISPLAY "WS-NUMBER-A : " WS-NA
DISPLAY "WS-NUMBER-B : " WS-NB
DISPLAY "WS-NUMBER-C : " WS-NC
DISPLAY "WS-NUMBER-D : " WS-ND
DISPLAY "WS-NUMBER-E : " WS-NE
STOP RUN.