Problem:
Release 4.0 With SP2 for Server Express the treatment of VALUE clauses in the FILE SECTION has changed.
Before it was used during program start up to initialize the data items with the desired values (line in WORKING-STORAGE), now it is ignored. Because this behaviour is documented, it cannot considered to be a bug.
Questions: Is it possible to get the old behaviour back (maybe by a compiler option)? Or what else solution can you provide to make our old programs run as before?
Example:
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. A.
000300 ENVIRONMENT DIVISION.
000400 INPUT-OUTPUT SECTION.
000500 FILE-CONTROL.
000600 SELECT FQS001 ASSIGN TO XX
000700 ORGANIZATION IS LINE SEQUENTIAL.
000800 DATA DIVISION.
000900 FILE SECTION.
001000 FD FQS001.
001100 01 RQS001 PIC X(80) VALUE ALL "A".
001200 PROCEDURE DIVISION.
001300 DISPLAY RQS001.
001400 STOP RUN.
compile: cob -V a.cbl "-C defaultbyte(85)"
With SP1 the program will output ALL "A"
With SP2 the output will be ALL "U"
Resolution:
This used to be a bug in Server Express 4.0 and has now been rectified. This means therefore that you may have some wrong coding in your previous version taken over to your new version where this bug has been fixed.
Here is a workaround (asterisked out what is wrong):
file-control.
select myfile assign "myfile".
data division.
file section.
fd myfile.
01 myrec.
03 myrec1 pic x(5) value "ABCDE".
03 myrec2 pic x(3).
working-storage section.
procedure division.
* initialize myrec all to value
open output myfile
move "FGH" to myrec2
write myrec
close myfile
open input myfile
read myfile
at end display "oops"
end-read
display "record contains:" myrec
*(output display "ABCDEFGH")
close myfile
stop run.