Creating Content

How do I get the content to the AS/400 so that the web server can access and serve the documents? There are a number of ways to get the content from your PC to the AS/400 (assuming that you are creating your content on a PC and not directly on the AS/400). If you are creating your content directly on your AS/400 in a source physical file or physical file then this discussion is not necessary. We have found that most customers work on a client PC/MAC/Workstation to create the content and move the documents to the AS/400 when they are ready to be served.

The client work environment you are using you will have different options available to you. This section is not intended to be a comprehensive list of options available to you as a user. It is intended to help assist in finding a method and describe some of the steps and configuration necessary to transfer the data. FTP and Client Access are described in detail because they are likely to be available to most customers. If you have Client Access available, you should find it the easiest option.

Location for files on your AS/400

The AS/400 has several file systems available. Ideally, you should put your content into the IFS root file system. This is faster than other file systems and supports long file names. This may be difficult depending on the method you are using to get the content to the AS/400.

Using FTP to Move Your Content

The first option that is available to most all client environments is to FTP the content from your client to the AS/400. The difficulty in transferring the content using FTP V3R1 and V3R6 versions of OS/400 is that you do not have the ability to transfer files directly into the IFS root file system. The only file systems supported are the QSYS and QDLS file systems. The FTP server available with V3R2 version of OS/400 supports the ability to access all IFS file systems.

The first thing that you need in order to use FTP is client FTP software. Secondly, your AS/400's FTP server software must be installed, configured and started. The FTP server is available as a free option of the operating system (TCP/IP Connectivity Utilities/400). The default configuration for the FTP server is a good configuration to use. Be aware of the fact that after the install of the TCP/IP Connectivity Utilities/400 all of the TCP/IP servers installed with this option are configured to start up automatically when TCP/IP is started on the AS/400 (STRTCP command). This is most likely not what you would expect nor want for your machine if it is connected to the Internet. You may want to use option 20 on the CFGTCP menu to disable the servers that you do not want started when TCP/IP is started. If you allow all applications to start and run constantly, you need to be aware of and evaluate the potential security risk involved. In order to start the FTP server independently of the STRTCP command you can use the STRTCPSVR SERVER(*FTP) command. The ENDTCPSVR SERVER(*FTP) command will end just the FTP server when you are done with it.

Transferring Content to QSYS

Once the FTP server is running on your AS/400 and client, you are ready to connect to the AS/400 and transfer your content. To connect to the AS/400 you will need to use your AS/400 User ID and password when prompted. If you are going to store all of your content in QSYS and have no binary files to transfer, you can use the FTP connection in its default mode. The PUT command will allow you to transfer the files to the AS/400 and carry out the conversion from ASCII to EBCDIC (files in the QSYS file system are stored in EBCDIC). If you want to control the type of file the data is stored in, the file needs to exist prior to the PUT command. The default file type created if the file does not exist is a physical file. If you want to store the document in a source physical file you will need to create it prior to the PUT command. Following is an example PUT command for the QSYS file system:

PUT example.htm examplelib/example examplembr

The example.htm file in the current directory on the client machine will be transferred to the examplelib library within the example file examplembr member.

Transferring Content to Other File Systems

To work with the QDLS file system, you will need to change naming formats. This is an AS/400 specific command that is not common with other FTP servers. The default name format is '0' (zero) which indicates the traditional "LIBRARY/FILENAME MEMBER" naming method. To get to the IFS file system and the QDLS file system within IFS, you will need to change to naming format '1'. Issue the following command from your FTP client: SITE NAMEFMT 1 The SITE command tells the client this is a site specific command that needs to be sent to the server to be carried out. Some FTP clients do not support SITE; an alternative method will need to be entered for these clients: QUOTE "SITE NAMEFMT 1" The quote command tells the client to send the quoted string to the server. When the AS/400 server receives the quoted string SITE NAMEFMT 1 it will change the naming format used and return a status message indicating that it has done so. The NAMEFMT command sent without a value following it will return the current naming form as a status message.

Once you have changed the naming format to '1' then you can use the IFS file naming convention to access the QDLS file system (the entire IFS file system is available beginning with OS/400 V3R2). The previous PUT command example would work as follows using the naming format of '1':


The example.htm file in the current directory on the client machine will be transferred to the examplelib library within the example file examplembr member.

The following example shows how to get to the QDLS file system using naming format '1'.

PUT example.htm /QDLS/example/example.htm

The example.htm file in the current directory on the client machine will be transferred to the example folder into the example.htm PC file. This transfer would NOT include any ASCII conversions. The code page assignment given to the file is the ASCII code page associated with the user profile signed on the FTP client.

Transferring Multiple Files

The MPUT command works in the same way as the PUT command but it gives the ability to specify wild card characters to send multiple files with one statement, for example:

MPUT *.htm /QDLS/example/*.htm

All of the files in the current directory on the client machine which contain the .htm extension would be transferred to the example folder. These transfers would NOT include any ASCII conversions. The code page assignments given to the files are the ASCII code page associated with the user profile signed on the FTP client. By default, the FTP client will prompt you before transferring each file. you can change this with the PROMPT command.

If your document root is in the root of IFS and you are transferring files to QDLS, you will need to transfer the files from the QDLS file system to the root file system. This can be done through use of the WRKLNK, CPY and MOVE commands available on the AS/400. The WRKLNK lists the files and directories one directory at a time. It also gives you the ability to select options (or commands) execute for the entities within the directory. The CPY command gives you the ability to copy files from one directory to another, or within the same directory with a different name. The MOVE command provides the ability to move a file or directory from one directory to another. The strength of the move command is that it works on directories and all sub-directories below the current. Note that both the CPY and MOVE commands fail when attempting to replace an existing file.

For more help on how to configure and use the FTP Clients and Servers on the AS/400 refer to the AS/400 TCP/IP Configuration and Reference (SC41-3420-02).

Client Access

Following are the file systems you can connect to with Client Access:

Client Access Version      Order Number  File System Access
---------------------      ------------  ------------------
CA/400 for Dos Ext         5763XB1       QDLS only
CA/400 for Windows 3.1     5763XC1       IFS root
CA/400 for OS/2            5763XF1       QDLS only
CA/400 for OS/2 optimized  5763XG1       IFS root

In addition to the above versions of CA/400, there is a beta version available at the time of this writing for Windows 95/Windows NT.

Both the QDLS connection and the IFS network drive connection give you the ability to copy the files directly on to the AS/400's disk. If you are using legacy clients and your web server's document root is within any file system other than QDLS you will need to copy or move the files to their appropriate locations using the WRKLNK, CPY or MOVE commands.

No data conversion takes place (EBCDIC/ASCII) during the transfer from the client machine to the AS/400 through either shared folders or the IFS network drive. However, a code page assignment will be given to the file. The Client Access product you are using decides the code page that will be assigned. Client Access for Windows 95/NT client will assign the code page value that your client machine is using. The other clients will make an assignment based on the single byte PC code page associated with AS/400 user profile used to sign onto the shared folder or IFS network drive.

The easiest and most secure way to determine what code page assignment was made is to check it using the display attributes option available on both the WRKLNK and DSPLNK commands. If the codepage assignment is not being made properly, you should override this value using the file CCSID value.

Determining the Actual Code Page of Your Content

Depending on what client operating system you are using you may find that the data created in a different code page than what is assigned to it on the AS/400. If your content is created under DOS or OS/2 then you can determine what code page your content was created in by issuing the CHCP command at a command prompt.

If you created the content under Windows this is a more difficult task. In most instances, Windows uses a different code page than DOS or any DOS session running within Windows. The CHCP command will only tell you what your DOS code page is not your Windows. The ANSI Code Page (ACP) is the code page value used for the Windows interface. If you are creating content with a Windows application your data will potentially have a different code page than if you created the data under DOS or OS/2. A different code page equates to potentially different code points for the same characters, which would produce unexpected results if not configured properly. All Client Access clients supporting a shared folder drive under Windows, except Client Access for Windows 95/NT, will most likely assign an incorrect code page to files copied to the AS/400 which were created by a Windows program. This problem can be corrected by configuring the File CCSID configuration value for a directory within the directory based configuration file. The following table should help assist in determining what CCSID value to assign.

       CCSID   Windows Operating System
       -----   ------------------------
       1250    Eastern European
       1251    Cyrillic
       1252    US (ANSI)
       1253    Greek
       1254    Turkish
       1255    Hebrew
       1256    Arabic
       874     Thai
       932     Japan
       936     Simplified Chinese (PRC, Singapore)
       949     Korean
       950     Chinese (Taiwan, Hong Kong)
Note: Windows NT (3.5 and beyond) support Unicode data files. It is recommended that you save any HTML files using ANSI Code Pages instead of the Unicode code page.