View previous topic :: View next topic
|
Author |
Message |
amitc23
New User
Joined: 05 Nov 2014 Posts: 95 Location: India
|
|
|
|
Hi
I am facing some problem while deleting the records from a VSAM file in a COBOL/CICS program. I need to START the file at top , go on reading the records and send them to an outer system until I reach End of File. Then I get a message back from the other system when they receive all the records correctly and then I need to empty the file.
For delete How do I read each record sequentially and then go on deleting the records. I don't think I can Mass Delete all records in one CICS Command.
Thanks |
|
Back to top |
|
|
amitc23
New User
Joined: 05 Nov 2014 Posts: 95 Location: India
|
|
|
|
Just to add I can not do a STARTBR/READNEXT again as the file is not defined in RLS mode. |
|
Back to top |
|
|
amitc23
New User
Joined: 05 Nov 2014 Posts: 95 Location: India
|
|
|
|
The only solution I can think of as yet is to Start and Read the file again and store say first 100 records key in an array and then Read the file for update with key and Delete. Repeat this process until I delete all the records. |
|
Back to top |
|
|
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
Hello,
amitc23 wrote: |
.... then I need to empty the file.
For delete How do I read each record sequentially and then go on deleting the records. I don't think I can Mass Delete all records in one CICS Command.... |
If it is emptying the file that you're looking for, instead of reading and deleting records, why not try using the SET FILE command with EMPTY, note that once the file has been opened to CICS as EMPTY you'll have to programmatically handle the initialization of the 'empty' file (which would mean writing at least one record to the file, depending on your site regulations, it can be low-values or all '0' etc, your choice):
Code: |
EXEC CICS SET
FILE (FILE-NAME)
CLOSED
ENABLED
EMPTY
RESP (WS-RESP)
RESP2(WS-RESP2)
NOHANDLE
END-EXEC
|
Hth. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Note; SET FILE API's only work on LOCAL files. |
|
Back to top |
|
|
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
Thank you Bill for pointing it out; I missed it in the original post ; though on a curious notion it shouldn't matter if MRO is not inforce, should it?
amitc23,
As pointed out by Bill, before you perform a 'SET FILE' (provided, you go with the above solution) it would be better to do an INQUIRE FILE, use the SYSID received from the REMOTESYSTEM, use it to do an ASSIGN SYSID, once done, you should be good to go for the 'SET FILE' command.
Hth. |
|
Back to top |
|
|
amitc23
New User
Joined: 05 Nov 2014 Posts: 95 Location: India
|
|
|
|
That looks great Abid and Bill. I am off for the day. Will try and let u know tomorrow. |
|
Back to top |
|
|
|