View previous topic :: View next topic
|
Author |
Message |
Vasanthr
New User
Joined: 24 Jan 2011 Posts: 21 Location: India
|
|
|
|
I have a file with records such as
A!ABBBB!CCCDFDHSSSKDD
EFHJKLOPMNGJ!S!PIGOSLF
EFHJKLDSSDS!SDSDQWOS!
I want to replace the symbol ‘!’ with ‘$’ in position between 5-20. The file contains almost 10000 records.
The symbol ‘!’ may come in any position of the file. But the ‘$’ symbol should be replaced only when it occurs between 5-20
So the output must be
A!ABBBB$CCCDFDHSSSKDD
EFHJKLOPMNGJ$S$PIGOSLF
EFHJKLDSSDS$SDSDQWOS!
Is this possible thorugh SORT in JCL? |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
You can use the FINDREP parameter available in SORT. Suggest you to search the forum before posting, you could find lot of topics related to it.
Code untested -
Code: |
OUTREC FINDREP=(IN=C'!',OUT=C'$',
STARTPOS=5,ENDPOS=20) |
|
|
Back to top |
|
|
Vasanthr
New User
Joined: 24 Jan 2011 Posts: 21 Location: India
|
|
|
|
It worked . thnks |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
I have a similar kind of requirement. I tried to use FINDREP.but it is giving me following error.
Code: |
E1 8 DSS10065E PARAMETER 'FINDREP' IS UNIDENTIFIED. |
Is there any alternative of FINDREP?
My step looks like
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=ORD.PYNPRIY.TEST.CHANGED.HILITD,
// DISP=SHR
//SORTOUT DD DSN=ORD.PYNPRIY.TEST.CHANGED.HILITD1,
// DISP=(,CATLG),
// SPACE=(CYL,(900,900),RLSE),
// DCB=*.SORTIN
//SYSIN DD *
OPTION COPY
INREC FINDREP=(IN=C'New data set fields',OUT=C' ')
/* |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Quote: |
E1 8 DSS10065E PARAMETER 'FINDREP' IS UNIDENTIFIED. |
the stupid message comes from Your stupid jcl checker
so we are just wasting time on a wrong approach
a jcl checker is supposed to check jcl, not the control cards of the <utilities>
submit the job and post the errors from a real run of Your sort product
the alternative is to get rid of the stupid jcl checker |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Priyanka Pyne wrote: |
I have a similar kind of requirement. I tried to use FINDREP.but it is giving me following error.
Code: |
E1 8 DSS10065E PARAMETER 'FINDREP' IS UNIDENTIFIED. |
Is there any alternative of FINDREP?
My step looks like
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=ORD.PYNPRIY.TEST.CHANGED.HILITD,
// DISP=SHR
//SORTOUT DD DSN=ORD.PYNPRIY.TEST.CHANGED.HILITD1,
// DISP=(,CATLG),
// SPACE=(CYL,(900,900),RLSE),
// DCB=*.SORTIN
//SYSIN DD *
OPTION COPY
INREC FINDREP=(IN=C'New data set fields',OUT=C' ')
/* |
|
You are aware that ICEMAN mimics IEBGENER, and is not an alias for ICETOOL or DFSORT, yes? |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Thanks. That worked.
I have multiple strings to be replaced. I tried with
Code: |
SYSIN :
SORT FIELDS=COPY
INREC FINDREP=(IN=C'New data set fields:',OUT=C' '
*
,AND,IN=C'Old data set fields:',OUT=C' ')
*
WER268A INREC STATEMENT : SYNTAX ERROR |
I do not have the correct syntax of FINDREP usinf AND operator. Could you please help me? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
You are aware that ICEMAN mimics IEBGENER, and is not an alias for ICETOOL or DFSORT, yes? |
Ahh, Umm, IIRC, ICEMAN does invoke DFSORT (or Syncsort depending on setup & the product in use). |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you don't know the syntax, are you certain it exists? If yes, try the comma at the end of the line you want to continue, not the start of the line you are continuing. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
dick scherrer wrote: |
Hello,
Quote: |
You are aware that ICEMAN mimics IEBGENER, and is not an alias for ICETOOL or DFSORT, yes? |
Ahh, Umm, IIRC, ICEMAN does invoke DFSORT (or Syncsort depending on setup & the product in use). |
Yep, it's been pointed out to me off-line, too. I am wrong; the novelty value of which has long since worn off. |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
I used the below sort card and it helped.
Code: |
SORT FIELDS=COPY
INREC FINDREP=(IN=(C'New data set fields:',
C'Old data set fields:'),
OUT=(C' ')) |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
FINDREP has been part of Syncsort for some time now. Suggest you run a test with only one value to be replaced.
IIRC, there is no AND . . . You might also look at INOUT. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Follow on:
Using this:
Code: |
//* *********************************************
//* SAMPLE OF FINDREP
//* *********************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAA
GGGG
FFFF
AAAA
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FINDREP=(INOUT=(C'AAAA',C'XXXX',
C'GGGG',C'YYYY')) |
Gives this as output:
Code: |
XXXX
YYYY
FFFF
XXXX |
If there is a high volume of data to be searched, you can also use ,STARTPOS=nn,ENDPOS=nn to limit the number of positions searched. |
|
Back to top |
|
|
Priyanka Pyne
New User
Joined: 09 Feb 2008 Posts: 95 Location: India
|
|
|
|
Thanks a lot Dick. This really helped me.
I want to replace some values of a VB file with spaces. Start and end position(positin of the spaces) have been provided to me.
I tried with the below sort card
Code: |
SORT FIELDS=(1,9,CH,A)
outrec fields=(1:1,20,21:5X,26:26,75) |
But this is reducing my file length to 100. How to do this for VB file keeping all the values (other than the intended one) as it is. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
1. With VB you need to take care about the RDW (Record Descriptor Word), which is of 4-bytes. So, your data in file starts from position 5. Take care about this, had the input been FB - postiion 26 will be 26 but for VB DSN it is 30.
2. For your SORT, OUTREC decides the LRECL of the SORTOUT. You've instructed SORT to have a LRECL of 20+5+75=100 and so the LRECL of SORTOUT is 100.
Quote: |
How to do this for VB file keeping all the values (other than the intended one) as it is. |
What exactly you are looking for here? What do you mean by "intended one", the SORT-card you've used applies to entire file, so all the records are "intended one". |
|
Back to top |
|
|
|