# Supress zeros when writing to work file

**URL:** <https://techcommunity.softwareag.com/t/supress-zeros-when-writing-to-work-file/181045>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [March 13, 2015, 8:52pm UTC](https://techcommunity.softwareag.com/t/supress-zeros-when-writing-to-work-file/181045 "2015-03-13T20:52:00Z")\
**Posts on this page:** 5\
**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:** [March 13, 2015, 8:52pm UTC](https://techcommunity.softwareag.com/t/supress-zeros-when-writing-to-work-file/181045/1 "2015-03-13T20:52:00Z")

</div>

I am not able to use ED ( Edit mask) and use it with WRITE WORK and suppress zeros in XXXX-N-SIZE field.

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.

But DB2 data does not have zeros padded before numeric filed but ADABAS data has zeros padded before numeric field. I want to fix this by either suppress zeros in ADABAS file or add zeros in DB2 file.

I am not able to do this , can anyone please suggest/guide/advice ?

```auto

 01 DDM-VIEW VIEW OF XXXXA      
   02 XXXX-C-SSSSSS /* (A1)     
   02 XXXX-N-TABLE /* (A4)      
   02 XXXX-N-SEQ /* (A3)        
   02 XXXX-D-UPDATE /* (A6)     
   02 XXXX-N-TIME /* (A5)       
   02 XXXX-N-SIZE /* (N4)    

 01 DB2-XXXXA                              
   02 ISN (N10)                   
   02 XXXX_C_SSSSSS (A1)                   
   02 XXXX_N_TABLE (A4)                    
   02 XXXX_N_SEQ (A3)                      
   02 XXXX_D_UPDATE (A6)                   
   02 XXXX_N_TIME (A5)                     
   02 XXXX_N_SIZE (A5) /* N4 + SIGN       
   02 XXXX_S_KEY (A8) /* SUPER-DESCRIPTOR  

  MOVE EDITED DDM-VIEW.XXXX-N-SIZE (EM=-9999)   
    TO DB2-XXXXA.XXXX_N_SIZE                    

  WRITE WORK 1             
  DDM-VIEW.XXXX-C-SSSSSS   
  DDM-VIEW.XXXX-N-TABLE    
  DDM-VIEW.XXXX-N-SEQ      
  DDM-VIEW.XXXX-D-UPDATE   
  DDM-VIEW.XXXX-N-TIME     
  DDM-VIEW.XXXX-N-SIZE     

BROWSE STAGING.ADABAS                  
 Command ===>                                                  
 004400191080109:220399 <--- ZERO is added before 399 size field                                                    
 005700291090207:130399                                                         
 004700191080109:261224                                                         

BROWSE .STAGING.DB2                    
 Command ===>                                                
 004400191080109:22399 <-- zero is not added before 399 size field                                                      
 005700291090207:13399                                                          
 004700191080109:261224                                                         
                                                         
            
```

in DB2 field XXXX\_N\_SIZE is SMALLINT 2

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [March 13, 2015, 10:19pm UTC](https://techcommunity.softwareag.com/t/supress-zeros-when-writing-to-work-file/181045/2 "2015-03-13T22:19:54Z")

</div>

You cannot suppress the leading zeros in a numeric field when writing it to a workfile. You will have to create an alpha field to hold it and write that to the workfile.

In your define data, add:  
1 HOLD-XXXX-N-SIZE (A5)

Before the WRITE WORK 1 at line 22, add:  
MOVE LEFT DDM-VIEW.XXXX-N-SIZE TO HOLD-XXXX-N-SIZE

In the WRITE WORK 1 statement, replace DDM-VIEW.XXXX-N-SIZE with HOLD-XXXX-N-SIZE.

Good luck!

---

<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:** [March 14, 2015, 6:55am UTC](https://techcommunity.softwareag.com/t/supress-zeros-when-writing-to-work-file/181045/3 "2015-03-14T06:55:39Z")

</div>

Thanks a TON Jerome , it worked!!

Ashish

---

<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:** [March 14, 2015, 7:39pm UTC](https://techcommunity.softwareag.com/t/supress-zeros-when-writing-to-work-file/181045/4 "2015-03-14T19:39:19Z")

</div>

Hi Ashish;

I know you have solved your current problem, but something to consider for the future.

Suppose, instead of N4, you moved the value to an I2 variable, then used that variable when writing to the work file?

This should work (haven’t tried it as yet).

---

<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/supress-zeros-when-writing-to-work-file/181045/5 "2021-04-02T15:33:04Z")

</div>


