Problem:

When a file gets created in the IFS, the default ownership is usually set to the person that created the IFS file. How can file ownership be changed using the DBTODELIM or DBSQLIFS commands ?

Solution:

There are a couple of ways to accomplish changing the authority for a new IFS file:
 
Run the CHGAUT command to change the authority as needed after the DBTODELIM or DBSQLIFS commands are run. This works with all versions of DataExport/400 since the CHGAUT command is an AS/400 command.
 
Example to give all users access to a newly created IFS file named /REPORTS/REPORT.PDF:
 
CHGAUT OBJ('/REPORTS/REPORT.PDF') USER(*PUBLIC) DTAAUT(*RWX) OBJAUT(*ALL)
 
-or-
 
Upgrade to the DataExport V1.10 or above AS/400 library (RJSEXPORT) and the DBTODELIM and DBSQLIFS commands can now change authorities automatically as a file is created in the IFS if desired.
 
Example to run DBTODELIM and change the IFS file authority so all users can access the file:
DBTODELIM FILE(QIWS/QCUSTCDT) FILNAM('/DATA.TXT') CHGAUT(*YES) USER(*PUBLIC) DTAAUT(*RWX) OBJAUT(*ALL)
 
Example to run DBSQLIFS and change the IFS file authority so all users can access the file:
DBSQLIFS SQL('SELECT * FROM QIWS/QCUSTCDT') IFSFILE('/AS400FILE.TXT') CHGAUT(*YES) USER(*PUBLIC) DTAAUT(*RWX) OBJAUT(*ALL)

Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016