# write output into workfile using edit mask

**URL:** <https://techcommunity.softwareag.com/t/write-output-into-workfile-using-edit-mask/90865>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [August 2, 2009, 11:56am UTC](https://techcommunity.softwareag.com/t/write-output-into-workfile-using-edit-mask/90865 "2009-08-02T11:56:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smruti](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@Smruti](https://techcommunity.softwareag.com/u/Smruti)\
**Post date:** [August 2, 2009, 11:56am UTC](https://techcommunity.softwareag.com/t/write-output-into-workfile-using-edit-mask/90865/1 "2009-08-02T11:56:58Z")

</div>

Hi,

I am trying to write some data into a workfile where I want a particular field in a specific format(like XXXX-XXXXX-XXXX-XXXX)

But when I am trying to write into a workfile it is not working and giving me an error. But this works when I try to print it on the normal Natural screen.

Appreciate if you could suggest the code or any other way to acheive it.  
You can also mail me your replies directly to me on my email address that is [ssamantasinghar@gmail.com](mailto:ssamantasinghar@gmail.com)

Please let me know if you need more information about the same.

Thank you!!!  
Smruti Kanta

---

<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:** [August 2, 2009, 4:46pm UTC](https://techcommunity.softwareag.com/t/write-output-into-workfile-using-edit-mask/90865/2 "2009-08-02T16:46:15Z")

</div>

From the Documentation:

"Fields written with a WRITE WORK FILE statement are represented in the external file according to their internal definition. No editing is performed on the field values.

For fields of format A and B, the number of bytes in the external file is the same as the internal length definition as defined in the Natural program. "

The compiler error refers to an illegal subscript; which is what Natural thinks the EM clause is.

The rather simple fix is to perform a MOVE EDITED of your “source field” into another field, and write that to the work file.

steve

---

<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:** [August 3, 2009, 1:59pm UTC](https://techcommunity.softwareag.com/t/write-output-into-workfile-using-edit-mask/90865/3 "2009-08-03T13:59:40Z")

</div>

[http://tech.forums.softwareag.com/viewtopic.php?t=7056](http://tech.forums.softwareag.com/viewtopic.php?t=7056)

---

<div class="post-metadata">

**Author:** ![Smruti](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@Smruti](https://techcommunity.softwareag.com/u/Smruti)\
**Post date:** [August 6, 2009, 6:50pm UTC](https://techcommunity.softwareag.com/t/write-output-into-workfile-using-edit-mask/90865/4 "2009-08-06T18:50:01Z")

</div>

Thank you very much

I will try to run my adhoc report code by using move edited and will let you know if I come across anything unusual

As always thanks again for your valuable updates!!!

---

<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/write-output-into-workfile-using-edit-mask/90865/5 "2021-04-02T14:57:20Z")

</div>


