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

Replacing a character in the file using jcl


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Fri Feb 12, 2010 12:16 pm
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
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
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: 8797
Location: Welsh Wales

PostPosted: Fri Feb 12, 2010 4:56 pm
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 Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 12, 2010 11:36 pm
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:

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
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
Reply with quote

Check below post. It will help you.
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top