Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve copy file #183

Open
alexbodn opened this issue Apr 29, 2024 · 3 comments
Open

Cannot resolve copy file #183

alexbodn opened this issue Apr 29, 2024 · 3 comments

Comments

@alexbodn
Copy link

hello friend,

and a big thank for providing gix.

i'm trying the example and gixpp fails

gixpp -e -S -I. -ext ".,.cpy,.CPY" -i TEST001.cbl -o TEST001.cbsql

TEST001.cbl(22): error: Cannot resolve copy file EMPREC
TEST001.cbl(39): error: Cannot resolve copy file SQLCA

looking at the source, i understood -ext should be -E.

i also tried
gixpp -e -S -I. -I/usr/share/gixsql/copy -E ".,.cpy,.CPY" -i TEST001.cbl -o TEST001.cbsql

with the same errors.

could you please fix or instruct me?
EMPREC is in place.

my installation is the last 1.0.21dev1 on debian 12.

@GitMensch
Copy link
Contributor

These should be the default extensions, please try without -E ".,.cpy,.CPY" - I guess /usr/share/gixsql/copy is the place that you did have the SQLCA in, right?

@alexbodn
Copy link
Author

These should be the default extensions, please try without -E ".,.cpy,.CPY" - I guess /usr/share/gixsql/copy is the place that you did have the SQLCA in, right?

thank you @GitMensch , gitpp didn't complain this time. SQLCA.cpy is there by default.

i'm funnily finding out that the following gixsql line does the same as the gixpp one.

@alexbodn
Copy link
Author

alexbodn commented Apr 29, 2024

i was able, with your valuable help, to run the test. giving here the things i had to fix.

the documentation i tried to follow is at: -

https://github.com/mridoni/gix/blob/main/doc/gixsql.md
and
https://github.com/mridoni/gixsql/tree/main

the line begining with gixpp seems to create the same TEST001.cbsql as the one with gixsql.
as per @GitMensch the file extensions are the defaults, but anyway they gave an error.

gixsql TEST001.cbl TEST001.cbsql -S -I.
the -ext parameter wasn't needed, and gitsql knew where SQLCA.cpy was.

cobc -x -I/usr/share/gixsql/copy TEST001.cbsql -L /usr/lib -lgixsql
the path to SQLCA.cpy is needed by the cobol compiler
-L /usr/lib is needed only if it's not standard.

i also had to patch the TEST001.cbl, as postgresql wouldn't open a cursor out of a transaction.

--- TEST001.cbl 2024-04-29 04:50:30.734822906 +0200
+++ 1   2024-04-29 04:21:03.475288152 +0200
@@ -67,6 +67,9 @@
            END-IF.
        100-MAIN.                                               
        
+       EXEC SQL 
+            BEGIN TRANSACTION;
+       END-EXEC. 
       *  open cursor
            EXEC SQL
                OPEN EMPTBL
@@ -126,6 +129,10 @@
            EXEC SQL 
                CLOSE EMPTBL 
            END-EXEC. 
+      *
+           EXEC SQL 
+               COMMIT;
+           END-EXEC. 
                   
            EXEC SQL
               CONNECT RESET

thank you very much for the opportunity to play with such great software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants