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

Removing unwanted characters in a field using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Fri Feb 29, 2008 7:26 pm
Reply with quote

Hi,

Could anyone please help me with the following requirement.

I've a input file with a field as 'Name' of 45 characters length.. For Example following is my input.

LOPEZ, MODESTO P.
SEDGWICK, TOM M
KENNEDY, KATHERINE M.
EIN, MARK D.
MCCOY, CHARLES H.
GRAY, RICHARD F.
THE ERICA LEIGH HOPKINS TRUST


I want to remove the SPACES and the Special characters inbetween these names. Here the special characters are ,(dot) and .(comma)

The output i need is like without spaces, (.dot) and ,(comma) in the name.

LOPEZMODESTOP
SEDGWICKTOMM
KENNEDYKATHERINEM
EINMARKD
MCCOYCHARLESH
GRAYRICHARDF
THEERICALEIGHHOPKINSTRUST

Can this be done using sort??


Thanks,
Dharani
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 Feb 29, 2008 10:07 pm
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/45)
//SORTOUT DD DSN=...  output file (FB/45)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(1,45,SQZ=(SHIFT=LEFT,PREBLANK=C'.,'))
/*
Back to top
View user's profile Send private message
nagarajan.dharani

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Mon Mar 03, 2008 4:14 pm
Reply with quote

Frank, Thanks a lot for the help that comes from you as always
icon_biggrin.gif

Thanks,
Dharani
Back to top
View user's profile Send private message
r.ravikumar

New User


Joined: 05 Jan 2007
Posts: 18
Location: chennai

PostPosted: Mon Mar 03, 2008 5:21 pm
Reply with quote

HI Frank,

Can you explain the INREC BUILD statement in the above JCL.
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: Mon Mar 03, 2008 10:28 pm
Reply with quote

Quote:
Can you explain the INREC BUILD statement in the above JCL.


Code:

  INREC BUILD=(1,45,SQZ=(SHIFT=LEFT,PREBLANK=C'.,'))


It uses DFSORT's SQZ function to squeeze out blanks, dots and commas.

1,45 specifies the field to be squeezed (1-45).

SQZ removes blanks.

PREBLANK=C'.,' indicates that all dot and comma characters are to be treated as blanks.

SHIFT=LEFT indicates that the field is to be squeezed to the left. Blank characters and PREBLANK characters are removed and the remaining bytes are moved to the left.

For complete information on DFSORT's SQZ function, see:

Use [URL] BBCode for External Links
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top