File Operation thru ISPF Services



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

File Operation thru ISPF Services

Postby eprasad629 » Fri Aug 21, 2009 3:33 pm

Hi,

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.
Thanks & Regards,

Praelay
--------------------------------
eprasad629
 
Posts: 34
Joined: Wed Jan 07, 2009 12:48 pm
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: File Operation thru ISPF Services

Postby expat » Fri Aug 21, 2009 4:57 pm

You have a dataset, and you wish to edit / delete a line or lines.

What would I do ............. use an ISPF edit macro to process the dataset.
"ISPEXEC EDIT DATASET('dataset name') MACRO(macroname)"
- - The macro will need to be in a dataset allocated to either SYSEXEC or SYSPROC unless you use the ALTLIB statement to allocate your own PDS as part of the concatenation.

Inside the edit macro
1) Find the line that needs to be deleted, "ISREDIT F 'string' FIRST"
2) Get the line where the string was found, "ISREDIT (CRSLINE) = CURSOR"
3) Delete the line where the cursor is, "ISREDIT DELETE "CRSLINE
4) Save the changes on exit from the macro, "ISREDIT END"

Take the time to read the ISPF edit macro manual - it is full of great examples and is easy to follow.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post