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
 

 

Truncate a particular character in a string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
esanraja

New User


Joined: 08 Aug 2007
Posts: 4
Location: chennai

PostPosted: Tue Jun 17, 2008 3:16 pm    Post subject: Truncate a particular character in a string
Reply with quote

I have file with the records like

22-1234-7980
11-789-4567
11-123-2345-23
1-234567-1234567

and the output should be like

117894567
2212347890
11123234523
12345671234567

Esan Raja
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Jun 17, 2008 3:37 pm    Post subject: Reply to: To truncate a Patricular character in a string usi
Reply with quote

esanraja,

Quote:
it has also to be sorted

by removing hyphens


Is the latest version of DFSORT installed in your shop? If yes you can use the PREBLANK option of DFSORT.

Search for PREBLANK in the DFSORT forum.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Tue Jun 17, 2008 3:43 pm    Post subject:
Reply with quote

Hi !

Also habe a look at INREC/OUTREC option of Sort.
DFSORT or SYNCSORT, whatever installed.
Back to top
View user's profile Send private message
esanraja

New User


Joined: 08 Aug 2007
Posts: 4
Location: chennai

PostPosted: Tue Jun 17, 2008 7:43 pm    Post subject: Hi,
Reply with quote

Hi Umeysan

SYNCSORT is Installed. but as u said INREC wont help.

Since the Hypen are at varing places.

If the Hypens are used in the same Column we can use INREC of SORT utility.

Do u know any other option using INREC to find out the Patricular character in the string and truncate them.
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 Aug 12, 2008 4:56 am    Post subject:
Reply with quote

If you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use DFSORT's new FINDREP function to do this kind of thing quite easily like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
22-1234-7980
11-789-4567
11-123-2345-23
1-234567-1234567
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  INREC FINDREP=(IN=C'-',OUT=C'')
  SORT FIELDS=(1,20,UFF,A)
/*


For complete details on the new FINDREP function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Tue Aug 12, 2008 11:04 am    Post subject:
Reply with quote

Hi esanraja
If you don't have the options sugested by Frank available @ your shop. Please try following fileaid step on your input file and then sort using your sort product.

Code:
 
//S15FAID  EXEC PGM=FILEAID             
//DD01     DD DSN=input,DISP=SHR 
//DD01O    DD DSN=TEMP output (input for sort in next step),         
//            DISP=(NEW,CATLG,DELETE)
//* 1, 15 searches hypen if you want to search hypen in whole record
//*you can use 1,0 in below control card   
//SYSIN    DD *                         
$$DD01  COPY EA=(1,15,C'-',C'')   
//SYSLIST  DD SYSOUT=*                 
//SYSTOTAL DD SYSOUT=*                 
//SYSPRINT DD SYSOUT=*                 
//USERNAME DD DUMMY                     



Hope this helps you.

Thnaks,
Santosh.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Aug 12, 2008 11:17 am    Post subject: Reply to: Truncate a particular character in a string
Reply with quote

Santhosh,

Quote:
$$DD01 COPY EA=(1,15,C'-',C'')


Are you sorting the output after removing the hypens?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Tue Aug 12, 2008 11:45 am    Post subject:
Reply with quote

Aaru,

you need to shift your screen to the right.

Quote:

If you don't have the options sugested by Frank available @ your shop. Please try following fileaid step on your input file and then sort using your sort product.


bold set by me.
Back to top
View user's profile Send private message
Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Tue Aug 12, 2008 11:59 am    Post subject:
Reply with quote

Aaru
It's two step solution.
1. Remove '-'
2. Sort

As it was simple sort i haven't added sample code to my previous post.
icon_smile.gif
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 Aug 12, 2008 10:02 pm    Post subject:
Reply with quote

Quote:
If you don't have the options sugested by Frank available @ your shop.


If you have DFSORT and you don't have PTF UK90013, ask your System Programmer to install it (it's free).

Note that DFSORT's FINDREP only takes one pass over the data whereas Santosh's FileAid/Sort solution takes two passes over the data.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am


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