HP3000-L Archives

December 1998, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Glenn J. Koster, Sr." <[log in to unmask]>
Reply To:
Date:
Thu, 17 Dec 1998 07:27:38 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (58 lines)
Cary Marshall wrote:

> I thought that if you initialized the file at the 01 level, then
> values at the 02, 03, etc levels would be properly initialized.

The answer is both a yes and a no.  You cannot do it in the working
storage section.  If you include a "VALUE" clause at the 01 level - all
fields get that value regardless of their type designation.  For
instance, coding the following would result in spaces in a numeric
field:

    01  GRP-A             VALUE SPACES.
        05  ALPH-FLD-A    PIC X(10).
        05  NUM-FLD-B     PIC 9(10).

However, you can always used the "INITIALIZE" verb in the procedure
division.  There are some "gotchas" that you need to be concerned with
particularly with what happens with "REDEFINES" clauses.  An example
(straight from the manual)...

     WORKING-STORAGE SECTION.
     01 A.
        05 B     PIC 999.
        05 C REDEFINES B.
           10 D  PIC X.
           10 E  PIC XX.
              :
     PROCEDURE DIVISION.
              :
          INITIALIZE A.
          INITIALIZE C.
          INITIALIZE C  A.

When the INITIALIZE statements in the example above are executed, the
data items are initialized as follows:

   1.  In the first INITIALIZE, B is set to zeroes, while C, D and E are
       ignored.

   2.  In the second INITIALIZE, D and E are set to blanks.

   3.  In the third INITIALIZE, D and E are set to blanks.  B is set to
       zeroes.  The net effect is that D and E are set to zeroes.

Glenn
--
 ______________
|  Navigators  | Under contract to Hewlett-Packard ISG (Greeley, CO)
|     |)       |
|     | )      | Glenn J. Koster, Sr.             [log in to unmask]
|     |  )     | Managed Business Solutions    http://www.mbsnav.com
|     |   )    | 214 S. College, Suite 201              970 350-5337
|     |----    | Fort Collins, CO  80524                970 224-1016
| ============ |
| \__________/ |
|   of Change  | aka:  [log in to unmask]
|______________| home: http://members.aol.com/MichiTex

ATOM RSS1 RSS2