# MULTIFETCH Vs PREFETCH

**URL:** <https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [December 2, 2009, 1:59am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273 "2009-12-02T01:59:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michele1](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Michele1](https://techcommunity.softwareag.com/u/Michele1)\
**Post date:** [December 2, 2009, 1:59am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/1 "2009-12-02T01:59:18Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [December 2, 2009, 4:26am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/2 "2009-12-02T04:26:17Z")

</div>

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

> [@](#):
>
> Can I use MultiFetch in batch jobs running on Z/OS?

Yes, of course. Via JCL or Natural statements.

> [@](#):
>
> For Multifetch in batch jobs, do I need any special parameters in my JCL.

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

> [@](#):
>
> Which is more efficient Multifetch or PreFetch?

Under zOS, Prefetch can perform better.

> [@](#):
>
> Can I use Multifetch in CICS online programs?

Yes, at the Natural statement level.

> [@](#):
>
> What is the difference between PREFETCH = YES and PREFETCH = OLD

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.

---

<div class="post-metadata">

**Author:** ![Michele1](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Michele1](https://techcommunity.softwareag.com/u/Michele1)\
**Post date:** [December 2, 2009, 4:51am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/3 "2009-12-02T04:51:08Z")

</div>

Ralph: Thank you for your prompt reply.

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

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [December 2, 2009, 4:59am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/4 "2009-12-02T04:59:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michele1](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Michele1](https://techcommunity.softwareag.com/u/Michele1)\
**Post date:** [December 2, 2009, 5:08am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/5 "2009-12-02T05:08:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michele1](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Michele1](https://techcommunity.softwareag.com/u/Michele1)\
**Post date:** [December 2, 2009, 5:46am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/6 "2009-12-02T05:46:30Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [December 2, 2009, 7:00am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/7 "2009-12-02T07:00:49Z")

</div>

> [@](#):
>
> 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?

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).

> [@](#):
>
> What is the advantage of using Prefetch in Batch ?
> 
> What is the advantage of using MultiFetch in Batch?

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.

---

<div class="post-metadata">

**Author:** ![Curtis\_Pew](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@Curtis\_Pew](https://techcommunity.softwareag.com/u/Curtis_Pew)\
**Post date:** [December 3, 2009, 6:58pm UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/8 "2009-12-03T18:58:35Z")

</div>

> [@Ralph Zbrog](#):
>
> The end result for you is much shorter batch job elapsed times.

The end result may be shorter batch job elapsed times.

The “gotcha

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [December 4, 2009, 12:34am UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/9 "2009-12-04T00:34:46Z")

</div>

NOT

STARTING FROM … ENDING AT

NOT

STARTING FROM… THRU

Only STARTING FROM … TO works as Curtis stated.

steve

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:57pm UTC](https://techcommunity.softwareag.com/t/multifetch-vs-prefetch/92273/10 "2021-04-02T14:57:48Z")

</div>


