Chapter 19. Using the QNetWare File System

The QNetWare file system provides access to NetWare files, directories, and NetWare Directory Services (NDS) objects through the AS/400 integrated file system (IFS). This file system also supports saving and restoring of NetWare data when the Integrated PC Server is in the Restricted state. 

This chapter describes how you can access the NetWare file system from the AS/400 by using the QNetWare file system. 


Integrated File System Introduction

Some of the file systems that you can access through the common interface of the integrated file system are the following: 
 
Root The / file system. This file system takes full advantage of the stream file support and hierarchical directory structure of the integrated file system. The root file system has the characteristics of the Disk Operating System (DOS) and OS/2 file systems. 
QOpenSys The open systems file system. This file system is compatible with UNIX**-based open system standards, such as POSIX** and XPG. Like the root file system, it takes advantage of the stream file and directory support that is provided by the integrated file system. In addition, it supports case-sensitive object names. 
QSYS.LIB The library file system. This file system supports the AS/400 library structure. This file system provides access to database files and all of the other AS/400 object types that the library support manages. 
QDLS The document library services file system. This file system supports the folders structure. It provides access to documents and folders. 
QNetWare The QNetWare file system. This file system provides access to local or remote data and objects that are stored on servers that run Novell NetWare 3.12 or 4.1. A user can dynamically mount NetWare file systems over existing local file systems. This file system also supports saving and restoring of NetWare data. 
QLANSrv The LAN Server file system. This file system provides access to the same directories and files that are accessible through the LAN Server licensed program. It allows users of the OS/400 file server and AS/400 applications to use the same data as LAN Server clients. 
QOPT The optical file system. This file system provides access to stream data that is stored on optical media. 
NFS The Network File System. This file system provides the user with local access to data and objects that are stored on a remote NFS server. 
UDFS The user-defined file system (UDFS). This file system resides on the Auxiliary Storage Pool (ASP) of the user's choice. The user creates and manages this file system. 

Users and application programs can interact with any of the file systems through a common integrated file system interface. This interface is optimized for input/output of stream data, in contrast to the record input/output provided through the data management interfaces. A set of user interfaces (commands, menus, and displays) and application program interfaces (APIs) is provided for interacting with the file systems through this common interface. 

For more information about the integrated file system, and for a complete list of possible file systems you can access through the common interface of the integrated file system, see the Integrated File System Introduction book. 


QNetWare File System Introduction

You can use the QNetWare file system to: 

  • Access data stored on a local or remote Integrated PC server (Integrated PC Server) running Novell NetWare 4.10. 
  • Access data stored on PC servers running Novell NetWare 3.12 or 4.1. You can access data on these servers and Integrated PC Servers simultaneously, by using authentication entries. 
  • Access NetWare Directory Services** (NDS**) objects. 
  • Dynamically mount NetWare file systems over any local mountable file system. Flexible mount options, similar to the MAP command, simplify and speed access to NetWare files. 
  • Store data in stream files. 
  • Save and restore NetWare volumes, storage spaces, objects, directories, and files. 

QNetWare Directory Structure

QNetWare file system provides a hierarchical directory structure that allows users and application programs to access objects in the QNetWare directory on the AS/400.   The QNetWare directory is at the root of the QNetWare file system. The QNetWare directory is only present when Enhanced Integration for NetWare is installed on the AS/400. QNetWare appears after the first IPL after the product is installed. 

  You can create and manipulate NetWare files and directories that use QNetWare as the root directory through application program interfaces (APIs). APIs allow application programming and data sharing between workstations. 

The QNetWare file system is similar to other file systems; it uses directories and subdirectories to store data. This data can be accessed by CA/400 and AS/400 users. 

The /QNetWare directory structure represents multiple distinct file systems: 

  • The structure represents Novell NetWare servers and volumes out in the network in the following form:

  •  
    /QNetWare/SERVER.SVR/VOLUME
    
    
    The extension .SVR is used to represent a Novell NetWare server. 
  • When a volume under a server is accessed either through the integrated file system menus, commands, or APIs, the root directory of the NetWare volume is automatically mounted on the VOLUME directory under /QNetWare
  • QNetWare represents NDS trees on the network in the following form:
  • /QNetWare/CORP_TREE.TRE/USA.C/ORG.O/ORG_UNIT.OU/SVR1_VOL.CN
    The extensions .TRE, .C, .O, .OU, and .CN are used to represent NDS trees, countries, organizations, organizational units, and common names, respectively. If a Novell NetWare volume is accessed through the NDS path through a volume object, it's root directory is also automatically mounted on the NDS object. 
Figure 19-1 shows the QNetWare file system and the servers and trees associated with it. The QNetWare subdirectory contains entries for each NetWare server connected to the AS/400. 

Figure 19-1. QNetWare File System
 

* figure rv3d670 not            displayed.

Path Names

A path name tells the system how to locate an object. The path name is expressed as a sequence of directory names followed by the name of the object. Individual directories and the object names are separated by a slash (/) or backslash (\) character; for example: 

  directory1/file

There is no difference between using the / or the \. 

Path Name Restrictions

Certain directories within the QNetWare file system represent resources, such as servers, volumes, and NDS trees within the network. Users cannot add or remove files or subdirectories from these directories. Changes to these directories occur when the system administrator changes the network by adding or removing a volume, for example, or by bringing a server online. Directories in which the user cannot directly make changes are the following:

Table 19-1. Directories That the User Cannot Change
 
Directory  Description 
QNetWare  Contains servers and NDS trees 
QNetWare/<server.svr>  Contains volumes on active NetWare servers 
QNetWare/<tree>  Contains NDS trees on active NetWare 4.10 servers 

File and Directory Names

The QNetWare file system does not preserve the case in which files or directories are entered in a command or API. All names are set to upper case in transmission to the NetWare server. Novell NetWare also supports the namespaces of multiple platforms, such as DOS, OS/2, Apple** Macintosh**, and NFS. Even though NetWare supports these namespaces, it also requires unique DOS names on all NetWare volumes. For consistency, the QNetWare file system displays all files and directories using their DOS name. 

NDS Objects

The QNetWare file system supports the display of NDS names in upper and lower case. 

Links

The QNetWare file system supports only one link to an object. Symbolic links cannot be created or stored in QNetWare. However, symbolic links can be created in the "root" (/) or QOpenSys directories that point to a QNetWare file or directory. 


Object Security and the QNetWare File System

Enhanced Integration for NetWare fully implements NetWare security and authenticates each user before allowing access to NetWare data. When you use AS/400 commands, APIs, or Client Access/400 to access the QNetWare file system, Enhanced Integration for NetWare maps security semantics between the AS/400 and NetWare. 

Authority and Ownership

Files and directories in QNetWare are stored and managed by Novell NetWare servers. When using commands to display or change the authorities of either owners or users, QNetWare maps NetWare users to AS/400 users based on the user's name. 

Mapping User's Authority

  Trustee assignments for files and directories on the NetWare server are mapped to the AS/400. This includes trustee assignments for groups, especially the group EVERYONE. The group EVERYONE is mapped as user *PUBLIC on the AS/400. 

Trustee assignments for users that do not have an AS/400 user profile are also mapped; however, if the NetWare name exceeds 10 characters, the authority is not mapped. 

Authorizing Users to Files and Directories

After Enhanced Integration for NetWare is installed you must add authentication entries for each user or each user must start a connection to the NetWare server before the file system can be used. Use of authentication entries greatly enhances the usability of the QNetWare file system. 

You can change a user's authority to files and directories, by using the WRKAUT or CHGAUT commands. When authorizing users to NetWare files and directories keep in mind that rights to files and directories can be inherited from parent directories, and that a specific right will override an inherited right. Most of the time it is easier to authorize a user to a high-level parent directory and then control which authorities are allowed to flow down to lower level directories by using NetWare inherited rights filters. For more information, see the NetWare manuals. The NetWare inherited rights filter for a file or directory can also be changed through the WRKAUT or CHGAUT command, by specifying the *NTWIRF special value. 

Users can determine their authority to a file or directory by running the DSPAUT command. However, the user must have sufficient authority to the file or directory to run the DSPAUT command against it. The user's effective rights are displayed under the *NTWEFF special value. 

The QNetWare file system changes the authority on the NetWare server, it does not maintain its own copy. When authorities are set or retrieved they are mapped between AS/400 authorities and NetWare rights. Table 19-2 maps the AS/400 authorities to NetWare rights. Table 19-3 maps the AS/400 authorities to NDS rights. 

Authority Translation

When you use CHGAUT command, or when you copy files in and out of the QNetWare file system, security semantics are mapped between the AS/400 and NetWare. 

NetWare Authorities to Files and Directories

NetWare files and directories are protected by the following rights: 
 
Supervisor The right to all rights 
Read Open, read, and execute a file 
Write Open and write to a file or directory 
Create For directories, the right to create files and subdirectories.
For files, the right to salvage a file after it has been deleted. 
Erase Delete a file or directory 
Modify Rename or change attributes 
File Scan View a file or directory name 
Access control Change access rights 

Tip:
The authority to write, delete, or rename a file is also controlled by NetWare file attributes. See "NetWare File Mode Support" for more information. 

Mapping of AS/400 Semantics

AS/400 authorities are mapped to NetWare rights, as follows:

Table 19-2. AS/400 Authorities and NetWare Rights
 
AS/400
Authorities 
NetWare Rights 
None  Supr  Read  Write  File Scan  Create  Erase  Modify  Access Control 
*OBJOPR 
*OBJMGT 
*OBJALTER 
*OBJREF 
*OBJEXIST 
*EXCLUDE 
*AUTL 
*READ (*R) 
*ADD (*W) 
*UPD (*W) 
*DLT (*W) 
*EXECUTE (*X) 
Notes:
  • The AS/400 *OBJOPR authority bit is turned on when a user has any data authority (*READ, *ADD, *UPD, *DLT, or *EXECUTE), but is not mapped explicitly to any specific NetWare right or rights. 
  • The NetWare right of None is equivalent to AS/400 *EXCLUDE authority. 
  • The CHGAUT command does not allow you to set *ADD, *UPD, and *DLT authorities individually. Instead, you must set them all by specifying *W. However, the DSPAUT command displays the *ADD, *UPD, and *DLT authorities individually if a subset of them are granted to a trustee from a NetWare interface such as NWADMIN, NETADMIN, or FILER. 

NetWare Directory Services (NDS) Object Rights

NDS objects are protected by the following rights: 
 
Browse Grants the trustee the right to see the object's name in the NDS tree. 
Create Grants the trustee the right to create a new directory services object within the container. 
Delete Grants the trustee the right to delete an object. 
Rename Grants the trustee the right to change the Name property for an object. 
Supervisor Grants all possible rights to the user object. 

  Attribute rights are not mapped. These rights can exist for each attribute of an object and might differ for different attributes. This prevents the AS/400 from working with attribute rights of NDS objects. Storage Management Services (SMS) rights, which control a user's right to save and restore a file, directory, NDS object, or other NetWare resource, are not mapped either; these rights are architected by Novell but are not yet implemented. 

AS/400 authorities are mapped to NDS rights, as follows:

Table 19-3. AS/400 Authorities and NDS Rights
 
AS/400
Authorities 
NDS Rights 
None  Browse  Create  Delete  Rename  Supervisor 
*EXCLUDE 
*OBJOPR  *
*OBJMGT 
*OBJALTER 
*OBJREF 
*OBJEXIST 
*AUTLMGT 
*READ 
*ADD 
*UPD 
*DLT 
*EXECUTE 
Note: The AS/400 *OBJOPR authority bit is turned on when a user has any data authority (*READ, *ADD, *UPD, *DLT, or *EXECUTE), but is not mapped explicitly to any specific NetWare right or rights. 

NetWare File Mode Support

NetWare uses file attributes to emulate file modes. Table 19-4 shows which attributes are set for owner permissions. Group and Others permissions are ignored.

Table 19-4. NetWare File Attributes for Owner Permissions
 
Mode  Delete
inhibited 
Hidden  Rename inhibited  Read only  System file  Execute only 
None  X
RW 
RX 
WX 
RWX 

Object Ownership

Owner's names are mapped to valid AS/400 owners. Where an owner's name cannot be mapped to a valid AS/400 owner, QDFTOWN is assigned. This can occur in the following cases: 

  • The user id does not exist on the AS/400. 
  • The user id is greater than 10 characters. 
  • The object has no owner. 
Changing the Owner of a File or Directory

You can use the CHGOWN command to transfer   object ownership from one user to another. For example, the following command transfers the ownership of myfile from the current owner to NEWOWNER. 

  CHGOWN OBJ('/QNetWare/server.svr/sys/myfile') NEWOWN(NEWOWNER)


Auditing

Although Novell NetWare supports the auditing of files and directories, the QNetWare file system cannot change the auditing values of these objects. Therefore, the CHGAUD command is not supported. 


Using Integrated File System Commands and Menus

To access the Integrated File System menu, type GO FILESYS. From the Integrated File System menu, you can select additional menus for operations on directories, objects and security. See "Integrated File System Commands" for a short description of each Integrated File System command you can use with the QNetWare file system. 

You can work with files and directories in the QNetWare file system using the integrated file system interface. The integrated file system interface is a set of menus, commands, and APIs provided by OS/400. Not all available operations can be used on the QNetWare file system, as described on page reference #4

Mounting NetWare File Systems

NetWare file systems located on NetWare servers can be mounted on the "root" (/), QOpenSys, and other file systems to make access easier and to perform better than under the /QNetWare directory. Otherwise, if you step through the QNetWare menus, AS/400 searches every NetWare server on the network. Depending on the size of your network, this can be a slow process. 

Mounting NetWare file systems can also be used to take advantage of the options on the Add Mounted File System (ADDMFS) or MOUNT command, such as mounting a read-write file system as read-only. 

NetWare file systems can be mounted using an NDS path or by specifying a NetWare path in the form of SERVER/VOLUME:directory/directory. For example, to mount the directory NOTES located in volume LOTUS on server OFFICE, a user would use this syntax: 

  OFFICE/LOTUS:NOTES

This path syntax is very similar to NetWare's MAP command syntax. 

NDS paths can be used to specify a path to a NetWare directory but cannot themselves be mounted. You can mount using NDS volume objects and directory map objects. 

Tip:
You must have *IOSYSCFG authority to use the ADDMFS or MOUNT command. 

Using the MOUNT Command

You can use the MOUNT (or ADDMFS) command to mount a specific volume or directory from a NetWare server or NDS tree. This allows your applications to access data more directly. 

Before you mount a file system on the AS/400, you need to create a directory by using the MKDIR command. In the following examples, the temp1 directory has been created. 

Tip:
If you are unsure of the entire path name for the MOUNT command, refer to "Using the OS/400 Integrated File System Interface" for information about determining a path name. 

Mounting a NetWare File System

This example shows how you can use the MOUNT command to mount the NetWare directory LOTSUITE/SMARTCTR contained in the volume LOTUS that resides on server RCHNWSVR1 over the directory /temp1. 

  MOUNT TYPE(*NETWARE) MFS('RCHNWSVR1/LOTUS:LOTSUITE/SMARTCTR')

        MNTOVRDIR('/temp1')


Mounting a NetWare File System by Using NDS Contexts

When you use NDS contexts, the AS/400 searches for volumes by the context of the job first and of the AS/400 system (default) next. 

This example shows how you can use the MOUNT command to mount the NDS volume LOTUS_VOL by using an absolute context, over the directory /temp1. 

  MOUNT TYPE(*NETWARE) MFS('.LOTUS_VOL.ROCHESTER.IBM')

        MNTOVRDIR('/temp1')


This example shows how you can use the MOUNT command to mount the path LOTSUITE/SMARTCTR on NDS volume LOTUS_VOL, by using a relative path and fully-qualified names, over the directory /temp1. 
  MOUNT TYPE(*NETWARE) MFS('CN=LOTUS_VOL.OU=ROCHESTER:
  LOTSUITE/SMARTCTR') MNTOVRDIR('/temp1')


Tip: If the volumes are not found, you can display or change the current context, by using one of the following commands:
 
Display  Change 
Job  DSPNDSCTX  CHGNDSCTX 
System  DSPNWSA  CHGNWSA 
In this example, the context for the job is changed to the NDS tree CT_TREE. 
  CHGNDSCTX  NDSCTX('.LOTUS_VOL.ROCHESTER') NDSTREE('CT_TREE')


In this example, the context for the job is changed to the root directory. 
  CHGNDSCTX  NDSCTX(*ROOT)


Mount Command Options

You can use several options with the MOUNT command. The default value for the options string is: 

  'rw,acregmax=60, acdirmax=60'


This specifies to mount as read-write, sets the maximum time to store file attributes locally to 60 seconds, and sets the maximum number of seconds to store directory attributes locally to 60 seconds. 

To mount a file system as read-only, use the option ro: 

  MOUNT TYPE(*NETWARE) MFS('LOTUS/VOL:')

        MNTOVRDIR('/temp1') OPTIONS('ro')


Using the DSPMFSINF Command

You can use the DSPMFSINF command to display information about a specific file system. For example, you can determine if it is mounted over, and also display other information, such as the file system type, block size, caching values, and server code page. 

In this example, information about the temp1 file system is sent to the default printer. 

  DSPMFSINF  OBJ('/temp1') OUTPUT(*PRINT)


Using the WRKAUT and CHGAUT Commands

User's authorities can be displayed and changed by using the WRKAUT and CHGAUT commands. When authorities are transferred to and from the server they are mapped to AS/400 authorities. 

+--------------------------------------------------------------------------------+
|                            Change Authority (CHGAUT)                           |
|                                                                                |
| Type choices, press Enter.                                                     |
|                                                                                |
| Object . . . . . . . . . . . . . > '/qnetware/ntwserv.svr/vol1/KYLE/GB4.JPG'   |
|                                                                                |
| User . . . . . . . . . . . . . . > PAWOLF        Name, *PUBLIC, *NTWIRF        |
|                + for more values                                               |
| New data authorities . . . . . . > *RWX          *SAME, *NONE, *RWX, *RX...    |
| New object authorities . . . . . > *OBJALTER     *SAME, *NONE, *ALL...         |
|                + for more values                                               |
| Authorization list . . . . . . .                 Name, *NONE                   |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                      Bottom    |
| F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    |
| F24=More keys                                                                  |
|                                                                                |
+--------------------------------------------------------------------------------+


  For NetWare 3.12, the NetWare bindery is searched to locate the user or the group to set the authority to the object. For NetWare 4.10, the user or group must exist in the NetWare NDS tree. To locate the user or group, the NDS context of the user you are authorizing is searched first. If it is not found, the context of the job is searched next and then the context of the AS/400 system. 

Tip: If the user or group is not found, message CPFA0A2,   "Information passed to this operation was not valid", appears. You can display or change the current context, by using one of the following commands:
 
Display  Change 
User  DSPNWSUSRA  CHGNWSUSRA 
Job  DSPNDSCTX  CHGNDSCTX 
System  DSPNWSA  CHGNWSA 

If the context is correct, you can verify that the user exists by using the WRKLNK command to display the NDS path to the user or group. 

Inherited Rights Filter and Effective Rights

You can set the NetWare inherited rights filter from the AS/400 by using the *NTWIRF special value on the CHGAUT command. To display your effective rights, use the DSPAUT command. Your effective rights are shown under special value, *NTWEFF. 

+--------------------------------------------------------------------------------+
|                              Work with Authority                               |
|                                                                                |
| Object . . . . . . . . . . . . :   /QNetWare/ntwserv.svr/vol1/lotus            |
| Owner  . . . . . . . . . . . . :   KYLE                                        |
| Primary group  . . . . . . . . :   *NONE                                       |
| Authorization list . . . . . . :   *NONE                                       |
|                                                                                |
|                                                                                |
| Type options, press Enter.                                                     |
|   1=Add user   2=Change user authority   4=Remove user                         |
|                                                                                |
|                    Data     --Object Authorities--                             |
| Opt  User        Authority  Exist  Mgt  Alter  Ref                             |
|  _   __________  ________                                                      |
|  _   *NTWIRF     *RWX               X     X     X                              |
|  _   *NTWEFF     *RWX               X     X     X                              |
|  _   MERRY       *R                 X     X     X                              |
|                                                                                |
|                                                                      Bottom    |
| Parameters or command                                                          |
| ===>                                                                           |
| F3=Exit   F4=Prompt   F5=Refresh      F9=Retrieve                              |
| F11=Display detail data authorities   F12=Cancel   F24=More keys               |
| (C) COPYRIGHT IBM CORP. 1980, 1996.                                            |
|                                                                                |
+--------------------------------------------------------------------------------+


Integrated File System Commands

All of the operations that you can do through the integrated file system menus and displays can also be done by entering control language (CL) commands. These commands can operate on files and other objects in any file system that is accessible through the integrated file system.

Table 19-5. Integrated File System Commands
 
Command  Description 
CHGAUT  Change Authority
Gives specific authority for an object to a user or group of users 
CHGCURDIR  Change Current Directory
Changes the directory to be used as the current directory 
CHGOWN  Change Owner
Transfers object ownership from one user to another 
CPY  Copy
Copies a single object or a group of objects 
CPYFRMSTMF  Copy from Stream File
Copies data from a stream file to a database file member 
CPYTOSTMF  Copy to Stream File
Copies data from a database file member to a stream file 
CRTDIR  Create Directory
Adds a new directory to the system 
DSPAUT  Display Authority
Shows a list of authorized users of an object and their authorities for the object 
DSPCURDIR  Display Current Directory
Shows the name of the current directory 
DSPLNK  Display Object Links
Shows a list of objects in a directory and provides options to display information about the objects 
MOV  Move
Moves an object to a different directory 
RMVDIR  Remove Directory
Removes a directory from the system 
RMVLNK  Remove Link
Removes the link to an object 
RNM  Rename
Changes the name of an object in a directory 
RST Restore
Copies an object or group of objects from a backup device to the system 
RTVCURDIR  Retrieve Current Directory
Retrieves the name of the current directory and puts it into a specified variable (used in CL programs) 
SAV  Save
Copies an object or group of objects from the system to a backup device 
WRKAUT  Work with Authority
Shows a list of users and their authorities and provides options for adding a user, changing a user authority, or removing a user 
WRKLNK  Work with Object Links
Shows a list of objects in a directory and provides options for performing actions on the objects 

Note:
The following integrated file system commands that (Ref #4.) operate on links or involve group ownership, auditing, and check-in/check-out cannot operate on the QNetWare file system. 
 
ADDLINK  Add Link 
CHGAUD  Change Owner 
CHGPGP  Change Primary Group 
CHKIN  Check In 
CHKOUT  Check Out 
WRKOBJOWN  Work with Objects by Owner 
WRKOBJPGP  Work with Objects by Primary Group 
In addition to the previous commands, the following commands cannot be used against NDS objects, servers, or volumes: 
 
CPYFRMSTMF  Copy from Stream File 
CPYTOSTMF  Copy to Stream File 
CRTDIR  Create Directory 
CHGOWN  Change Owner 
CPY  Copy Objects 
For more details about the integrated file system commands, please see Integrated File System Introduction

Copying Objects

Three commands are available for copying objects to and from the QNetWare file system. You also can use the graphical interfaces of the Client Access Optimized clients and the Client Access for Windows 3.1 client to copy Integrated File System objects. 

  1. CPY (or COPY) Copy Object 
  2. CPYTOSTMFCopy to Stream File 
  3. CPYFRMSTMFCopy from Stream File 
CPY to Copy Objects

You can use this command to copy QNetWare file system objects into other file systems that support stream files (for example, "root", QOpenSys or QDLS). It is possible to copy objects within QNetWare file system; that is, from one server to another. 

You can copy an AS/400 database file to QNetWare file system using this command; but no conversion is done. The resulting stream file in the QNetWare file system may not be useful. 

When copying files between other file systems and QNetWare, the authorizations are also copied, if possible. Because a trustee assignment on a file or directory overrides any inherited rights, the result might be more or less authority than desired. After you perform a CPY or MOV, check the resulting authority by using the DSPAUT command, as shown in "Inherited Rights Filter and Effective Rights"

Copying an AS/400 Database File to QNetWare file system--Example

Suppose you want to make an AS/400 database file available to all NetWare users. This file is in library DATALIB and has the name CUSTCDT. See Figure 19-2 for the DDS description of the file CUSTCDT. The fields CUSNUM, ZIPCOD, CDTLMT, CHGCOD, BALDUE and CDTDUE are of type "packed decimal". All other fields are of type "character". 

Figure 19-2. DDS for AS/400 Database File CUSTCDT
 
 

+--------------------------------------------------------------------------------+
|A          R CUSREC                                                             |
|A            CUSNUM         6P 0       COLHDG('Customer number')                |
|A            LSTNAM         8A         COLHDG('Last name')                      |
|A            INIT           3A         COLHDG('First/middle initial')           |
|A            STREET        13A         COLHDG('Street address')                 |
|A            CITY           6A         COLHDG('City')                           |
|A            STATE          2A         COLHDG('State abbreviation')             |
|A            ZIPCOD         5P 0       COLHDG('Zip code')                       |
|A            CDTLMT         4P 0       COLHDG('Credit limit')                   |
|A            CHGCOD         1P 0       COLHDG('Charge code')                    |
|A            BALDUE         6P 2       COLHDG('Balance due')                    |
|A            CDTDUE         6P 2       COLHDG('Credit due')                     |
+--------------------------------------------------------------------------------+

If you are not familiar with DDS definitions see Figure 19-4 for the output of the DSPFFD CUSTCDT command. See Figure 19-5 for the content of the CUSTCDT file which was created using an AS/400 query. 

  Because the CUSTCDT database file contains packed decimal fields you cannot copy it directly into the QNetWare file system. You have to convert the packed decimal fields to zoned decimal fields. You can do this by creating a logical file over CUSTCDT where you change the field definition for all fields of type "packed decimal" to type "zoned decimal". See Figure 19-3 for the DDS definitions of such a logical file. The name of this logical file is CUSTCDTL. 

There is no need to specify other field definitions. The logical file is built over the physical file and copies all the field definitions from it. You only need to specify "S" for the data type of all fields of type packed decimal to redefine it as type zoned decimal. 

Optionally you can select a subset of fields you want to copy to QNetWare. Just put the fields you need into the logical file. You could also specify an ordering sequence on the logical file. 

For more information about DDS, see the DDS Reference book. 

Figure 19-3. DDS for Logical File CUSTCDTL
 
 

+--------------------------------------------------------------------------------+
|A          R CUSREC                    PFILE(CUSTCDT)                           |
|A            CUSNUM          S                                                  |
|A            LSTNAM                                                             |
|A            INIT                                                               |
|A            STREET                                                             |
|A            CITY                                                               |
|A            STATE                                                              |
|A            ZIPCOD          S                                                  |
|A            CDTLMT          S                                                  |
|A            CHGCOD          S                                                  |
|A            BALDUE          S                                                  |
|A            CDTDUE          S                                                  |
+--------------------------------------------------------------------------------+


To copy the CUSTCDT database file to the QNetWare file system:

  1.   Create a directory in the QNetWare file system to use for storing AS/400 database files. For example, to create a directory on server SRVNW0A, enter:
  2.   MKDIR DIR('QNetWare/SRVNW0A.SVR/SYS/DTA')
    
      DTAAUT(*NONE) OBJAUT(*NONE) CRTOBJAUD(*NONE)
    
    
    

    Figure 19-5. Content of CUSTCDT Created with Query/400

  3. Create the logical file using the DDS from Figure 19-3. Use the command: 

  4.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    CRTLF FILE(DATALIB/CUSTCDTL) SRCFILE(DATALIB/QDDSSRC)

    Note:
    DATALIB/QDDSSRC is the source physical file which contains the member CUSTCDTL shown in Figure 19-3

  5. After you have created the logical file you can use it to copy the data to a program-described physical file. But first you must create the program-described physical file. To do that you must know the record length of the logical file, because the program-described file must have the same record length. You can find the record length of the logical file using the command: 

  6.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    DSPFD CUSTCDTL *RCDFMT

    See Figure 19-6 for the result. 

    Figure 19-6. Result of the Command DSPFD CUSTCDTL *RCDFMT
     
     

+--------------------------------------------------------------------------------+
|                        Record  Format Level                                    |
|  Format       Fields   Length  Identifier                                      |
|  CUSREC           11       60  3B84438D4C428                                   |
|    Text . . . . . . . . . . . . . . . . . . . :                                |
|  Total number of formats  . . . . . . . . . . :           1                    |
|  Total number of fields . . . . . . . . . . . :          11                    |
|  Total record length  . . . . . . . . . . . . :          60                    |
+--------------------------------------------------------------------------------+


  1. The record length of CUSTCDTL is 60. Create the program-described physical file:       

  2.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    CRTPF DATALIB/CUSTSTMF RCDLEN(60)
     
     

  3. Copy the logical file CUSTCDTL to the program-described physical file CUSTSTMF:       

  4.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    CPYF FROMFILE(CUSTCDTL) TOFILE(CUSTSTMF) 
    MBROPT(*ADD) FMTOPT(*NOCHK)
     

    Note:
    FMTOPT(*NOCHK) is required because the record format of the database files are different. 

  5. Copy the program-described file CUSTSTMF into the QNetWare/SRVNW0A.SVR/SYS/DTA directory of the QNetWare file system. You created this directory in step 1. See Figure 19-7 for the prompt of the CPYTOSTMF command.       

  6.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Figure 19-7. CPYTOSTMF Command
     
     

+--------------------------------------------------------------------------------+
|                         Copy To Stream File (CPYTOSTMF)                        |
|                                                                                |
| Type choices, press Enter.                                                     |
|                                                                                |
| From database file member  . . (1) > '/QSYS.LIB/DATALIB.LIB/CUSTSTMF.FILE      |
|/CUSTSTMF.MBR'                                                                  |
| To stream file . . . . . . . . (2) > 'QNetWare/SRVNW0A.SVR/SYS/DTA/CUSTCDT.DAT'|
|                                                                                |
| Copy options . . . . . . . . . .   *NONE         *NONE, *ADD, *REPLACE         |
| Data conversion options  . . . (3)   *AUTO         *AUTO, *TBL, *NONE          |
| Database file CCSID  . . . . . (4) > 37            1-65533, *FILE              |
| Stream file codepage . . . . . (5) > 850           1-32767, *STMF              |
| End of line characters . . . . .   *CRLF         *CRLF, *LF, *CR, *LFCR...     |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                                |
|                                                                      Bottom    |
| F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    |
| F24=More keys                                                                  |
|                                                                                |
+--------------------------------------------------------------------------------+


     
    (1) From database file member

    Specify the path name of the CUSTSTMF program-described database file. 

    Note:
    A database file in the QSYS.LIB file system is a directory. The member name is the object name in the QSYS.LIB file system that contains the data. 

    (2) To stream file

    Specify the path name of the stream file. 

    QNetWare/SRVNW0A/SVR/SYS/DTA/CUSTCDT.DAT
    
    
    
    In this case you would use the drive letter as a link to CUSTCDT.DAT. 
    (3) Data conversion option

    The default of *AUTO converts the data during the copy operation using the coded character set identifier (CCSID) equivalent   of the stream file data code page and the database file CCSID. 

    To use your own translation table object specify *TBL and enter the table name into the TBL parameter. 

    (4) Database file CCSID

    If your database file has a CCSID of 65535, you must enter a valid CCSID code for your data to be correctly converted to ASCII. The values 0, 65534, and 65535 are not valid to use with this command. 

    (5) Stream file code page

    Specify the ASCII code page of the NetWare server to convert the data. To obtain the code page of server SRVNW0A, enter: 

    DSPMFSINF OBJ('/QNetWare/SRVNW0A.SVR/SYS/DTA')
     
     
     

    This example converts the database file data from CCSID 37 to ASCII code page 850. 

  1. Now you can access the data from a NetWare workstation. Map a drive to the SYS volume of server SRVNW0A and then change into the DTA directory of the mapped drive. 
  2. You can now look at the data in CUSTCDT.DAT (use any DOS editor) and you will see that the file no longer contains any field information. The application that accesses the data must know the record structure. To put more field information into the stream file (such as a field separator character) you must write your own program. See "ILE C/400 Program to Copy an AS/400 Database File to QNetWare File System--Example" for a sample program. 

Transferring Files to QNetWare

You can use the File Transfer Protocol (FTP) support to transfer files to and from any of the following file systems: 

  • "Root" (/) file system 
  • Open systems file system (QOpenSys) 
  • Library file system (QSYS.LIB) 
  • Document library services file system (QDLS) 
  • Optical file system (QOPT) 
  • LAN server file system (QLANSrv) 
  • Network File System (NFS) 
  • QNetWare file system (QNetWare) 
However, be aware of the following restrictions: 
  • The Integrated File System limits FTP support to transferring file data only. You cannot use FTP to transfer attribute data. 
  • QSYS.LIB file system limits FTP support to physical file members, source physical file members, and save files. You cannot use FTP to transfer other object types, such as programs (*PGM). However, you can save other object types to a save file, transfer the save file, and then restore the objects. 
For information about FTP, see the book TCP/IP Configuration and Reference, SC41-3420. 

Migrating Data

You can use AS/400 commands and shared folders support to move data: 

  • From one NetWare server to another 
  • From a NetWare server to an Integrated PC Server 
  • From a client to an Integrated PC Server 
  • From shared folders to an Integrated PC Server 
Migrating Data Using the Integrated File System

You can move data from one NetWare server to another or rearrange data within an Integrated PC Server by using the integrated file system commands, Copy (CPY) and Move (MOV). Mount the volumes with the files you want to move as well as the target Integrated PC Server. Then use the CPY command to move the files from one location to another. It is recommended that you use the CPY command rather than the MOV command to ensure your ability to retrieve the data, if needed. To ensure that authorities are preserved, the user migrating data should be a NetWare administrator with Supervisor (*OBJREF) authority. 

Each file system has its own unique characteristics. You may want to move objects from one file system to another to take advantage of those characteristics. However, moving objects to a different file system may mean losing the advantages of the file system that the objects are currently stored in. Before moving objects to another file system, you should consider the following: 

  • Are you using applications that use advantages of the file system that the objects are currently in? Some file systems support interfaces that are not part of the integrated file system support. Applications that use these interfaces may no longer be able to access objects that are moved to another file system. For example, the QDLS file system supports HFS (hierarchical file system) APIs and commands that work with document and folder objects. You cannot use these interfaces on objects that are in other file systems. 
  • What characteristics of the objects are important to you? Not all characteristics are supported by all file systems. For example, the QSYS.LIB file system supports storing and retrieving only a few extended attributes, whereas the "root" (/) and QOpenSys file systems support storing and retrieving all extended attributes. Therefore QSYS.LIB is not a good candidate for storing objects that have extended attributes. QDLS supports many "office" attributes, but other file systems do not. Therefore, QDLS is a good place to keep your office documents. 
Good candidates for migration are the PC files that are in QDLS. Most PC applications should continue working with PC files that are moved from QDLS to other file systems. The / and QOpenSys file systems are good choices for storing these PC files, because they support many of the characteristics of the OS/2 file system and provide faster access to the files. 

Migrating objects to another file system involves the following: 

  • Saving a copy of all objects that you are planning to migrate. Having a backup copy allows you to restore the objects to the original file system if you find that applications cannot access the objects in the file system to which you have moved them. 

  •  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Note:
    You cannot save objects from one file system and restore them to another. 

  • Using the Create Directory (CRTDIR) command to create the directories in the file system that you want to move the objects to. You should carefully examine the attributes of the directory the objects are currently in to determine if you want to duplicate those attributes on the directories you create. For example, the user who creates the directory is its owner, rather than the user who owned the old directory. You may want to transfer ownership of the directory after you have created it, if the file system supports setting the owner of a directory. 
  • Using the Move (MOV) command to move the files to the file system that you have chosen. MOV is recommended because it preserves the ownership of the objects, if the file system supports setting the ownership of objects. If the Copy (CPY) command is used, the user who copies the objects becomes their owner, if the file system supports setting the ownership of objects. Note that when using MOV or CPY: 
    • Attributes may not match and may be discarded. 
    • Extended attributes may be discarded. 
    • Authorities may not be equivalent and may be discarded. 
    This means that if you decide to return the object to its original file system, you may not want to just move or copy it back because of the attributes that have been discarded. The safest way to return an object is to restore a saved version of it. 
For more information about the Integrated File System and how to migrate documents to the AS/400, see the Integrated File System Introduction book. For more information about the AS/400 commands, see the CL Reference

Migrating Data Using Shared Folders Support

If you have a PC with both the NetWare Requester and Client Access (the premier Client Access clients) installed, you can move data from one Integrated PC Server to another or rearrange data within the Integrated PC Server by using shared folders support. You can use the PC command (COPY) or other client interfaces to copy information in files on the client to a directory in the Integrated File System. You can also transfer data using the transfer request support provided by Client Access. For more information about PC commands and shared folder support, see the Client Access/400 for DOS with Extended Memory User Guide or the Client Access/400 for OS/2 User Guide


Installing DOS Applications

You can install DOS applications in the QNetWare file system either from CA/400 or the NetWare requester. 

Installing Applications from CA/400

To install DOS applications from CA/400: 

  1. Use the MOUNT command on the AS/400 to mount a specific directory. Using the MOUNT command is faster than stepping through the AS/400 file system screens. 

  2.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Note:

    The MOUNT command is very similar to the NetWare MAP command, but you assign a directory on the AS/400 rather than to a network drive. 
    Refer to the Client Access documentation for instructions on mapping a drive and using CA/400. 
  3. After you mount the directory on the AS/400, you can directly access it from CA/400. 
  4. Now you can change to the mapped drive and following the installation instructions of the DOS application. 
Installing Applications from NetWare Requester

Refer to Integration Services for File Server I/O Processor for information about installing applications on the Integrated PC Server. Refer to the NetWare documentation for information about using NetWare Requester to install DOS applications. 


Saving and Restoring Files through QNetWare

You can save and restore NetWare volumes, files, directories, storage spaces, and NetWare 3.12 binderies accessed through the QNetWare file system. You can use one of the following methods when saving and restoring NetWare data: 

  • Complete saves 

  •  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    NetWare data is stored in the QFPNWSSTG directory in QNetWare. In this directory, each logical PC drive appears as one large object to AS/400. Therefore, you can save entire virtual drives by saving this directory, but you cannot restore individual files or directories from saved copies of directories within the QFPNWSSTG directory. 

    To save the QFPNWSSTG directory, vary off the NWSD (network server description) and use option 21 or option 23 on the Save menu. The time that it takes to save the QFPNWSSTG directory is significantly less than the time it takes to save the QNetWare directory. 

  • Incremental saves 

  •  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    The QNetWare directory reflects the hierarchical directory structure of your PC. Therefore, you can save and restore individual volumes, directories, and files from this directory. You can also save resources in SAV.RST; however, they cannot be selectively restored. Instead, the resources are saved and restored as a single block of data. 

    The NWSD (network server description) must be varied on to save objects accessed through QNetWare. 

The authority of a NetWare object is stored with the object, not with the user profiles that have the authority. Before you can perform save and restore operations, you must either have the necessary authority to the object or NetWare administrator authority (equivalent to *ALLOBJ on AS/400). The SAVSECDTA and the SAVSYS commands do not save authority for NetWare objects. 

*ALLOBJ special authority gives enough authority to save NetWare objects and their authority information only when: 

  • You are a defined NetWare user 
  • The NetWare server is an Integrated PC Server on a local AS/400 
Put your AS/400 system in a restricted state, if possible, when you save either the QFPNWSSTG or QNetWare directory. This is the only way to ensure that everything is saved. 

Refer to Chapter 10. "Save/Restore Planning" for more information about saving and restoring NetWare objects and data. 


Accessing the QNetWare File System from AS/400 or Client Access/400

You can access the QNetWare file system either from the integrated file system interface on the AS/400 or the Client Access/400 interface. 


Using the OS/400 Integrated File System Interface

If you want to display or access all the NetWare volumes in your network, you can use the WRKLNK or DSPLNK command and use the OS/400 menus. You can also use this method to determine the entire path name for the MOUNT command. 

Tip:
To improve performance, use the DETAIL(*NAME) parameter to show only the name of the link. 

To access all the NetWare volumes in your network using the WRKLNK command:

  1. Enter WRKLNK.   

  2.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Figure 19-8. Work with Object Links Display
     
     

+--------------------------------------------------------------------------------+
|                            Work with Object Links                              |
|                                                                                |
|Directory  . . . . :   /                                                        |
|                                                                                |
|Type options, press Enter.                                                      |
|  3=Copy   4=Remove   5=Next level   7=Rename   8=Display attributes            |
|  11=Change current directory ...                                               |
|                                                                                |
|Opt   Object link            Type     Attribute    Text                         |
|5     QNetWare               DIR                                                |
|      QOpenSys               DIR                                                |
|      QOPT                   DIR                                                |
|      QPWXCGA                DIR                                                |
|      QPWXCGY                DIR                                                |
|      QPWXCPC                DIR                                                |
|      QPWXCRB                DIR                                                |
|      QPWXCRBD               DIR                                                |
|      QPWXCSO                DIR                                                |
|                                                                      More...   |
|Parameters or command                                                           |
|===>                                                                            |
|F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F12=Cancel   F17=Position to   |
|F22=Display entire field           F23=More options                             |
|                                                                                |
+--------------------------------------------------------------------------------+


  1. Type 5 next to QNetWare, as shown in Figure 19-8, and then press Enter. 

  2.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Figure 19-9. Work with Object Links, QNetWare Directory
     

+--------------------------------------------------------------------------------+
|                            Work with Object Links                              |
|                                                                                |
|Directory  . . . . :   /QNetWare                                                |
|                                                                                |
|Type options, press Enter.                                                      |
|  3=Copy   4=Remove   5=Next level   7=Rename   8=Display attributes            |
|  11=Change current directory ...                                               |
|                                                                                |
|Opt   Object link            Type     Attribute    Text                         |
|      A960502A.SVR           DDIR                                               |
|      CT_TREE.TRE            DDIR                                               |
|5     NTWSERV.SVR            DDIR                                               |
|      IBM_TREE1.TRE          DDIR                                               |
|      ITSOM02_TREE.TRE       DDIR                                               |
|      LONG_TREE_NAME_THA >   DDIR                                               |
|      LONGPATH_WITH_ENOU >   DDIR                                               |
|      MENG536.SVR            DDIR                                               |
|      NETSRV.SVR             DDIR                                               |
|                                                                      More...   |
|Parameters or command                                                           |
|===>                                                                            |
|F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F12=Cancel   F17=Position to   |
|F22=Display entire field           F23=More options                             |
|                                                                                |
+--------------------------------------------------------------------------------+


  1. Type 5 next to NTWSERV.SVR, as shown in Figure 19-9, and then press Enter. 

  2.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Figure 19-10. Work with Object Links, QNetWare/NTWSERV.SRV
     
     

+--------------------------------------------------------------------------------+
|                            Work with Object Links                              |
|                                                                                |
|Directory  . . . . :   /QNetWare/NTWSERV.SRV                                    |
|                                                                                |
|Type options, press Enter.                                                      |
|  3=Copy   4=Remove   5=Next level   7=Rename   8=Display attributes            |
|  11=Change current directory ...                                               |
|                                                                                |
|Opt   Object link            Type     Attribute    Text                         |
|      AS4NW                  DDIR                                               |
|5     DOC                    DDIR                                               |
|      DOCVIEW                DDIR                                               |
|      ETC                    DDIR                                               |
|      FSNWMON.LOG            DSTMF                                              |
|      LOGIN                  DDIR                                               |
|      MAIL                   DDIR                                               |
|      PUBLIC                 DDIR                                               |
|      SYSTEM                 DDIR                                               |
|                                                                      More...   |
|Parameters or command                                                           |
|===>                                                                            |
|F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F12=Cancel   F17=Position to   |
|F22=Display entire field           F23=More options                             |
|                                                                                |
+--------------------------------------------------------------------------------+


  1. Type 5 next to DOC, as shown in Figure 19-10, and then press Enter. 
Now you should be able to access the information in the DOC directory. You can also determine the correct path by using the path shown in the Directory field and the name of the object you are linking to: NTWSERV/DOC:. 

Using the Client Interface

You can also display or access all the NetWare volumes in your network from an AS/400 client. 

  1. Start Graphical Access as your 5250 emulator from your PC when you connect to your AS/400 system. 
  2. Enter WRKLNK to see the display shown in Figure 19-11

  3.  

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Figure 19-11. Accessing the QNetWare Directory from Client Access/400

  4. Double-click the item in the Object Link to advance to the next level in the QNetWare file system. 

Writing Integrated File System Applications

In addition to the Integrated File System commands and menus, OS/400 provides APIs that enable ILE C/400 programs to perform functions on files and directories in all file systems. 

Be aware that there are some considerations using Integrated File System APIs on the QNetWare file system compared to the other file systems. To write ILE C/400 programs to use the QNetWare file system see the System API Reference, book for a detailed description of each API. See ILE Concepts, ILE C/400 Programmer's Guide, and ILE C/400 Programmer's Reference, for more information about ILE and ILE C/400. 

The Integrated File System APIs are very useful for integrating the AS/400 database with Enhanced Integration for NetWare data. "Copying an AS/400 Database File to QNetWare file system--Example" contains an example of using the CPYTOSTMF command to copy an AS/400 database file to the QNetWare file system for Enhanced Integration for NetWare users. See "ILE C/400 Program to Copy an AS/400 Database File to QNetWare File System--Example" for an ILE C/400 program example that performs a similar function. 

Note:
The following C language functions are not supported on the QNetWare file system: 
 
givedescriptor()  Five file access to another job 
link()  Create link to file 
readlink()  Read value of symbolic link 
symlink()  Make symbolic link 
takedescriptor()  Take file access from another job 

In addition to the previous APIs, you cannot use the following APIs against NDS objects, servers, or volumes: 
chmod()  Change file authorizations 
chown()  Change owner and group of file 
create()  Create new file or rewrite existing file 
fchmod()  Change file authorizations by descriptor 
fchown()  Change owner and group of file by descriptor 
fcntl()  Perform file control action 
ftruncate()  Truncate file 
lseek()  Set file read/write offset 
mkdir()  Make directory 
read()  Read from file 
readv()  Read from file (vector) 
unmask()  Set authorization mask for job 
write()  Write to file 
writev()  Write to file (vector) 
For more details about the integrated file system APIs, please see System API Reference

ILE C/400 Program to Copy an AS/400 Database File to QNetWare File System--Example

Suppose you have a customer file that you want to make available to all NetWare users. See Figure 19-2 for the DDS description of our example database file CUSTCDT in library DATALIB. The contents of CUSTCDT are shown in Figure 19-5 using an AS/400 query. 

The ILE C/400 program NWCUST uses the external description of CUSTCDT. To convert the data from EBCDIC to ASCII, it uses the system APIs from the service program QTQICONV. This service program provides APIs to convert a buffer of characters from one coded character set identifier (CCSID) into another CCSID. To create the stream file CUST.DAT, it uses the open(), write() and close() Integrated File System APIs. 

Create the ILE C/400 module and bind it to the QTQICONV service program to create the NWCUST program. Use the following commands: 

CRTCMOD MODULE(NWCUST) SRCFILE(QCSRC) 

OUTPUT(*PRINT) OPTION(*SHOWUSR)
 
 

CRTPGM PGM(NWCUST) BNDSRVPGM(QTQICONV)
 
 
 

See Figure 19-12 for the source listing of NWCUST created by the CRTCMOD command. 
 
(1) Open the stream file with the Integrated File System open() API. 

This function opens the stream file for write only (O_WRONLY flag). If the file does not exist it is created (O_CREAT flag). If it exists it is truncated to 0 bytes length (O_TRUNC flag). This ensures that the stream file is replaced every time the program runs. 

S_IRWXU sets file authority bits. 
 
S_IRWXU  Read, write, and search or execute for the file owner. 
The open() API requires authority bits to be set when the O_CREAT flag is set. 

S_IRWU is used to let you read and write to the file. Refer to "NetWare File Mode Support" for more information. 

(2) Build the buffer for the stream file record. Add a comma as the field delimiter. 

The sprintf() function converts all packed decimal data fields from the database file into characters and formats them correctly with the format-string for example,, "D(6.2)"

(3) Convert stream file buffer from CCSID 37 to CCSID 850. 

Function iconv() converts the stream file buffer to ASCII code page 850. 

Note:
Use the code page of your NetWare server. To determine the code page of the server, use the DSPMFSINF command. For example, to obtain the code page of directory SYSTEM in volume SYS of server NTWSERV1, enter: 

  DSPMFSINF OBJ('/QNetWare/
 NTWSERV1.SVR/SYS/SYSTEM')
 
 
 

(4) Add ASCII carriage return and line feed as a record delimiter to the stream file buffer. 

Note:
The character string "\15\12" represents hex x'0D0A' in octal form. 

(5) Write the stream file buffer to the file using the Integrated File System write() API. 

Note:
The library DATALIB where the CUSTCDT database file is in has to be in the library list of the job from which you run the program. 

This sample program is not restricted to the QNetWare file system. You can use it to copy an AS/400 database file into other file systems that are supported by the Integrated File System. For example, you could change the hard-coded name of the stream file path to be the current directory: "./CUST.DAT". Before you run the program, use the CHGCURDIR command to change to the directory in which you   want to create the stream file. However, you cannot copy this file into the QSYS.LIB file system because CUST.DAT is not a valid name for the QSYS.LIB file system. 

See Figure 19-13 for the contents of the stream file CUST.DAT after the NWCUST program has run and created it. 

Figure 19-13. Content of CUST.DAT from a DOS or OS/2 TYPE Command
 
 

+--------------------------------------------------------------------------------+
|[C:\]type \\J:cust.dat                                                          |
|938472,Henning ,G K,4859 Elm Ave ,Dallas,TX,75217,5000,3,37.00,0.00             |
|839283,Jones   ,B D,21B NW 135 St,Clay  ,NY,13041,400,1,100.00,0.00             |
|392859,Vine    ,S S,PO Box 79    ,Broton,VT,5046,700,1,439.00,0.00              |
|938485,Johnson ,J A,3 Alpine Way ,Helen ,GA,30545,9999,2,3987.50,33.50          |
|397267,Tyron   ,W E,13 Myrtle Dr ,Hector,NY,14841,1000,1,0.00,0.00              |
|389572,Stevens ,K L,208 Snow Pass,Denver,CO,80226,400,1,58.75,1.50              |
|846283,Alison  ,J S,787 Lake Dr  ,Isle  ,MN,56342,5000,3,10.00,0.00             |
|475938,Doe     ,J W,59 Archer Rd ,Sutter,CA,95685,700,2,250.00,100.00           |
|693829,Thomas  ,A N,3 Dove Circle,Casper,WY,82609,9999,2,0.00,0.00              |
|593029,Williams,E D,485 SE 2 Ave ,Dallas,TX,75218,200,1,25.00,0.00              |
|192837,Lee     ,F L,5963 Oak St  ,Hector,NY,14841,700,2,489.50,0.50             |
|583990,Abraham ,M T,392 Mill St  ,Isle  ,MN,56342,9999,3,500.00,0.00            |
|                                                                                |
|[C:\]                                                                           |
+--------------------------------------------------------------------------------+


  In this example, the J: drive was mapped to SERVER:VOLUME\DATA using the NetWare client. 

Because the fields in CUST.DAT are separated by a comma, it is very easy to incorporate the file into a spreadsheet application. 


[ Top of Page | Previous Page | Next Page | Table of Contents | Index