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
 

 

New line character in char field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Selva-kumar

New User


Joined: 01 Mar 2007
Posts: 52
Location: chennai

PostPosted: Fri Jul 20, 2007 1:05 pm    Post subject: New line character in char field
Reply with quote

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
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jul 20, 2007 2:14 pm    Post subject:
Reply with quote

Do you want it replaced with a blank?
Or do you want it (and the character position it occupies) squeezed out?
Back to top
View user's profile Send private message
Selva-kumar

New User


Joined: 01 Mar 2007
Posts: 52
Location: chennai

PostPosted: Fri Jul 20, 2007 2:30 pm    Post subject: Re: New line character in char field
Reply with quote

I want it to be as spaces...
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Fri Jul 20, 2007 2:38 pm    Post subject:
Reply with quote

Hi Selva,

You can code this

Code:
IF FLDA = X'15'
    MOVE SPACES TO FLDA
ELSE
    CONTINUE
END-IF.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jul 20, 2007 2:42 pm    Post subject:
Reply with quote

Have you looked at various options available in the COBOL reference manual? The inspect verb?
Back to top
View user's profile Send private message
Selva-kumar

New User


Joined: 01 Mar 2007
Posts: 52
Location: chennai

PostPosted: Fri Jul 20, 2007 2:54 pm    Post subject: Re: New line character in char field
Reply with quote

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
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Fri Jul 20, 2007 3:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jul 20, 2007 3:53 pm    Post subject:
Reply with quote

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
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Fri Jul 20, 2007 9:06 pm    Post subject:
Reply with quote

Either way that is horrible can't you just do an INSPECT FLDA replaceing x'15' by x'40'
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 20, 2007 10:26 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


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