Dᑍerrno PR 9B EXTPROC('geterrno')
DUser S 12A
DBuffer S 32767A
DReturnPtr S ᑍ
DReturnInt S 9B
DFileDesc S 9B
Dtest_file S 248A INZ('test.file')
DInitialDir S 248A
Dtest_data S 12A INZ('Hello World!')
DBytesWrt S 9B
DBytesRead S 9B
DFileName S 249A
DPrintLine S 1A
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