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

How to remove spaces in a string using SORT?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vimalravi83

New User


Joined: 28 Feb 2010
Posts: 21
Location: Bloomington, IL

PostPosted: Fri Mar 26, 2010 7:33 pm
Reply with quote

Hi,
I have a string which can contain spaces in between. How can I remove those spaces and trim the string to it's left. Once it is done, if there are any lowercase charaters, it should be converted into uppercase. Is there anyway can we do this using SORT function? Spaces can come anywhere in input string, not in a fixed position. Length of input string is 25 chars.

For eg;
Input String;
----+----1----+----
abC16 98KJ Mn


Output String;
----+----1----+----
ABC1698KJMN
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Mar 26, 2010 7:43 pm
Reply with quote

Quote:
remove those spaces and trim the string to it's left
And leave the length at the original 25 characters?

Dfsort or Syncsort?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Mar 26, 2010 7:49 pm
Reply with quote

Have you tried the "INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))" found in the topic OMIT Spaces?
Back to top
View user's profile Send private message
vimalravi83

New User


Joined: 28 Feb 2010
Posts: 21
Location: Bloomington, IL

PostPosted: Fri Mar 26, 2010 8:24 pm
Reply with quote

CICS Guy wrote:
Have you tried the "INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))" found in the topic OMIT Spaces?
.

Let me try SQUEEZE option. I think that should work for me. DFSORT or SYNCSORT ..both are fine with me.
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 Mar 26, 2010 9:17 pm
Reply with quote

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

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN DD *
   OPTION COPY
   INREC OVERLAY=(1:1,25,SQZ=(SHIFT=LEFT),
    1:1,25,TRAN=LTOU)
/*
Back to top
View user's profile Send private message
vimalravi83

New User


Joined: 28 Feb 2010
Posts: 21
Location: Bloomington, IL

PostPosted: Sun Mar 28, 2010 11:16 pm
Reply with quote

Great !!! That worked. Thanks a lot Frank and CICS guy! icon_lol.gif
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 -> JCL & VSAM

 


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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top