# Work filename as input parameter

**URL:** <https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [July 28, 2011, 9:28pm UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864 "2011-07-28T21:28:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artur\_Paciorkowski](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Artur\_Paciorkowski](https://techcommunity.softwareag.com/u/Artur_Paciorkowski)\
**Post date:** [July 28, 2011, 9:28pm UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864/1 "2011-07-28T21:28:14Z")

</div>

In some batch program I’m using:  
READ WORK FILE 1 DATA  
…

In a job that is runned i need to define CMWKF01 as work file, for example BAR.WORKS.TEST1.

Is possible to get work name (BAR.WORKS.TEST1) as input parameter to Natural program ?

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [July 28, 2011, 10:29pm UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864/2 "2011-07-28T22:29:14Z")

</div>

If you have Entire System Server, you could read the workfile directly using the dataset name which could be held in a variable.

Or… you could dynamically write JCL with Natural and submit it to RJE via NATRJE or PROCESS SUBMIT.

---

<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:** [July 29, 2011, 4:45am UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864/3 "2011-07-29T04:45:51Z")

</div>

Hi Artur,

Take a look at the DEFINE WORK FILE statement.

e.g.

INPUT #DSN  
DEFINE WORK FILE 1 #DSN

N.B. The dataset must be catalogued and is allocated with DISP=SHR.

* * *

Graeme Lane

---

<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:** [July 29, 2011, 5:01am UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864/4 "2011-07-29T05:01:06Z")

</div>

Hi Artur,

On further reading of your question, it could also be interpreted as you wanting to be able to find out the name of the dataset as defined in the JCL. You can use USR1050N or USR2011N to do that.

Cheers,

Graeme Lane

---

<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:** [July 29, 2011, 5:01am UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864/5 "2011-07-29T05:01:22Z")

</div>

> [@Artur Paciorkowski](#):
>
> In a job that is runned i need to define CMWKF01 as work file, for example BAR.WORKS.TEST1.

If you need to dynamically define CMWKF01 to point to BAR.WORKS.TEST1 use  
USR2021N in library SYSEXT.

> [@Artur Paciorkowski](#):
>
> Is possible to get work name (BAR.WORKS.TEST1) as input parameter to Natural program ?

Not quite sure I understand, you can supply it as a parameter via CMPRMIN, then use INPUT  
from your Natural program to read it in, if this doesn’t answer the question please clarify.

---

<div class="post-metadata">

**Author:** ![Artur\_Paciorkowski](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Artur\_Paciorkowski](https://techcommunity.softwareag.com/u/Artur_Paciorkowski)\
**Post date:** [July 29, 2011, 2:03pm UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864/6 "2011-07-29T14:03:57Z")

</div>

Thanks a lot for Your help.

---

<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, 3:00pm UTC](https://techcommunity.softwareag.com/t/work-filename-as-input-parameter/97864/7 "2021-04-02T15:00:39Z")

</div>


