Trimming of Leading Zeros and Trailing Spaces

I have a ADABAS file of which i have to take a backup extract in a flat file in a Variable extract format.So i read it in a waork file and add a delimiter in filler.Eg:
1 #work
2 #a (a50)
2 #filler init<’|’>
2 #b (a50)

write work
The record contains
#a : standard text
#b : record
the output would be
50 bytes | 50 bytes
but the output should be like:
standard text|record
Also need to remove the leading zeros .Kindly help out for the same

I would do something like this:


DEFINE DATA LOCAL                                         
1 #A (A) DYNAMIC                                          
1 FIELD1 (A50)    INIT <'some text'>                      
1 FIELD2 (N7.2)  INIT <123>                             
END-DEFINE                                                
COMPRESS NUMERIC FIELD1 FIELD2 INTO #A WITH DELIMITER '|' 
WRITE #A (AL=78)                                          
WRITE WORK FILE 1 VARIABLE #A
END                                                         

When done, #A contains “some text|123.4”

Two things to note:

  1. COMPRESS NUMERIC preserves the decimal in the numeric field.
  2. The VARIABLE option of WRITE WORK FILE allows you to write work file records with different lengths.