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
 

 

Replace the characters with DFSORT?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
davidllw

New User


Joined: 12 May 2005
Posts: 4
Location: China

PostPosted: Thu May 26, 2005 8:47 pm    Post subject: Replace the characters with DFSORT?
Reply with quote

Can we use DFSORT to search the dataset with a key word, and then replace it by the other word we specify?

i.e.

Input File A:
AAABBBCCDDDEEE
CCCAAABB
CEDCCC

run after the DFSORT coding

Ouput File B:
AAABBB11DDDEEE
111AAABB
1ED111

All 'CCC' change to '111'.

Thanks...
David
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 May 27, 2005 6:19 am    Post subject:
Reply with quote

You say
Quote:
All 'CCC' change to '111'.
but in your example of input and output you show EVERY 'C' replaced by '1'.

This DFSORT job will give you the output you show by replacing every 'C' with '1'. I've assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
* Set up ALTSEQ table for TRAN=ALTSEQ.
* X'C3' = 'C'.  X'F1' = '1'.
  ALTSEQ CODE=(C3F1)
* Use TRAN=ALTSEQ to change 'C' (X'C3') to '1' (X'F1').
  OUTREC FIELDS=(1,80,TRAN=ALTSEQ)
/*
Back to top
View user's profile Send private message
davidllw

New User


Joined: 12 May 2005
Posts: 4
Location: China

PostPosted: Wed Jun 01, 2005 5:41 pm    Post subject: Re: Replace the characters as the Office WORD can do by DFSO
Reply with quote

Many Thanks...I'll try it tomorrow...:)
Back to top
View user's profile Send private message
davidllw

New User


Joined: 12 May 2005
Posts: 4
Location: China

PostPosted: Wed Jun 01, 2005 5:46 pm    Post subject:
Reply with quote

Dear Frank,

I would like to ask one more stupid question. I never use the program highlight below. Is it still the DFSORT?

S1 EXEC PGM=ICEMAN
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: Wed Jun 01, 2005 9:31 pm    Post subject:
Reply with quote

PGM=ICEMAN and PGM=SORT are ways to invoke the primary sort product at your site. If you have DFSORT as the primary sort product at your site, PGM=ICEMAN and PGM=SORT will invoke DFSORT.
Back to top
View user's profile Send private message
davidllw

New User


Joined: 12 May 2005
Posts: 4
Location: China

PostPosted: Thu Jun 02, 2005 7:52 pm    Post subject: Re: Replace the characters as the Office WORD can do by DFSO
Reply with quote

Frank, Thanks for your reply. I've tried your method. It do work. If I want to make a little change as follows. Can the DFSORT also solve it?

Change all 'C' to 'cat' and all 'B' to 'boys'. It means the length may extend.

i.e.
Input:
CAAAC
AACBBC

Output:
catAAAcat
AAcatboysboyscat

Regards,
David
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: Thu Jun 02, 2005 8:41 pm    Post subject:
Reply with quote

DFSORT doesn't have any built-in functions for doing that kind of find and replace.

<It does as of July, 2008 - see my post later on>
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 87

PostPosted: Tue Jun 27, 2006 4:55 pm    Post subject: Re: Replace the characters as the Office WORD can do by DFSO
Reply with quote

hello,

Actually I am looking for a replacement for '$' with space (1 Byte only). How do I do that ???

Actually I was referring to the ASCII table for hex equivalent but it was of not help ...

Any kind of help would be really appreciated.

- Mohit
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Tue Jun 27, 2006 5:33 pm    Post subject: Re: Replace the characters as the Office WORD can do by DFSO
Reply with quote

Hi,
Try this.

Code:

//S1    EXEC  PGM=ICEMAN                               
//SYSOUT    DD  SYSOUT=*                               
//SORTIN    DD *                                       
AAA$BBCCDDDEEE                                         
CCC$AABB                                               
CED$CC                                                 
//SORTOUT   DD SYSOUT=*                               
//SYSIN     DD  *                                     
  OPTION COPY                                         
* SET UP ALTSEQ TABLE FOR TRAN=ALTSEQ.                 
* X'5B' = '$'.  X'40' = blank.                           
  ALTSEQ CODE=(5B40)                                   
* USE TRAN=ALTSEQ TO CHANGE '$' (X'5B') TO ' ' (X'40').
  OUTREC FIELDS=(1,80,TRAN=ALTSEQ)                     


your o/p will look like

Code:

AAA BBCCDDDEEE 
CCC AABB       
CED CC         


Thank you
Krishy
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 87

PostPosted: Tue Jun 27, 2006 7:48 pm    Post subject: Re: Replace the characters with DFSORT?
Reply with quote

Hi Krishy,

It is working now.

Thanks a ton but tell me one thing .... what table are you are referring to figure out '$' as 5B ...

As I mentioned in my previous message that I referred the ASCII table but couldn't find what you got and what you got is working fine ... so plz do tell me what table you are referring to ???

Thanks once again.

Mohit
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: Tue Jun 27, 2006 8:43 pm    Post subject:
Reply with quote

Quote:
As I mentioned in my previous message that I referred the ASCII table but couldn't find what you got and what you got is working fine ... so plz do tell me what table you are referring to ???


The ASCII and EBCDIC character sets are different. You need to look at the EBCDIC values for ALTSEQ. Here's a link to a table that shows the ASCII characters on the left and the EBCDIC characters on the right:

http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IBMp690/IBM/usr/share/man/info/en_US/xlf/html/lr425.HTM

If you go down the page on the right side, you'll see that blank is X'40' in EBCDIC and '$' is X'5B' in EBCDIC. So the ALTSEQ statement you need to change every '$' to a blank is:

Code:

      ALTSEQ CODE=(5B40)
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 182
Location: hyderabad

PostPosted: Tue Jun 27, 2006 11:38 pm    Post subject: Re: Replace the characters with DFSORT?
Reply with quote

Hi,
The simple thing that I do generally is,open any member in EDIT mode and type the letter which you want to convert.

Then use the HEX on function and see it's hex value and use that one in
ALTSEQ CODE.

When you type $0 and use the HEX on ,you can see the values like this.
54
b0

Thank you
Krishy
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: Wed Jun 28, 2006 1:13 am    Post subject:
Reply with quote

Krishy,

Good suggestion. I often do that too.
Back to top
View user's profile Send private message
vinoth_316

New User


Joined: 20 Jun 2006
Posts: 4

PostPosted: Wed Jun 28, 2006 6:54 pm    Post subject:
Reply with quote

Hi all

I am new to Mainframes, I have a doubt similar to the question in this thread. I need to find out the low and high values in a file and replace them by space. Any help???
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 87

PostPosted: Wed Jun 28, 2006 8:25 pm    Post subject: Re: Replace the characters with DFSORT?
Reply with quote

What if I want to replace two chars at a time

For example if I want to replace '$' with '0' (zero) and ' '(space) with '0'.

so the input file

abc$a888 9999

would look like:

abc0a88809999

How can we do this in just one step.

Rgds,
Mohit
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 87

PostPosted: Wed Jun 28, 2006 8:35 pm    Post subject: Re: Replace the characters with DFSORT?
Reply with quote

well I am just replying to my post ...

two replacementw would be done like

ALTSEQ CODE=(5BF0,40F0)

also we can have more separated by commas

Thanks,
Mohit
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: Wed Jun 28, 2006 8:59 pm    Post subject:
Reply with quote

vinoth_316 wrote
Quote:
I have a doubt similar to the question in this thread. I need to find out the low and high values in a file and replace them by space.


If by low values you mean X'00', and by high values you mean X'FF', you can use the DFSORT technique shown previously with:

Code:

   ALTSEQ CODE=(0040,FF40)


If you mean something else by low and high values, you need to be more specific about what exactly you mean.
Back to top
View user's profile Send private message
vinoth_316

New User


Joined: 20 Jun 2006
Posts: 4

PostPosted: Fri Jun 30, 2006 10:30 am    Post subject:
Reply with quote

Hi Frank,

By low values and high values, I do not mean 00 and FF. One of my friends said to find out low values, the command " F P'.' " can be used and this command shows low values in the form of dots, but the hex value of these dots vary(to name some 12, 2D, 05 etc).


Similarly is there any command to find out the high values and also how to replace such characters using space.

Thanks

Vinoth
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Fri Jun 30, 2006 3:10 pm    Post subject: Re: Replace the characters with DFSORT?
Reply with quote

I think what you are describing is the picture-string FIND command for 'invalid' characters
and that what you want to do is change those characters with spaces.

In ISPF edit you would do it such;

C p'.' ' ' all

are you looking for a batch method to do this?
Back to top
View user's profile Send private message
vinoth_316

New User


Joined: 20 Jun 2006
Posts: 4

PostPosted: Mon Jul 03, 2006 1:21 pm    Post subject:
Reply with quote

Hi all,

Yes, I want to replace the invalid characters with blank space, any batch method to do that would be really helpful.

Thanks,
Vinoth
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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