COBOL Sign条件

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 WS-NUM1 PIC S9(9) VALUE -1234.
   01 WS-NUM2 PIC S9(9) VALUE 123456.

PROCEDURE DIVISION.
   A000-FIRST-PARA.
   IF WS-NUM1 IS POSITIVE THEN
      DISPLAY 'WS-NUM1 IS POSITIVE'.

   IF WS-NUM1 IS NEGATIVE THEN
      DISPLAY 'WS-NUM1 IS NEGATIVE'.

   IF WS-NUM1 IS ZERO THEN
      DISPLAY 'WS-NUM1 IS ZERO'.

   IF WS-NUM2 IS POSITIVE THEN
      DISPLAY 'WS-NUM2 IS POSITIVE'.

STOP RUN.

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265750.html

(0)
上一篇 2022年6月7日
下一篇 2022年6月7日

相关推荐

发表回复

登录后才能评论