# Determine allocated file name

**URL:** <https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [March 9, 2006, 7:51pm UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652 "2006-03-09T19:51:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![pidipius](https://avatars.discourse-cdn.com/v4/letter/p/48db29/32.png) [@pidipius](https://techcommunity.softwareag.com/u/pidipius)\
**Post date:** [March 9, 2006, 7:51pm UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/1 "2006-03-09T19:51:16Z")

</div>

How to determine allocated file name in natural (giving workfile number)?

---

<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:** [March 9, 2006, 8:11pm UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/2 "2006-03-09T20:11:35Z")

</div>

If you have Entire System Server (aka Natural Process) this is fairly easy. If you don’t, I don’t know of a way, unless you want to write an assembler routine and call it.

---

<div class="post-metadata">

**Author:** ![Henrik\_Hermansen1](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@Henrik\_Hermansen1](https://techcommunity.softwareag.com/u/Henrik_Hermansen1)\
**Post date:** [March 17, 2006, 5:15pm UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/3 "2006-03-17T17:15:45Z")

</div>

> [@](#):
>
> If you have Entire System Server (aka Natural Process) this is fairly easy

Very explaining 😉

---

<div class="post-metadata">

**Author:** ![Arnold\_Carreon](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@Arnold\_Carreon](https://techcommunity.softwareag.com/u/Arnold_Carreon)\
**Post date:** [March 23, 2006, 1:28am UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/4 "2006-03-23T01:28:50Z")

</div>

If you are not using ESS, you may have:

- specified it in the JCL, then pass it on to the program. If passing on is a problem, parse the JCL if you know where it is located :twisted:

- created it using the user-exit/dynamic allocation, then pass it on to the program needing it

---

<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:** [March 25, 2006, 1:17am UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/5 "2006-03-25T01:17:35Z")

</div>

> [@](#):
>
> Very explaining 😉

I didn’t take the trouble to work it out earlier (because I’m lazy), but I ended up having to do something like this today. So here’s some code to find the dataset name for work file 1:

```auto
MOVE *INIT-USER TO #JOB-NAME
FIND ALLOCATIONS WITH JOB-NAME = #JOB-NAME AND DDNAME = 'CMWKF01'
  DISPLAY DSNAME
END-FIND
```

---

<div class="post-metadata">

**Author:** ![Arnold\_Carreon](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@Arnold\_Carreon](https://techcommunity.softwareag.com/u/Arnold_Carreon)\
**Post date:** [March 25, 2006, 3:51am UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/6 "2006-03-25T03:51:50Z")

</div>

Curtis,

Is this using ESS? We don’t have it so I don’t even know the fields of the ALLOCATIONS view. Using your code, wouldn’t you need additional criteria if you have multiple steps and if you have procs?

---

<div class="post-metadata">

**Author:** ![zarchasmpgmr](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/zarchasmpgmr/32/126_2.png) [@zarchasmpgmr](https://techcommunity.softwareag.com/u/zarchasmpgmr)\
**Post date:** [March 26, 2006, 3:15am UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/7 "2006-03-26T03:15:20Z")

</div>

If there isn’t a USR routine to do it, you’ll have to write an assembler program.

Are you z/OS or z/VSE? (I’ll assume you aren’t BS2000/OSD. 😃 )

I’ve got routines that you can use for either one.

---

<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:** [March 29, 2006, 11:56pm UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/8 "2006-03-29T23:56:29Z")

</div>

My sample code does use ESS. ALLOCATIONS is one of the views provided by ESS. It reports the allocations of the currently executing step; you don’t have to provide step or proc information. (On the other hand, if you want to know about a step not currently executing, you’re out of luck.)

---

<div class="post-metadata">

**Author:** ![florian\_gaulier](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@florian\_gaulier](https://techcommunity.softwareag.com/u/florian_gaulier)\
**Post date:** [May 24, 2007, 6:16pm UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/9 "2007-05-24T18:16:58Z")

</div>

You can use USR1007

---

<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 26, 2007, 3:27am UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/10 "2007-05-26T03:27:13Z")

</div>

> [@florian\_gaulier](#):
>
> You can use USR1007

Hello florian\_gaullier. Thanks for your input. I had asked pidipius’ question in a previous post but unfortunately we do not have ESS at our site.

I took a look at the SYSEXT sample program (we have Natural 4.13 installed) for USR1007 but didn’t see it returning the dataset name. “Device Name” is only 8 bytes long and is probably DDName. Here is the parameter layout used to call the module:

```auto
01 PARMS /* PARAMETER LIST
   02 DEVICE-CLASS (A08) /* IN/OUT : 'P'RINTER,'W'ORKFILE,'L'OGPRINT
   02 DEV-NO (N02) /* IN : DEVICE NUMBER
   02 ERROR (N04) /* OUT : ERROR CODE
   02 ERROR-TEXT (A72) /* OUT : EXPLANATION TO ERROR CODE
   02 STAT-TX (A32) /* OUT : DEVICE STATUS TEXT
   02 STAT-CD (A08) /* OUT : DEVICE STATUS CODE
   02 SYSNO (A03) /* OUT : VSE EDITED SYS-NUMBER
   02 NUM (N02) /* OUT : PHYSICAL device number
   02 TYPE (A08) /* OUT : DEVICE TYPE
   02 NAME (A08) /* OUT : DEVICE NAME
   02 RECF (A02) /* OUT :
   02 LEN (P05) /* OUT :
   02 BLKS (P05) /* OUT :
```

Do you have more info ? Thanks.

---

<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:40pm UTC](https://techcommunity.softwareag.com/t/determine-allocated-file-name/60652/11 "2021-04-02T14:40:30Z")

</div>


