View previous topic :: View next topic
|
Author |
Message |
Lingam D
New User
Joined: 07 Sep 2011 Posts: 8 Location: india
|
|
|
|
Hi, Could you please help me with the solution for the below requirement -
My Input is like:
Code: |
10.82
0.83
0.76
20.89 |
And I want the output like:
Code: |
10.82
.83
.76
20.89 |
I need to supress the leading zeros before the decimal point. |
|
Back to top |
|
|
TheMFKid
New User
Joined: 20 Nov 2013 Posts: 91 Location: India
|
|
|
|
Lingam, This post is regarding - Inserting Leading zeroes through Sort.
Do you intent to achieve your requirement using SORT?. I guess it is better to start new post than replying to existing active posts with new requirements. |
|
Back to top |
|
|
Lingam D
New User
Joined: 07 Sep 2011 Posts: 8 Location: india
|
|
|
|
Yes, I intent to achieve this using SORT. Can it be achieved using SORT in a single step.
My Input is in PD format.
Sorry for posting this in this thread. |
|
Back to top |
|
|
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
Use something like below:
Adjust the length and positionings as per your requirement.
This is untested.
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(<position>,5,PD,TO=ZD,EDIT=(IIIIII.TT) )
/* |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks ksouren007. That'll right-justity, so you would need to be shifted left as well. You don't need TO and EDIT at the same time. |
|
Back to top |
|
|
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
Thanks for the advice Bill. How about the below:
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(<position>,5,PD,EDIT=(IIIIII.TT),JFY=(SHIFT=LEFT) )
/* |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What happens when you run this? |
|
Back to top |
|
|
shyamala.m
New User
Joined: 26 Nov 2013 Posts: 5 Location: India
|
|
|
|
that doesn't work..
by giving EDIT=(IIIIIIII.TT), the decimal point is also getting removed.
|
|
Back to top |
|
|
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
What is the sort card that you are using...and does the decimal point come at a fixed position in your input data? |
|
Back to top |
|
|
shyamala.m
New User
Joined: 26 Nov 2013 Posts: 5 Location: India
|
|
|
|
Hi,
This is my sort card.
Yes...having the PD field in a fixed position.
OUTFIL OUTREC=(1:11,4,PD,EDIT=(SIIIIIIT.TT),SIGNS=(,-)) |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
shyamala.m wrote: |
Yes...having the PD field in a fixed position. |
You realize that packed decimal data does not have any internal alignment, yes? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
use the following control cards
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(11,4,PD,EDIT=(SIIIIIT.TT),SIGNS=(,-))),
IFTHEN=(WHEN=INIT,BUILD=(1,10,JFY=(SHIFT=LEFT))),
IFTHEN=(WHEN=(1,2,CH,EQ,C'0.'),BUILD=(2,9)),
IFTHEN=(WHEN=(1,3,CH,EQ,C'-0.'),BUILD=(3,8))
//* |
|
|
Back to top |
|
|
shyamala.m
New User
Joined: 26 Nov 2013 Posts: 5 Location: India
|
|
|
|
Thanks a lot! |
|
Back to top |
|
|
|