IBM Version 4 Universal Remote User Manual


 
C + %TRIMR(test_file)
C + ' closed successfully'
C except
C endif
C
Cᑍ Open the file for read only
C
C eval FileDesc = open2(%ADDR(FileName)
C : x'1')
C
Cᑍ Check for error and report status. If an error occurs,
Cᑍ attempt cleanup.
C
C if FileDesc = -1
C eval PrintLine = 'Open of file failed'
C exsr error
C eval ReturnInt = unlink(%ADDR(FileName))
C eval ᑍINLR = '1'
C return
C else
C eval PrintLine = 'Open of file successful'
C except
C endif
C
Cᑍ Read from file
C
C eval BytesRead = read(FileDesc
C : %ADDR(Buffer) : %SIZE(Buffer))
C
Cᑍ Check for error and report status. If an error occurs,
Cᑍ attempt cleanup.
C
C if BytesRead = -1
C eval PrintLine = 'Read failed'
C exsr error
C eval ReturnInt = close(FileDesc)
C eval ReturnInt = unlink(%ADDR(FileName))
C eval ᑍINLR = '1'
C return
C else
C if BytesRead = BytesWrt
C eval PrintLine = 'Data successfully read: '
C + %TRIMR(Buffer)
C else
C eval PrintLine = 'Data truncation on read'
C endif
C except
C endif
C
Cᑍ Close the LinkName file
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 = 'Close of link failed'
B-186 System API Programming V4R1