Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Vigneshwaran S
Warnings : 1

New User

Joined: 10 Dec 2008
Posts: 60
Location: Chennai

Posted: Fri Aug 07, 2009 2:23 pm    Post subject: Moving leading zeroes as Trailing Zeros.

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

dick scherrer

Site Director

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

 Posted: Fri Aug 07, 2009 7:37 pm    Post subject: Hello, Just curious. . . What was the reason for this requirement?
Escapa

Senior Member

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

Posted: Fri Aug 07, 2009 7:44 pm    Post subject:

 Quote: Hello, Just curious. . . What was the reason for this requirement?

Exactly same from me too...?

Is it homework given???
Frank Yaeger

DFSORT Moderator

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

Posted: Fri Aug 07, 2009 9:02 pm    Post subject:

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))) /*
Vigneshwaran S
Warnings : 1

New User

Joined: 10 Dec 2008
Posts: 60
Location: Chennai

Posted: Tue Aug 11, 2009 9:51 am    Post subject:

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
Frank Yaeger

DFSORT Moderator

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

Posted: Tue Aug 11, 2009 9:19 pm    Post subject:

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
dick scherrer

Site Director

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

 Posted: Tue Aug 11, 2009 9:40 pm    Post subject: Reply to: Moving leading zeroes as Trailing Zeros. Yup, kinda why i asked the reason for the requirement earlier
Vigneshwaran S
Warnings : 1

New User

Joined: 10 Dec 2008
Posts: 60
Location: Chennai

 Posted: Wed Aug 12, 2009 9:42 am    Post subject: 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!!!!!!
Vigneshwaran S
Warnings : 1

New User

Joined: 10 Dec 2008
Posts: 60
Location: Chennai

 Posted: Wed Aug 12, 2009 10:00 am    Post subject: 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!!!!
Frank Yaeger

DFSORT Moderator

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

 Posted: Wed Aug 12, 2009 9:36 pm    Post subject: Oh, ok. That clears it up.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us