Document Number: J4/02-0234
30 October 2002
Page 1 of 3
Subject:
SELECT WHEN clause
Author:
Wim Ebbinkhuijsen
Date:
2002-10-30
References:
1. Item 13.16.41, RECORD clause, GR 8, first sentence
2. Item 13.16.49, SELECT WHEN clause, Introduction
REQUEST FOR INTERPRETATION
Select file-1 assign to ….. format character numeric data.
...
FD file-1 record is varying in size from 81 to 301 characters.
01 record-1 select when condition-1.
03 rec-type-a pic X.
88 condition-1
value 'A'.
88 condition-2
value 'B'.
03 pic X(100).
03
pic 9(30).
01 record-2 select when condition-2.
03 pic X.
03 pic 1(50).
03
pic X(30).
01 record-3 select when other.
03 pic X.
03 pic X(300).
...
Move 'C' to rec-type-a
Write record-1
Question 1
There is no rule that explicitly states that the length of the record that is released to the
operating system by the successful execution of a WRITE statement specifying
record-name-1 is defined by the record description referenced by record-name-1.
Traditionally, it has always been treated this way (and probably always implemented
too).
I therefore take this as granted, but I suggest to add a GR about this.
Question 2
Document Number: J4/02-0234
30 October 2002
Page 2 of 3
According to reference 1, the number of bytes associated with the record description
of 'record-1' is 131.
According to reference 2, the record description of 'record-3' will be associated with the
record. According to reference 1, the number of bytes associated with the record
description of 'record-3' is 301.
What will be the size of the record being written?
Question 3
Add the following code:
Select file-1 assign to ….. format character numeric data.
...
FD file-2 record is varying in size from 81 to 301 characters.
01 record-4 select when condition-3.
03 rec-type-b pic X.
88 condition-3
value 'A'.
88 condition-4
value 'B'.
03 pic X(100).
03
pic 9(30).
01 record-5 select when condition-4.
03 pic X.
03 pic 1(50).
03
pic X(30).
01 record-6 select when other.
03 pic X.
03 pic X(300).
...
and change the WRITE statement in the coded example into
Write file file-1 from record-4
Will the SELECT WHEN clauses in the record descriptions of 'file-2' have any effect
upon the execution of the WRITE statement?
Questions 4, 5 and 6
Questions 1, 2 and 3 also apply to the REWRITE statement.
Questions 7 and 8
Document Number: J4/02-0234
30 October 2002
Page 3 of 3
Questions 1 and 2 also apply to the RELEASE statement.