;---------------------------------------------------------------- ; Delete a File that has its file name passed in as a PL/I pointer ; to an ascii string ; ; ; Written by Richard Holmes 14-12-84 ; Last Update Richard Holmes 14-12-84 ;---------------------------------------------------------------- ; name 'delfil' public delfil ; bdos equ 5 parse equ 152 ; Parse a file name delete equ 19 ; Kill a file function code ; ; Error codes returned by the routines ; bf$er equ 10 ; Bad file name error ; ; Call this routine with the following declarations. Note the delimeter ; ; dcl ; name char(14) var, ; delfil entry(pointer) returns(bin(15)); ; ; name = '*.bak '; /* blank delimeter */ ; status = delfil(addr(name)); ; delfil: mov e,m inx h mov d,m ; fetch the pointer address xchg mov e,m inx h mov d,m ; DE is the string pointer ; xchg ; ML -> string size mov a,m ora a jz null$name inx h ; -> string data bytes now shld pfcb ; save the address ; lxi d,pfcb mvi c,parse call bdos mov a,l cpi 0ffh jnz df1 mov a,h cpi 0ffh jnz df1 lxi h,bf$er ret ; ; Now try to delete the file ; df1: lxi d,fcb mvi c,delete call bdos ret ; Return the code from bdos directly ; ; A null file name was entered ; null$name: lxi h,0 mov a,l ; take a copy ret ; ; dseg pfcb: ; Parsing file control block dw 00 ; filled in by the program dw fcb ; fcb: ds 36 ; an fcb for the PARSE end