# Subroutines - run time errors

**URL:** <https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [May 8, 2007, 1:23am UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184 "2007-05-08T01:23:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thespin](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@thespin](https://techcommunity.softwareag.com/u/thespin)\
**Post date:** [May 8, 2007, 1:23am UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184/1 "2007-05-08T01:23:23Z")

</div>

Ola caballeros.

Currently, PERFORMed subroutines are not flagged at compile time if the subroutine name doesn’t exist in the main program obstensibly because the subroutine can be defined externally (why doesn’t it check the external library at compile time?).

ANYHOW, I ask because a production program poorly tested and stowed six months ago just went down because a subroutine just invoked for the first time was misspelled.

Is there anyway to flag these situations with a WARNING when they exist ?

Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [May 8, 2007, 4:55am UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184/2 "2007-05-08T04:55:37Z")

</div>

I have been burned by this, too. I wish there were a compiler option to issue warnings, but I can’t come up with anything. I would be happy if the compiler just listed all subroutines that are not defined internally.

You can do this yourself with LIST DIR, but that’s easy to forget.

---

<div class="post-metadata">

**Author:** ![thespin](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@thespin](https://techcommunity.softwareag.com/u/thespin)\
**Post date:** [May 8, 2007, 9:17pm UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184/3 "2007-05-08T21:17:57Z")

</div>

Thanks so much for your response, Jerome. That works for me! I will publish …

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [May 10, 2007, 12:19pm UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184/4 "2007-05-10T12:19:53Z")

</div>

> [@thespin](#):
>
> (why doesn’t it check the external library at compile time?).

To keep the logic consistent? If you CALLNAT or FETCH a module which doesn’t exist, you’ll also get a runtime error.

DDM, INCLUDEs, LOCAL or PARAMETER USING are evaluated at comile time.

---

<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:** [May 10, 2007, 5:07pm UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184/5 "2007-05-10T17:07:19Z")

</div>

What happens when I have :

Subprogram A, which CALLNATs Subprogram B which CALLNATs Subprogram C  
which CALLNATs Subprogram A ???

What would be the order for STOW’ing???

As far as a warning, it has already been pointed out that LIST DIR gives you a list of Subprograms.

steve

---

<div class="post-metadata">

**Author:** ![thespin](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@thespin](https://techcommunity.softwareag.com/u/thespin)\
**Post date:** [May 10, 2007, 7:10pm UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184/6 "2007-05-10T19:10:37Z")

</div>

Gentlemen, I am not suggesting that the STOW give errors, just warnings … yes, maybe even on the CALLNATs and FETCHes if the module (‘literals’ only check) or subroutine is not found in the library concatenation …

Wouldn’t that be nice ?

---

<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:41pm UTC](https://techcommunity.softwareag.com/t/subroutines-run-time-errors/62184/7 "2021-04-02T14:41:10Z")

</div>


