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 a character in the file using jcl

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Neena John

New User


Joined: 20 Nov 2008
Posts: 13
Location: bangalore

PostPosted: Fri Feb 12, 2010 12:12 pm    Post subject: Replacing a character in the file using jcl
Reply with quote

Hi,
I have an input file .All the fields are delimited with
'|'.
But in the input file,there can be instances where the character '|' appears inside the file data other than the delimiter.

Example

yyy|abcd|123|xxx

In the above example abcd|123 is the file data.I need to replace abcd|123 with abcd:123.
The above instance can appear anywhere based on the record.It depends on the data.

How do i replace the | in the data with : apart from delimiter which is also '|' using jcl ?
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 12, 2010 12:16 pm    Post subject:
Reply with quote

/RANT ON
Once more let us clarify exactly what JCL is.

it is Job Control Language.

By itself it does nothing. It is used to invoke the chosen program and to define which datasets are to be used by the DD names associated with the chosen program.

JCL does not have magical powers that solve all problems, JCL is merely the vehicule for telling the processor which program you want it to execute.
/RANT OFF

So, if you might just care to tell us which program you wish the JCL to execute, we might be able to help you
Back to top
View user's profile Send private message
Neena John

New User


Joined: 20 Nov 2008
Posts: 13
Location: bangalore

PostPosted: Fri Feb 12, 2010 12:36 pm    Post subject:
Reply with quote

I am looking for some utility which will replace '|' in the position say '10 to 15 (length 5)'

In the above example
abcd|123

It can also be a|123 in the file.This '|' can appear anywhere from position 10 to 15.

What is did first is that i separated all records from the input file where the '|' is coming in data other than the delimiter using include condition

include cond=(10,5,SS,EQ,C'|')

Now i need some utility for replacing '|' with :.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri Feb 12, 2010 4:38 pm    Post subject:
Reply with quote

Neena John,
You can use the IFTHEN condition to replace the | with :.Please proivde the informantion on the SORT product that your system is having and the record format,lRECL etc...Give some dummy input and the expected out out as well.

Thanks
Krishy
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Feb 12, 2010 4:56 pm    Post subject:
Reply with quote

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT and will be moved into the appropriate forum by one of the moderators. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and the topic will remain in the JCL forum by one of the moderators. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in your site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY
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 Feb 12, 2010 11:36 pm    Post subject:
Reply with quote

Neena,

Please be more careful when posting your requirement to get it right.

Quote:
in the position say '10 to 15 (length 5)'


10 to 15 would be length 6. 10 to 14 would be length 5.

abcd|123 would NOT fit in 10 to 14 or 10 to 15.

Assuming the positions are actually 10 to 14 and the input data looks something like this:

Code:

*********abc|d*********   
*********a|123*********   
*********ab|cd*********   


You can use a DFSORT job like the following to replace | with : in those positions:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC FINDREP=(STARTPOS=10,ENDPOS=14,IN=C'|',OUT=C':')
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
Neena John

New User


Joined: 20 Nov 2008
Posts: 13
Location: bangalore

PostPosted: Wed Feb 17, 2010 5:51 pm    Post subject:
Reply with quote

it uses SYNCSORT FOR Z/OS 1.3.1.1R .It is not supporting FINDREP also.
Any alternate utility for FINDREP?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Feb 17, 2010 6:00 pm    Post subject: Reply to: Replacing a character in the file using jcl
Reply with quote

Check below post. It will help you.
http://www.ibmmainframes.com/viewtopic.php?t=45755&highlight=altseq
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 Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


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