![]() You can use g++ to verify it is there: g++ -vĬOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapperĬonfigured with. Using the \l command again you will see the database: To list the existing databases use the psql command \l (that’s a lowercase L): The sample ocesql programs will make use of a database called testdb. I had to go into the firewall, add the PostgreSQL server, and allow access to it: When I attempted to access PostgreSQL on my Windows 10 system, the firewall blocked access. WARNING: psql major version 10, server major version 12. Now verify you can get access to the PostgreSQL server using psql: psql -h -U postgres If you aren’t using PostgreSQL server on the same system as the compiler, you are going to want to install the client: sudo apt install postgresql-client I found it on another system and created it in the requested directory. After installing gnuCOBOL I did a test compile and got the error gcc: error: /usr/share/dpkg/no-pie-link.specsįor some reason my PC was missing the file specified above. This probably won’t be an issue for you, but it was for me so I will document it. To verify the install, do the following: cobc -v Installing is very easy, just use apt install for each file: sudo apt install Packages for the Debian Package Manager (DPKG)ĭownload both COBOLworx GnuCOBOL 3.1 and COBOLworx GnuCOBOL CBL-GDB Debugging Extensions. The compiler and debugger can be found at: I wanted to use the COBOLWorx distribution of gnuCOBOL so I can use their debugger if necessary. I created a Virtualbox VM and installed Linux Mint 19.3 to do this testing. That is working fine and for this test, I will be using PostgreSQL for Windows. I will give a quick summary regarding the Linux installation below.Įarly on I installed PostgreSQL onto a Windows system. Honestly, I can’t imagine any scenario I would prefer using COBOL in Windows more than Linux. After wasting several hours on that, I gave up and implemented it in Linux. I am using OCESQL and I could not get it to compile properly in minGW. ![]() Eventually I would get the problem resolved. ![]() There was a lot of wasted time and head banging trying to make whatever test I was trying to do in gnuCOBOL work in Windows. My initial plan was to do this running gnuCOBOL in Windows. Instead, I’m going to cover how to implement it for gnuCOBOL. I won’t spend time explaining the operation of embedded SQL as mainframe examples can be easily found elsewhere. SELECT :MACADDR FROM DEVICES WHERE OWNERID = :OWNERID AND DEVICEID = :DEVICEID For example, the above in COBOL would be: EXEC SQL You just delimit the SQL command with EXEC SQL … END-EXEC. That’s exactly how embedded SQL in COBOL works. It works, but wouldn’t it by much nicer if I could just embed the query straight into the Pascal program something like SQL('select :macdaddr from devices where ownderId = :ownerId and deviceId = :deviceId') Then the query is executed on the server: query.Open Īnd finally I extract from the query result the values my program needs: qfbn(query, macAddr, 'macAddr') The variables in the where clause of the query, :ownerId and :deviceId, are then assigned values from program variables: qpbn(query, deviceR.ownerId, 'ownerId') There is a fair amount of extra code besides the actual SQL statement.įor example, in one of my Pascal programs, I setup an SQL command I want to execute: := 'select * from devices where ownerId = :ownerId and deviceId = :deviceId' A query is setup, executed, then the results are extracted. In all of the programming I’ve done / seen, SQL is accessed via some type of procedure calls. After 6 months of messing around with gnuCOBOL, I am finally to the point of trying to implement Embedded SQL.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |