View previous topic :: View next topic
|
Author |
Message |
maridawson
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
HI,
I wrote a COBOL program to read the records from two input files and write into one output file. While printing the records in the output file i am getting zeros and hyphens suffixed with the output records. I tried to move spaces before writing the records,but it is not working.i have attached my output with this query.
Thanks.[/b] |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Printer spacing control characters. |
|
Back to top |
|
|
maridawson
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
can you please tell me how can i remove those characters from my output file?
Thanks, |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Use WRITE not WRITE AFTER ADVANCING. |
|
Back to top |
|
|
maridawson
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
ya. thats what i have used for writing each record. Is it like i have to use a minimum of no. of lines of gap between each record ? Actually every line that was displayed in my output, i have declared that as a group variable in the file descriptor section for the output file. I will just move values to the respective group variables and print the records using WRITE AFTER ADVANCING 2 LINES or 5 LINES. am i more sound like confusing ? |
|
Back to top |
|
|
maridawson
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
Sorry i misread your answer craq. I am just opening my output file and writing into output file by moving values to the respective group variables and then i am closing it. If i use write alone , cant the records get overwritten? |
|
Back to top |
|
|
maridawson
New User
Joined: 24 Jun 2008 Posts: 59 Location: chennai
|
|
|
|
Thank you very much Craq. I got the required output.
Can you please tell me what is the difference between write and write after advancing? and when i should use the latter?
Thanks, |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
WRITE is for data files, WRITE AFTER ADVANCING is for reports. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
WRITE AFTER ADVANCING adds carriage control characters to your output file since the presumption is that you're printing: space for single space, 0 for double space, - for triple space, 1 for top of page, etc.
WRITE doesn't add carriage control characters.
In both cases, since the output buffer is cleared before the next COBOL statement is encountered, there is no chance of overwriting data -- unless you're running two programs that write to the same file at the same time without using a mechanism such as enqueue. |
|
Back to top |
|
|
|