AMT Help Files

IF

COBOL JAVA
IF Java if statement

Example(s)

COBOL Java
IF A > B THEN
    MOVE A TO B
    ADD A TO B
END-IF.
                
if (locDef.a.getIntValue() > locDef.b.getIntValue()) {
    locDef.b.assign(locDef.a.getIntValue());
    locDef.b.assign(locDef.b.getIntValue() + locDef.a.getIntValue());
}
                
IF A > B THEN
    IF B < A THEN
        IF A = B THEN
            MOVE A TO B
            ADD A TO B
        ELSE
            NEXT SENTENCE
    END-IF
    ELSE
        MOVE B TO A
        ADD B TO A
    END-IF
ELSE
    DISPLAY 'NON OF THE ABOVE'
END-IF.
                
if (locDef.a.getIntValue() > locDef.b.getIntValue()) {
    if (locDef.b.getIntValue() < locDef.a.getIntValue()) {
        if (locDef.a.getIntValue() == locDef.b.getIntValue()) {
            locDef.b.assign(locDef.a.getIntValue());
            locDef.b.assign(locDef.b.getIntValue() + locDef.a.getIntValue());
        } else {
            jumpToLabel = Label_NextSentence_1; // NEXT SENTENCE
            continue mainLoop;
        }
    } else {
        locDef.a.assign(locDef.b.getIntValue());
        locDef.a.add(locDef.b.getIntValue());
    }
} else {
    display("non of the above");
}