Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Remove leading zeros

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Supress leading zeros in Packed Decimal
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    Post subject:
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu Nov 21, 2013 12:47 pm    Post subject: Reply to: Remove leading zeros
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    Post subject:
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

Site Director


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

PostPosted: Thu Nov 21, 2013 7:37 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Remove leading zeros
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: 1738
Location: Bloomington, IL

PostPosted: Wed Nov 27, 2013 6:28 pm    Post subject: Re: Reply to: Remove leading zeros
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    Post subject: Reply to: Remove leading zeros
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    Post subject: Reply to: Remove leading zeros
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Remove Special Characters from Mainfr... Rodger Zhang All Other Mainframe Topics 6 Wed Jul 06, 2016 1:12 am
No new posts Join key - Populate Zeros when Unpair... rexx77 DFSORT/ICETOOL 6 Thu May 12, 2016 12:22 am
No new posts Remove header only knobi SYNCSORT 5 Mon Feb 15, 2016 10:42 pm
No new posts Append to file, but also remove old r... Garry Carroll JCL & VSAM 3 Mon Jan 25, 2016 8:05 pm
No new posts Remove intermediate spaces Pallavi Vishwanath SYNCSORT 1 Fri Jan 15, 2016 2:45 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us