IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Remove leading zeros


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

New User


Joined: 07 Sep 2011
Posts: 8
Location: india

PostPosted: Thu Nov 21, 2013 12:00 pm
Reply with quote

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

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Thu Nov 21, 2013 12:26 pm
Reply with quote

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

New User


Joined: 07 Sep 2011
Posts: 8
Location: india

PostPosted: Thu Nov 21, 2013 12:28 pm
Reply with quote

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

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Thu Nov 21, 2013 12:42 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Thu Nov 21, 2013 12:47 pm
Reply with quote

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

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Thu Nov 21, 2013 1:02 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Thu Nov 21, 2013 7:37 pm
Reply with quote

Hello,

What happens when you run this?
Back to top
View user's profile Send private message
shyamala.m

New User


Joined: 26 Nov 2013
Posts: 5
Location: India

PostPosted: Tue Nov 26, 2013 3:36 pm
Reply with quote

that doesn't work..
by giving EDIT=(IIIIIIII.TT), the decimal point is also getting removed.
icon_confused.gif
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Wed Nov 27, 2013 12:17 pm
Reply with quote

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
View user's profile Send private message
shyamala.m

New User


Joined: 26 Nov 2013
Posts: 5
Location: India

PostPosted: Wed Nov 27, 2013 4:44 pm
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1789
Location: Bloomington, IL

PostPosted: Wed Nov 27, 2013 6:28 pm
Reply with quote

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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Nov 28, 2013 12:29 am
Reply with quote

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
View user's profile Send private message
shyamala.m

New User


Joined: 26 Nov 2013
Posts: 5
Location: India

PostPosted: Tue Dec 17, 2013 5:21 pm
Reply with quote

Thanks a lot!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts How to remove this shortcut bar? TSO/ISPF 3
No new posts How to remove remote file older than ... All Other Mainframe Topics 4
No new posts User key common area users - How to r... All Other Mainframe Topics 0
No new posts IEBGENER to copy from FB to VB and re... All Other Mainframe Topics 3
No new posts Convert Numeric to Packed decimal and... DFSORT/ICETOOL 5

Back to Top