Menu

CBL_DELETE_FILE

2025-05-17
2025-05-18
  • Maurizio Bongini

    Hi
    Env GnuCobol 3.2 on Lubuntu 24.04
    Managing a big program i commit a keyboard error writing an unwanted blank
    but this shows me what can be an bug in gnucobol (IMHO)

    01 PGM-ID PIC X(8).
    ........
    MOVE ' MAG0050' TO PGM-ID.
    ........
    CALL 'CBL_DELETE_FILE' USING PGM-ID..
    

    But file is not deleted because the leading blank
    the same if i code

    CALL 'CBL_DELETE_FILE' USING ' MAG0050'

    in this second case compiler should check for leading blanks and warn
    in the first case runtime code should trim string to the left ...
    Thanks in advance for the support
    Maurizio

     

    Last edit: Maurizio Bongini 2025-05-17
    • Eugenio Di Lorenzo

      Hi, I suggest you to also check the GnuCOBOL statement DELETE FILE described in the chapter 7.8.11 DELETE of programmer's Guide.

       
  • Ralph Linkletter

    To ask COBOL to "guess" your intent seems like a good application for an AI enabled COBOL.
    Adding a test of return-code after the call would indicate the success of the call.

    Your example is not a GnuCOBOL bug.
    It was a defect in your program.

     
    👍
    1
  • Maurizio Bongini

    Hi
    I do not agree ...
    i did not code an invalid file name
    MAG0050 exists
    I read documentation before posting and it is written it behaves like rm commnad
    if i write
    rm MAG0050
    wiht two spaces between rm and MAG0050 it works
    it ithe Gnucobol manual is s not written leading blanks cause this function to fail
    please do not tell me about AI or other things out of dicusssion , in the previous post i opened i had reason it was a bug... please read all ... i do not open threads because i'm stupid
    i corrected immediately the code before opening the thread it takes 30 seconds to find the problem ... do not teach me to check return code, i passed all my working life in IBM to check return codes to debug
    my keystroke error cusally shows a lack in the code... in my humble opinion
    i thinki have the duty to signal problems when they happens
    regards

     

    Last edit: Maurizio Bongini 2025-05-17
    • Simon Sobisch

      Simon Sobisch - 2025-05-17

      It does behave identical, as you effectively wrote rm " MAG0050" - which is a totally valid command, deleting a file with a very uncommon name (leading space).
      But feel free to make a suggestion where exactly we should add the quotes in the documentation to make the point clearer.

       
    • Simon Sobisch

      Simon Sobisch - 2025-05-17

      And for your edit: thank you for taking the time to check with any potential problems (here possibly the documentation). It is appreciated.

       
    • Ralph Linkletter

      I disagree with your disagreement
      If there was not a defect in your program - it would work as you expected.
      "I passed all my working life in IBM"
      So did I - IBM will not process a DSN with a leading space, an embedded space.
      Expecting COBOL, irrespective of vendor, to discern your defect of a leading space ain't gonna happen

       

      Last edit: Ralph Linkletter 2025-05-17
  • Maurizio Bongini

    Hi
    i', mot interest in polemics... you started a polemic with me i do not know why ...
    please read carefully before accusing people ... read again what i wrote and what Simon answered.. the book does not reports that rm command will enclosse filename into
    rm " xxxx ". this change the behaviour of command if instead using rm xxxx...

     

    Last edit: Maurizio Bongini 2025-05-17
    • Vincent (Bryan) Coen

      On 17/05/2025 20:34, Maurizio Bongini wrote:

      Hi
      i', mot interest in polemics... you started a polemic with me i do not
      know why ...
      please read carefully before accusing people ... read again what i
      wrote and what Simon answered.. the book does not reports that rm
      command will be enclosed filename into rm " xxxx ".
      this change the behaviour of command if instead using rm xxxx...

      I was not involved with this BUT the bug is with your program, not the
      compiler and generated code.

      Computers are not mind readers and can only work based on your programming.

      As pointed out to you by another, you did not specify exactly the file
      name in your ASSIGN.

      So fix the coed error and rerun - joining the rest of us finding bugs in
      our code :)

       
  • Ralph Linkletter

    You indicated in your original email that this statement was a COBOL bug
    "CALL 'CBL_DELETE_FILE' USING 'bMAG0050' where b is a space.
    That program is defective. Period !
    To change the discussion to a Linux operating CLI is your own windmill to tilt at.
    I am done with this thread :-)

     
  • Maurizio Bongini

    Are yo uaware that ..
    In your first answer you offended me treating me like an idiot ?
    So Keep your offenses for yourself !
    STOP !
    Next if you want change this on the book
    ... done using rm
    to
    ....done using rm (with filename enclosed into double quotes)

     

    Last edit: Maurizio Bongini 2025-05-18

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.