# Remove special characters from fields

**URL:** <https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes, Natural-on-Windows-Unix\
**Created:** [April 29, 2015, 11:15pm UTC](https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746 "2015-04-29T23:15:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@Ashish\_Srivastava](https://techcommunity.softwareag.com/u/Ashish_Srivastava)\
**Post date:** [April 29, 2015, 11:15pm UTC](https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746/1 "2015-04-29T23:15:21Z")

</div>

What are we doing?  
We are trying to convert ADABAS data to DB2 format data and then verify if all data has been migrated. We are able to convert ADABAS to DB2 and load the data in DB2. Now I am trying to verify all the data. I have have 2 datasets ADABAS datasets has data from ADABAS using WRITE command. second dataset has data from DB2 tables. My plan is to be able to a comparison of both files using Super C in mainframe.

Issue:  
Differences  
ADABAS DATA DB2 DATA  
NW896} 0 896} NW-8960 0 -8960

I want output as -8960 in place of 896}. If there is no value then I want just ‘0’(zero).  
Snapshot of data is below.

```auto

ADABAS Data
NN7120 7120 J NN0 
NN750} 0 750} NN4320 0
NW896} 0 896} NN0 

DB2DATA
NN7120 7120 -1 NN0  
NN-7500 0 -7500 NN4320 0
NW-8960 0 -8960 NN0

01 DDM-VIEW VIEW OF exxxA 
02 exxx-Q-vvv-TOTAL-THIS-YR /* (N5) 
02 exxx-Q-vvv-EARNED-UNUSED /* (N5) 
02 exxx-Q-ccccc-SICK /* (N9)    

01 DB2-exxxA
02 exxx_Q_vvv_TOTAL_THIS_YR (A6) /* N5 + SIGN
02 exxx_Q_vvv_EARNED_UNUSED (A6) /* N5 + sign
02 exxx_Q_ccccc_SICK (A10) /* N9 + sign

   MOVE LEFT DDM-VIEW.exxx-Q-vvv-TOTAL-THIS-YR              
     TO DB2-exxxA.exxx_Q_vvv_TOTAL_THIS_YR 
   MOVE LEFT DDM-VIEW.exxx-Q-vvv-EARNED-UNUSED            
     TO DB2-exxxA.exxx_Q_vvv_EARNED_UNUSED
   MOVE LEFT DDM-VIEW.exxx-Q-ccccc-SICK                   
     TO DB2-exxxA.exxx_Q_ccccc_SICK      

WRITE WORK 1  
               DB2-exxxA.exxx_Q_vvv_TOTAL_THIS_YR
                    DB2-exxxA.exxx_Q_vvv_EARNED_UNUSED
                    DB2-exxxA.exxx_Q_ccccc_SICK 

```

I tried remove special characters using EM. It fixes the problem but then number get righ justified and comparison again fails.  
I tried below.

```auto

  MOVE EDITED DDM-VIEW.exxx-Q-ccccc-SICK (EM=-ZZZZZZZZ9)
* MOVE LEFT DDM-VIEW.exxx-Q-ccccc-SICK                
    TO DB2-exxxA.exxx_Q_ccccc_SICK     
                
```

Before above fix data was:

```auto

      0 0 0 0 WIS0 S0 MN 4541
      0 0 96} 0 MNS0 S0 MN 2663
      0 0 15780 168 WIM1 M1 MN 0359
      0 0 0 0 S0 S0 MN 4968
      0 0 0 0 WIS0 S0 XS 6696
      0 0 0 0 NDS0 S0 MN 0329
      0 0 99579 403 MNM0 M0 MN 4968
```

After above fix the data is as below:

```auto

      0 0 00 WIS0 S0 MN 45416GNDL02
      0 0 -9600 MNS0 S0 MN 26630GNDM01
      0 0 15780168 WIM1 M1 MN 0359CGNDM02
      0 0 00 S0 S0 MN 4968AGNDM03
      0 0 00 WIS0 S0 XS 66965GNDN01
      0 0 00 NDS0 S0 MN 03290GNDR01
      0 0 99579403 MNM0 M0 MN 4968LGNDR02
      0 0 144600 MNS0 S0 MN 2160DGNDS01
```

Can anyone please suggest/guide/advice ?

---

<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:** [April 30, 2015, 5:39am UTC](https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746/2 "2015-04-30T05:39:58Z")

</div>

[quote=Ashish Srivastava]  
I tried below.

```auto
MOVE EDITED DDM-VIEW.exxx-Q-ccccc-SICK (EM=-ZZZZZZZZ9)
* MOVE LEFT DDM-VIEW.exxx-Q-ccccc-SICK                
    TO DB2-exxxA.exxx_Q_ccccc_SICK
```

Try changing this to

```auto
MOVE EDITED DDM-VIEW.exxx-Q-ccccc-SICK (EM=-ZZZZZZZZ9) TO DB2-exxxA.exxx_Q_ccccc_SICK
MOVE LEFT DB2-exxxA.exxx_Q_ccccc_SICK TO DB2-exxxA.exxx_Q_ccccc_SICK
```

---

<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:** [April 30, 2015, 8:22am UTC](https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746/3 "2015-04-30T08:22:00Z")

</div>

Having given this more thought, here’s a one-statement alternative.

```auto
COMPRESS NUMERIC DDM-VIEW.exxx-Q-ccccc-SICK INTO DB2-exxxA.exxx_Q_ccccc_SICK
```

---

<div class="post-metadata">

**Author:** ![Ashish\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@Ashish\_Srivastava](https://techcommunity.softwareag.com/u/Ashish_Srivastava)\
**Post date:** [April 30, 2015, 8:30pm UTC](https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746/4 "2015-04-30T20:30:32Z")

</div>

Ralph Thank!!

I tried first option and it works for me ( I had tried this before not sure why did not work then).

COMPRESS NUMERIC throws below error.  
NAT0099 Field error in a COMPRESS statement.

Ashish

---

<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:** [April 30, 2015, 9:27pm UTC](https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746/5 "2015-04-30T21:27:02Z")

</div>

Sorry. The NAT0099 must be a version issue. I don’t have access to a mainframe and am testing with Natural 8.3 under Windows.

---

<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:33pm UTC](https://techcommunity.softwareag.com/t/remove-special-characters-from-fields/181746/6 "2021-04-02T15:33:20Z")

</div>


