The SUBTRACT statement is used to subtract one, or the sum of two or more, numeric data items from a numeric data item and store the result.
Format 3:Subtract Corresponding
In Format 1, all literals or identifiers preceding the word FROM are added together and the sum is stored in a temporary data item.The value of this temporary data item is subtracted from the value of the data item specified by identifier-3, storing the result into the data item specified by identifier-3, and repeating this process for each successive occurrence of identifier-3 in the left-to-right order in which identifier-3 is specified.
In Format 2, all literals or identifiers preceding the word FROM are added together, the sum is subtracted from literal-2 or identifier-2 and the result of the subtraction is stored as the new value of identifier-3.
If Format 3 is used, data items in identifier-1 are subtracted from and stored into corresponding data items in identifier-2.
Each identifier must refer to a numeric elementary item except that:
Each literal must be a numeric literal.
Additional rules and explanations regarding features of the SUBTRACT statement that are common to other arithmetic statements can be found in the discussion of common rules.See in particular the discussions of the ROUNDED phrase, the size error condition, overlapping operands, modes of operation, composite size, and incompatible data.
If the CORRESPONDING phrase is used, selected items within identifier-1 are subtracted from, and the result stored in, the corresponding items in identifier-2.
For the SUBTRACT statement with the CORRESPONDING phrase:
The rules that govern the selection of eligible subordinate data item pairs are as follows:
If any of the individual operations produces a size error condition, imperative-statement-1 in the ON SIZE ERROR phrase is not executed until all of the individual subtractions are completed.
CORR is an abbreviation for CORRESPONDING.
SUBTRACT Statement Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.