1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Stackoverflow]

Discussão em 'StackOverflow' iniciado por fdantas, Novembro 20, 2024.

  1. fdantas

    fdantas Administrator Moderador

    If i run OS-DELETE using the same procedure editor it deletes but if i run through application it copies the file but the delete is not happening. Code below:

    WHEN "Processed" THEN
    DO:

    OS-COPY VALUE(TT-ACT-FILES.FilePath) VALUE(TT-ACT-FILES.ProcessedPath).

    /* Check if the copy operation resulted in an error */
    IF ERROR-STATUS:ERROR THEN DO:
    MESSAGE "Error copying file: " ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
    RETURN.
    END.

    /* Debug message for the copy operation */
    MESSAGE "File copied successfully from :" (TT-ACT-FILES.FilePath) " to " (TT-ACT-FILES.ProcessedPath) VIEW-AS ALERT-BOX.

    /* Check if the source file exists before deletion */
    IF SEARCH(TT-ACT-FILES.FilePath) <> ? THEN DO:
    /* Attempt to delete the original file */
    OS-DELETE VALUE(TRIM(TT-ACT-FILES.FilePath)) NO-ERROR.

    /* Check if delete operation was successful */
    IF ERROR-STATUS:ERROR THEN DO:
    MESSAGE "Error deleting original file: " ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
    END.
    ELSE
    MESSAGE "Original file deleted successfully." VIEW-AS ALERT-BOX.
    END.
    ELSE
    MESSAGE "Source file does not exist for deletion: " (TRIM(TT-ACT-FILES.FilePath)) VIEW-AS ALERT-BOX.
    END.

    Continue reading...

Compartilhe esta Página