MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remove Leading Spaces

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Thu Aug 10, 2006 4:32 am    Post subject: Reply with quote

Hi all,

I was looking for a solution with SORT with which i can remove the leading spaces from a report(spaces are variable). Is it possible to do it using Sort?

Thanks
bade_miya
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Aug 10, 2006 6:02 am    Post subject: Reply with quote

bade_miya,

Assume that your dataset contains blanks in first two bytes that is column1 and column2 ,what i am doing is i am Building an output record so as to omit the first two bytes.Hope this helps.

Try this code:
Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
  AMITABH                                                               
  KRITHIK                                                               
  SUNNY                                                                 
  AMIR                                                                 
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTREC FIELDS=(1:3,78)                                               
/*                                                                     
//       

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Thu Aug 10, 2006 6:21 am    Post subject: Reply with quote

shekar123,

Quote:

(spaces are variable).



The solution you have provided, works fine if the blanks present are in some pre-determined positions (in this case the first 2 bytes).

bade_miya,

This can be accomplished using JFY option in DFSORT.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
          OVERLAY=(necessary parameters,JFY=(SHIFT=LEFT)))
/*


Note: This will work only if Recent DFSORT release is being installed.

Hope this helps.

Thanks,
Vivek.G
Back to top
View user's profile Send private message
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Thu Aug 10, 2006 6:46 am    Post subject: Reply with quote

Hi guys,
Thanks for your replies.
Shekhar, The spaces is variable. I dont know how many spaces there will be in the input file beforehand.

Vivek, Can you please let me know what you ment by "necessary parameters" in OVERLAY parameter.

Thanks
bade_miya
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Aug 10, 2006 7:02 am    Post subject: Reply with quote

Vivek1983,

Thanks for the code and the information.

Can you post your sample Input Data and Output Data so that we can have an understanding how exactly the code works ? Morever i am getting Sytanx error while running your code probably i do not have the latest version of DFSORT and please let us know what version u are using / feature is supported ?
Code:
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5
            OPTION COPY                                                         
            INREC IFTHEN=(WHEN=INIT,                                           
                  OVERLAY=(1:80,JFY=(SHIFT=LEFT)))                             
                                $                                               
ICE111A E REFORMATTING FIELD ERROR                                             
ICE751I 0 C5-K05352 C6-Q95214 C7-K90000 C8-K05352 E7-K90000                     
ICE052I 3 END OF DFSORT                                                         

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Aug 10, 2006 10:57 am    Post subject: Reply with quote

You need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) to use DFSORT's new JFY function.

shekar123 - ask your System Programmer to install PTF UK90007 so you can use the new April, 2006 DFSORT functions described at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/peug/index.html

The correct syntax for the DFSORT control statements in this case would be:

Code:

  OPTION COPY
  INREC BUILD=(1,n,JFY=(SHIFT=LEFT))


where n is equal to the LRECL of the input file.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Thu Aug 17, 2006 9:36 am    Post subject: Reply with quote

Hi Frank,

Thanks for the answers.

Thanks
bade_miya
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group