# Searching for variables in LIST EXPAND

**URL:** <https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [September 21, 2009, 4:29pm UTC](https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295 "2009-09-21T16:29:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mishra](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mishra](https://techcommunity.softwareag.com/u/Mishra)\
**Post date:** [September 21, 2009, 4:29pm UTC](https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295/1 "2009-09-21T16:29:10Z")

</div>

Hi,

Usually the programs use many LDAs and each LDA contain many variables.  
During analysis some times it is really difficult (time consuming)to find in which LDA the variable is defined (by listing each LDA).

Is there any approach which can ease the search by not leaving the editor or not listing each of the Data areas?

(EXPAND is useful only in LIST mode and we can not SCan the variables with the EXPAND command).

Thanks in Advance.  
Mishra

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [September 21, 2009, 9:32pm UTC](https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295/2 "2009-09-21T21:32:00Z")

</div>

do you have XREF on? This feature enables you to cross reference programs, variables, views, modules, etc.

To use it, you need to have the objects in question STOWed with XREF=ON, then use the LIST XREF command to produce the reports.

---

<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:** [September 21, 2009, 9:48pm UTC](https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295/3 "2009-09-21T21:48:42Z")

</div>

An XREF can include false hits. That is, the variable in question may reside in 10 LDAs, but only one of those LDAs is in your module.

Another option is to list the module in batch with

```auto
L module EXPAND 
```

Then scan the softcopy listing for the variable.

Or you could write a utility to

- . search the contents of the Source Work Area for external data area names  
. determine the variable name by the cursor position in the editor  
. search each external data area for the variable  
. display a pop-up window with the results

Or you could purchase a third-party solution.

---

<div class="post-metadata">

**Author:** ![Mishra](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mishra](https://techcommunity.softwareag.com/u/Mishra)\
**Post date:** [September 22, 2009, 7:13am UTC](https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295/4 "2009-09-22T07:13:22Z")

</div>

Hi,

Thank you for your responses.

The LIST module EXPAND seems a nice option to go with.

Thank you,  
Mishra 🙂

---

<div class="post-metadata">

**Author:** ![Paul6](https://avatars.discourse-cdn.com/v4/letter/p/ee7513/32.png) [@Paul6](https://techcommunity.softwareag.com/u/Paul6)\
**Post date:** [September 22, 2009, 1:51pm UTC](https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295/5 "2009-09-22T13:51:00Z")

</div>

Hi Mishra

If you are looking for a quick way of finding a variable without leaving the editor, then I have something that works 99% of the time.

What I think you are describing is a case where you have something like this:

0010 define data  
0020 local using lda1  
0030 local using lda2  
0040 local using lda3  
0050 local using lda4  
0060 local using lda5  
0070 end-define  
0080 write #a #b #c #d #e  
0090 end

where you don’t know where one of the variables, say #b, exists. Assuming the code already checks, just insert a new variable named for the one the are looking for just after the define data statement, something like this:

0010 define data  
0011 local  
0012 1 #b (i4)  
0020 local using lda1  
0030 local using lda2  
0040 local using lda3  
0050 local using lda4  
0060 local using lda5  
0070 end-define  
0080 write #a #b #c #d #e  
0090 end

It doesn’t matter what you define #b as, the only requirement is that it’s defined in front of the other data areas. If you now simply check the code, you’ll get a 283 error saying that the variable has been defined more than once and when you hit enter or return, Natural will mark the LDA where the second occurence has been found. Not elegant, but it’s a quick way of finding out where your variable is!

---

<div class="post-metadata">

**Author:** ![Mishra](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mishra](https://techcommunity.softwareag.com/u/Mishra)\
**Post date:** [September 22, 2009, 9:46pm UTC](https://techcommunity.softwareag.com/t/searching-for-variables-in-list-expand/91295/6 "2009-09-22T21:46:13Z")

</div>

Hi Paul,

This is a trick for a quick check…thank you very much 🙂

Thanks,  
Mishra

---

<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/searching-for-variables-in-list-expand/91295/7 "2021-04-02T14:57:32Z")

</div>


