Thursday, 10 March 2011

*PROGRAM sum of elements of 2 groups using ADD CORRESPONDING verb

       IDENTIFICATION DIVISION
       PROGRAM-ID. ARRAY ADDITION
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 GROUPA.
           02 N1 PIC S999V99.
           02 N2 PIC S999V99.
           02 N3 PIC S999V99.
       01 GROUPB.
           02 N1 PIC S999V99.
           02 N2 PIC S999V99.
           02 N3 PIC S999V99.
       01 GROUPC.
           02 N1 PIC -ZZZ.ZZ.
           02 N2 PIC -ZZZ.9Z.
           02 N3 PIC -ZZZ.9Z.
       PROCEDURE DIVISION.
       ACC-PARA.
           DISPLAY "ENTER THE VALUES OF GROUP A".
           ACCEPT N1 OF GROUPA.
           ACCEPT N2 OF GROUPA.
           ACCEPT N3 OF GROUPA.
          

           DISPLAY "ENTER THE VALUES OF GROUP B".
           ACCEPT N1 OF GROUPB.
           ACCEPT N2 OF GROUPB.
           ACCEPT N3 OF GROUPB.
           MOVE CORR GROUPA TO GROUPC.
           DISPLAY "GROUP A          ", GROUPC.
           MOVE CORR GROUPB TO GROUPC.
           DISPLAY "GROUP B          ", GROUPC.

           ADD CORR GROUPA TO GROUPB.
           MOVE CORR GROUPB TO GROUPC.

           DISPLAY "SUM OF TWO GROUPS", GROUPC.
          
       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) ...