How do you omit the CRLF



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

How do you omit the CRLF

Postby ctrevino » Thu Aug 26, 2010 9:20 pm

I know this is probably a dumb question but here goes. (if it is please don't flame me)

We are saving a report into a flat file that can also be sent to a printer. The version that goes to the flat file, I would like to have no CR/LF at the beginning of the line. Is there a way to do that in COBOL?

Christy
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: How do you omit the CRLF

 

Re: How do you omit the CRLF

Postby MrSpock » Thu Aug 26, 2010 9:51 pm

Since we're talking about mainframes, that means we're talking about data in EBCDIC. I'm not too familiar with a concept of CRLF in EBCDIC, so I'm not sure how to respond. How does this CRLF get in there to begin with? Can you just remove it there at its point of origin?

Beyond that, the concept of altering or manipulating data outside of the application, depending on your needs, is usually handled best and most efficiently with your SORT program.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: How do you omit the CRLF

Postby Robert Sample » Thu Aug 26, 2010 10:39 pm

Can you browse the file in HEX mode and post the data so we can see what you're calling a CR/LF? Mainframe carriage control is generally the first byte of the record, not at the end -- and the CR/LF characters don't work on the mainframe the way they do on the PC, anyway. When you post the data, use the Code tag at the top of the dialog box to preserve exactly the data.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: How do you omit the CRLF

Postby steve-myers » Fri Aug 27, 2010 1:24 am

The actual question to ask is are those characters actually in the data. IBM mainframe data is typically in records that are delimited by their length (RECFM U and F) or by a length value that is part of the record (RECFM V). This is not the PC world where text lines are delimited by a CR (carriage return) character followed by a LF (line feed) character, usually at the end of the line, or the Unix world, where LF serves the same purpose and CR is not generally used. There are EBCDIC characters that are analogs of the ASCII CR and LF characters, intended for EBCDIC character oriented printers that have been phased out years ago. The EBCDIC CR is X'0D' and LF is X'0A'. This record orientation was quite deliberate; System/360 designers were influenced by the 14xx system design which used in-stream characters as record delimiters, and it was eventually felt this scheme caused more trouble that it was worth.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: How do you omit the CRLF

Postby steve-myers » Fri Aug 27, 2010 1:30 am

Excuse me. I looked too quickly. EBCDIC CR is X'0D', but LF is X'25'. Another problem is CR was often the equivalent of CRLF.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: How do you omit the CRLF

Postby ctrevino » Fri Sep 03, 2010 10:13 pm

Thanks for all your replies everyone.

Mr. Spock, thanks for the idea. I always forget about using the sort program and it is so easy to use.

Robert, I am indeed talking about the first byte of the line, basically mainframe carriage control, and so misled y'all by confusing my terms.
Basically, I am creating a dynamic file in cobol that contains what used to be a printed report (it was dynamically sent to the printers) that then executes a java program (still on the mainframe) that executes another java program on the server side that is a restful web service and ends up on a feed that proviced the report in both .txt and .pdf formats.

The first character is travelling along and shows up in the 'txt' and 'pdf' files as extended ASCII special characters in the first byte of the lines.

I am only directly responsible for the main program that produces the report and the subroutines that do the dynamic allocation and ftp (the cobol part). The Java programmer on the server side is having some trouble with some special characters that are showing up. He just changed over to SQL server 2005 so all of the prior examples of the problem characters have wiped out.

I believe we may be close to a solution though.
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: How do you omit the CRLF

Postby ZAWIETR » Wed Jan 19, 2011 3:33 am

I have a followup question to the one orginally asked. My program is reading in data from a DB2 table that was orginally populated by data sent up from an AIX platform via a Java program. The data has been manipulated and now I am findindg CRLF X'0D25' values in the middle of certain fields, causing bad things to happen in the downstream application. I am thinking that I need to do an INSPECT/REPLACE but I don't know what to INSPECT for... Any suggestions? :(
ZAWIETR
 
Posts: 1
Joined: Wed Jan 19, 2011 3:26 am
Has thanked: 0 time
Been thanked: 0 time

Re: How do you omit the CRLF

Postby Robert Sample » Wed Jan 19, 2011 5:28 am

If you read the COBOL Language Reference manual, you will find that literals that can be used in an INSPECT statement include literals in the format X'0D25' (or X"0D25"). So why not use X'0D25'?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post