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

Truncate a particular character in a string


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1287
Location: Chennai, India

PostPosted: Tue Jun 17, 2008 3:37 pm
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: 771
Location: Germany

PostPosted: Tue Jun 17, 2008 3:43 pm
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
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 Developer


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

PostPosted: Tue Aug 12, 2008 4:56 am
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:

Use [URL] BBCode for External Links
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
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: 1287
Location: Chennai, India

PostPosted: Tue Aug 12, 2008 11:17 am
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: 6966
Location: porcelain throne

PostPosted: Tue Aug 12, 2008 11:45 am
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
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 Developer


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

PostPosted: Tue Aug 12, 2008 10:02 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
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
No new posts file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top