- 1 Getting started
- 2 Compile
- 3 Customize
- 4 Optimize
- 5 Debug
- 6 Non-standard extensions
- 7 System Routines
- 附录 A
- 附录 B
- 附录 E
- 附录 I
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
7.2 CBL_GC_HOSTED
CBL_GC_HOSTED
provides access to the following C hosted variables:
argc
to binary-long by valueargv
to pointer to char **stdin
,stdout
,stderr
to pointererrno
giving address of errno in pointer to binary-long, use based for more direct access
and conditional access to the following variables:
tzname
pointer to pointer to array of two char pointerstimezone
C long, will be seconds west of UTCdaylight
C int, will be 1 during daylight savings
System will need to HAVE_TIMEZONE
defined for these to return anything meaningful. Attempts made when they are not available return 1 from CBL_GC_HOSTED
.
It returns 0 when match, 1 on failure, case matters as does length, arg
won’t match.
The usage of this system routine is described by the following example.
HOSTED identification division. program-id. hosted. data division. working-storage section. 01 argc usage binary-long. 01 argv usage pointer. 01 stdin usage pointer. 01 stdout usage pointer. 01 stderr usage pointer. 01 errno usage pointer. 01 err usage binary-long based. 01 domain usage float-long value 3.0. 01 tzname usage pointer. 01 tznames usage pointer based. 05 tzs usage pointer occurs 2 times. 01 timezone usage binary-long. 01 daylight usage binary-short. *> Testing CBL_GC_HOSTED procedure division. call "CBL_GC_HOSTED" using stdin "stdin" display "stdin : " stdin call "feof" using by value stdin display "feof stdin : " return-code call "CBL_GC_HOSTED" using stdout "stdout" display "stdout : " stdout call "fprintf" using by value stdout by content "Hello" & x"0a" call "CBL_GC_HOSTED" using stderr "stderr" display "stderr : " stderr call "fprintf" using by value stderr by content "on err" & x"0a" call "CBL_GC_HOSTED" using argc "argc" display "argc : " argc call "CBL_GC_HOSTED" using argv "argv" display "argv : " argv call "args" using by value argc argv call "CBL_GC_HOSTED" using errno "errno" display "&errno : " errno set address of err to errno display "errno : " err call "acos" using by value domain display "errno after acos(3.0): " err ", EDOM is 33" call "CBL_GC_HOSTED" using argc "arg" display "'arg' lookup : " return-code call "CBL_GC_HOSTED" using null "argc" display "null with argc : " return-code display "argc is still : " argc *> the following only returns zero if the system has HAVE_TIMEZONE set call "CBL_GC_HOSTED" using daylight "daylight " display "'timezone' lookup : " return-code if return-code not = 0 display "system doesn't has timezone" else display "timezone is : " timezone call "CBL_GC_HOSTED" using daylight "daylight " display "'daylight' lookup : " return-code display "daylight is : " daylight set environment "TZ" to "PST8PDT" call static "tzset" returning omitted on exception continue end-call call "CBL_GC_HOSTED" using tzname "tzname" display "'tzname' lookup : " return-code *> tzs(1) will point to z"PST" and tzs(2) to z"PDT" if return-code equal 0 and tzname not equal null then set address of tznames to tzname if tzs(1) not equal null then display "tzs #1 : " tzs(1) end-if if tzs(2) not equal null then display "tzs #2 : " tzs(2) end-if end-if end-if goback. end program hosted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论