Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to suppress the unwanted spaces?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
manojkumar.sesuraj

New User


Joined: 15 Apr 2009
Posts: 43
Location: Mumbai

PostPosted: Tue Sep 15, 2009 11:04 am    Post subject: How to suppress the unwanted spaces?
Reply with quote

Hi,
I have 500 or more number of records. The record layout is,

manoj
bcdefg
ddg
dfddddddf
yyyyyy

This field length is 10 bytes. I want to select this data and add 'NAME-' label infront and '-END' at the end. My report should be like,

NAME-manoj-END
NAME-bcdefg-END
NAME-ddg-END
NAME-dfddddddf-END
NAME-yyyyyy-END

Is there any special command to suppress the spaces in DFSORT? It is not only DFSORT, that is fine for REXX or SAS...
Back to top
View user's profile Send private message

manojkumar.sesuraj

New User


Joined: 15 Apr 2009
Posts: 43
Location: Mumbai

PostPosted: Tue Sep 15, 2009 11:05 am    Post subject:
Reply with quote

I forgot to change the subject, The actual subject is "How to suppress the SPACES?".
Title edited per request.
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Sep 15, 2009 11:17 am    Post subject:
Reply with quote

Assuming your input name field is 10 bytes long
Below sortcard will give you desired output.
Code:

//SYSIN    DD    *                     
  OPTION COPY                         
  INREC FIELDS=(C'NAME-',1,10,C'-END')
  OUTFIL BUILD=(1,19,SQZ=(SHIFT=LEFT))
/*                                     

Or using ifthen
Code:

//S1 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
manoj                                                   
bcdefg                                                   
ddg                                                     
dfddddddf                                               
yyyyyy                                                   
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD    *                                       
  OPTION COPY                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(C'NAME-',1,10,C'-END')),
        IFTHEN=(WHEN=NONE,BUILD=(1,19,SQZ=(SHIFT=LEFT)))
/*                                                       
Back to top
View user's profile Send private message
manojkumar.sesuraj

New User


Joined: 15 Apr 2009
Posts: 43
Location: Mumbai

PostPosted: Tue Sep 15, 2009 1:03 pm    Post subject:
Reply with quote

Thanks Sam... It is working fine... icon_smile.gif

But, It is suppressing all spaces. For example,

Input:
manoj
aaaaaaaa
bbb
ccccccc

Output:

Please consider the BOLD letters are constants. It won't get change. We are just passing the data from input file.

My name ('manoj') and dept ('11111')
My name ('aaaaaaa') and dept ('11111')
My name ('bbb') and dept ('11111')
My name ('ccccccc') and dept ('11111')

How can i get this format?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Tue Sep 15, 2009 1:14 pm    Post subject: Reply to: How to find a remove the unwanted space?
Reply with quote

Quote:
But, It is suppressing all spaces.


You got what You asked for, a solution for the example You posted
why complain ??

if You had posted a different example You would have received a different solution
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Sep 15, 2009 5:30 pm    Post subject:
Reply with quote

You can use below for it..
Code:

//S1 EXEC PGM=ICEMAN                                               
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
manoj                                                               
bcdefg                                                             
ddg                                                                 
dfddddddf                                                           
dfddddddff                                                         
yyyyyy                                                             
/*                                                                 
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD    *                                                 
  OPTION COPY                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(C'"My name (''"',1,10,             
                        C'"'') and dept (''11111'')"')),           
        IFTHEN=(WHEN=INIT,BUILD=(1,46,SQZ=(SHIFT=LEFT,PAIR=QUOTE))),
        IFTHEN=(WHEN=NONE,FINDREP=(IN=C'"',OUT=C''))               

Output will be
Code:

My name ('manoj') and dept ('11111')     
My name ('bcdefg') and dept ('11111')   
My name ('ddg') and dept ('11111')       
My name ('dfddddddf') and dept ('11111')
My name ('dfddddddff') and dept ('11111')
My name ('yyyyyy') and dept ('11111')   
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Sep 15, 2009 9:18 pm    Post subject:
Reply with quote

Manoj,

Here's an easier way to do what you want with DFSORT:

Code:

 OPTION COPY                                             
 INREC BUILD=(1,10,JFY=(SHIFT=LEFT,LENGTH=80,           
   LEAD=C'My name (''',                                 
   TRAIL=C''') and dept (''11111'')'))                   
Back to top
View user's profile Send private message
manojkumar.sesuraj

New User


Joined: 15 Apr 2009
Posts: 43
Location: Mumbai

PostPosted: Wed Sep 16, 2009 6:55 pm    Post subject:
Reply with quote

Thanks a lot Frank & Sam... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am
No new posts How to suppress retun code of partil ... mkk157 DB2 9 Fri May 27, 2016 6:59 am
No new posts Remove intermediate spaces Pallavi Vishwanath SYNCSORT 1 Fri Jan 15, 2016 2:45 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us