PROGRAM 1: PROGRAM NAME : OCCURFL2 THE AIM OF THE CODE IS TO ACCEPT & DISPLAY THE STUDENT NO,NAME,TOTAL MARKS,AVERAGE ...... FOR 5 STU...
PROGRAM 1:
PROGRAM NAME : OCCURFL2
THE AIM OF THE CODE IS TO ACCEPT & DISPLAY THE STUDENT NO,NAME,TOTAL MARKS,AVERAGE ...... FOR 5 STUDENTS & 3 SUBJECTS
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. OCCURFL2.
000003 ENVIRONMENT DIVISION.
000004 INPUT-OUTPUT SECTION.
000005 FILE-CONTROL.
000006 SELECT INFILE ASSIGN TO DDIN
000007 ORGANIZATION IS SEQUENTIAL
000008 ACCESS MODE IS SEQUENTIAL.
000009 DATA DIVISION.
000010 FILE SECTION.
000011 FD INFILE.
000012 01 SIN.
000013 02 GNUM PIC 999.
000014 02 F PIC X.
000015 02 GNAME PIC X(20).
000016 02 F PIC X.
000017 02 GMARK PIC 9(3).
000002 PROGRAM-ID. OCCURFL2.
000003 ENVIRONMENT DIVISION.
000004 INPUT-OUTPUT SECTION.
000005 FILE-CONTROL.
000006 SELECT INFILE ASSIGN TO DDIN
000007 ORGANIZATION IS SEQUENTIAL
000008 ACCESS MODE IS SEQUENTIAL.
000009 DATA DIVISION.
000010 FILE SECTION.
000011 FD INFILE.
000012 01 SIN.
000013 02 GNUM PIC 999.
000014 02 F PIC X.
000015 02 GNAME PIC X(20).
000016 02 F PIC X.
000017 02 GMARK PIC 9(3).
000018 02 F PIC X.
000019 02 GGRADE PIC X.
000020 02 F PIC X.
000021 02 GAVG PIC 9(3)V99.
000022 02 F PIC X(44).
000023 WORKING-STORAGE SECTION.
000024 01 GR1.
000025 02 A1 OCCURS 5 TIMES.
000026 4 NUM PIC 9(3).
000027 04 NAME PIC X(20).
000028 04 GRADE PIC X.
000029 04 MARKS OCCURS 3 TIMES.
000030 05 MARK PIC 9(3).
000031 77 I PIC 9.
000032 77 TOTAL1 PIC 9(4).
000033 77 AVG PIC 999V99.
000034 77 J PIC 9.
000035 PROCEDURE DIVISION.
000019 02 GGRADE PIC X.
000020 02 F PIC X.
000021 02 GAVG PIC 9(3)V99.
000022 02 F PIC X(44).
000023 WORKING-STORAGE SECTION.
000024 01 GR1.
000025 02 A1 OCCURS 5 TIMES.
000026 4 NUM PIC 9(3).
000027 04 NAME PIC X(20).
000028 04 GRADE PIC X.
000029 04 MARKS OCCURS 3 TIMES.
000030 05 MARK PIC 9(3).
000031 77 I PIC 9.
000032 77 TOTAL1 PIC 9(4).
000033 77 AVG PIC 999V99.
000034 77 J PIC 9.
000035 PROCEDURE DIVISION.
000036 OPEN OUTPUT INFILE.
000037 INITIALIZE SIN.
000038 PERFORM VARYING I FROM 1 BY 1 UNTIL I > 5
000039 ACCEPT NUM(I)
000040 DISPLAY NUM(I)
000041 ACCEPT NAME(I)
000042 DISPLAY NAME(I)
000043 PERFORM VARYING J FROM 1 BY 1 UNTIL J > 3
000044 ACCEPT MARK(I,J)
000045 DISPLAY MARK(I,J)
000046 COMPUTE TOTAL1 = TOTAL1 + MARK( I , J )
000047 DISPLAY TOTAL1
000048 END-PERFORM
000049 ACCEPT GRADE(I)
000050 DISPLAY GRADE(I)
000051 COMPUTE AVG = TOTAL1 / 3
000052 DISPLAY AVG
000053 MOVE NUM(I) TO GNUM
000054 MOVE NAME(I) TO GNAME
000055 MOVE TOTAL1 TO GMARK
000056 MOVE GRADE(I) TO GGRADE
000057 MOVE AVG TO GAVG
000058 WRITE SIN
000059 COMPUTE TOTAL1 = 0
000060 END-PERFORM.
000061 CLOSE INFILE.
000062 STOP RUN.
000037 INITIALIZE SIN.
000038 PERFORM VARYING I FROM 1 BY 1 UNTIL I > 5
000039 ACCEPT NUM(I)
000040 DISPLAY NUM(I)
000041 ACCEPT NAME(I)
000042 DISPLAY NAME(I)
000043 PERFORM VARYING J FROM 1 BY 1 UNTIL J > 3
000044 ACCEPT MARK(I,J)
000045 DISPLAY MARK(I,J)
000046 COMPUTE TOTAL1 = TOTAL1 + MARK( I , J )
000047 DISPLAY TOTAL1
000048 END-PERFORM
000049 ACCEPT GRADE(I)
000050 DISPLAY GRADE(I)
000051 COMPUTE AVG = TOTAL1 / 3
000052 DISPLAY AVG
000053 MOVE NUM(I) TO GNUM
000054 MOVE NAME(I) TO GNAME
000055 MOVE TOTAL1 TO GMARK
000056 MOVE GRADE(I) TO GGRADE
000057 MOVE AVG TO GAVG
000058 WRITE SIN
000059 COMPUTE TOTAL1 = 0
000060 END-PERFORM.
000061 CLOSE INFILE.
000062 STOP RUN.
COMPILE CODE :
000100 //OZA030A JOB NOTIFY=&SYSUID
000200 //JOBPROC JCLLIB ORDER=OZASUP.SUP.PROCLIB
000210 //COBOL EXEC COBCL
000300 //COMPILE.SYSIN DD DSN=OZA030.FILES.COBOL(OCCURFL2),DISP=SHR
000400 //LKED.SYSLMOD DD DSN=OZA030.LOAD.PDS(OCCURFL2),DISP=SHR
000200 //JOBPROC JCLLIB ORDER=OZASUP.SUP.PROCLIB
000210 //COBOL EXEC COBCL
000300 //COMPILE.SYSIN DD DSN=OZA030.FILES.COBOL(OCCURFL2),DISP=SHR
000400 //LKED.SYSLMOD DD DSN=OZA030.LOAD.PDS(OCCURFL2),DISP=SHR
RUN CODE :
000001 //OZA030A JOB MSGLEVEL=(1,1),NOTIFY=OZA030
000002 //COBCL EXEC PGM=OCCURFL2
000003 //STEPLIB DD DSN=OZA030.LOAD.PDS,DISP=SHR
000004 //SYSOUT DD SYSOUT=*
000005 //SYSPRINT DD SYSOUT=*
000006 //DDIN DD DSN=OZA030.FILES.COBOL(INPUT),DISP=SHR
000007 //*DD2 DD DSN=OZA030.S.COBOL(MEM3),DISP=SHR
000008 //*DD3 DD DSN=OZA030.BATCH74.OTPT1,DISP=SHR
000009 //SYSIN DD *
000010 012
000011 MANI
000012 033
000013 043
000014 053
000015 Q
000016 013
000017 YANI
000002 //COBCL EXEC PGM=OCCURFL2
000003 //STEPLIB DD DSN=OZA030.LOAD.PDS,DISP=SHR
000004 //SYSOUT DD SYSOUT=*
000005 //SYSPRINT DD SYSOUT=*
000006 //DDIN DD DSN=OZA030.FILES.COBOL(INPUT),DISP=SHR
000007 //*DD2 DD DSN=OZA030.S.COBOL(MEM3),DISP=SHR
000008 //*DD3 DD DSN=OZA030.BATCH74.OTPT1,DISP=SHR
000009 //SYSIN DD *
000010 012
000011 MANI
000012 033
000013 043
000014 053
000015 Q
000016 013
000017 YANI
000018 077
000019 044
000020 088
000021 R
000022 014
000023 YANI
000024 099
000025 092
000026 091
000027 D
000028 077
000029 SAN
000030 032
000031 056
000032 045
000033 S
000034 033
000035 THE
000019 044
000020 088
000021 R
000022 014
000023 YANI
000024 099
000025 092
000026 091
000027 D
000028 077
000029 SAN
000030 032
000031 056
000032 045
000033 S
000034 033
000035 THE
000036 043
000037 088
000038 099
000039 G
000040 /*
000041 //
000037 088
000038 099
000039 G
000040 /*
000041 //
OUTPUT DISPLAYED IN INFILE :
000001 012 MANI 129 Q 04300
000002 013 YANI 209 R 06966
000003 014 YANI 282 D 09400
000004 077 SAN 133 S 04433
000005 033 THE 230 G 07666
000002 013 YANI 209 R 06966
000003 014 YANI 282 D 09400
000004 077 SAN 133 S 04433
000005 033 THE 230 G 07666
OUTPUT DISPLAYED IN SDSF :
012
MANI
033
0033
043
0076
053
0129
Q
04300
013
YANI
077
0077
044
0121
088
0209
R
06966
014
MANI
033
0033
043
0076
053
0129
Q
04300
013
YANI
077
0077
044
0121
088
0209
R
06966
014
YANI
099
0099
092
0191
091
0282
D
09400
077
SAN
032
0032
056
0088
045
0133
S
04433
033
THE
043
099
0099
092
0191
091
0282
D
09400
077
SAN
032
0032
056
0088
045
0133
S
04433
033
THE
043
0043
088
0131
099
0230
G
07666
088
0131
099
0230
G
07666
No comments
Post a Comment