[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnubol: Record delimiter clause and parse order
Tim Josling wrote:
>
> Matthew,
>
> Parsing
> *******
>
> Where there are many clauses, I would use something like this.
>
> select_clause:
> SELECT optional_clause_opt assign_clause
> select_sub_clause_rep_opt
> ;
>
> _rep (obvious)
> _opt (obvious)
>
> select_sub_clause:
> access_mode_clause
> |file_status_clause
> |lock_mode_clause
> |organization_clause
> |padding_char_clause
> |record_delim_clause
> |reserve_area_clause
> |sharing_clause
> ;
>
> The benefit is that you get maximum recognition out of the parser
> and if the clauses are out of order you don't get a dumb 'syntax
> error' message.
>
> You then have the option of accepting the clauses out of order or
> doing a manual check. You would probably only do the manual check
> only in pedantic mode, at which time you can put out a good
> message.
>
> Record Delimiter
> ****************
>
> The record delimiter clause is optional, in ANSI 85. "Record
> delimiter is standard-1" is only allowed for mag tapes.
>
> On the general question of the sequential formats I would suggest
> that we do as the Romans do, which as far as I know (please
> someone knowledgeable correct me on this).
>
> - ORGANISATION IS SEQUENTIAL
> means that either it is fixed records with no delimiter or
> variable records with some record prefix. Someone may be able to
> tell us what is the format used by Merant or FJ. The IBM
> mainframe format can be ignored for now. It is a horrible mess.
>
> - ORGANISATION iS LINE-SEQUENTIAL
> means that it is delimited by CRLF or CR or LF depending on te
> platform (whatever fread regards as "\n"). This would be flagged
> as an extension in pedantic mode and the keyword line-sequential
> would be just another word in standard cobol-84 mode (see
> cobctok.def).
>
> I don't know why they did not use 'record delimiter is newline'
> instead of inventing line-sequential, but they did.
>
For shits-n-grins, and personal aggrandizement, I did a little test in
MF today at work. Sequential is sequential, with no delimiters,
assuming fixed length records. Line sequential is delimited by "\r\n"
(hex 0D 0A). At least, that's how they come out on OS/2. So, for fixed
length sequential, that's the way I'll do it. Line sequential I'll
throw in because it seems that so many non-mainframe compilers seem to
advertise support it--"Shop here!! We support MicroFocus' non-standard
proprietary extensions!!"
> Someone mentioned that fixed vs variable changes the filling of
> the records. True.
>
I also did a couple of variable length writes, so I could get an idea of
what MF does with writing variable length files. I'm hard pressed to
decipher them, however, even with a hex editor. I've attached it, and
the program I used to write it. I can understand the basic
structure--starts out at 6 bytes, then increases to 10 bytes, and
presumably would add another 4 bytes when rec-len reaches 14, to give 18
bytes, and so on. Any pointers on interpreting would be very much
appreciated. We don't really use variable length records in files.
Actually, we do much more DB work than we do file IO at all...
> Don't forget we have the option to ignore clauses that have no
> meaning in our environment. Eg we can say memeory-size is
> ignored, same for record-delimiter. This is important for running
> code for other compilers.
>
Of course. ;) I would like to support as much as we can, though, as
long as it's appropriate for the operating system.
Gahh!! never really thought about all the work that goes on behind the
scenes in COBOL. It really is an amazing language, notwithstanding
having over 400 reserved words.
BTW, for the attached file, I only attached the sequential variable
length file, and not the line sequential. Not really much difference,
anyhow.
ciao,
--
Matthew Vanecek
Visit my Website at http://mysite.directlink.net/linuxguy
For answers type: perl -e 'print
$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
*****************************************************************
For 93 million miles, there is nothing between the sun and my shadow
except me. I'm always getting in the way of something...
0~ 0005221510209500052215102095 >