2,480 pts.
 Data Transfer in iseries
I am transferring a non keyed Physical File from an i5 to a .txt file on my PC.  Is there a way to force the resulting sequence of records in the .txt file on my PC to be the same as the Physical File on the i5 ?

The sequence is inconsistent, sometime the same, sometimes different.



Software/Hardware used:
iSeries Access for Windows V5R4M0 Service Level SI35287
ASKED: February 9, 2010  6:55 PM
UPDATED: February 20, 2010  2:34 AM

Answer Wiki:
On the iSeries Access for Windows dialog box, click on the "data options" button and enter a field in the "order by " text box. If you don't know the name of the field, you can click on the "details button" to get a list of the fields in the file you are using. Click on the "Order by" tab and select your sort field.
Last Wiki Answer Submitted:  February 10, 2010  11:15 pm  by  Teandy   5,830 pts.
All Answer Wiki Contributors:  Teandy   5,830 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Please describe how you are “…transferring a non keyed Physical File from an i5 to a .txt file on my PC.”

FTP? iSeries Access File Transfer? CPYTOIMPF? Your own programming? Something else?

Some transfer methods use SQL for example. With SQL, a sequence is never guaranteed without an ORDER BY clause. Or it might be something else entirely.

Tom

 108,135 pts.

 

Tom,

As described above I am using iSeries Access for Windows V5R4M0, Data File Transfer.

Thank You,
Bill

 2,480 pts.

 

Teandy,

That is my problem, I don’t have a field to sort on, I want the .txt file created on my PC in the same sequence as the PF I am doing a Data Transfer from.

Thanks,
Bill

 2,480 pts.

 

What type of file are you transfering? Is it a flat file (A file that has only one field that contains the data)? Is it a flat file with delimiters between fields?

 5,830 pts.

 

Teandy,

It is a flat file with only 1 field, 750 characters long, created thru DDS and compiled. No delimeters.

Thanks,
Bill

 2,480 pts.

 

Try running the following command on you i5:

CPYTOIMPF FROMFILE(My_Flat_File) +
TOSTMF(‘/My_IFS_folder/My_Flat_File.TXT’) +
MBROPT(*REPLACE) STMFCODPAG(*PCASCII) +
RCDDLM(*CRLF) DTAFMT(*FIXED) +
STRDLM(*NONE) FLDDLM(‘|’)

This should create a text file on the IFS called My_Flat_File.txt in folder My_IFS_folder.
You should then be able to map a drive to the IFS folder and pull the file down to your desktop. Once you have the file, see if it is in the order you want.

The only other thing I can think of would be to create a new file with two fields. One field acts as the key for the file and the other holds the data from the flat file. Then read the flat file, pick a from and through position in the flat file field to act as the key and write the key and the data from the flat file to the new file. Then import the new file using iSeries Access for Windows.

 5,830 pts.

 

Getting to the heart of the question, how do you know what the ‘order’ is on your iSeries? And is your “flat file” a program-described or externally-described file? (If you run DSPFD, is the “Externally described file” attribute ‘Yes’ or ‘No’?)

A reliable solution might require recreating your flat file.

Tom

 108,135 pts.