View previous topic :: View next topic
|
Author |
Message |
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
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 |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
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 |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
LRECL: 8 RECORD FORMAT: FB
FOR BOTH INPUT AND OUTPUT FILES |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
how does 00120,60 become 120,150 and 01000,80 become 1000,50 ?
Gerry |
|
Back to top |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
SORRY .Expected output file is
12,50
120,60
1000,80 |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
Thanks Gerry.
It works fine. |
|
Back to top |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
Back to top |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
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 |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
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 |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
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 |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
thank you Kratos. |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
Is it OK to have a leading zero after the comma?
eg 100,01
Should it become 100,1? |
|
Back to top |
|
|
ramsankar rajkumar
New User
Joined: 07 Jun 2011 Posts: 18 Location: Chennai, India
|
|
|
|
Yeah its ok.... Sorry for the late reply. |
|
Back to top |
|
|
|