For Programmers: Free Programming Magazines  


Home > Archive > Cobol > February 2006 > Sequential File Termination Characters ---- Help!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Sequential File Termination Characters ---- Help!
John Simpson

2006-02-16, 6:55 pm

I have an application written in Microsoft Cobol 5.0 which creates and
writes a sequential file. This is a segmented medical claim EDI file which
allows no record terminators. I have solved that problem by defining a large
string and appending each record (segment) of the file to the string. At the
end of the procedure, I write the string to disk and the CRLF record
terminator is appended to the record. Several of the insurance providers do
not have a problem with this, but the testing software for the provider that
I'm currently working with produces an error because of the CRLF terminator.

The question is ---- does anyone know how to write this record without the
CRLF being appended??

Thanks in advance for the wisdom that I know is out there!

John Simpson


Alain Reymond

2006-02-16, 6:55 pm

John Simpson a écrit :
> I have an application written in Microsoft Cobol 5.0 which creates and
> writes a sequential file. This is a segmented medical claim EDI file which
> allows no record terminators. I have solved that problem by defining a large
> string and appending each record (segment) of the file to the string. At the
> end of the procedure, I write the string to disk and the CRLF record
> terminator is appended to the record. Several of the insurance providers do
> not have a problem with this, but the testing software for the provider that
> I'm currently working with produces an error because of the CRLF terminator.
>
> The question is ---- does anyone know how to write this record without the
> CRLF being appended??
>
> Thanks in advance for the wisdom that I know is out there!
>
> John Simpson


John,

CRLF is typical for the Windows world. Under Unix, you have no CRLF but
only a LF at the end of the record.
AFAIK Cobol programs do not have any problem reading CRLF or LF
terminated files when the file is declared as line sequential. Try to
obtain the information on which system the provider works...

If the problem is in the terminator, you can :
- either use sequential files instead of line sequential and add a LF at
the end of the record. But you loose the advantage of line sequential
files which eliminates trailing spaces.
- or pipe the file CRLF terminated file through a dos2unix utility. It
will scan the text file and convert CRLF to LF.
unix2dos also exists.
Search Google for dos2unix. You will find a lot of references.

Regards.

Alain
Rick Smith

2006-02-16, 6:55 pm


"John Simpson" <jasimp@earthlink.net> wrote in message
news:zF1Jf.83022$QW2.30552@dukeread08...
> I have an application written in Microsoft Cobol 5.0 which creates and
> writes a sequential file. This is a segmented medical claim EDI file which
> allows no record terminators. I have solved that problem by defining a

large
> string and appending each record (segment) of the file to the string. At

the
> end of the procedure, I write the string to disk and the CRLF record
> terminator is appended to the record. Several of the insurance providers

do
> not have a problem with this, but the testing software for the provider

that
> I'm currently working with produces an error because of the CRLF

terminator.
>
> The question is ---- does anyone know how to write this record without the
> CRLF being appended??
>
> Thanks in advance for the wisdom that I know is out there!
>
> John Simpson


Why not use the same solution you asked about
nearly three years ago?

< http://groups.google.com/group/comp...bedc85f012341c3 >
----begin quote
Hi All,

Forgive me if this topic has been covered, but I'm new to the group and a
search on the subject has not been fruitful.

I have an application where I must create sequential files with variable
length records. This is easy, but the problem is that the end user (HIPAA)
cannot tolerate the CRLF record terminator at the end of each record.

Do any of you Guru's have a solution to write these records without the
CRLF?

Thanks in advance.

John
-----end quote



Richard

2006-02-16, 6:55 pm


John Simpson wrote:
> I have an application written in Microsoft Cobol 5.0 which creates and
> writes a sequential file. This is a segmented medical claim EDI file which
> allows no record terminators. I have solved that problem by defining a large
> string and appending each record (segment) of the file to the string. At the
> end of the procedure, I write the string to disk and the CRLF record
> terminator is appended to the record. Several of the insurance providers do
> not have a problem with this, but the testing software for the provider that
> I'm currently working with produces an error because of the CRLF terminator.
>
> The question is ---- does anyone know how to write this record without the
> CRLF being appended??


When you say 'sequential' I assume that it is actually 'line
sequential' where it appends a CRLF at the end of each record and you
are writing the whole EDI document as one huge record.

You can write a file without any terminators at all f you define it as
'sequential' (not line) and have a one byte record size. Each character
is written separately. This is very slow but will achieve your
requirements.

Alternately a simple utility program can be used to strip off the
terminators. Write one in C, Perl, or Python.

John Simpson

2006-02-16, 6:55 pm

Probably, it's because when you get to be my age, you can't remember what
you had for dinner yesterday, and secondly, this is NOT the same problem.

But thanks for your attention.

John

"Rick Smith" <ricksmith@mfi.net> wrote in message
news:11v9is9preqmcc3@corp.supernews.com...
>
> "John Simpson" <jasimp@earthlink.net> wrote in message
> news:zF1Jf.83022$QW2.30552@dukeread08...
which[color=darkred]
> large
> the
> do
> that
> terminator.
the[color=darkred]
>
> Why not use the same solution you asked about
> nearly three years ago?
>
> < http://groups.google.com/group/comp...bedc85f012341c3 >
> ----begin quote
> Hi All,
>
> Forgive me if this topic has been covered, but I'm new to the group and a
> search on the subject has not been fruitful.
>
> I have an application where I must create sequential files with variable
> length records. This is easy, but the problem is that the end user (HIPAA)
> cannot tolerate the CRLF record terminator at the end of each record.
>
> Do any of you Guru's have a solution to write these records without the
> CRLF?
>
> Thanks in advance.
>
> John
> -----end quote
>
>
>



John Simpson

2006-02-16, 6:55 pm

Alain,

No, Cobol programs will have no difficulty in reading the file. I have no
clue what is being used to read the file other than it's the "Velocedi
Analysis Engine" by Claredi.

I am using the "organization is sequential" clause, but it tacks on the CRLF
either in the write or close statement.

I can probably process the file with VB to remove the CRLF, but it's one
more step for the client to go through.

John

"Alain Reymond" <arwebmail@skynet.be> wrote in message
news:43f4be8e$0$18969$ba620e4c@news.skynet.be...
> John Simpson a écrit :
which[color=darkred]
large[color=darkred]
the[color=darkred]
do[color=darkred]
that[color=darkred]
terminator.[color=darkred]
the[color=darkred]
>
> John,
>
> CRLF is typical for the Windows world. Under Unix, you have no CRLF but
> only a LF at the end of the record.
> AFAIK Cobol programs do not have any problem reading CRLF or LF
> terminated files when the file is declared as line sequential. Try to
> obtain the information on which system the provider works...
>
> If the problem is in the terminator, you can :
> - either use sequential files instead of line sequential and add a LF at
> the end of the record. But you loose the advantage of line sequential
> files which eliminates trailing spaces.
> - or pipe the file CRLF terminated file through a dos2unix utility. It
> will scan the text file and convert CRLF to LF.
> unix2dos also exists.
> Search Google for dos2unix. You will find a lot of references.
>
> Regards.
>
> Alain



John Simpson

2006-02-16, 6:55 pm

Richard,

With this version of Cobol, even the "organization is sequential" clause
appends a CRLF to the record either during the write or the close statement.
The one-byte-record-size is fine for the body of the file, but unfortunately
doesn't solve the problem when the record is written to disk.

I can whack the CRLF by running it through a VB program, but it's one more
step for the client.

John



"Richard" <riplin@Azonic.co.nz> wrote in message
news:1140116959.105774.37040@g44g2000cwa.googlegroups.com...
>
> John Simpson wrote:
which[color=darkred]
large[color=darkred]
the[color=darkred]
do[color=darkred]
that[color=darkred]
terminator.[color=darkred]
the[color=darkred]
>
> When you say 'sequential' I assume that it is actually 'line
> sequential' where it appends a CRLF at the end of each record and you
> are writing the whole EDI document as one huge record.
>
> You can write a file without any terminators at all f you define it as
> 'sequential' (not line) and have a one byte record size. Each character
> is written separately. This is very slow but will achieve your
> requirements.
>
> Alternately a simple utility program can be used to strip off the
> terminators. Write one in C, Perl, or Python.
>



Richard

2006-02-16, 6:55 pm

> With this version of Cobol, even the "organization is sequential" clause
> appends a CRLF


No, that is not true. I have a copy here that I just retested to
confirm that it does not add any CRLF and that single byte records
write a file that is only those bytes that are expliitly written.

However, that test was done with _my_ compiler settings and you
probably need to check what you have for the SEQUENTIAL"type" compiler
directive, and/or whether you have the RM compiler directive set (which
will set SEQUENTIAL"LINE").

Michael Mattias

2006-02-16, 6:55 pm

"John Simpson" <jasimp@earthlink.net> wrote in message
news:a85Jf.4688$Tf3.3233@dukeread09...
> Richard,
>
> With this version of Cobol, even the "organization is sequential" clause
> appends a CRLF to the record either during the write or the close

statement.
> The one-byte-record-size is fine for the body of the file, but

unfortunately
> doesn't solve the problem when the record is written to disk.


If you are in fact writing ANSI ASC X12 EDI (an 837 or other document) (you
never said that) putting a CRLF after EVERY segment following the
'official' segment terminator character should handle it. Even the HIPAA
IG's say so, allowing for "one segment per line" (technically a misnomer,
but everyone knows what they mean) format.

Sheesh, MICROSOFT COBOL. And I thought I was old. But that should never be
adding anything to what you write, because that would anger the Lords of
COBOL.

MCM


Richard

2006-02-16, 6:55 pm

> putting a CRLF after EVERY segment following the
> 'official' segment terminator character should handle it.


Shoulda, coulda, woulda doesn't cut it when the receiver of these
messages buys or writes a solution for megabucks and it doesn't do
CRLF. They think that everyone sending in messages should match what
they do regardless of what the standard says because they can simply
toss out anything that they don't like.

I have been handling EDIFACT for decades and have learnt to process
anything that is thrown at my programs, but the more that others pay
for broken software the more they are insistent that it must be done
to match that.

James J. Gavan

2006-02-16, 6:55 pm

John Simpson wrote:
> I have an application written in Microsoft Cobol 5.0 which creates and
> writes a sequential file. This is a segmented medical claim EDI file which
> allows no record terminators. I have solved that problem by defining a large
> string and appending each record (segment) of the file to the string. At the
> end of the procedure, I write the string to disk and the CRLF record
> terminator is appended to the record. Several of the insurance providers do
> not have a problem with this, but the testing software for the provider that
> I'm currently working with produces an error because of the CRLF terminator.
>
> The question is ---- does anyone know how to write this record without the
> CRLF being appended??
>
> Thanks in advance for the wisdom that I know is out there!
>
> John Simpson
>


I still occasionally use the PWB Editor and just loaded V 5.0. But so
long ago that I really don't have the patience to work through how to
create a project and use the PWB Make. So :-

Can you be a bit more specific :-

- Richard queried Directives - are you using Defaults or are you setting
directives, and if so which ones ?

- Can we see a small mock-up of a program, File and Record Definition
etc., mode of opening and how you are processing those records. I'd be
curious to see that 'appending' technique you are talking about. Do we
assume the string you talk about is say pic x(1500) and you are using
that as a FIXED record length in the file spec ? That is initially, do
you write the record containing the first 50 characters, the remainder
being blanks, then come back later and add perhaps another 70 characters
etc. Strictly speaking, if it is SEQUENTIAL as opposed to LINE
SEQUENTIAL there should be no need to add the CRLF.

Some of your insurance providers have no problem with the 'artificial
CRLF' you are adding to the end of a supposedly Sequential NOT Line
Sequential. Are you going to upset the applecart for them by ignoring
the CRLF for this other user ? (Do you have an inclusive record-length
for them, or are they identifying the termination of your 'string' by
recognizing the CRLF).

Bearing in mind MS COBOL V 5.0 is a re-badged MF COBOL V 3.??? - file
handling should be consistent, according to M/F's rules. I wouldn't mind
seeing a sample program that I could compile through Net Express and see
what results I get.

If all else fails join the Micro Focus Forum and ask your question under
'Other Products'. I know strictly speaking MS COB 5 is not their baby,
but perhaps they just *might* help you out.

Jimmy, Calgary AB
Bob Iles

2006-02-17, 6:55 pm



John Simpson wrote:
> Alain,
>
> No, Cobol programs will have no difficulty in reading the file. I have no
> clue what is being used to read the file other than it's the "Velocedi
> Analysis Engine" by Claredi.
>

John, I would assume and program reading the file generated would have
to have some limiter to determine the end of each record and a fixed
number of bytes. This would be true in any language. If you open the
file as a "binary sequential" and define with one byte.

fd output-file.
01 output-record.
03 output-byte.

If you open as output and write each byte from your array, you could
write only the characters of data you want, and no record terminators
would be added.

But again, unless the data has some text, that the input process knows
where each record ends, this would lead to trouble.


my $.02.

Bob.

> I am using the "organization is sequential" clause, but it tacks on the CRLF
> either in the write or close statement.
>
> I can probably process the file with VB to remove the CRLF, but it's one
> more step for the client to go through.
>
> John
>
> "Alain Reymond" <arwebmail@skynet.be> wrote in message
> news:43f4be8e$0$18969$ba620e4c@news.skynet.be...
>
>
> which
>
>
> large
>
>
> the
>
>
> do
>
>
> that
>
>
> terminator.
>
>
> the
>
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com