MULTIFETCH Vs PREFETCH

I need to know the difference between Multifetch and Prefetch. I have read the documentation and I am confused.

  1. Can I use MultiFetch in batch jobs running on Z/OS?

  2. For Multifetch in batch jobs, do I need any special parameters in my JCL.

  3. Which is more efficient Multifetch or PreFetch?

  4. Can I use Multifetch in CICS online programs?

  5. What is the difference between PREFETCH = YES and PREFETCH = OLD

I coded a batch job and put in production.

I used MultiFetch 10 on a read statement against a Adabas file.
Here is the main loop:
READ MULTI-FETCH 10 INS-UV1 BY INS-POLICY-EXP-DATE = #START-DATE
IF INS-UV1.INS-POLICY-EXP-DATE > #END-DATE
ESCAPE BOTTOM /* last rec for date range
END-IF

  •                                           Ignore cancelled policy.
    
    IF INS-UV1.INS-POLICY-CANCL-DATE > 0
    ESCAPE TOP
    END-IF
    RESET APPL-UV1 ENDRS-UV1
    #APPL-FOUND #REPORT-PI #REPORT-INS
    #OUT-INSE-REC #ENDRS-KEY
    PERFORM FIND-APPLICATION
    IF #APPL-FOUND
    PERFORM FIND-ENDRS
    END-IF
    PERFORM WRITE-EXTRACT-RECORD
    END-READ /* Ins-policy read

This seems to work, but I did not code in the JCL any PREFETCH Commands. Do I need them? Am i really doing a MULTIFETCH in this batch program or is it being ignored.

Any help would be appreciated. THanks. :slight_smile:

PREFETCH is invoked via JCL. Multifetch may be invoked via JCL or at the statement level in Natural.

Yes, of course. Via JCL or Natural statements.

Via JCL, you specify PREFETCH=YES. For statement-level Multi-fetch, this JCL parameter is not necessary.

Under zOS, Prefetch can perform better.

Yes, at the Natural statement level.

PREFETCH=YES invokes (the newer) Multi-fetch; PREFETCH=OLD invokes (the older) PREFETCH.

To verify that Multi-fetch is being applied (batch or on-line), issue the TEST DBLOG command before and after running/executing your program. Look at the OP column of the report. An M signifies a Multi-fetched/physical call; a < signifies a logical call.

Ralph: Thank you for your prompt reply.

Forgive me, how do I do a Test Dblog in batch. Is there a JCL statement?

//CMSYNIN  DD *
LOGON natlib
TEST DBLOG
yourpgm
TEST DBLOG
FIN
/*

Ralph, that is magnificient, I will give it a try and learn more! THanks a whole bunch!..Michele :smiley:

Ralph, another question:

If I have MultiFetch (10) coded in a Batch program, and I have the PreFetch = OLD parameter in the JCL, which is used, Multifetch or Prefetch?

What is the advantage of using Prefetch in Batch ?

What is the advantage of using MultiFetch in Batch?

We are using Z/OS.
Thanks in advance.

I did get my DBLOG, and now I will learn how to read it!..SMILE!

I believe that the statement-level specification will override the batch specification. You can verify this with TEST DBLOG (and then report back to us).

Both Prefetch and Multi-fetch are implementations of Adabas read-ahead processing. Adabas retrieves multiple records for each physical call, thereby reducing overhead. The end result for you is much shorter batch job elapsed times.

The end result may be shorter batch job elapsed times.

The “gotcha

NOT

STARTING FROM … ENDING AT

NOT

STARTING FROM… THRU

Only STARTING FROM … TO works as Curtis stated.

steve