× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



"COBOL400-L" <cobol400-l-bounces@xxxxxxxxxxxx> wrote on 08/17/2016
01:00:06 PM:
----- Message from "Stone, Joel" <Joel.Stone@xxxxxxxxxx> on Tue, 16
Aug 2016 20:11:29 +0000 -----

To:

"'COBOL Programming on the IBM i (AS/400 and iSeries)'" <cobol400-
l@xxxxxxxxxxxx>

Subject:

Re: [COBOL400-L] DDS DFT for date field: does COBOL honor DFT value
with initialize or WRITE verb?

Hi Chuck

Thanks for your detailed explanation.

Im not sure that it makes sense though. It sounds like you are
stating that because COBOL loads an entire record into the buffer
prior to WRITE-ing it, therefore the OS will ignore the DDS DFT
constraints that established.

However, COBOL does honor various other requirements that are
established in the DDS. For example if I have a numeric field
described in DDS, then COBOL will properly initialize that to
zeroes. This will occur properly with both LF and PF WRITEs.

Why does COBOL adhere to numeric constraints on a field during the
record add process, but ignores the DFT constraints?

Thanks!

Joel

They aren't technically constraints, they are defaults for the COBOL data
types. COBOL will initialize appropriate values for all data types except
time, date and Boolean. (I don't recall whether pointers are handled--more
on that below.) I believe this is because those data types are extensions
to the COBOL standard--although I'm unclear why IBM could get approval to
extend the standards for the data types, but not their initialization
values. (I'm speaking strictly on my quasi-scientific guess--I have no
inside information.)

I believe the logic for the compiler to initialize values to DDS DFT
values wouldn't be worth the payback. It's simpler for the compiler to
initialize elements to COBOL data type defaults.)

At any rate COBOL isn't really adhering to any DDS constraints. The
constraint is on the COBOL item data type. For further reference I look at
the INITIALIZE statement. The manual lists the following as exceptions to
INITIALIZE statement processing:

---------------------------------------------

Index, pointer, and procedure-pointer data items
Elementary FILLER data items
Items that are subordinate to identifier-1 and contain a REDEFINES clause,
or any items subordinate to such an item. (However, identifier-1 may
contain a REDEFINES clause or be subordinate to a redefining item.)
BOOLEAN data items
Data items described with the FORMAT clause as DATE, TIME, or TIMESTAMP .

---------------------------------------------

RPG when handling the RESET opcode, will restore any "variable to the
value held at the end of the *INIT phase." Meaning it's value at the end
of the *INZSR. I don't believe that takes into account DDS DFT values
either--correct me if I'm wrong. Regardless, COBOL just doesn't handle
things the same. That's a fact of life I've had to get used to when
working in COBOL.

Michael Quigley
Computer Services
The Way International
www.TheWay.org

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.