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

replacing characters using Syncsort


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

New User


Joined: 24 Jan 2011
Posts: 21
Location: India

PostPosted: Wed Aug 10, 2011 12:00 pm
Reply with quote

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
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Wed Aug 10, 2011 12:17 pm
Reply with quote

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
View user's profile Send private message
Vasanthr

New User


Joined: 24 Jan 2011
Posts: 21
Location: India

PostPosted: Wed Aug 10, 2011 12:27 pm
Reply with quote

It worked . thnks
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Wed Sep 14, 2011 10:22 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Sep 14, 2011 10:30 pm
Reply with quote

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 icon_evil.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Sep 14, 2011 10:39 pm
Reply with quote

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
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Wed Sep 14, 2011 10:48 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 14, 2011 10:49 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Sep 14, 2011 10:56 pm
Reply with quote

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
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Sep 14, 2011 11:09 pm
Reply with quote

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
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Wed Sep 14, 2011 11:10 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 14, 2011 11:17 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 14, 2011 11:42 pm
Reply with quote

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
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Fri Sep 16, 2011 2:59 am
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Sep 16, 2011 1:54 pm
Reply with quote

    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
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Count the number of characters in a f... CA Products 1
Search our Forums:

Back to Top