Menu

please help with copyboox include or copy statemtent

J McNamara
2024-12-09
2024-12-09
  • J McNamara

    J McNamara - 2024-12-09

    Hi-

    I am trying to use these statements.

           COPY 'C:\Users\stealth_droid\Documents\Gix\Examples\test001'
          -     '\bin\debug\x64\EMPREC.cpy'.
    
           COPY 'C:\Users\stealth_droid\Documents\Gix\Examples\test001'
          -      '\bin\debug\x64\sqlca.cpy'.
    

    the dash goes in line 7.

    gixsql TEST001.cbl TEST001.cbsql -S -I. -I"C:\Users\stealth_droid\Documents\Gix\Examples\test001\bin\debug\x64" -I"C:\msys64\mingw64\share\gnucobol\copy" --esql-copy-exts "C:\Users\stealth_droid\Documents\Gix\Examples\test001\bin\debug\x64\sqlca.cpy" "C:\Users\stealth_droid\Documents\Gix\Examples\test001\bin\debug\x64\EMPREC.cpy"
    TEST001.cbl(35): error: Wrong file format or unexpected end of file
    C:\Users\stealth_droid\Documents\Gix\Examples\test001\bin\debug\x64\TEST001.cbl(35): error: syntax error, unexpected end of file
    

    when i take away the copy statements the unexpected end of file error goes away.

    I am trying to use with this syntax. I must be doing it wrong.

    both the copybooks are not in the 'copy' dir. one is in the current dir and the other is in the 'copy' dir.

    but i think it is the copy statement itself not being in the right format.

    it was trying in the example to use ...

    exec sql
    include sqlca
    end-exec
    

    this is really messing me up because i cant go farther on the project until i get past it.

    I am doing more reading on how to use gixpp and gixsql but this is my barrier for the time being.

    thanks for any help,
    jim

     

    Last edit: Simon Sobisch 2024-12-09
    • J McNamara

      J McNamara - 2024-12-09

      https://stackoverflow.com/questions/78850297/gnucobol-3-2-0-copybooks

      this seems to be the solution that works but if i didn't know about column 12 and this tip it is understandable how i could get stuck.

      thanks to Jeremy.

      have a cool day,
      jim

      Sent with Proton Mail secure email.

       
  • Simon Sobisch

    Simon Sobisch - 2024-12-09

    I highly suggest to read the matching docs or study the --help options of the tools used...

    $> gixsql --help
    gixpp - the ESQL preprocessor for Gix-IDE/GixSQL
    Version: 1.0.21dev
    libgixpp version: 1.0.21dev
    
    Options:
      -h, --help                          displays help on commandline options
      -V, --version                       displays version information
      -I, --copypath arg                  COPY file path list
      -i, --infile arg                    input file
      -o, --outfile arg                   output file
      -s, --symfile arg                   output symbol file
      -e, --esql                          preprocess for ESQL
      -p, --esql-preprocess-copy          ESQL: preprocess all included COPY files
      -E, --esql-copy-exts arg            ESQL: copy files extension list (comma-separated)
      -z, --param-style arg (=d)          ESQL: generated parameters style (=a|d|c)
      -S, --esql-static-calls             ESQL: emit static calls
      -g, --debug-info                    generate debug info
      -c, --consolidate                   consolidate source to single-file
      -k, --keep                          keep temporary files
      -v, --verbose                       verbose
      -d, --verbose-debug                 verbose (debug)
      -D, --parser-scanner-debug          parser/scanner debug output
      -m, --map                           emit map file
      -C, --cobol85                       emit COBOL85-compliant code
      -Y, --varying arg                   length/data suffixes for varlen fields (=LEN,ARR)
      -N, --varying-length-size arg (=4)  size of the length indicator fields for VARYING fields(=2|4))
      -P, --picx-as arg (=char)           text field options (=char|charf|varchar)
      --no-rec-code arg                   custom code for "no record" condition(=nnn)
    

    Note: the gixsql wrapper does the following, so part of those are already used:

    input=$1; shift   
    output=$1; shift
    $install_dir/bin/gixpp -e -I $install_dir/share/gixsql/copy -i $input -o $output $*
    

    checking that with your command line shows:

    • --esql-copy-exts should get a comma separated list like cpy,copy (but I think you don't need that at all; they are definitely superfluous in your example as you include the file extension in the literal already)
    • you should only give the COBOL source file to be preprocessed in (you have a trailing EMPREC.cpy in your options - if you want to include that, you either have the full path in your program or only the name and specify its path to -I

    So... you commonly don't want to put full paths anywhere, because of portability issues, and instead use the names and specify their folders in -I.

    Note that gixpp (which is wrapped by gixsql) likely only needs the path to the copybooks that you include via preparser - in this case EXEC SQL INCLUDE SQLCA END-EXEC (and you should not expect the preparser to know of any other copybooks, so only use variables for binding that are in either those coypybooks and/or between EXEC SQL DECLARE SECTION END-EXEC. / EXEC SQL END DECLARE SECTION END-EXEC. blocks.

    Lastly (I don't know if this works in either gixpp or cobc for the copybook) - if you have long literals that you want to continue via in column 7 - they don't have a "terminator" in the line before and go until last column of the code area in fixed format - so instead of

           COPY 'C:\Users\stealth_droid\Documents\Gix\Examples\test001'
          -     '\bin\debug\x64\EMPREC.cpy'.
    

    use

           COPY 'C:\Users\stealth_droid\Documents\Gix\Examples\test001\bin\d
          -     'ebug\x64\EMPREC.cpy'.
    

    As an alternative to this COBOL85 line continuation (which is marked as obsolete since at least COBOL2023) you can use the literal continuation or literal concatenation, which work in both fixed-form and free-form reference format (not checked if they work for COPY/SQL INCLUDE):

           COPY 'C:\Users\stealth_droid\Documents\Gix\Examples\test001'-
                '\bin\debug\x64\EMPREC.cpy'.
    
           COPY 'C:\Users\stealth_droid\Documents\Gix\Examples\test001'
              & '\bin\debug\x64\EMPREC.cpy'.
    
     

Anonymous
Anonymous

Add attachments
Cancel