| Goals for this chapter: |
The IBM AS/400 and Linux have been very successful for many years and it is increasingly important to find the best ways to integrate their usage. It should be noticed that what is described below about Linux is generally applicable also to UNIX.
IBM has done a lot of work from version 3.1 of the OS/400 to improve the coexistence with the Unix and PC applications.
Recently IBM has also announced that Linux will be installed as an option on the AS/400 by using a separate Logical Partition (LPAR).
The following point will examine in detail how the recent changes make the integration of these two worlds easier.
The
AS/400 Integrated File System
The Integrated File System has been built in the operating system after the version 3.1 to allow an easier coexistence between the AS400 native applications and stream file oriented systems such as Linux, UNIX, DOS and OS/2.
The traditional AS/400 approach consists of fixed format records stored in database files residing in libraries (single level containers with the exception of QSYS that contains all other libraries).
Normally each file (stored in the DB2 UDB database for the AS/400) has an external definition of the component fields that is automatically copied into each program that uses the file.
This model is very good for business applications because it allows to identify and process each field of any database file easily, but is not very suitable for other files such as word processing documents, Web pages, Java classes and graphics.
The world of Unix, Linux and PCs has been instead traditionally oriented towards the use of stream files that have not a fixed structure and are well suited for documents processing.
IBM had tried in the past to use the traditional library structure also for stream files with the concept of 'shared folders', but they were difficult to manage and performed poorly.
The IFS was then introduced to allow a better coexistence on the AS/400 of the different approaches described above.
The IFS supports stream
files and subdivides the space among different file systems that use different
rules and conventions. For instance:
The AS/400 originally supported only the IBM System Network Architecture (SNA) with APPN/APPC communications.
Different solutions were developed to allow the coexistence with other approaches such as TCP/IP or Novell IPX.
For instance Microsoft developed an SNA gateway that allow translating the original SNA protocols into TCP/IP protocols.
IBM decided to open its arms to TCP/IP and adopted TCP/IP as a brother to APPN/APPC after the version 3.1 of the Operating System (OS/400).
The main reasons for
this development are the following:
NFS allows access to remote file systems, which appear to applications as if they reside on the local machine. Therefore the need to duplicate and copy files among different machines on the net is eliminated.
Sun Microsystems originally developed NFS and released it in 1984. Since then Sun NFS has become a de facto standard within the Unix community.
The AS/400 has included NFS support with the V3R7 release of the OS/400 and the implementation is based on Sun's Version 2, which is one of the most commonly used.
NFS uses exporting from the server to make local file systems, directories and objects available to remote systems. The server administrator must decide what local file systems (i.e. subtrees of directories and files) may be exported as well as how they will be exported.
The administrator can
choose which clients may access the files and how (e.g. read only).
The options chosen by the server administrator are typically stored in a file called /etc/exports and then the exports can be activated by using the command exportfs. This can be done at start-up and can be included in the AS/400 start-up file QSTRUP run automatically during IPL.
The clients can then add the exported file system to the local machine by using a mount command (normally on an empty directory). The exported file system can later be un-mounted by using the umount command.
If the mount command
is done on an AS/400 the format is as follows:
MOUNT TYPE(*NFS) MFS('Sunset:/home/dir1')
MNTTOVRDIR('/Sunset/data')OPTIONS('ro, retry=10, timeo=60, soft')CODEPAGE(297 297)
The communications
with the server are handled by Remote Procedure Call (RPC), which is a
high-level stateless network protocol that saves no information from client/server
communications.
RPC bundles up the arguments intended for a procedure call into a packet of data called a network datagram. The NFS client creates an RPC session with an NFS server by connecting to the proper server for the job and transmitting the datagram to that server. The arguments are then unpacked and decoded on the server. The operation is processed by the server and a return message (should one exist) is sent back to the client. On the client, this reply is transformed into a return value for NFS. The user's application is re-entered as if the process had taken place on a local level.
By using NFS the AS/400 can be included as a client or a server in the network and Linux and AS/400 machines can easily share their files.
An AS/400 can export any of the following file systems:
Both the AS/400 and Linux can use Telnet to establish an interactive session.
However, when Linux wants to access an AS/400, Telnet is not the best option because the communication is oriented to single characters, whereas theAS/400 original 5250 data stream manages one full screen at a time.
Some interesting emulators
exists for the Linux market and are described below:
Database File to Stream File Copy
The utility consists of a command (UCRTFTPFIL) and some programs to perform the conversion.
The AS/400 packed fields are converted into numeric fields and an explicit decimal point is added when there are decimals.
Moreover a field separator is added to identify the end of each field.
The command prompt
the data in the following mask:
Create FTP file (UCRTFTPFIL)
The utility assumes that the stream file contains fields separated by a separator. It is not requested to have the fields in the same sequence as those on the AS/400 database file.
The mapping of the fields can be entered by using the utility program UFMAP01L, that displays the following screen:
UFMAP01 MAPPING FILE MAINTENANCE 23.01.01 12:26:46
AS400 Database File: CPTRAN FTP File: FTPTRAN
Seq AS400 Fld Description
Typ Len D From
No. Name
FldNo
1 CT0010 COUNTRY-CODE
P 2 1
2 CT0020 BRANCH CODE
P 2 3
3 CT0030 VENDOR CODE
P 2 2
4 CT0040 VENDOR PGM-NO
P 2 0
5 CT0050 VENDOR POOL-NO
P 2 0
6 CT0060 TRANSACTION-NO
P 3 0
7 CT0061 STATUS CODE
P 1 0
8 CT0080 CRL-NUMBER LESSEE
P 5 0
9 CT0110 TRANSACTION FILE STATUS
A 1 0
10 CT0111 RENTAL STR. FILE STATUS
A 1 0
11 CT0112 DOCUMENT FILE STATUS
A 1 0
12 CT0113 EQUIPMENT FILE STATUS
A 1 0
13 CT0114 PROPOSAL FILE STATUS
A 1 0
14 CT0115 TRANSACTION FILE ERROR-KZ
A 2 0
15 CT0116 RENTAL STR. FILE ERROR-KZ
A 2 0
Segue...
F3=Exit
F6=Update Mappings
F9=Assign sequential field no.
In the example above, the field number 1 of the stream file (see From FldNo) is mapped to the field CT0010 of the AS/400 database file, the field number 2 is mapped to CT0030 and the field number 3 is mapped to CT0020.
Once the mappings have
been defined, it is possible to perform the copy by using the command UCPYFTP
that prompts the user for the following data:
Copy FTP file to AS400 DB file (UCPYFTP)
Immettere le scelte e premere Invio.
AS400 DB File . . . . . . . . .
Valore carattere
AS400 Library . . . . . . . . . *LIBL
Valore carattere
AS400 Record . . . . . . . . . .
Valore carattere
Separator . . . . . . . . . . . '|'
Valore carattere
Decimal Point . . . . . . . . . ','
,, .
FTP File . . . . . . . . . . . .
Valore carattere
FTP Library . . . . . . . . . .
Valore carattere
Up to Record No. . . . . . . . . 0
Numero
F3=Exit
F6=Add
Also in this case the user is required to specify the separator and the decimal point used for the numbers.
It should be mentioned that the field mappings must be specified only once for each couple of files and that the copy command uses them automatically.
Exercises (Only if you have an AS/400 system in your enviroment)
Read the answers
to the exercises.
Check the Interactive Exam Cram Networking:
Internet Resources for this Chapter.