[Info-vax] COBOL example $MGBLSC
Arne Vajhøj
arne at vajhoej.dk
Sat Sep 9 16:37:53 EDT 2023
On 9/9/2023 2:38 PM, bill wrote:
> On 9/9/2023 1:16 PM, Arne Vajhøj wrote:
>> On 9/9/2023 12:47 PM, bill wrote:
>>> On 9/9/2023 12:15 PM, Arne Vajhøj wrote:
>>>> Today it is considered weird that you can insert arbitrary
>>>> spaces in variable names.
>>>>
>>>
>>> That is all about parsing and really has nothing to do with the
>>> function of the language.
>>
>> True.
>>
>> But treating - as _ in Cobol (in some contexts) is also just parsing
>> and not function.
>
> Not really the same. The space is not considered a valid character
> within a name in any language that I know of. In COBOL the "-" and
> "_" are considered valid characters for use in names and should
> therefore be considered different.
> Cases where different characters are considered
> equivalent exist and are covered in the documentation. That is upper
> and lower case letters are considered equivalent. No other characters
> are considered equivalent in any compiler I have worked with except
> the VMS compiler. I would love to see a pointer to any other compiler
> that allows this.
Not the exact same context, but close:
C:\Work>type m2.cob
IDENTIFICATION DIVISION.
PROGRAM-ID.M2.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 I-V PIC 9(9) DISPLAY EXTERNAL.
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
MOVE 123 TO I-V
CALL "R2"
STOP RUN.
C:\Work>type r2.cob
IDENTIFICATION DIVISION.
PROGRAM-ID.R2.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 I_V PIC 9(9) DISPLAY EXTERNAL.
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
DISPLAY I_V.
END PROGRAM R2.
C:\Work>cobc -Wall -free -x m2.cob r2.cob
C:\Work>m2
000000123
Arne
More information about the Info-vax
mailing list