View previous topic :: View next topic
|
Author |
Message |
Vigneshwaran S Warnings : 1 New User
Joined: 10 Dec 2008 Posts: 60 Location: Chennai
|
|
|
|
Hi All,
How to move the leading zeroes to trailing zeroes.
This is my sample input record,
Code: |
0001234567890123
0002222222222678
0087888888888890
0123456789333330
2345678902345698
3456543457891234
0987654345678761
|
My output,
Code: |
1234567890123000
2222222222678000
8788888888889000
1234567893333300
2345678902345698
3456543457891234
9876543456787610
|
LRECL = 80, and my input is a FB
Please suggest. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Just curious. . .
What was the reason for this requirement? |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
Hello,
Just curious. . .
What was the reason for this requirement?
|
Exactly same from me too...?
What is business need ?
Is it homework given??? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Vicky,
Here's one way to do it with DFSORT. I added a couple of extra input records for a more complete test.
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0001234567890123
0002222222222678
0087888888888890
0123456789333330
2345678902345698
3456543457891234
0987654345678761
0000000000000000
0000000000000001
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,
PARSE=(%01=(FIXLEN=15,ENDBEFR=C'1',ENDBEFR=C'2',ENDBEFR=C'3',
ENDBEFR=C'4',ENDBEFR=C'5',ENDBEFR=C'6',ENDBEFR=C'7',
ENDBEFR=C'8',ENDBEFR=C'9',ENDBEFR=C' ')),
BUILD=(1,16,ZD,M10,LENGTH=16,17:%01)),
IFTHEN=(WHEN=INIT,
BUILD=(1,31,JFY=(SHIFT=LEFT)))
/*
|
|
|
Back to top |
|
|
Vigneshwaran S Warnings : 1 New User
Joined: 10 Dec 2008 Posts: 60 Location: Chennai
|
|
|
|
Hi all,
This requirement is done by using a cobol code. We were planning to remove this cobol code from installation. So thought of doing in DFSORT way. I tried in so many ways but i dint get the output i wanted, but here is a solution to remove leading zeroes,
Code: |
OPTION COPY
INREC OVERLAY=(1:1,16,ZD,M10,LENGTH=16)
|
Thanks Frank!!!!!!!!!
Thanks all for posting |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I don't understand the purpose of your latest post. I gave you what you asked for and you showed control statements for something completely different. Why?
The solution I gave you does what you asked for - it produces the output you said you wanted from the input you showed.
Your INREC statement does NOT do what you asked for and does not produce the output you said you wanted. It just replaces leading zeros with blanks, so the output would be:
Code: |
1234567890123
2222222222678
87888888888890
123456789333330
2345678902345698
3456543457891234
987654345678761
0
1
|
Obviously, that doesn't match the output you asked for in your first post of:
Code: |
1234567890123000
2222222222678000
8788888888889000
1234567893333300
2345678902345698
3456543457891234
9876543456787610
|
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Yup, kinda why i asked the reason for the requirement earlier |
|
Back to top |
|
|
Vigneshwaran S Warnings : 1 New User
Joined: 10 Dec 2008 Posts: 60 Location: Chennai
|
|
|
|
Hi all,
Sorry for confusing everybody!!!!!
Frank the solution which you gave me was perfect for my requirement!!!!
But when i tried, I have learnt how to remove leading zeroes using M10 mask.
So i just posted it like Knowledge sharing!!!!!!
The Solution which you gave me was working perfectly!!!!!!!!
Once again Sorry for the confusion Caused!!!!!! |
|
Back to top |
|
|
Vigneshwaran S Warnings : 1 New User
Joined: 10 Dec 2008 Posts: 60 Location: Chennai
|
|
|
|
Hi all,
Frank has given me the Solution for my requirement. My output has to look like the one which i have asked in my First post.
Please ignore my post which caused all the confiusion.
Sorry frank!!!! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Oh, ok. That clears it up. |
|
Back to top |
|
|
|