Win32 API ルーチン呼び出し例

制限事項 This topic applies to Windows environments (local development) only.

次のプログラムは、現在の日付と時間を検索するために、API ルーチンを使用したものです。

 special-names.
     call-convention 74 is winapi.
 working-storage section. 
 01 system-time.
     03 system-year     pic 9(4) comp-5.
     03 system-month    pic 9(4) comp-5.
     03 system-day-of-week  pic 9(4) comp-5.
     03 system-day    pic 9(4) comp-5.
     03 system-hour    pic 9(4) comp-5.
     03 system-minute   pic 9(4) comp-5.
     03 system-second   pic 9(4) comp-5.
     03 system-millisecond  pic 9(4) comp-5.

 procedure division.
     call "cob32api"
     $if NOILGEN defined
         call "cob32api"
     $end
     call winapi "GetSystemTime" using
                  by reference system-time
     display "Day of week is:  " system-day-of-week
     display "Day of month is:  " system-day
     stop run.