Thursday, 10 March 2011

Largest Of 3 Nos using COBOL

*PROGRAM TO FIND LARGEST OF 3 NUMBERS
       IDENTIFICATION DIVISION
       PROGRAM-ID. LARGEST OF 3 NUMBERS
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       77 A PIC S9999V99.
       77 B PIC S9999V99.
       77 C PIC S9999V99.
       77 K PIC ZZ99.99.
       PROCEDURE DIVISION.
       EVAL-PARA.
           DISPLAY "ENTER THE VALUES OF A B C".
           ACCEPT A.
           ACCEPT B.
           ACCEPT C.
           IF A = B AND B = C
                DISPLAY "all are equal"
           ELSE IF A > B AND A > C
                MOVE A TO K
                DISPLAY "LARGEST=", K GO TO EXT-PARA
           ELSE IF B > C
                MOVE B TO K
                DISPLAY "LARGEST=", K GO TO EXT-PARA
           ELSE
                MOVE C TO K
                DISPLAY "LARGEST=", K.
       EXT-PARA.
       STOP-RUN.

No comments:

Post a Comment

Get CSV Values in SQL

Query: DECLARE @CSVValue NVARCHAR(50)='100,101,102'                   DECLARE @eachValue NUMERIC(9,0)   while len(@CSVValue) ...