|
View previous topic :: View next topic
|
| Author |
Message |
avdhoot kubal
New User
Joined: 30 Aug 2011 Posts: 3 Location: India
|
|
|
|
Hi,
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 |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Why does someone believe this is needed?
What business requirement might this support?
As the values are equal, any computer system can work with them as-is with no problem. . .  |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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. |
|
| Back to top |
|
 |
avdhoot kubal
New User
Joined: 30 Aug 2011 Posts: 3 Location: India
|
|
|
|
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
SORT FIELDS=COPY
OUTFIL FILES=01,
IFTHEN=(WHEN=INIT,
BUILD=(001,04,
005,08,BI,M10,X'4F',
013,08,BI,M10,X'4F',
021,08,BI,M10,X'4F',
029,02,BI,M10,X'4F',
.
.
.
046,01,X'4F',
047,01,X'4F',
048,02,BI,M10,X'4F',
050,02,BI,M10,X'4F',
052,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),X'4F',
064,02,BI,M10,X'4F',
066,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),X'4F',
078,02,BI,M10,X'4F',
080,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),X'4F',
092,02,BI,M10,X'4F',
094,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),X'4F',
106,02,BI,M10,X'4F',
108,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),X'4F',
120,02,BI,M10,X'4F',
122,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),X'4F',
134,02,BI,M10,X'4F',
136,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
.
.
.
.
.
470,02,BI,M10,X'4F',
472,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,))),
IFTHEN=(WHEN=INIT,
OVERLAY=(5:5,1253,SQZ=(SHIFT=LEFT))) |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
I believe the focus is on something that (from the data shown) is not an issue.
If you really want to reduce the ftp file size, compress the data before transmitting and de-compress the data on the target system. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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.
| Code: |
SORT FIELDS=COPY
OUTFIL FILES=01,VLTRIM=X'4F',
IFTHEN=(WHEN=INIT,
BUILD=(001,04,
005,08,BI,M10,X'4F',
013,08,BI,M10,X'4F',
021,08,BI,M10,X'4F',
029,02,BI,M10,X'4F',
.
.
.
046,01,X'4F',
047,01,X'4F',
048,02,BI,M10,X'4F',
050,02,BI,M10,X'4F',
052,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),C'$',
064,02,BI,M10,X'4F',
066,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),X'4F',
078,02,BI,M10,X'4F',
080,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),C'$',
092,02,BI,M10,X'4F',
094,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),C'$',
106,02,BI,M10,X'4F',
108,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),C'$',
120,02,BI,M10,X'4F',
122,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),C'$',
134,02,BI,M10,X'4F',
136,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),C'$',
.
.
.
470,02,BI,M10,X'4F',
472,12,PD,EDIT=(SIIIIIIIIIIIIIIIIIIIT.TTT),
SIGNS=(,-,,),C'$')),
IFTHEN=(WHEN=INIT,
FINDREP=(IN=(C'000$',C'00$',C'0$',C'$'),OUT=X'4F')),
IFTHEN=(WHEN=INIT,
FINDREP=(INOUT=(C' ',C'')))
/*
|
|
|
| Back to top |
|
 |
avdhoot kubal
New User
Joined: 30 Aug 2011 Posts: 3 Location: India
|
|
|
|
Thanks Frank,
Its working great ! Just curious - have u replaced SQZ with FINDREP to remove spaces for any specific purpose ? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|