Are there any APIs that delete files and clear members? I need to delete and clear a large number of files on a regular basis and was wondering if there were APIs that I could use in the interest of performance.
There are no API's that you can use to improve performance for clearing physical files. You can, however, improve performance by changing the job's wait time for locks, checking to see if there is a lock on an object prior to deleting or clearing it. A simple CL should help with a few twists. I currently read my entries from a file in CL and attempt to allocate the object. ... code not shown
... code not shown
IF COND(&CLRMBRFLG *EQ 'Y') THEN(DO)
ALCOBJ OBJ((&LIB/&FILE *FILE *EXCL &MBR)) WAIT(1)
MONMSG CPF0000 EXEC(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG)
MSGDTA('Cannot allocate file: ' *TCAT &LIB *CAT '/' *CAT &FILE *TCAT ' for clearing')
CLRPFM FILE(&LIB/&FILE) MBR(&MBR)
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Dig Deeper on RPG iSeries programming
Related Q&A from John Brandt
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.