View previous topic :: View next topic
|
Author |
Message |
Selva-kumar
New User
Joined: 01 Mar 2007 Posts: 52 Location: chennai
|
|
|
|
Hi,
My input field is FLDA and output field is FLDB. In my program i'm having
MOVE FLDA TO FLDB. My field FLDA has a hex value of X'15' which is a new line charater. How can i eliminate this character. I'm initializing the output file before move. And after move i'm inspecting for low-values and high-values. What to do for this X'15'.? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Do you want it replaced with a blank?
Or do you want it (and the character position it occupies) squeezed out? |
|
Back to top |
|
|
Selva-kumar
New User
Joined: 01 Mar 2007 Posts: 52 Location: chennai
|
|
|
|
I want it to be as spaces... |
|
Back to top |
|
|
kgumraj
Active User
Joined: 01 May 2006 Posts: 151 Location: Hyderabad
|
|
|
|
Hi Selva,
You can code this
Code: |
IF FLDA = X'15'
MOVE SPACES TO FLDA
ELSE
CONTINUE
END-IF. |
|
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Have you looked at various options available in the COBOL reference manual? The inspect verb? |
|
Back to top |
|
|
Selva-kumar
New User
Joined: 01 Mar 2007 Posts: 52 Location: chennai
|
|
|
|
Hi kgumraj,
I can do that if condition. But my input file has 300 fields and i don't know in which field it can occur? So how can i check as a overall? |
|
Back to top |
|
|
kgumraj
Active User
Joined: 01 May 2006 Posts: 151 Location: Hyderabad
|
|
|
|
Check this logic
MOVE FUNCTION LENGTH (FLDA) TO WS-VAR.
PERFORM VARYING J-IND FROM 1 BY 1 UNTIL J-IND > 15
IF FLDA(J-IND:1) = X'15'
MOVE SPACES TO FLDA
ELSE
CONTINUE
END-IF
END-PERFORM.
Thanks |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Kiran, did you mean:
MOVE FUNCTION LENGTH (FLDA) TO WS-VAR.
PERFORM VARYING J-IND FROM 1 BY 1 UNTIL J-IND > WS-VAR
IF FLDA(J-IND:1) = X'15'
MOVE SPACES TO FLDA(J-IND:1)
ELSE
CONTINUE
END-IF
END-PERFORM. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Either way that is horrible can't you just do an INSPECT FLDA replaceing x'15' by x'40' |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Just to add a bit to
Quote: |
Either way that is horrible can't you just do an INSPECT FLDA replaceing x'15' by x'40' |
If FLDA is not the group/record, create a group that contains all of the fields that need to have the x'15' replaced. |
|
Back to top |
|
|
|