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
 

 

To remove the separators from a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: To remove the separators from a file
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    Post subject:
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: 1288
Location: Chennai, India

PostPosted: Thu Nov 15, 2007 5:15 pm    Post subject: Reply to: To remove the separators from a file
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: To remove the separators from a file
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    Post subject: To remove the separators from a file
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    Post subject:
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: 2360
Location: Israel

PostPosted: Tue Nov 20, 2007 3:48 pm    Post subject:
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    Post subject:
Reply with quote

Thanks for that ofer71
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: Fri Aug 22, 2008 2:41 am    Post subject:
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:

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

Moderator


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

PostPosted: Fri Aug 22, 2008 11:41 am    Post subject:
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    Post subject:
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    Post subject: Reply to: To remove the separators from a file
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    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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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