IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

to remove trailing zeroes after decimal point in VB file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
avdhoot kubal

New User


Joined: 30 Aug 2011
Posts: 3
Location: India

PostPosted: Tue Aug 30, 2011 9:50 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 30, 2011 11:00 pm
Reply with quote

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. . . icon_confused.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Aug 30, 2011 11:42 pm
Reply with quote

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
View user's profile Send private message
avdhoot kubal

New User


Joined: 30 Aug 2011
Posts: 3
Location: India

PostPosted: Wed Aug 31, 2011 8:14 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Aug 31, 2011 8:25 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Sep 01, 2011 2:04 am
Reply with quote

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
View user's profile Send private message
avdhoot kubal

New User


Joined: 30 Aug 2011
Posts: 3
Location: India

PostPosted: Thu Sep 01, 2011 1:05 pm
Reply with quote

Thanks Frank,

Its working great ! Just curious - have u replaced SQZ with FINDREP to remove spaces for any specific purpose ?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Sep 01, 2011 11:01 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top