OpenVMS Source Code Demos
DEMO_STRING_IO_OPERATIONS_A.BAS
1000 %title "demo_string_io_operations_a.bas" !
declare string constant k_program = "demo_string_io_operations_a" !
!================================================================================================
! file : demo_string_operations_a.bas
! author : NSR
! date : 2012-09-06
! purpose: quick hack to compare string i/o operations in VMS-BASIC-1.7
! build1 : bas/nooptim/list/machine demo_string_io_operations_a.bas
! : link demo_string_io_operations_a
! build2 : bas/optim=level=4/list/machine demo_string_io_operations_a.bas
! : link demo_string_io_operations_a
! run : sh acc see current accounting
! : set acc/ena enable all accounting
! : set acc/new enable new log
! : run demo_string_io_operations_a/accounting/out=nl:/input=nl: test version a
! : run demo_string_io_operations_b/accounting/out=nl:/input=nl: test version b
! : set acc/dis disable all accounting
! : acc/full browse the accounting log
!================================================================================================
option type=explicit ! cuz tricks are for kids
!=======================================================================
! main
!=======================================================================
main:
print k_program !
print string$(len(k_program), asc("=")) !
!
%let %concat = 0 !
%if %concat = 0 !
%then !
print "variation 0" !
%else !
print "variation 1" !
%end %if !
!
declare string default_dir$
!
map (routine_history_73) &
string d73_whole_record = 84, ! &
d73_align = 0 !
map (routine_history_73) &
string d73_id = 4, ! routine id number &
d73_date = 14, ! YYYYMMDDhhmmss &
d73_status = 1, ! line status &
d73_group = 3, ! group &
d73_initials = 3, ! initials &
d73_text = 59, ! the name says it all &
d73_align = 0
!
default_dir$ = "csmis$dat:"
!
open default_dir$ + "routinedb_hist_30.dat" for input as #73 &
,access modify &
,allow modify &
,organization indexed &
,map routine_history_73 &
,contiguous &
,primary key (d73_id ) duplicates descending &
,alternate key (d73_id,d73_date) duplicates changes descending
!
open k_program +".dat" for output as #1 &
,organization sequential &
,recordsize 32767
!
when error in !
while 1 !
get #73, regardless !
%if %concat = 0 !
%then ! this appears to be a little more costly
print #1, d73_id; " "; d73_date; " "; d73_status; " "; d73_group; " "; d73_initials; " "; edit$(d73_text,128)
%else ! this appears to be a little less costly
print #1, d73_id +" "+ d73_date +" "+ d73_status +" "+ d73_group +" "+ d73_initials+ " "+ edit$(d73_text,128)
%end %if !
next !
use !
print "-i-status: "+ str$(err) !
end when !
close #1
close #73
!
fini:
end