I'm working on a new command for COZTOOLS, called "Delete Database Records".
This command will allow you to delete records from a database file using either of the following two options:
Any records matching the selection criteria are deleted from the file.
Background: I have clients that moved from S/36 to our current operating system over the decades but left in legacy routines. Most have been updated, but some old CL was converted from S/36 OCL and still has that primitive look to it.
For example, one client has a CPYF command that copies a master file to a temp file with the following:
CPYF A TOFILE(B) CRTFILE(*YES) INCCHAR(*RCD 1 *EQ 'D') CPYF B TOFILE(A) CRTFILE(*NO) MBROPT(*REPLACE)
Often they'll throw in a DLTF A in the middle of these things. Which of course is creating havoc on our Journalling (Deleting a file that's journalled screws up a lot of things.)
Therefore I'm creating this new Delete Database Records" command that will delete using the INCCHAR style parameter or an SQL style WHERE clause.
Here's my question and I welcome any other comments:
I currently have a 3rd option for deleting records. I allow you to specify a starting Record number and record count. So you could say DLTRCD( 36 ) and it will delete record number 36. Or you could say DLTRCD( 36 10) and it would delete the 10 records starting with record 36.
The difficulty I'm having with this option is that a SETLL to the record number will cause it to position to the net available relative record number. So perhaps the user really did mean the 36th record, but what if they mean relative record number 36 and its isn't there? I could reverse the logic and use a CHAIN to the record number and if not found, do nothing, but then I have the reverse issue. If someone uses (for example) DSPPFM to view the data in the file and sees a record number of 36, then they issue the command, they may want the 36th record in the file deleted, not relative record 36.
Which gives me this vexing issue to resolve. My current thinking is to simply (A) omit the parameter and not provide deleting by record number or (B) make the parameter a hidden parm that only appears when F10 is pressed on the prompter, and tell people to use with caution.
So what do you think? Should I drop the DLTRCD (delete record range) parameter, keep it, or something else?