Code Comments
Programming Forum and web based access to our favorite programming groups."Chuck Stevens" <charles.stevens@unisys.com> writes:
> Hmmm. I don't have any problem with the following program using either of
> the COBOL compilers supported for the Unisys MCP systems ('74 and '85
> standards respectively):
>
> IDENTIFICATION DIVISION.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 77 FACT-RES PIC 9(8).
> 77 ARGUMENT PIC 9(8).
> PROCEDURE DIVISION.
> MAIN-LINE.
> MOVE 1 TO FACT-RES. MOVE 5 TO ARGUMENT.
> PERFORM COMPUTE-FACTORIAL.
> DISPLAY FACT-RES.
> STOP RUN.
> COMPUTE-FACTORIAL.
> IF ARGUMENT > 1
> COMPUTE FACT-RES = FACT-RES * ARGUMENT
> SUBTRACT 1 FROM ARGUMENT
> PERFORM COMPUTE-FACTORIAL.
OK, this works for me (OpenCobol) after indenting by 8 and introducing a
line 2
PROGRAM-ID. FACTORIAL.
Thanks, Nicolas.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.