IBM Version 4 Universal Remote User Manual


 
Dᑍerrno PR 9B  EXTPROC('geterrno')
DUser S 12A
DBuffer S 32767A
DReturnPtr S
DReturnInt S 9B 
DFileDesc S 9B 
Dtest_file S 248A INZ('test.file')
DInitialDir S 248A
Dtest_data S 12A INZ('Hello World!')
DBytesWrt S 9B 
DBytesRead S 9B 
DFileName S 249A
DPrintLine S 1A
DNull C CONST(X'')
C
Cᑍ Get and print the real user id with the getuid function.
C
C eval ReturnInt = getuid
C
Cᑍ Check for error and report status.
C
C if ReturnInt = -1
C eval PrintLine = 'Error getting real user id'
C exsr error
C eval ᑍINLR = '1'
C return
C else
C move ReturnInt User
C eval PrintLine = 'The real user id is '
C + %TRIML(User)
C except
C endif
C
Cᑍ Get the current working directory and store it in Buffer.
C
C eval ReturnPtr=getcwd(%ADDR(Buffer)
C : %SIZE(Buffer))
C
Cᑍ Check for error and report status.
C
C if ReturnPtr = ᑍNULL
C eval PrintLine = 'Error getting current directory'
C exsr error
C eval ᑍINLR = '1'
C return
C else
C
Cᑍ Print current directory name remembering to scan for null terminator.
C
C Null scan Buffer NullFound 5 
C eval InitialDir = %SUBST(Buffer:1:NullFound)
C eval PrintLine = 'Current Directory is '
C + InitialDir
C except
C endif
C
Cᑍ Create the file TEST_FILE for writing. If it does not exist,
Cᑍ give the owner authority to read, write, and execute.
B-184 System API Programming V4R1