On Thursday, April 08, 1999, 06:06 AM, Kevin G. Bohenek wrote: Can anyone please explain how the function INITIALIZE works? In our CBL & CBLLE programs, we have the following: Initialize EXHMAS-Rec, Move some values in the key, and then writing the record. The COMP and SIGNED numeric fields have a value of HEX '40' not zeros like we expected. There are no redefines and no occurs within the externally described DDS. P.S – The Initialize works when using a copybook or described record within the pgm. The first time I coded a COBOL program on the AS/400, I did the same thing you are doing. The problem is not the INITIALIZE command, but what you are trying to initalize. When a COBOL program uses an external file definition, the FD is defined like this, FD EXHMAS-FILE. 01 EXHMAS-REC. copy DDS-ALL-FORMATS OF EXHMAS ALIAS. When this expands out it becomes FD EXHMAS-FILE. 01 EXHMAS-REC. 05 EXHMAS-RECORD PIC X(length of record). 05 (first record format defined in external file) REDEFINES EXHMAS-RECORD. 10 alpha-filed pic x(3). 10 numeric field pic 9(3). 05 (second record format defined in external file) REDEFINES EXHMA-RECORD.. 10 .... A file can have more than one record format. The COBOL compiler creates a 05 level redefine for each record format in the external file. If you INITALIZE the 01 EXHMAS-REC the record will be all hex(40) as the format is one long character record. The redefine contains the format of the fields for the record format. Initalize the 05 redefine not the 01 level. JHicks@SUZ.com

Reply With Quote