Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IDENTIFICATION DIVISION.
- PROGRAM-ID. UC3.
- ENVIRONMENT DIVISION.
- FILE-CONTROL.
- select invoercsv assign to 'invoerbestand.csv'
- organization is line sequential.
- select tempuitvoer assign to 'tempuitvoer.txt'
- organization is line sequential.
- DATA DIVISION.
- FILE SECTION.
- FD invoercsv.
- 01 Csvinvoer.
- 03 pic X(100).
- FD tempuitvoer.
- 01 uitvoertemp.
- 03 tempMail pic X(20).
- 03 tempGamePoints pic 9(5)V9(2).
- 03 tempExamenpunten pic 9(2).
- 03 tempTotaal pic 9(5)V9(2).
- 03 tempOpmerking pic X(50).
- WORKING-STORAGE SECTION.
- 01 punten pic 9(3).
- 01 naam pic X(10).
- 01 maxCumScore pic 9(3)V9(2).
- 01 teamPeriodScoreCumOvGame pic 9(3).
- 01 teamGamePoints pic 9(5)V9(2).
- 01 gamePoints pic 9(5)V9(2).
- 01 teamId pic 9(2).
- 01 gameId pic 9(2) value 10.
- 01 maxGamePoints pic 9(2).
- 01 Csvrecord.
- 03 mail pic X(15).
- 03 examenpunten pic 9(2).
- 03 p2pcoef pic 9(2).
- 03 gegeventekst pic X(50).
- 01 eindeCsv pic x value 0.
- 88 einde-Csvbestand value 1.
- EXEC SQL
- BEGIN DECLARE SECTION
- END-EXEC
- 01 SQLCODE PIC S9(3).
- 01 SQLSTATE PIC X(5).
- 01 JdbcString PIC X(255).
- EXEC SQL
- END DECLARE SECTION
- END-EXEC
- PROCEDURE DIVISION.
- MAIN-PARAGRAPH.
- PERFORM DO-CONNECT
- PERFORM OPENFILES
- PERFORM INLEZENCSVBESTAND
- PERFORM DO-DISCONNECT
- ACCEPT SQLSTATE
- GOBACK
- DO-CONNECT.
- STRING "jdbc:sqlserver://localhost\SQLEXPRESS;"
- DELIMITED BY SIZE
- "databaseName=ProjectManagement;"
- DELIMITED BY SIZE
- "userName=gameAdmin;password=project"
- DELIMITED BY SIZE
- INTO JdbcString
- EXEC SQL
- CONNECT
- TO :JdbcString
- DRIVER "com.microsoft.sqlserver.jdbc.SQLServerDriver"
- END-EXEC.
- DO-DISCONNECT.
- EXEC SQL
- DISCONNECT
- END-EXEC.
- OPENFILES.
- open input invoercsv
- read invoercsv at end move 1 to eindeCsv
- end-read
- open output tempuitvoer
- .
- HAALMAXCUMSCOREOP.
- EXEC SQL
- SELECT MAX(ScoreCumulativeOverallGame)
- INTO :maxCumScore
- FROM tgamTeamPeriods
- END-EXEC
- .
- BEREKENSCORE.
- EXEC SQL
- SELECT TeamId
- INTO :teamId
- FROM tgamUsers
- WHERE Email = :mail
- END-EXEC
- EXEC SQL
- SELECT ScoreCumulativeOverallGame
- INTO :teamPeriodScoreCumOvGame
- FROM tgamTeamPeriods
- WHERE TeamId = :teamId
- END-EXEC
- EXEC SQL
- SELECT MaximumPoints
- INTO :maxGamePoints
- FROM tgamGames
- WHERE Id = :gameId
- END-EXEC
- COMPUTE teamGamePoints =
- maxGamePoints * teamPeriodScoreCumOvGame / maxCumScore
- END-COMPUTE
- COMPUTE gamePoints =
- p2pcoef * teamGamePoints
- END-COMPUTE
- move mail to tempMail
- display "E-mail: " tempMail
- move gamePoints to tempGamePoints
- display "GamePoints: " tempGamePoints
- move examenpunten to tempExamenpunten
- display "Examenpunten: " tempExamenpunten
- move 5 to tempTotaal
- display "Totaal: " tempTotaal
- move gegeventekst to tempOpmerking
- display "Opmerking: " tempOpmerking
- display "-------------"
- write uitvoertemp
- .
- INLEZENCSVBESTAND.
- PERFORM HAALMAXCUMSCOREOP
- perform until einde-csvbestand
- unstring Csvinvoer delimited by "," into
- mail, examenpunten, p2pcoef, gegeventekst
- EXEC SQL
- UPDATE tgamUsers
- SET Exampoints = :examenpunten,
- PierEvaluationCoefficient = :p2pcoef,
- Opmerkingen = :gegeventekst
- WHERE Email = :mail
- END-EXEC
- EXEC SQL
- COMMIT WORK
- END-EXEC
- PERFORM BEREKENSCORE
- read invoercsv at end move 1 to eindeCsv
- end-read
- end-perform
- close invoercsv
- .
Add Comment
Please, Sign In to add comment