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

Removing leading zero


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

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 11:25 am
Reply with quote

Hi,

Ihave a requirement here. Input file have character. not decimal.

input file:

00012,50
00120,60
01000,80

output file:

12,50
120,150
1000,50

Could anybody tell me how to achieve this?
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Thu Sep 08, 2011 11:29 am
Reply with quote

You need to give us more information like lrecl, recfm of the input and output file and do you want the fields to be squeezed to left.

Try to use code tags for better readability.
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 11:33 am
Reply with quote

LRECL: 8 RECORD FORMAT: FB

FOR BOTH INPUT AND OUTPUT FILES
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 08, 2011 11:39 am
Reply with quote

Hi,

how does 00120,60 become 120,150 and 01000,80 become 1000,50 ?


Gerry
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 11:43 am
Reply with quote

SORRY .Expected output file is

12,50
120,60
1000,80
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 08, 2011 11:45 am
Reply with quote

Hi Ramsankar,

try this
Code:
//S1       EXEC PGM=ICEMAN                         
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                     
00012,50                                           
00120,60                                           
01000,80                                           
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD    *                                 
  OPTION COPY                                       
  INREC BUILD=(1,05,ZD,EDIT=(IIIII),6,3)           
  OUTREC BUILD=(1,08,JFY=(SHIFT=LEFT))             
/*                                                 


Gerry
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 12:07 pm
Reply with quote

Thanks Gerry.

It works fine.
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 12:18 pm
Reply with quote

is it possible to convert

11,00012,50
12,00120,60
13,01000,80

to

11,12,50
12,120,60
13,1000,80
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Sep 08, 2011 12:37 pm
Reply with quote

the answer is YES

if You do not like YES/NO answers learn not to ask YES/NO questions
as already suggested here
www.ibmmainframes.com/viewtopic.php?t=55100&highlight=
read and meditate on
how to ask questions the smart way
catb.org/~esr/faqs/smart-questions.html
( in the hope that repeating things will make You understand better)

why not use a bit of imagination and try something Yourself ...

hint copy the first 2 chars asis and squeeze from column 3

people will be more eager to answer if You show that you tried something
and not just sitting lazily waiting for us to spoon feed You icon_evil.gif
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 2:40 pm
Reply with quote

Thanks Enrico

I used below code and got the expected result.

Code:

//STEP0050 EXEC PGM=SORT                 
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD *                       
11,   12.50                           
11,  120.60                           
11, 1000.80                           
//SORTOUT  DD SYSOUT=*             
//SYSIN    DD *                       
  OPTION COPY                           
  OUTREC FIELDS=(1,11,SQZ=(SHIFT=LEFT))
/*
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Thu Sep 08, 2011 3:06 pm
Reply with quote

Initially you wanted to remove the leading Zeros but your solution will remove the spaces. You could have saved other's time by providing your requirements clearly.

Going forward, try to state your requirements clearly and use code tags. If you do not know how to use it check here
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 3:22 pm
Reply with quote

Now too i want to remove leading zero. Using first code i can convert zero to space, using 2nd code can remove space.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Thu Sep 08, 2011 3:48 pm
Reply with quote

Maybe also check the DFSORT manuals ("sticky" at the top of the forum) for how to remove leading zeros? You might be surprised.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Thu Sep 08, 2011 4:21 pm
Reply with quote

You can do it in a single step as below -

Code:
  OPTION COPY                                   
  INREC BUILD=(1,03,4,5,ZD,EDIT=(IIIII),09,3)   
  OUTREC BUILD=(1,11,SQZ=(SHIFT=LEFT))           
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Thu Sep 08, 2011 4:24 pm
Reply with quote

thank you Kratos.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Thu Sep 08, 2011 10:33 pm
Reply with quote

Is it OK to have a leading zero after the comma?
eg 100,01

Should it become 100,1?
Back to top
View user's profile Send private message
ramsankar rajkumar

New User


Joined: 07 Jun 2011
Posts: 18
Location: Chennai, India

PostPosted: Mon Sep 12, 2011 5:31 pm
Reply with quote

Yeah its ok.... Sorry for the late reply.
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 Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts How to display the leading zeros of a... DB2 7
No new posts Removing date values lines/records fr... SYNCSORT 2
Search our Forums:

Back to Top