klophockey
Programmer
The NetCOBOL Win11.0 Language Reference guide shows that a RECORD can be deleted in NetCobol (Delete a record at 6.4.11 in the guide)
However, I do not see documentation on how to delete a file in a Cobol program in the NetCOBOL environment.
In practical coding, execution and observation, I have been able to delete a RECORD
HOWEVER
I have not been able to delete a file in my Cobol program as one might do in other flavors of Cobol
Eg. Delete filename
The resulting status code is a 49 (A DELETE or REWRITE operation has been tried on a file that is not opened I-O.)
Just to be sure the file was opened as I-O, I put the following couple of lines of code before the delete statement:
Open i-o mymast.
Close mymast.
Delete mymast.
STILL got the 49 error code
I would be interested in knowing how to code in NetCobol so that I could delete the file. Your help would be very much appreciated.
Here is how the file is defined.
FILE-CONTROL.
SELECT mymast-file ASSIGN TO "mymast,EXFH"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS cm-mynumb
FILE STATUS IS mymast-status
FILE SECTION.
FD mymast-file
RECORD IS VARYING IN SIZE FROM 16 TO 1024 CHARACTERS.
01 mymast-record.
03 cm-mynumb PIC X(4).
03 cm-myzipc PIC X(9).
03 cm-myloc PIC X(2).
03 cm-myrtng PIC X(1).
03 cm-myname PIC X(47).
03 cm-myaddr PIC X(47).
03 cm-mycity PIC X(47).
However, I do not see documentation on how to delete a file in a Cobol program in the NetCOBOL environment.
In practical coding, execution and observation, I have been able to delete a RECORD
HOWEVER
I have not been able to delete a file in my Cobol program as one might do in other flavors of Cobol
Eg. Delete filename
The resulting status code is a 49 (A DELETE or REWRITE operation has been tried on a file that is not opened I-O.)
Just to be sure the file was opened as I-O, I put the following couple of lines of code before the delete statement:
Open i-o mymast.
Close mymast.
Delete mymast.
STILL got the 49 error code
I would be interested in knowing how to code in NetCobol so that I could delete the file. Your help would be very much appreciated.
Here is how the file is defined.
FILE-CONTROL.
SELECT mymast-file ASSIGN TO "mymast,EXFH"
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS cm-mynumb
FILE STATUS IS mymast-status
FILE SECTION.
FD mymast-file
RECORD IS VARYING IN SIZE FROM 16 TO 1024 CHARACTERS.
01 mymast-record.
03 cm-mynumb PIC X(4).
03 cm-myzipc PIC X(9).
03 cm-myloc PIC X(2).
03 cm-myrtng PIC X(1).
03 cm-myname PIC X(47).
03 cm-myaddr PIC X(47).
03 cm-mycity PIC X(47).