I'd stay with something a little more tradition for the data access with the intention of being able to reuse the code with minimal modification in 10-50 years time (by which time we may well have had another alphabet soup of APIs and everyone else will have had to rewrite their code a few times), or right now with DB2, Oracle, SQL Server or PostgreSQL on Windows, .NET or Linux using ODBC, ADO.NET or JDBC, so something like this (I used .NET types for the data, the code will work with either .NET, JVM or traditional COBOL types, it just depends on how portable you want to be). $set sql working-storage section. exec sql include sqlca end-exec. 01 Ident binary-long. 01 Name string. 01 DateOfBirth type System.DateTime. procedure division. exec sql whenever sqlerror go to sql-error end-exec exec sql connect to studentDB end-exec exec sql declare c cursor for select * from Student end-exec exec sql open c end-exec perform until exit exec sql fetch c into :Ident, :Name, :DateOfBirth end-exec if sqlcode = 100 exit perform end-if *> process the student ... end-perform exec sql close c end-exec goback. sql-error. display "SQL Error " sqlerrmc goback.
↧