For Programmers: Free Programming Magazines  


Home > Archive > Cobol > June 2004 > writing cariage return character









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 writing cariage return character
hpy_awad@yahoo.com

2004-06-11, 8:55 am

My Cobol is RMCOBOL, And I am trying to I write new line into an
input.fil say my record is :

01 file-record.
02 emp_no pict 9(4).
02 filler pict x(2).
02 name pict x(20).
02 ---writing carraige return character--Howw ???
JerryMouse

2004-06-11, 8:55 am

hpy_awad@yahoo.com wrote:
> My Cobol is RMCOBOL, And I am trying to I write new line into an
> input.fil say my record is :
>
> 01 file-record.
> 02 emp_no pict 9(4).
> 02 filler pict x(2).
> 02 name pict x(20).
> 02 ---writing carraige return character--Howw ???


02 file-crlf pic x(2).

.....
MOVE X'0D0A' to file-crlf.

If your SELECT statment contains

ORGANIZATION IS LINE SEQUENTIAL

the compiler will insert these characters for you automatically. In other
words, each record becomes two bytes longer than your FD definition and
these extra two bytes contain 0D0A (carriage return/line feed).


Michael Mattias

2004-06-11, 3:55 pm

"hpy_awad@yahoo.com" <ehab_aziz2001@yahoo.com> wrote in message
news:7ecaee57.0406110348.41b7d270@posting.google.com...
> My Cobol is RMCOBOL, And I am trying to I write new line into an
> input.fil say my record is :
>
> 01 file-record.
> 02 emp_no pict 9(4).
> 02 filler pict x(2).
> 02 name pict x(20).
> 02 ---writing carraige return character--Howw ???


I doubt you are *writing* to an *input* file, but easiest way to do this
"when ORGANIZATION IS SEQUENTIAL" is

01 file-record.
02 emp_no pict 9(4).
02 filler pict x(2).
02 name pict x(20).
02 rec-term PIC X(01).

MOVE x'0D' to rec-term of File-Record

For PC-termination, you should move carriage return PLUS line feed, so
change rec-term to PIC X(02) and move x'0D0A' to it.

But, you might want to look at ORGANIZATION IS LINE SEQUENTIAL. If you use
this, record termination will be handled by the compiler.

MCM



MCM





Sponsored Links







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

Copyright 2008 codecomments.com