In Cobol, large amount of spaces between records due to variable definition



I am building a variable that gets notes from an input file. The
variable may end up containing notes that may be 1 character or made up
of up to 1900 characters. I use this one variable for writing to an
output file. In Cobol, I'm assuming I have to define this variable
in the Working-Storage:
01 THE-NOTE-STRING-COMPLETE PIC X(1900).

I'm assuming I have to make it this variable 1900 characters since
the notes can get that big. They are then written to the output file:
FD PNOTES-NEW-OUT
LABEL RECORDS ARE STANDARD.
01 PNOTES-NEW-OUT-RECORD.
05 WK3-PNOTES-COMPLETE-LINE PIC X(1900).

When it writes to the output file, due to the variable being defined at
1900 characters, there may be a large amount of spaces between records
because the previous record has only a small amount of notes. In the
example below, the "~PRICE VALID TILL STOCK OUT" is the only notes
for that record, so there are almost 1900 spaces between the end of
that record and the next:

===========EXAMPLE========================
~PRICE VALID TILL STOCK OUT


Up to almost 1900 spaces between the 2 records!!


HAZARDOUS(1) MTRL, PACK PER CFR~TOLUENE(1); FLASH POINT 6 TO END OF
LINE~SHIP(1)

==========END OF EXAMPLE===================

I want all the trailing spaces in each record eliminated. I don't
know how this can be done since the variable is defined at 1900
characters. And I didn't think Cobol allowed you to have a
"variable-sized" variable. I feel like I'm going about this in
the wrong manner and don't know how to remedy this issue. Can you
help? Thank you!

.



Relevant Pages

  • Re: In Cobol, large amount of spaces between records due to variable definition
    ... (This assumes you have an '85 Standard compiler) ... > I'm assuming I have to make it this variable 1900 characters since ... They are then written to the output file: ... > ~PRICE VALID TILL STOCK OUT ...
    (comp.lang.cobol)
  • Re: newbie question: whats wrong with my code?
    ... What are you doing with all those characters that fgetc() is returning ... They're certainly not being written to your output file. ... You've mixed up the parameter order: ...
    (comp.lang.c)
  • Re: In Cobol, large amount of spaces between records due to variable definition
    ... > I am building a variable that gets notes from an input file. ... > up of up to 1900 characters. ... They are then written to the output file: ... Um, check your compiler. ...
    (comp.lang.cobol)
  • Re: Need some help with Search
    ... > After getting the line i want to browse thro the entire line and ... > just redirect that word to an output file and not the entire line. ... characters that delimit words, you can use tr to convert all such characters ... newline separate words, you can use: ...
    (comp.unix.programmer)
  • Fwd: RE: [Python-Help] Python Help
    ... in the pullerListto an output file. ... You can verify it if you print patchNumber at the end of the loop. ... Better, to avoid having to count characters -very prune to error-, try this version: ... Todo lo que querías saber, y lo que ni imaginabas, ...
    (comp.lang.python)