gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] line sequential and string.


From: Bill Klein
Subject: Re: [open-cobol-list] line sequential and string.
Date: Tue, 3 Mar 2009 10:22:09 -0600

My personal recommendation is that any time that you use RECORD DEPENDING ON
in an FD, that you ALSO use the "corresponding" OCCURS DEPENDING ON in the
subodirnate record, e.g. 

FD somelineseq
>    RECORD SIZE IS VARYING
      from 1 to 9999  *> whatever is a reasonable max - or even a 78-level
>      DEPENDING ON reclenfield ...

01  Full-Rec.
    05  EachByte occurs 1 to 999 times
        Depending on reclenfile
        Pic X.

In this way your "currently available" record will always match the actually
available record size.  This works for input, output, and I-O.

> -----Original Message-----
> From: Brian Tiffin [mailto:address@hidden 
> Sent: Tuesday, March 03, 2009 12:39 AM
> To: address@hidden
> Subject: Re: [open-cobol-list] line sequential and string.
> 
> ORGANIZATION IS LINE SEQUENTIAL records do NOT retain the newline and 
> carriage-return is stripped.  (But I didn't look too closely 
> into extfh 
> external SEQ/RAN handlers.  But that only kicks in if that is 
> configured).
> 
> In the FD (not the FILE-CONTROL SELECT) include the VARYING 
> DEPENDING ON 
> clause.
> 
> FD somelineseq
>    RECORD SIZE IS VARYING
>      DEPENDING ON reclenfield ...
> 
> After each read, the record buffer is SPACE filled and the 
> length actually 
> read (ignoring truncation, actual file record length, skipping any 
> carriage-return and terminated by line-feed) will be in   reclenfield.
> 
> And then you can play reference modification tricks like
> 
> MOVE "}" TO destbuff(reclenfield + 1 : 1)
> 
> with your own tests for destbuff sizing, or cobc -debug to 
> trap out any refmod 
> out of bounds. 
>   
> Cheers,
> Brian
> 
> On March 2, 2009 06:28:54 pm John Culleton wrote:
> > 1. Does a line sequential record that is read in and is
> > shorter than the receiving record description retain its
> > EOL character or is it stripped off?
> >
> > 2. If it retains the EOL character how do I designate it in
> > Open Cobol?. I am working on a Linux system. I want to do
> > a STRING  placing a "}" after the last printable character
> > which means I need to use a DELIMITED BY EOL or however
> > it is designated in OC.
> >
> > I can always fill with HIGH VALUES or something and test for
> > that but that seems a bit clumsy.
> 
> --------------------------------------------------------------
> ----------------
> Open Source Business Conference (OSBC), March 24-25, 2009, 
> San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing 
> the Enterprise
> -Strategies to boost innovation and cut costs with open 
> source participation
> -Receive a $600 discount off the registration fee with the 
> source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]