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
 

 

Removing leading zero

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Removing leading zero
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    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Sep 08, 2011 11:39 am    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Sep 08, 2011 11:45 am    Post subject:
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Sep 08, 2011 12:37 pm    Post subject: Reply to: Removing leading zero
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
http://www.ibmmainframes.com/viewtopic.php?t=55100&highlight=
read and meditate on
how to ask questions the smart way
http://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    Post subject:
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Sep 08, 2011 3:48 pm    Post subject: Reply to: Removing leading zero
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am
No new posts Removing the MODETAB field in a VTAM ... rcwing All Other Mainframe Topics 1 Fri Feb 19, 2016 7:11 pm
No new posts Syncsort to remove the leading spaces V S Amarendra Reddy SYNCSORT 5 Fri Jan 08, 2016 9:47 pm
This topic is locked: you cannot edit posts or make replies. Mainframe Jobs in Leading Indian MNC aman2248 Mainframe Jobs 0 Mon Dec 21, 2015 3:25 pm


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