MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can we replace a set of characters in a file using sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
krkcs
Beginner


Joined: 30 May 2004
Posts: 27
Topics: 5

PostPosted: Tue Apr 03, 2007 10:30 am    Post subject: Can we replace a set of characters in a file using sort Reply with quote

hi,

I have a file of length 200 bytes; we have packed data at 90-100 cols.

Is there anyway to space-out the characters (from 1-89, 101-200, leave the packed data which is at 90-100 bytes) which are not in set of pre-defined chars (like !"%$''" etc..,) ?

I tried with a program, cost is really high !! can anyone suggest an alternative ??
_________________
-kr
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Apr 03, 2007 10:39 am    Post subject: Reply with quote

kr,

Try these sort control cards

Code:

//SYSIN  DD *
  SORT FIELDS=COPY
  OUTREC FIELDS=(089X,
                 090,11,
                 200:X)
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
krkcs
Beginner


Joined: 30 May 2004
Posts: 27
Topics: 5

PostPosted: Tue Apr 03, 2007 10:44 am    Post subject: Reply with quote

Kolusu,

I meant a little different., "I'll be replacing only if not in set of pre-defined chars (like !"%$''" etc..,), if its in there, write the original character.." more or less like ALTSEQ..but negation..
_________________
-kr
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Apr 03, 2007 10:50 am    Post subject: Reply with quote

krkcs,

ALTSEQ can do what you asked for. Please provide all the pre-defined characters with a sample input and output data

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
krkcs
Beginner


Joined: 30 May 2004
Posts: 27
Topics: 5

PostPosted: Tue Apr 03, 2007 10:59 am    Post subject: Reply with quote

.<(+|&!$*);
_________________
-kr
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Apr 03, 2007 11:35 am    Post subject: Reply with quote

krkcs,

The following control card will replace any of the following the characters

Code:

    _________ ________ ______________________ ________________ ________________
   | 122     | `      | Grave accent         | 121            | 79             |
    _________ ________ ______________________ ________________ ________________
   | 123     | :      | Colon                | 122            | 7A             |
    _________ ________ ______________________ ________________ ________________
   | 124     | #      | Number sign, pound   | 123            | 7B             |
   |         |        | sign                 |                |                |
    _________ ________ ______________________ ________________ ________________
   | 125     | @      | At sign              | 124            | 7C             |
    _________ ________ ______________________ ________________ ________________
   | 126     | '      | Apostrophe, prime    | 125            | 7D             |
   |         |        | sign                 |                |                |
    _________ ________ ______________________ ________________ ________________
   | 127     | =      | Equal sign           | 126            | 7E             |
    _________ ________ ______________________ ________________ ________________
   | 128     | "      | Quotation marks      | 127            | 7F             |
    _________ ________ ______________________ ________________ ________________
   | 177     | ^      | Caret                | 176            | B0             |
    _________ ________ ______________________ ________________ ________________
   | 188     | [      | Opening square       | 187            | BA             |
   |         |        | bracket              |                |                |
    _________ ________ ______________________ ________________ ________________
   | 189     | ]      | Closing square       | 188            | BB             |
   |         |        | bracket              |                |                |
    _________ ________ ______________________ ________________ ________________
   | 193     | {      | Opening brace        | 192            | C0             |
   _________ ________ ______________________ ________________ ________________
   | 162     | ~      | Tilde                | 161            | A1             |
    _________ ________ ______________________ ________________ ________________
   | 209     | }      | Closing brace        | 208            | D0             |
    _________ ________ ______________________ ________________ ________________
   | 225     | \      | Backslash            | 224            | E0             |
    _________ ________ ______________________ ________________ ________________



Code:

//SYSIN DD *                                               
 OPTION COPY                                               
 OUTREC FIELDS=(01,89,TRAN=ALTSEQ,90,11,101,100,TRAN=ALTSEQ)
 ALTSEQ CODE=(7A40,7B40,7C40,7D40,7E40,7F40,7940,           
              B040,BA40,BB40,C040,A140,D040,E040)           
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
krkcs
Beginner


Joined: 30 May 2004
Posts: 27
Topics: 5

PostPosted: Tue Apr 03, 2007 11:50 am    Post subject: Reply with quote

Kolusu, currently this is the way i'm following, but included almost 170 hex val's to be converted to spaces.
since, in this case, the data is retrieved from a other than mainframe platform, so good chances that there can be characters other than the one's which you listed above.
I thought finding the way, which will replace all the chars to spaces (except the one's which are on the list)..
Pls. let me know if you find some.

Thanks a lot.
_________________
-kr
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Apr 03, 2007 12:11 pm    Post subject: Reply with quote

how large is this file? This is pretty easy to do in Rexx with a small translate() trick to create the translate table. The basics of the trick are shown from another exec:
Code:
trtable='abcdefghijklmnopqrstuvwxyz'   /* Setup valid dsname chars   */
trtable=trtable||translate(trtable)||'$#@0123456789.''-{()'
trtable=translate(xrange('00'x,'FF'x),,trtable,' ')
zscreeni=translate(zscreeni,,trtable,' ') /* Remove non-Dsn chars    */

Then using translate() and overlay() the process should be pretty fast.
Back to top
View user's profile Send private message Visit poster's website
krkcs
Beginner


Joined: 30 May 2004
Posts: 27
Topics: 5

PostPosted: Tue Apr 03, 2007 1:10 pm    Post subject: Reply with quote

semigeezer, not all of us are supposed to program in REXX, thank you !
_________________
-kr
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group