Midrange News for the IBM i Community


Posted by: rpgprogrammer
Vancouver, BC
CPYFRMIMPF
has no ratings.
Published: 29 Nov 2012
Revised: 23 Jan 2013 - 667 days ago
Last viewed on: 19 Nov 2014 (1381 views) 
CPYFRMIMPF Published by: rpgprogrammer on 29 Nov 2012 view comments(8)


I want to transfer a text file wich has a deliminator to iSeries.  I am using CPYFRMIMPF Command to do that.
In the text file there are around 500 records. Some of the records have multiple lines and because of that not able to transfer record correctly.  Any help?

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: DaleB
Premium member *
Reading, PA
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 23 days 2 hours 37 minutes ago

What do you mean by "some of the records have multiple lines?" Are you saying that some of the character fields have embedded CRLF, or something like that? Can you provide an example?

Posted by: rpgprogrammer
Premium member *
Vancouver, BC
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 22 days 12 hours 51 minutes ago
Edited: Fri, 30 Nov, 2012 at 09:11:49 (721 days ago)

Hi,

 

Assume this is a single record  as below.  Now when you copy this in a text file (notepad) it will come in two lines. and they when we try to copy the text file by CPYFRMIMPF command, in the iseries, it will write two records instead of one and the field to field mapping will be lost.  I have the PF Created based on number of fields in below text (deliminator based)

RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMERRPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG|RPGPROGRAMMER|TEST1|ABCDEFG||TEST1|ABCDEFG|
Posted by: Paulster
Premium member *
Sweden and The Netherlands
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 22 days 10 hours 8 minutes ago
Edited: Thu, 29 Nov, 2012 at 23:57:48 (722 days ago)

It is a little known fact that Notepad does not handle long lines well. Up to 1024 positions you're ok, after that Notepad will split the line and view the rest on the next line. Not really how you want any txt editor or viewer to behave. Good txt editors such as Notepad++ don't have this problem.


So first view your file in a proper txt editor and see if it is ok there. I tested your example and it behaves exactly as it should in Notepad++ - you get only one line of data. In Notepad, as expected, it splits the line at 1025 and views the rest on the next line.

 

Dunno about the CPYFRMIMPF command cause I don't use it but there are quite a few keywords there for record and field delimiters to play with. In your example, all delimiters seem the same, where's the record delimiter? Also, what's the record length of the target PF on the IBM i?

 

Good luck,

Paulster

Posted by: Viking
Premium member *
CA
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 21 days 23 hours 56 minutes ago

I use Notepad++ too and really like it.

Posted by: clbirk
Premium member *
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 21 days 21 hours 30 minutes ago

another great text editor is ultraedit  (www.ultraedit.com). I have used it for like 10 years, it puts nice column markings at the top, I have opened up files that are 1/2 gb and it works...

 

chris

Posted by: DaleB
Premium member *
Reading, PA
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 19 days 2 hours 15 minutes ago

I use PSPad; you can turn wrap on/off at will.

But line wrapping in an editor has nothing to do with CPYFRMIMPF, unless the editor itself is inserting end-of-line characters (as opposed to wrapping as part of rendering).

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 19 days 16 minutes ago

Have you looked at the RCDDLM parameter? For example, how do you know what the end of line/record marker is in your file? If you simply have a stream of fields with no record delimiter, how are you expecting CPYFRMIMPF to know where the end-of-record is? Especially if one database record could appear over multiple "lines" in the text file. It doesn't simply count the fields, ignoring CR/LF characters.

Perhaps try determining the line/record delimiter sequence and specify it on the RCDDLM parameter. For example if you use one bar to separate the fields, but two bars to indicate a new record, then specify RCDDLM('||').

I'm assuming you've already adjusted the FLDDLM parameter from a comma to a single bar?

Posted by: rpgprogrammer
Premium member *
Vancouver, BC
Comment on: CPYFRMIMPF
Posted: 1 years 11 months 18 days 11 hours 37 minutes ago

Thanks Bob,  Seems I was not getting CRLF for few records in the file.  W