IBM iSeries computers, still known as AS / 400 systems, use the IBM DB2 database To store and open data organized in files with the following features:
- They are based on data areas that usually have fixed length and type
- They have external data definitions that can be used with application programs
- Numbers can be stored in a packed format, with each spelling stored in half.
- Data is categorized into EBCDIC
Other systems, such as Linux / Unix and Windows, use files that are just order bytes (usually encoded in ASCII) and are therefore known as streamlists. Often they do not have specific lengths and are defined by special demarcation features such as semiconductor, colon or plum (regionally-generated files are often produced by transferring data originally stored in spreadsheets such as Microsoft Excel or databases such as Microsoft Access.)
It is often necessary or useful to transfer files between IBM iSeries (AS / 400) and PC and Linux / Unix systems, but the different filing organizations described above often make such transfers complicated and painful.
This article described some methods to simplify the work.
2. IBM Useful Commands
IBM AS / 400 uses an integrated file system (IFS) that enables different file organizations to be used on the same server as those used by Linux / Unix or Windows and native AS / 400 ones. Native AS / 400 files are stored in libraries or DB2 collections within QSYS.LIB. Other filesystems exist in QOpenSys (similar to Unix) or QDLS (used to store documents and files in computer formats).
IFS allows to use the same server Linux / Unix based applications together with
The AS / 400 operating system provides some useful commands to simplify data exchange between different file systems as described below:
- CPYFRMIMPF to copy data from IFS into the AS / 400 database system
- CPYTOIMPF to copy data from AS / 400 database to IFS
- CPYFRMSTMF to copy stream files to AS / 400 databases
- CPYTPSTMF to copy AS / 400 database files to stream files
- CPYTOPCD to copy AS / 400 database files to computer documents, stored in the QDLS folders
- CPYFRMPCD to copy PC documents into the QDLS folders in AS / 400 database files
The CPYTOPCD and CPYFRMPCD commands are specific to the QDLS system and do not have many options, but the ones allow multiple possibilities and are more flexible. They look similar, but there are important differences as follows:
CPYFRMSTMF transforms text files (streamlined text) into physical files. It has no concept of fields, so it can only write entries to program detected files (ie, files that have no fields defined) or source pfs.
CPYFRMIMPF also converts text files, but tries to interpret the range of input files and copy them into the appropriate fields in the production list. You can either enter specified fields (for example, CSV files, tabbed files, parse files, etc.) Or you can read input from fixed lines (you must define the file structure in "
An example of the second command is as follows:
CPYFRMIMPF FROMSTMF (& # 39; / Fldr1 / File1.CSV & # 39;) TOFILE (Lib1 / FILE3) MBROPT (* Replace) RCDDLM (* CRLF) DTAFMT (* FIXED) FLDDFNFILE (Lib1 / FILE4 )
The example above uses a fixed data format (ie not delimited) and uses the FILE4 key to describe text files as follows:
– This is a comment
– DBFieldname startpos endpos nullIndpos
reit1 1 12 13
field2 14 24 0
reit3 25 55 56
reit4 78 89 90
Reit5 100 109 0
reit6 110 119 120
reit7 121 221 0
The above was required to import the text file into a DB file with the title name: FIELD1, FIELD2, FIELD3, … and FIELD7. * END is required. I think you can release the third column if no fields are invalid.
3. Some User Machines
The following commands are useful and usually perfectly adequate, but they can be complex especially when copying data is not the same or when you want to work Only a few data
I participated in some networking exercises, as such copies between Unix, PC and AS / 400 systems had to be done often, and I developed some tools to simplify this activity.
The machines are designed to meet the following requirements:
- Support for any separator used to deselect the fields
- Possibility to copy valid data into fields that are defined as numbers, numbers or packed numbers
- Possibility to copy data stored in different order in two files. For example, you should be able to copy the boxes 1, 3,4 and 6 of the text file in boxes 5, 2, 1 and 4 in the target database.
- Utility should be able to store the file area (as described above) to allow the user to simply use the previously entered mapping.
I organized the tools in several commands and programs as follows:
a) Order UCPYFTP to manage duplicate files between two files. The board requires entering the following parameters:
AS400 DB File. . . . . . . . . TOFILE …….
AS400 Library. . . . . . . . . TOLIB * LIBL
AS400 member. . . . . . . . . . TOMBR * FIRST
FTP file. . . . . . . . . . . . FROMFILE …….
FTP Library. . . . . . . . . . FROMLIB …….
Field Separator # T = TAB]. . . . SEPARATOR & # 39; | & # 39;
Desimal Point. . . . . . . . . DECPOINT & # 39;. & # 39;
View Field Mappings (Y / N). . . VIEWMAP & # 39; N & # 39;
Up to file no. . . . . . . . UPTOREC 0
b) UFMA01L application to display and maintain existing directory folders.
The screen looks as follows:
UFMAP30 MAPPING FILE MAINTENANCE 20/02/09 10:03:38
AS400 Database File: WERCSWKF FTP File: WERCS
Seq AS400 Fld Description Type Len D From
No.. Name FldN
1 WK0003 WK_CLIENTE A 9 3
2 WK0004 WK_CLI_SAP A 10 4
3 WK0005 WK_RAGSOC A 40 5
4 WK0006 WK_ZIP A 5 9
5 WK0016 WK_ADDRESS1 A 100 17
6 WK0017 WK_ADDRESS2 A 100 19
7 WK0101 WK_INDI A 30 0
8 WK0102 WK_CAP A 5 0
9 WK0103 WK_LOC A 25 0
10 WK0104 WK_PROV A 2 0
F3 = Exit F6 = Update Mappings F9 = Use Series Identification F11 = Method
The screen shows that the field number 3 of the FTP file is copied to the first field in the database called WK0003, box 4 is copied to WK0004 and so on. The fields in which the number is zero is not copied, but is transcribed correctly in the target file (with zero or spots).
Notice the following points:
- The file to be dubbed is called an FTP file because it is usually sent to AS / 400 using FTP transfer.
- The user must specify the name and the library of both the FTP file and the target AS / 400 database file.
- Commands use some specs for the region pair and the decimal, but they can be changed by the user.
- When the menu item is set to & # 39; Y & # 39; The user will see previously defined roster images or enter new folders.
- When the user calls the command for the first time for new fpp and target files, the application completes the definitions on the database and shows the map layout to allow the user to enter the cardholder that is then stored to allow future use.
A similar tool called UCPYTOFTP allows you to copy the data from the AS / 400 database into a text file downloaded to the Linux / Unix or Windows machine.
The Utilities And Their Documents Can Be Downloaded Free Of My Website. The applications are free software that may be distributed and / or modified under the terms of the GNU General Public License as published by the Free Software Foundation.
Source by Mario Pesce