How to resolve the algorithm Delete a file step by step in the COBOL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Delete a file step by step in the COBOL programming language
Table of Contents
Problem Statement
Delete a file called "input.txt" and delete a directory called "docs". This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Delete a file step by step in the COBOL programming language
Source code in the cobol programming language
IDENTIFICATION DIVISION.
PROGRAM-ID. Delete-Files.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT Local-File ASSIGN TO "input.txt".
SELECT Root-File ASSIGN TO "/input.txt".
DATA DIVISION.
FILE SECTION.
FD Local-File.
01 Local-Record PIC X.
FD Root-File.
01 Root-Record PIC X.
PROCEDURE DIVISION.
DELETE FILE Local-File
DELETE FILE Root-File
GOBACK.
END PROGRAM Delete-Files.
IDENTIFICATION DIVISION.
PROGRAM-ID. Delete-Files.
PROCEDURE DIVISION.
CALL "CBL_DELETE_FILE" USING "input.txt"
CALL "CBL_DELETE_DIR" USING "docs"
CALL "CBL_DELETE_FILE" USING "/input.txt"
CALL "CBL_DELETE_DIR" USING "/docs"
GOBACK.
END PROGRAM Delete-Files.
You may also check:How to resolve the algorithm Sorting algorithms/Permutation sort step by step in the zkl programming language
You may also check:How to resolve the algorithm 24 game step by step in the TorqueScript programming language
You may also check:How to resolve the algorithm Hex words step by step in the Perl programming language
You may also check:How to resolve the algorithm Bernstein basis polynomials step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Sum of a series step by step in the EDSAC order code programming language