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

Moving leading zeroes as Trailing Zeros.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Aug 07, 2009 2:23 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Aug 07, 2009 7:37 pm
Reply with quote

Hello,

Just curious. . .

What was the reason for this requirement?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Aug 07, 2009 7:44 pm
Reply with quote

Quote:
Hello,

Just curious. . .

What was the reason for this requirement?


Exactly same from me too...?

What is business need ?
Is it homework given??? icon_rolleyes.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 07, 2009 9:02 pm
Reply with quote

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
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Tue Aug 11, 2009 9:51 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Aug 11, 2009 9:19 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Aug 11, 2009 9:40 pm
Reply with quote

Yup, kinda why i asked the reason for the requirement earlier icon_rolleyes.gif
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Wed Aug 12, 2009 9:42 am
Reply with quote

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
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Wed Aug 12, 2009 10:00 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 12, 2009 9:36 pm
Reply with quote

Oh, ok. That clears it up.
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 Moving Or setting POINTER to another ... COBOL Programming 2
No new posts How to display the leading zeros of a... DB2 7
Search our Forums:

Back to Top