× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I changed the field definition to Varying, but received the same results.
<snip>

D Test_Data S 50A Varying

Test_Data = '123456179,THIS IS A TEST ITEM' + CRLF;

Bytes_Loaded = // Bytes written

Write (FileDS // File Descriptor

: %Addr(Test_Data ) // Data to write

: %Len(Test_Data ) // Length of data

);

Test_Data = '787898779,This is a new item ' + CRLF;

Bytes_Loaded = // Bytes written

Write (FileDS // File Descriptor

: %Addr(Test_Data ) // Data to write

: %Len(Test_Data ) // Length of data

);
</snip>

Also tried using %Size for length of data with the same results.

Data in file -
123456179,THIS IS A TEST ITEM
787898779,This is a new item




On Tue, Jun 19, 2012 at 9:26 AM, Charles Wilt <charles.wilt@xxxxxxxxx>wrote:

Repeat after me....

When dealing with strings...varying fields are my friends.... :)

Charles

On Tue, Jun 19, 2012 at 9:19 AM, Porterfield, Sean
<SPorterfield@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
Same problem. You have blanks in your field after the CRLF. Use a
varying field. I think you'll want the length of the field then rather
than %size.
--
Sean Porterfield


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:
rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Tuesday, June 19, 2012 09:17
To: RPG programming on the IBM i / System i
Subject: Re: Help creating file on IFS

Scott & All,
With Scotts' help I was able to get the file created properly and able
to read it in Notepad.
However, when I view it with Option 5 under WRKLNK or open it with
Notepad, I noticed that my data is not aligned properly.
The data consists of 2 records, each a maximum of 50 bytes.
What I am seeing is:
123456179,THIS IS A TEST ITEM
787898779,This is a new item

The second record is starting under the H ot THIS in the first record.
The code below shows how I am writting the data.

What am I missing now???

Thanks,


<snip>

D Test_Data S 50A

Test_Data = '123456179,THIS IS A TEST ITEM' + CRLF;

Bytes_Loaded = // Bytes written

Write (FileDS // File Descriptor

: %Addr(Test_Data ) // Data to write

: %Size(Test_Data ) // Length of data

);

Test_Data = '787898779,This is a new item ' + CRLF;

Bytes_Loaded = // Bytes written

Write (FileDS // File Descriptor

: %Addr(Test_Data ) // Data to write

: %Size(Test_Data ) // Length of data

);
</snip>

On Tue, Jun 19, 2012 at 9:00 AM, Jeff Young <jyoung0950@xxxxxxxxx>
wrote:

Scott,
Thanks!
The problem was that I did not trim the trailing blanks from the file
name on the Open.

I appreciate you taking the time to help with this.



On Tue, Jun 19, 2012 at 6:39 AM, Dennis Lovelady <iseries@xxxxxxxxxxxx
wrote:

This is a variation on a theme, but to add on to Scott's possibilities:

In a filesystem where case matters, it is possible that you have two
files with the same name - but the name cases don't match. This can
cause Windoze to do some strange things, like showing you only one of
the files when there are clearly two.

If your intended file is /path/to/file/filename.csv, then on your IBM
i, do

qsh

ls -l /path/to/file' | grep -i '*filename.csv*'

This may reveal something to you.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Tact is the ability to describe others as they see themselves."
-- Abraham Lincoln



Yes, the IFS e-book on my web site was written for v4r5... The
O_TEXT_DATA feature (and it's corresponding 5th parameter) was
added to the OS in V5R2. You can get the current copy of IFSIO_H
here:

http://scottklement.com/rpg/copybooks/ifsio_h.rpgle.txt

It's still unclear to me what the actual cause of the problem is...
Here's how I'd call the open() API... maybe that'll help.

IFS_File_Name = '/excel/xml/I12456_0.csv';

FileDs = open( %trimr(IFS_File_Name)
: O_CREAT + O_WRONLY + O_TEXTDATA + O_CCSID
+ O_TEXT_CREAT + O_INHERITMODE
: 0
: 1208
: 0 );

The fact that the file shows up on IBM i, but not on Windows is not
a commonplace error. It implies (as I said before) that there are
two copies of the file.

Two possibilities:

1) That there are two locations, and you're viewing different
locations from each source.

2) That you didn't trim the trailing blanks from the filename, and
so you have two copies, one with blanks in the filename, and one
without.


On 6/18/2012 2:07 PM, Jeff Young wrote:
Scott,
1. The proper number of bytes for the file is 100. This shows in
the WRKLNK option 8 on the i. The file consists of 2 records
each
50
bytes.

2. In Windows (XP Pro) when I view the list of files on the
mapped
drive,
it shows 1K.
When I double click on the file name, nothing happens. The
file
does
not open and no error is issued.

3. When viewing the properties in Windows, the file shows as 0
bytes.


I am using the IFSIO_H copy book from your book, although it may
be
an
older copy as I had to modify the Open prototype to add the fifth
parm
required for O_TEXT_CREAT.

The code I use for the Open of the file is shown in my original
post.

--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/rpg400-l.




--
Jeff Young
Sr. Programmer Analyst




--
Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.


This email is confidential, intended only for the named recipient(s)
above and may contain information that is privileged. If you have received
this message in error or are not the named recipient(s), please notify the
sender immediately and delete this email message from your computer as any
and all unauthorized distribution or use of this message is strictly
prohibited. Thank you.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.