Programming Examples in C
The following list links to programming examples for the OpenVMS operating system. My intention is to do an example for nearly every LIB$ and SYS$ routine available.
Note that on the pages that show the examples, the navigation menu is not displayed to give me a little room to display the code. Use the browser back button to return to this page or click on the link at the bottom of each page to return to this list.
If you know nothing about LIB$ and SYS$ routines, you should probably start looking at these from the beginning. Else feel free to just dive in anywhere. Later programs will assume that you have read earlier ones.
Most of this code is not commented extensively (unlike my production code, which is obsessively commented).
I do however try to give a brief description of a concept that is used extensively the first time it's used. One thing that deserves mention is error checking. I use a macro to do error checking, and have it included from a file, errchk.h. Don't forget to get this if you want to build the snippets.
Most of the code builds with a simple
$ cc filename
$ link filename
If something special needs to be done, the code will have compile instructions included in comments. Also included in the comments will be warnings about privileges required and the possibility of shooting yourself in the foot by running the code. Read the license and disclaimer before running this code.
As an additional bonus, the code hyperlinks to the OpenVMS documentation for the particular system services or RTL routines called from the code.
As usual, I would be very interested to hear comments or criticisms concerning this code.
Enjoy.
- lib$signal,
- lib$get_ef,
- lib$free_ef,
- lib$get_input,
- lib$put_output,
- sys$bintim,
- lib$add_times,
- lib$sub_times,
- lib$convert_date_string,
- lib$adawi,
- lib$analyze_sdesc,
- lib$analyze_sdesc_64,
- lib$callg,
- lib$bbssi,
- lib$bbcci,
- lib$char,
- lib$crc, lib$crc_table.c,
- lib$getdvi,
- lib$getjpi,
- lib$get_logical,
- lib$currency,
- lib$create_dir, sys$setddir,
- lib$sys_asctim,
- lib$cvtf_from_internal_time,
- lib$cvtf_to_internal_time,
- lib$cvt_vectim,
- sys$creprc,
- lib$cvt_dtb,
- lib$cvt_htb,
- lib$cvt_otb,
- lib$date_time,
- lib$day,
- lib$day_of_week,
- lib$delete_file,
- lib$digit_sep,
- lib$do_command,
- lib$wait,
- lib$spawn,
- lib$set_logical,
- lib$delete_logical,
- lib$set_symbol,
- lib$delete_symbol,
- lib$create_vm_zone, lib$get_vm, lib$show_vm, lib$show_vm_zone, lib$verify_vm_zone, lib$free_vm, lib$delete_vm_zone, lib$find_vm_zone, lib$stat_vm,
- lib$fid_to_name,
- lib$init_timer, lib$show_timer, lib$stat_timer, lib$free_timer,
- sys$putmsg,
- lib$establish, lib$revert,
- lib$find_file, lib$find_file_end,
- lib$addx,
- lib$getsyi,
- lib$get_command,
- lib$put_commmon, lib$get_common,
- lib$subx,
- lib$run_program,
- lib$sys_fao,
- lib$sys_faol,
- lib$sys_getmsg,
- lib$format_date_time, lib$get_maximum_date_length,
- lib$get_users_language,
- lib$ichar,
- lib$len,
- lib$index,
- lib$pause,
- lib$lp_lines,
- lib$polyg,
- lib$radix_point,
- lib$insqhi, lib$insqti, lib$remqhi, lib$remqti,
- sys$asctoid,
- lib$stop,
- lib$rename_file,
- lib$lookup_key,
- lib$locc,
- lib$matchc,
- lib$movc3,
- lib$movc5,
- lib$ediv,
- lib$insert_tree, lib$lookup_tree, lib$traverse_tree,
- lib$emul,
- lib$extv,
- lib$extzv,
- lib$ffc,
- sys$dclast,
- lib$ast_in_prog,
- sys$getjpiw,
- sys$getjpi, sys$clref, sys$setef, sys$waitef,
- sys$assign, sys$dassgn,
- sys$getdvi, lib$reserve_ef, sys$wfland,
- sys$getdviw,
- sys$setprv,
- sys$setimr, sys$cantim, sys$hiber, sys$wake,
- sys$exit,
- sys$crembx,
- sys$delmbx,
- sys$ascefc, sys$dlcefc, sys$wflor, sys$readef, sys$dacefc,
- lib$getqui, lib$get_accnam, lib$format_sogw_prot,
- sys$gettim, sys$numtim,
- sys$setpri,
- sys$add_ident, sys$add_holder, sys$grantid, sys$revokid, sys$rem_holder, sys$rem_ident,
- sys$asctim,
- lib$get_foreign,
- lib$get_hostname, lib$expand_nodename, lib$get_fullname_offset, lib$sget1_dd, lib$sfree1_dd,
- sys$alloc, sys$dalloc,
- sys$device_scan,
- sys$erapat, sys$dismou, sys$mount, sys$qiow,
- sys$getsyi, sys$getsyiw, sys$synch,
- lib$enable_ctrl, lib$disable_ctrl,
- sys$create, sys$connect, sys$extend, sys$put, sys$flush, sys$get, sys$disconnect, sys$close, sys$erase,
- sys$purgws,
- sys$schdwk, sys$canwak,
- lib$file_scan, lib$file_scan_end,
- lib$sig_to_ret, lib$sig_to_stop,
- sys$add_proxy, sys$display_proxy, sys$verify_proxy, sys$delete_proxy,
- sys$crelnt, sys$crelnm, sys$dellnm,
- sys$getenv,
- sys$trnlnm,
- sys$dclexh, sys$canexh,
- sys$delprc,
- sys$cmkrnl,
- sys$getuai, sys$setuai,
- lib$find_image_symbol,
- sys$crmpsc, sys$updsec, sys$deltva,
- sys$adjwsl,
- sys$ascutc, sys$binutc, sys$numutc,
- sys$lkwset, sys$ulwset,
- lib$get_symbol,
- lib$get_vm_page, lib$free_vm_page,
- lib$asn_wth_mbx,
- sys$audit_eventw,
- sys$setup_avoid_preempt, sys$avoid_preempt,
- sys$sndopr,
- sys$brkthruw,
- sys$getutc,
- sys$resched,
- sys$setprn,
- sys$timcon,
- sys$icc_open_assoc, sys$icc_connectw, sys$icc_disconnectw, sys$icc_accept, sys$icc_receivew, sys$icc_transmitw, sys$icc_close_assoc,
- sys$setdfprot,
- sys$check_privilegew,
- sys$create_region_64, sys$cretva_64, sys$expreg_64, sys$setprt_64, sys$deltva_64, sys$delete_region_64,
- sys$start_transw, sys$end_transw, sys$abort_transw,
- sys$check_access,
- sys$find_held, sys$idtoasc, sys$find_holder, sys$finish_rdb,
- lib$insv,
- lib$mult_delta_time, lib$multf_delta_time,
- sys$lckpag, sys$ulkpag,
- sys$create_user_profile, sys$persona_create, sys$persona_modify, sys$persona_assume, sys$persona_clone, sys$persona_delete,
- sys$show_intrusion, sys$delete_intrusion,
- sys$getquiw, sys$sndjbcw,
- sys$setast,
- sys$hash_password,
- sys$acmw,
- sys$cmexec, sys$getlkiw,
- lib$tparse, lib$table_parse,
- sys$forcex,
- sys$fao, sys$faol,
- lib$tra_asc_ebc, lib$tra_ebc_asc,
- sys$start_align_fault_report, sys$get_align_fault_data, sys$stop_align_fault_report,
- sys$chkpro, sys$get_security,
- sys$setshlv,
- sys$setrwm,
- sys$set_process_propertiesw,
- sys$set_security, sys$parse_acl,
- sys$subsystem,
- sys$setcluevt, sys$tstcluevt, sys$clrcluevt,
- lib$scanc,
- lib$get_date_format,
- lib$emodg,
- lib$cvt_dx_dx,
- lib$scopy_dxdx,
- sys$process_scan,
- lib$skpc,
- lib$movtc,
- lib$scopy_r_dx,
- sys$create_bufobj, sys$delete_bufobj, sys$io_setup, sys$io_performw, sys$io_cleanup,
- sys$perm_report_align_fault, sys$perm_dis_align_fault_report,
- sys$crmpsc_gdzro_64, sys$mgblsc_64, sys$dgblsc,
- sys$setpra,
- sys$setswm,
- sys$io_fastpathw,
- sys$cpu_capabilities, sys$get_user_capability, sys$process_capabilities, sys$free_user_capability,
- sys$cancel,
- sys$check_fen,
- sys$cvt_filename,
- sys$dclcmh,
- sys$filescan,
- sys$format_audit,
- sys$get_region_info,
- sys$set_implicit_affinity,
- sys$suspnd, sys$resume,
- sys$unwind, lib$match_cond, sys$getmsg,
- sys$snderr,
- sys$clrast,
- sys$create_uid,
- sys$getrmi,
- sys$set_system_event, sys$clear_system_event,
- sys$acquire_galaxy_lock, sys$create_galaxy_lock, sys$create_galaxy_lock_table, sys$delete_galaxy_lock, sys$delete_galaxy_lock_table, sys$get_galaxy_lock_info, sys$get_galaxy_lock_size, sys$release_galaxy_lock,
- sys$create_gpfn, sys$mgblsc_gpfn_64,
- lib$lock_image, lib$unlock_image,
- lib$spanc,
- sys$wait, sys$read, sys$write, sys$enter, sys$remove,
- sys$init_vol,
- sys$rpcc_64,
- sys$enqw, sys$deq