I'm currently working over a REXX module which makes use of ISPF services to delete/add line in a sequential file.
I'm able to add a new line at the end of the file by using ISPF service command. I don't know how to delete a line (which could be at start/middle/last) from a file.
Currently I'm processing the file by
1. Reading the file contents by LMGET and storing it to a stem variable.
2. Erase the file completely
3. Re-Create the file with the same name
4. Searching the line to be deleted in the stem variable which was created earlier
5. If the search string matches with the stem variable, NOP, else LMPUT to write the content back to new file.
I think the code which I have written is so vague which I want to get rid off.
Could you please advise how this could be simplified further?
Please let me know if the information is not clear.
Many thanks in advance.