I am using sort card to produce edited numeric decimal in VB format. I have to eliminate leading zeroes before decimal and trailing zeroes after decimal. I was able to eliminate leading zeroes by edited masks. How can I remove trailing zeroes after decimal ?
e.g.
a|1234|00456.000|cd|456.000
b|455|0001.230|ut|002.400
output
a|1234|456.|cd|456.
b|455|1.23|ut|2.4
Please note I need only to remove trailing zeroes after decimal
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Based on your small example, if the trailing zeros are the last bytes in the VB records (that is the RDW length is equal to the position of the last 0), you can use these DFSORT statements:
Code:
OPTION COPY
OUTFIL VLTRIM=C'0'
Of course, whether that works or not will depend on exactly what the records in your input file look like for all cases.
D.Sch. -> Actually we have to FTP this file to other system hence requirement is to minimize the space by squeezing data as much so as to minimize the transfer time.
Frank -> Thanks. Actually in single record there are multiple position from where we have to remove trailing zero after decimal point.
SORT card I am using is below. I need to remove trailing zeroes after decimals for all fields which are edited as SIIIIIIIIIIIIIIIIIIIT.TTT
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
aVDHOOT,
Now that you've shown what you are really trying to do, I can help you.
You can use these DFSORT control statements. Note that I used C'$' after every EDITed field and X'4F' (C'|') after every unedited field. That let's us change 000$ etc to | and we squeeze out the blanks using FINDREP as well.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
The way my job is set up, SQZ wouldn't work correctly because it would pad the VB records on the right with blanks. FINDREP will not pad the records on the right with blanks, and it's easier to use because you don't have to give the position and length - it uses the length in the RDW automatically.