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
 

 

replacing characters using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: replacing characters using Syncsort
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    Post subject:
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    Post subject: Reply to: replacing characters using sort
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Sep 14, 2011 10:30 pm    Post subject: Reply to: replacing characters using sort
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: 1738
Location: Bloomington, IL

PostPosted: Wed Sep 14, 2011 10:39 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Sep 14, 2011 10:49 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Sep 14, 2011 10:56 pm    Post subject: Reply to: replacing characters using sort
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: 1738
Location: Bloomington, IL

PostPosted: Wed Sep 14, 2011 11:09 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Sep 14, 2011 11:17 pm    Post subject:
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

Site Director


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

PostPosted: Wed Sep 14, 2011 11:42 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Fri Sep 16, 2011 1:54 pm    Post subject:
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    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 syncsort: copy lines after the keyword shreya19 SYNCSORT 6 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts ICETOOL/SYNCSORT - SYSPRINT output nartcr DFSORT/ICETOOL 17 Wed Oct 05, 2016 10:46 pm
No new posts Syncsort version supporting FINDREP c... juares castro SYNCSORT 9 Tue Aug 09, 2016 6:54 pm


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