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 

Replace CRLF characters to Space

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


Joined: 08 Jun 2004
Posts: 11
Topics: 5

PostPosted: Wed Sep 14, 2005 5:05 am    Post subject: Replace CRLF characters to Space Reply with quote

I have String of 455 chars. It may contain Carriage Return in between. Is there any way to check for availablity of Carriage return in a String and if Found, I have to replace the Carriage Return with spaces.

The hex value of CRLF is X'0D25'.

Thanks

Seenu
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Sep 14, 2005 5:41 am    Post subject: Reply with quote

Seenu,

There are several ways of replacing a Character or string.

1. Using Sort (ALTSEQ)
2. Using Rexx
3. Using COBOL,
4. Using File-Aid
5. Using Easytrieve.....

Which one do you prefer?

Thanks,
Phantom
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Sep 14, 2005 5:42 am    Post subject: Reply with quote

Whatever be the case, I need the LRECL, RECFM of your input file.

Thanks,
Phantom
Back to top
View user's profile Send private message
ANIL SARATHY
Beginner


Joined: 30 Aug 2005
Posts: 88
Topics: 3
Location: Syracuse,New york

PostPosted: Thu Sep 15, 2005 1:22 am    Post subject: Reply with quote

For information only.

Using Sort (ALTSEQ) , we can change as many as 1 byte values , but not 2 consecutive bytes ( always).

hex representation:

F F F 4 2 0 0 2
1 2 3 0 5 D D 5 .

Here we need to change "0d25" values only. if in the input file "od" and "25" don't appear any where individualy ie separate from each other then ALTSEQ can be used. Other wise it will change OD and 25 , no matter whereever they are. It defeats the purpose of changing CLRF with spaces.


Other wise , we have to use X,2,CHANGE=(2,x"0d25",x"4040"),nomatch=(x,2) for all positions.

Smile
_________________
Anil Sarathy
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kseenu
Beginner


Joined: 08 Jun 2004
Posts: 11
Topics: 5

PostPosted: Thu Sep 15, 2005 2:11 am    Post subject: Reply with quote

I am fetching the data from DB in a Cobol Program. Then I have to search for the CRLF value and replace them with spaces.

The LRECL is 3657 and RECFM is FB


thanks
Back to top
View user's profile Send private message
ANIL SARATHY
Beginner


Joined: 30 Aug 2005
Posts: 88
Topics: 3
Location: Syracuse,New york

PostPosted: Thu Sep 15, 2005 3:34 am    Post subject: Reply with quote

try this
Code:

//REPSORT  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD input file
//SORTOUT  DD output file
//SYSIN DD *
  OPTION COPY
  OUTREC FIELDS=(1,3657,TRAN=ALTSEQ)
  ALTSEQ CODE=(0D40,2540)
/*


Smile

i didn't tried this

Code:

//XXXXX EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//DD01 DD input file
//DD01O DD SYSOUT=*
//SYSIN DD *
$$DD01 COPY REPLALL=(1,0,X'0D25',X'4040') 
/*

_________________
Anil Sarathy
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Sep 15, 2005 3:40 am    Post subject: Reply with quote

Seenu,

If you are reading this file using a COBOL why not just use INSPECT..REPLACING ?

Code:

INSPECT WS-SOURCE-DATA
REPLACING ALL X'0D40' BY SPACES


Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Sep 15, 2005 7:48 am    Post subject: Reply with quote

Anil sarathy,

You need to use the BBCODEs to enable the proper format of the code.

put your code enclosed in between the bbcode and check it.

{code}
//REPSORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD input file
//SORTOUT DD output file
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1,3657,TRAN=ALTSEQ)
ALTSEQ CODE=(0D40,2540)
/*

{/code}

Now replace the { brackets with [ for {CODE} & {/CODE} .

Now this is how it looks like

Code:

//REPSORT  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD input file
//SORTOUT  DD output file
//SYSIN DD *
  OPTION COPY
  OUTREC FIELDS=(1,3657,TRAN=ALTSEQ)
  ALTSEQ CODE=(0D40,2540)
/*



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
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Thu Sep 15, 2005 3:42 pm    Post subject: Reply with quote

I'm with Phantom, only it's X'0D25', not X'0D40'
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 315
Topics: 49
Location: Germany

PostPosted: Fri Sep 16, 2005 5:59 am    Post subject: Reply with quote

Quote:

I am fetching the data from DB in a Cobol Program. Then I have to search for the CRLF value and replace them with spaces.




kseenu,

if your database is DB2 try this:

SELECT
REPLACE(MYFILED, <CRLF> , <BLANKS> .......) AS MYFILED
FROM MYTABLE
WHERE ......


<CRLF> = X'0D25', <BLANKS> = X'4040'


regards,
bauer
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 -> Application Programming 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