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

gnubol: Examine, Truncation, De-editing



I broke the screen on my laptop computer, so I wasn't doing much 
email.  Now I have a functional computer, but I'm working full time.  I'm 
trying to catch up with my email.


Let me weigh in with The Truth As I Know It about EXAMINE:  The COBOL-68 
standard (X3.23-1968) contained the verb EXAMINE.  The semantics in the 
standard didn't quite match the semantics in the JOD and neither quite 
matched what was really wanted or what was really implemented.  For 
COBOL-74, the J4 committee decided to get it right, which meant scrapping 
the existing EXAMINE.  Rather than obsolete existing programs, J4 decided 
to change the verb name to INSPECT, so that vendors could continue to 
support the old syntax and semantics of EXAMINE.

They are not the same.  You can change EXAMINE to INSPECT for the simple 
case, but if you use TALLYING or REPLACING, the syntax and semantics are 
different.  In EXAMINE there's a reserved data-name TALLY which holds the 
tally, while in INSPECT the data name is specified in the TALLYING 
phrase.  I don't recall the other differences.

At 15:13 1/29/00 , William M. Klein wrote:
 >As far as "truncation" warnings go, some compilers do this and some don't.
 >The results are "well-defined" and some programmers hate these messages -
 >while others "love them".  (When IBM went from OS/VS COBOl to VS COBOL II,
 >the "loss" of the truncation warning message for numeric - not alphanumeric
 >items - was often talked about.  However, I think that most current IBM
 >mainframe programmers would be surprised if these messages were ever
 >"resurrected".)

Are you telling me that if I write this:

     05  TOTAL-BAL       PIC 9(6)V99.
     05  PRINT-BAL       PIC $$$,$$$.99.

     MOVE TOTAL-BAL TO PRINT-BAL.

I will not get a truncation warning?  That's terrible.  Gnubol should give 
a warning, though there should be a way to turn off that class of warnings.

At 15:13 1/29/00 , William M. Klein wrote:
>I *believe* that it is true that most existing compilers "believe the data"
>and not the picture clause.  Therefore, they do move "AB" in this specific
>MOVE statement.  However, I do know of some compilers (at least when running
>in "optimize" mode) that "believe" the picture clause (at least sometimes).
>Therefore, they can "figure out" at compile time that the only thing that
>SHOULD need to be moved at run-time is that first byte - and can
>"pre-determine" that the second byte that should go to the receiving items is
>always SUPPOSED to be a "/" - and they can do this with a more efficient
>"literal" move (at compile-time).

If a compiler produces different results with optimize set, the 
non-optimized version is normally correct.

At 04:14 1/30/00 , RKRayhawk@aol.com wrote:
>So the counter-point would be, assuming elementary moves: when do you not
>want de-editing to happen? And why? Can you state the reasons that you expect
>universal agreement on that?

De-editing was introduced in COBOL-85.  In COBOL-74, moving from X/X to XXX 
was legal, and no one expected it to be de-edited, so COBOL-85 didn't touch 
that.  Moving 9/9 to 99 was illegal in COBOL-74, so COBOL-85 made it legal 
and called for de-editing.

I still wish alphanumeric de-editing existed, but it obviously won't be in 
COBOL-20XX.

BTW, the word "de-edit" is COBOL jargon.  I don't believe "de-edit" exists 
anywhere in the English language outside COBOL.

And I came across an interesting editing problem recently.  When the value 
000131 is moved to PIC ZZ/ZZ/ZZ, what should result?  I always thought 
slash behaved like comma so I expected "    1/31", but the compiler I'm 
using produced "  / 1/31" which looks better.

--
RB |\  Randall Bart
aa |/  Barticus@usa.net        1-818-985-3259       Barticus@att.net
nr |\  8321 Burnet Av #1, North Hills, CA 91343
dt ||\                                Computer Programmer since 1972
a   |/ I Love You               12 years Unisys/Burroughs experience
l   |\ MS^7=6/28/107                          Will work for paycheck
l   |/ DOT-HS-808-065   http://users.aol.com/PanicYr00/RBResume.html

--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.