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

To remove the separators from a file


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

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Thu Nov 15, 2007 4:57 pm
Reply with quote

Hi,
I have to remove the separators from a file.

For eg:
john ~0345~0056
maria~5678~3218

In the above eg i want to remove '~'

output should be:

john 03450056
maria56783218





Thanx,
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Nov 15, 2007 5:10 pm
Reply with quote

Code:
//********************************
//STEP1    EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                   
----+----1----+----2----+----3----
JOHN ~0345~0056                   
MARIA~5678~3218                   
/*                               
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                   
  SORT FIELDS=COPY               
  OUTREC BUILD=(1:1,5,           
                6:7,4,           
               11:12,4)           
/*                               
Back to top
View user's profile Send private message
Aaru

Senior Member


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

PostPosted: Thu Nov 15, 2007 5:15 pm
Reply with quote

KMV,

Quote:
I have to remove the separators from a file.


Is the seperator(~) present only in position 6 and 11 as showed in the input?
Back to top
View user's profile Send private message
VinayCM

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Thu Nov 15, 2007 5:22 pm
Reply with quote

If seperators are in fixed positions like in the eg. given by you then the above JCL works fine...
Back to top
View user's profile Send private message
KMV

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Thu Nov 15, 2007 6:00 pm
Reply with quote

Hi All,
Thanks for ur replies icon_biggrin.gif

Seperators are in fixed positions only.
but there are nearly 30 fields.

I m eager to know whether is there any other way to do the same?

Thanx,
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Nov 15, 2007 6:13 pm
Reply with quote

Quote:
I m eager to know whether is there any other way to do the same?
No other way, go a head and code for all 30 fields. icon_biggrin.gif
Back to top
View user's profile Send private message
KMV

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Thu Nov 15, 2007 6:15 pm
Reply with quote

Thank you Kris icon_biggrin.gif
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Tue Nov 20, 2007 12:56 pm
Reply with quote

Assuming that your LRECL is 80 can u try the following sort card....

Code:
OPTION COPY
ALTSEQ CODE=(A140)
OUTREC FIELDS=(1,80,TRAN=ALTSEQ)
Back to top
View user's profile Send private message
KMV

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Tue Nov 20, 2007 1:41 pm
Reply with quote

Hi SKKP,
I used this sort card, but the fields are not proper.
It would be better if you explain this sort card.


Thanx,
Back to top
View user's profile Send private message
KMV

New User


Joined: 15 May 2007
Posts: 22
Location: Coimbatore

PostPosted: Tue Nov 20, 2007 1:46 pm
Reply with quote

SKKP,
Quote:

Code:

     OUTREC FIELDS=(1,80,TRAN=ALTSEQ)



Here TRAN=ALTSEQ replaces the separator '~' with space.
But for my requirement, '~' should be eliminated, not replaced. icon_confused.gif


Thanx,
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Nov 20, 2007 3:48 pm
Reply with quote

If you like REXX, you can try something like this:
Code:
/* REXX */                       
                                 
A = 'AB~CD~EF~GH'               
B = SPACE(TRANSLATE(A,' ','~'),0)
                                 
SAY A                           
SAY B                           
                                 
EXIT                             
                                 


O.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Nov 20, 2007 4:24 pm
Reply with quote

Thanks for that ofer71
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 Aug 22, 2008 2:41 am
Reply with quote

You can now use DFSORT's new FINDREP function available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) to remove the ~ characters quite easily like this:

Code:

//S1   EXEC  PGM=ICEMAN                                         
//SYSOUT    DD  SYSOUT=*                                         
//SORTIN DD DSN=...  input file                                                   
//SORTOUT DD DSN=...  output file 
//SYSIN    DD    *                                               
  OPTION COPY                                                   
  INREC FINDREP=(IN=C'~',OUT=C'')                                 
/*


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
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Aug 22, 2008 11:41 am
Reply with quote

Quote:
I m eager to know whether is there any other way to do the same?

KMV,

If you have fileaid, you can try this option too.
Code:
//STEP01   EXEC PGM=FILEAID             
//SYSPRINT DD SYSOUT=*                 
//DD01     DD *                         
john ~0345~0056                         
maria~5678~3218                         
//DD01O    DD SYSOUT=*                 
//SYSIN    DD *                         
$$DD01 COPY OUT=0,EDITALL=(1,0,C'~',C'')


DD01O
Code:
john 03450056
maria56783218


Thanks,
Arun
Back to top
View user's profile Send private message
tuhin

New User


Joined: 01 Jun 2007
Posts: 6
Location: Dallas,Texas

PostPosted: Fri Aug 22, 2008 4:43 pm
Reply with quote

Use the following fileaid job. It will replace all "~" character by spaces.No need to give all positions of the character.
//STEP01 EXEC PGM=FILEAID
//DD01 DD *
JOHN ~0345~0056
MARIA~5678~3218
//DD01O DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
$$DD01 COPY EDITALL=(1,80,C'~',C' ')
>>>>>>>>>>>>>>>>>>>
i assume input file is 80 byte.
Please let me know in case of any concern

Regards,
Tuhin
Back to top
View user's profile Send private message
rahulpandey

New User


Joined: 07 Aug 2007
Posts: 3
Location: India

PostPosted: Fri Aug 22, 2008 7:32 pm
Reply with quote

Hi,
You can use C ALL '~' '' from command line.
If you want this in batch, You can use the same command using REXX.


Thanks
Rahul
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 How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top