IBM Version 4 Universal Remote User Manual


 
C
C eval FileName = %TRIMR(test_file) + Null
C eval FileDesc = open(%ADDR(FileName)
C : x'1A' : x'1C')
C
Cᑍ Check for error and report status.
C
C if FileDesc = -1
C eval PrintLine = 'Could not create file'
C exsr error
C eval ᑍINLR = '1'
C return
C else
C eval PrintLine = 'File '
C + %TRIMR(test_file)
C + ' created successfully'
C except
C end
C
Cᑍ Write test_data to test_file via FileDesc returned by open
C
C eval BytesWrt = write(FileDesc
C : %ADDR(Test_Data)
C : %SIZE(Test_Data))
C
Cᑍ Check for error and report status. If an error occurs,
Cᑍ attempt cleanup.
C
C if BytesWrt = -1
C eval PrintLine = 'Could not write to file'
C exsr error
C eval ReturnInt = close(FileDesc)
C eval ReturnInt = unlink(%ADDR(FileName))
C eval ᑍINLR = '1'
C return
C else
C eval PrintLine = 'Wrote to '
C + %TRIMR(test_file)
C + ' successfully'
C except
C endif
C
Cᑍ Close test_file via FileDesc
C
C eval ReturnInt = close(FileDesc)
C
Cᑍ Check for error and report status. If an error occurs,
Cᑍ attempt cleanup.
C
C if ReturnInt = -1
C eval PrintLine = 'Could not close file'
C exsr error
C eval ReturnInt = close(FileDesc)
C eval ReturnInt = unlink(%ADDR(FileName))
C eval ᑍINLR = '1'
C return
C else
C eval PrintLine = 'File '
Appendix B. Original Examples in Additional Languages B-185