Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NetCOBOL Delete Action

Status
Not open for further replies.

klophockey

Programmer
May 25, 2016
41
US
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).



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top