View previous topic :: View next topic
|
Author |
Message |
KMV
New User
Joined: 15 May 2007 Posts: 22 Location: Coimbatore
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
|
VinayCM
New User
Joined: 06 Nov 2007 Posts: 36 Location: Bengaluru
|
|
|
|
If seperators are in fixed positions like in the eg. given by you then the above JCL works fine... |
|
Back to top |
|
|
KMV
New User
Joined: 15 May 2007 Posts: 22 Location: Coimbatore
|
|
|
|
Hi All,
Thanks for ur replies
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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. |
|
Back to top |
|
|
KMV
New User
Joined: 15 May 2007 Posts: 22 Location: Coimbatore
|
|
|
|
Thank you Kris |
|
Back to top |
|
|
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
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 |
|
|
KMV
New User
Joined: 15 May 2007 Posts: 22 Location: Coimbatore
|
|
|
|
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 |
|
|
KMV
New User
Joined: 15 May 2007 Posts: 22 Location: Coimbatore
|
|
|
|
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.
Thanx, |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Thanks for that ofer71 |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
tuhin
New User
Joined: 01 Jun 2007 Posts: 6 Location: Dallas,Texas
|
|
|
|
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 |
|
|
rahulpandey
New User
Joined: 07 Aug 2007 Posts: 3 Location: India
|
|
|
|
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 |
|
|
|