How to accept a signed number from a user and display the number in COBOL

2 Answers

0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. INPUT_NUMBERS.
DATA DIVISION.
    WORKING-STORAGE SECTION.
        77 SNUM PIC S9(4).                      
PROCEDURE DIVISION.
    ACCEPT SNUM.                       
    DISPLAY SNUM.              
STOP RUN.


*> STDIN
*>    -0291


*> run:
*>
*> -0291
*>

 



answered Oct 25, 2024 by avibootz
0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. INPUT_NUMBERS.
DATA DIVISION.
    WORKING-STORAGE SECTION.
        77 SNUM PIC S9(4).                      
PROCEDURE DIVISION.
    ACCEPT SNUM.                       
    DISPLAY SNUM.              
STOP RUN.


*> STDIN
*>    2958


*> run:
*>
*> +2958
*>

 



answered Oct 25, 2024 by avibootz

Related questions

1 answer 155 views
1 answer 230 views
1 answer 207 views
207 views asked Aug 26, 2022 by avibootz
1 answer 315 views
315 views asked Sep 17, 2020 by avibootz
...