Page 1 of 1

How can I format amount of LEADING ZEROS in DISPLAY?

PostPosted: Mon Nov 13, 2017 9:31 pm
by andrisole
Hi,

I am trying to make one exercise, which requires to me to make a report on different branches.

I need branches to have exactly 6 digits, in case if there is brach 123, it will be displayed as 000123.
What I am trying to do is to include leading zeros using LZ statement:
HEADER('SORTCODE') ON(1,4,BI,A0,LZ)
,

but it prints too many leading zeros, and I do not know how to remove extra ones.

   SORTCODE
-----------
 0000000000
 0000000001
 0000000012
 0000010101
 0000010203
 0000012017
 0000040101
 0000090909
 0000101010
 0000101101
 0000110695
 0000111111
 0000111112
 


Can anyone help please?

Re: How can I format amount of LEADING ZEROS in DISPLAY?

PostPosted: Fri Feb 09, 2018 11:11 pm
by Aki88
Hello,

Unsure if this is resolved, in case it still isn't, look at the usage of EDIT mask under the DISPLAY operator that you are using.
You can use a mask: E'999999'; the edit mask should give you the desired output as you've restricted the data to 6 bytes in the mask.
Else use a simple BUILD command with the desired EDIT pattern.