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 

Replacing leading spaces by zeroes thru sort

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


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Mon Mar 14, 2005 11:17 pm    Post subject: Replacing leading spaces by zeroes thru sort Reply with quote

I have to replace all leading spaces in column positon 1 to 6 with zeroes. Input file is of lenght 80 (FB). How can this be done thru sort or batch file-aid ?

I/P:
Code:

0001XX 20041210           
B2044X                   
BBX4407 20041110         
X8768978                 
BXX46464                 
B646 5665                 
BBBFF FDFS     


Where B denotes a space.

O/P should look like:
Code:

0001XX 20041210           
02044X                   
00X4407 20041110         
X8768978                 
0XX46464                 
0646 5665                 
000FF FDFS       

Thanks
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 15, 2005 8:37 am    Post subject: Reply with quote

Naveen,

Do you want to replace only the leading spaces or any space within the first 6 bytes.

For ex: look at the record

Code:

----+----1
B646 5665                 


This record has a space in the 1st byte as well as 5th byte. Now do you want to replace both 1 and 5 ? or just the first byte?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Tue Mar 15, 2005 11:06 am    Post subject: Reply with quote

And by "zero", do you mean a character zero (C'0' = X'F0') or a binary zero (X'00')?
_________________
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
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Wed Mar 16, 2005 2:53 am    Post subject: Reply with quote

Kolusu,

Only leading spaces:

(space)(space)2345 should be changed to 002345


and

(space)234(space)5

should be changed to 0234(space) 5.


Frank,

Zero is C'0'
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Mar 16, 2005 11:02 am    Post subject: Reply with quote

Naveen,

Here's a DFSORT job that will do what you asked for. It uses the new IFTHEN and OVERLAY features of DFSORT available with z/OS DFSORT V1R5 PTF UQ95214 and DFSORT R14 PTF UQ95213 (Dec, 2004). If you have DFSORT, but you don't have the Dec, 2004 PTF installed, ask your System Programmer to install it (it's free).
For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

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=(1,6,CH,EQ,C' '),OVERLAY=(C'000000')),
       IFTHEN=(WHEN=(1,5,CH,EQ,C' '),OVERLAY=(C'00000')),
       IFTHEN=(WHEN=(1,4,CH,EQ,C' '),OVERLAY=(C'0000')),
       IFTHEN=(WHEN=(1,3,CH,EQ,C' '),OVERLAY=(C'000')),
       IFTHEN=(WHEN=(1,2,CH,EQ,C' '),OVERLAY=(C'00')),
       IFTHEN=(WHEN=(1,1,CH,EQ,C' '),OVERLAY=(C'0'))
/*

_________________
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
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Wed Mar 16, 2005 11:12 pm    Post subject: Reply with quote

Thanks a lot Frank.
Back to top
View user's profile Send private message Send e-mail
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