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
 

 

How do we handle the carriage return in the cobol program
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
patriot

New User


Joined: 01 Dec 2006
Posts: 8
Location: chennai

PostPosted: Thu Feb 01, 2007 5:11 pm    Post subject: How do we handle the carriage return in the cobol program
Reply with quote

How do we handle the carriage return in the cobol program.
Ex: If we get a carriage return in the file, some functionality is being done.
what is the cobol equivalent value for carriage return. I should use this in an IF condition. How do we handle this?
Back to top
View user's profile Send private message

William Thompson

Global Moderator


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

PostPosted: Thu Feb 01, 2007 5:21 pm    Post subject: Re: carriage return cobol program
Reply with quote

patriot wrote:
How do we handle the carriage return in the cobol program.
Ex: If we get a carriage return in the file, some functionality is being done.
what is the cobol equivalent value for carriage return. I should use this in an IF condition. How do we handle this?
Are you parsing thru this file byte by byte or is there a field that you are inspecting?
Back to top
View user's profile Send private message
patriot

New User


Joined: 01 Dec 2006
Posts: 8
Location: chennai

PostPosted: Thu Feb 01, 2007 6:29 pm    Post subject:
Reply with quote

Carriage return comes in field and that has to be inspected.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Feb 01, 2007 6:52 pm    Post subject:
Reply with quote

EBCDIC CR is usually a X'0D', does that help?
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Feb 01, 2007 6:55 pm    Post subject:
Reply with quote

I was using something like
05 WS-LIT-ENTER-N PIC S9(9) COMP VALUE +3365.
05 FILLER REDEFINES WS-LIT-ENTER-N.
10 FILLER PIC XX.
10 WS-LIT-ENTER PIC XX.

for identifying the Carriage return. But couldn't use this WS-LIT-ENTER in INSPECT.
When I tried parsing that field byte by byte and comparing each byte with that WS-LIT-ENTER also am not able to make it.

Could some one suggest us how to fix this.
Me and patriot were working on this for a long time but couldn't fix it...

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: Thu Feb 01, 2007 7:35 pm    Post subject:
Reply with quote

Magna wrote:
I was using something like
Code:
05 WS-LIT-ENTER-N          PIC S9(9) COMP VALUE +3365.
05 FILLER  REDEFINES  WS-LIT-ENTER-N.
          10 FILLER            PIC XX.
          10 WS-LIT-ENTER      PIC XX.

for identifying the Carriage return. But couldn't use this WS-LIT-ENTER in INSPECT.
When I tried parsing that field byte by byte and comparing each byte with that WS-LIT-ENTER also am not able to make it.

Could some one suggest us how to fix this.
Me and patriot were working on this for a long time but couldn't fix it...
The 3365 is CR/LF, X'0D25'. what does the field in the file look like, what is its PIC?
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Feb 01, 2007 8:13 pm    Post subject:
Reply with quote

The fileds PIC is x(40).
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Feb 01, 2007 8:34 pm    Post subject:
Reply with quote

So you are trying to scan the 40 bytes looking for a CR/LF combination or just one or the other?
Once found, what are you going to do with it?
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: Thu Feb 01, 2007 9:39 pm    Post subject:
Reply with quote

Hello,

How many fields follow the 40-byte field that has the cr/lf?

Open your file with the embedded cr/lf in tso/browse. Then set HEX ON. This will make the data easier for you to view.

If the last thing in a record is the cr/lf it can most likely be ignored. If there are fields after the cr/lf, you will need to decide what action is necessary.

What kind of data is this? Is it typed text or is it some number of fields that will line up and be an input file for some process? Please post a couple of your records indicating where the cr/lf combination is and what you want to do with the records on the mainframe.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Thu Feb 01, 2007 9:51 pm    Post subject:
Reply with quote

Some versions of COBOL support the definition:
Code:
01  WS-CR     PIC X    VALUE X'0D'.
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Feb 01, 2007 10:01 pm    Post subject: Re: How do we handle the carriage return in the cobol progra
Reply with quote

Well, I'll be verifying for the CR/LF in my 40 bytes field.
In the file if there is a CR/LF the record continuing that field is moved to the next line.
So I need to find the carriage return in the 40 byte field and have to populate a space in that place and get the remaining records from the next line of the file and concatenate and populate it to my o/p file.
I'll be processing the o/p file for loading the table.
The 40 byte field is a Address field.
So I might have numbers or Characters or symbols like ',*,<,>,....
anything like this.

For an example the contents will be like this:
2, Broadway Th road 3/4 aaaaaa(CR and no more fields after this)
bbbbbbbbbbbbbbbbbbbb(rest of the record)
and when i checked the HEX equiv value in the file has the same value as space.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Feb 01, 2007 10:22 pm    Post subject:
Reply with quote

Inspect 40byte converting x'0d25' to spaces
that will convert all x'0d's and all x'25's that occur in the record with blanks. Is that what you want?
Unstring 40byte into recievingarea delimited by x'0d25'
would also work.
This is your input?
Quote:
2, Broadway Th road 3/4 aaaaaa(CR and no more fields after this)bbbbbbbbbbbbbbbbbbbb(rest of the record)
And this is your output?
Quote:
2, Broadway Th road 3/4 aaaaaabbbbbbbbbbbbbbbbbbbbbb(rest of the record)
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Thu Feb 01, 2007 10:45 pm    Post subject:
Reply with quote

How should I code the INSPECT stmt if i also want to know the position where I actually find the CR/LF...
I'm asking this because i need to concatenate the remaining part of the record ( that is in the next line ) after that position to get the complete record.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Feb 01, 2007 11:03 pm    Post subject:
Reply with quote

Not real easily, that would be more like inspect tallying all before initial CR/LF, and then you would replace it.
count=0
inspect 40byte tallying count for characters before initial x'0d'
move spaces to 40byte(count+1:2)
move next40 to 40byte(count+1+?:40)
I think that's what direction you are going....
Why not just string the multiple 40 byte records int your output?
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: Thu Feb 01, 2007 11:34 pm    Post subject:
Reply with quote

Hello,

When you say
Quote:
For an example the contents will be like this:
2, Broadway Th road 3/4 aaaaaa(CR and no more fields after this)
bbbbbbbbbbbbbbbbbbbb(rest of the record)
and when i checked the HEX equiv value in the file has the same value as space.

are you saying that when you browse the record there is a hex'40' after the aaaaaa and that there is no more data in that record?

If so, where is the cr/lf? Keep in mind for an embedded cr/lf they will take up 2 bytes.

What should happen if there is a cr/lf after the bbbbbbbbbb data?

Please post a few records (in hex) showing the data you are working with. We will be much more able to help if we can better see the situation.
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Fri Feb 02, 2007 9:44 am    Post subject:
Reply with quote

File Record length : 250

This is how my file is

POLYESTER SLEEVING 3/4"
DDDECEECD4EDCCECDC4F6F744444444444444444444444444
7638523590235559570314F00000000000000000000000000

The below is the continuation of the above specified record

N 05/16/200305/16/2063ANIXTER KC
D4444444444444444444FF6FF6FFFFFF6FF6FFFFCDCEECD4DC44444444444444444444444444444444444
5000000000000000000005116120030511612063159735902300000000000000000000000000000000000

The 'ANIXTER KC' is the end of record actually. It got splitted into two.

What I need is After the POLYESTER SLEVING 3/4", one space, and the next line should continue.
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 Feb 02, 2007 10:02 am    Post subject:
Reply with quote

Hello,

I shifted your posted data into "code" so it would line up (see below). Please note that the lines are not in sync. In browse, the system would not display the second "line" the way it is here - the bytes do not line up. You posted that the length is 250, but what we have here is far less.

Code:

POLYESTER SLEEVING 3/4"
DDDECEECD4EDCCECDC4F6F744444444444444444444444444
7638523590235559570314F00000000000000000000000000


Code:

N 05/16/200305/16/2063ANIXTER KC
D4444444444444444444FF6FF6FFFFFF6FF6FFFFCDCEECD4DC44444444444444444444444444444444444
5000000000000000000005116120030511612063159735902300000000000000000000000000000000000


Looking at the data provided, i do not see any cr/lf.

How did this data get to your mainframe? Is it now in a qsam file? Please look at the file in tso 3.2 and post the file attributes.

If you can get a few records (copy the 2 records before these and the 2 after to another file) downloaded and attach them as a text file i can look at that. I'll upload them to my system to look at.
Back to top
View user's profile Send private message
Magna

New User


Joined: 30 Oct 2006
Posts: 24

PostPosted: Fri Feb 02, 2007 11:00 pm    Post subject:
Reply with quote

Hi friends Thanks.. It worked.
The issue is fixed. But there is one more value which we found in the file which had a hexa value of '25' what is it?
It is displayed a dark vertical thick line when we download it to a text file.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Sat Feb 03, 2007 1:06 am    Post subject:
Reply with quote

Magna wrote:
Hi friends Thanks.. It worked.
The issue is fixed. But there is one more value which we found in the file which had a hexa value of '25' what is it?
It is displayed a dark vertical thick line when we download it to a text file.
the hex 25 is the LF or Line Feed....
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Sat Feb 03, 2007 1:42 am    Post subject: Re: How do we handle the carriage return in the cobol progra
Reply with quote

I've been following this post since its inception, and I must admit that the original concept of what was asked has had me stumped from the beginning. I'm not aware of any such concept as a "carriage-return" in the world of EBCDIC data, and, looking at the final postings, wasn't this just a simple case of multiple data records that needed to be spliced together into a single record (something that DFSORT could've easily handled)?
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts DFHWS2LS return value divated CICS 4 Mon Nov 07, 2016 5:44 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am


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