× 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.



Bob,
My fields are all defined as 10i0.
My mode flags are:

Mode_Flag = S_IWUSR + S_IRUSR + S_IRGRP + S_IROTH;
>From what I understand, this, along with my other logic, should create a file 
>that I can process from the PC.
 
I apprecate any and all help.
 
Thanks,


Bob Cozzi <cozzi@xxxxxxxxx> wrote:
My Mode flags are:
// Add all User, Other and Group Auth to the mode flag.
nModeFlags = S_IRWXU + S_IRWXO + S_IRWXG;

Lastly... are you flag fields and CCSID defined as 10i0 value?

D nFlags S 10I 0
D nModeFlags S 10I 0 
D nCCSID S 10I 0

If you are using an older data-type such as "B" (binary), it may not be
converting correctly on the call to the IFS API.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jeffrey Young
Sent: Thursday, July 14, 2005 12:33 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: IFS Output problem

Bob,
I tried your suggestions and have the same result.
I have mapped the directory using windoz map network drive after setting the
share in iSeries Access.
The RPG code that creates the file is:

// Remove file if it exists first, so we don't overwrite beg file seg

RC=unlink(%TrimR(IFS_File_Name));

// Create file with correct code page, in text mode

Open_Flag = O_CODEPAGE + O_RDWR + O_CREAT ;

Mode_Flag = S_IWUSR + S_IRUSR + S_IRGRP + S_IROTH;

fd=open(%TrimR(IFS_File_Name) :Open_Flag : Mode_Flag : Code_Page);

// Close file

RC=close(fd);

// File Created - Open for text output

Open_Flag = (O_TEXTDATA + O_RDWR + O_APPEND);

fd=open(%TrimR(IFS_File_Name) : Open_Flag);


Bob Cozzi wrote:
Looks like you've obfuscated your HTML.

So, you open the file to create it.
You close the file.
You re-open the same file and then write data to it.
The data looks okay when viewing it via a 5250 screen.
You open it in Notepad and it looks obfuscated. 
This is again, a CCSID issue. Something's obviously not right, and I'm sorry
to state the obvious because without seeing the code, I can't really do much
else. 
You might also look at how you're mapping the IFS folder to your PC. I
remember in Client Access there was a CCSID setting that defaults to
something completely screwy. If you not using the standard Windows method to
Map a Network Drive, and are using CA to do it, that could be your issue.
Just a shot in the dark here, before you do all that investigating, try
changing the flags for the Initial Open to use O_RDWR instead of O_WRONLY.

I use:
O_CODEPAGE + O_RDWR + O_CREAT

To create the file, then I use:
O_TEXTDATA + O_RDWR + O_APPEND

To open the file the second time to write data to it.
Again, the purpose of this sequence is to create or replace a file and then
open it for output.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jeffrey Young
Sent: Thursday, July 14, 2005 11:53 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: IFS Output problem

Bob,
I added the O_APPEND, now when I try to open with NOTEPAD, I see 
&#59904;&#26684;&#28020;&#15980;&#26684;&#24933;&#15972;&#29756;&#29801;
964;&#8254;&#17980;&#28271;&#8308;&#25405;&#27759;&#29295;&#8765;&#17990;
7990;&#17990;&#15906;&#28483;&#29298;&#25445;&#24948;&#27746;&#8293;&#29263;
&#25956;&#29554;&#12092;&#28518;&#29806;&#15422;&#29743;&#29801; as the
data.
When I look in the IFS using the WRKLNK I see the same data that I had
before.
The attributes display indicates code page 819.
Coded character set ID . . . . . . . . : 819 

What happened?
Why am I still getting garbage in my output data (as viewed in the WRKLNK)
I must be doing something wrong, but I am out of my depth here.

Thanks,

Bob Cozzi wrote:
You need to add O_APPEND to the set of Open Flags for the second open.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jeffrey Young
Sent: Thursday, July 14, 2005 11:14 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: IFS Output problem

This is the RPG code I am using to create / open the file.

D Code_Page S 10U 0 Inz(819)


// Create file with correct code page, in text mode

Open_Flag = O_CREAT + O_WRONLY + O_CODEPAGE;

Mode_Flag = S_IWUSR + S_IRUSR + S_IRGRP + S_IROTH;

fd=open(%TrimR(IFS_File_Name) :Open_Flag : Mode_Flag : Code_Page);

// Close file

RC=close(fd);

// File Created - Open for text output

Open_Flag = (O_WRONLY + O_TEXTDATA);

fd=open(%TrimR(IFS_File_Name) : Open_Flag);
>From what I understand, the initial open should have created the file with
code page 819.
If not, what am I doing wrong, and why do I have the garbage imbedded in my
data?



Bob Cozzi wrote:
Yes, well I suspect you're problem is related to what I suggested. Opening
it directly from Excel or Windows Explore would produce the same results.
I may being going out on a limb here, but I'm going to "guess" you
open/create the file on the IFS in once step, then write data to it? If so,
the system doesn't automatically convert it to the 819 codepage. You have to
open/create it, then close it, then reopen it with append before writing to
it. At that point the system will automatically translate the EBCDIC to the
ASCII codepage.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jeffrey Young
Sent: Thursday, July 14, 2005 10:42 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: IFS Output problem

Bob,
I am accessing the file directly from the IFS.
The code page is 819.



Bob Cozzi wrote:
How are you getting the file from the IFS to the PC? Or aren't you?
I find that if you use Windows Explorer to pull down a file, you get the
results you experience.
If you use FTP to transfer the file from the IFS to the PC, you get good
results.
This has to do with the CCSID of the IFS file. Make sure it is PC ASCII (I
think that's CCSID 819) and it should open fine from Explorer or FTP.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jeffrey Young
Sent: Thursday, July 14, 2005 10:03 AM
To: midrange-l@xxxxxxxxxxxx; rpg400-l@xxxxxxxxxxxx
Subject: IFS Output problem

I am creating a file in the IFS in HTML format with a .xls extension to be
opened by MS EXCEL.
I am getting garbage characters in my output file that my program did not
create.
When I try to open the file, EXCEL can not determine what type of data it
contains.
When I view it in NOTEPAD it looks fine.
I SAVE the file from NOTEPAD *without any changes*, then EXCEL can open it.
When it is displayed, I get weird results as follows:
Run Date: 07/14/2005Correctable OrdersRequested by: JEFF
repeated 245 times....

The file in NOTEPAD is as follows:

êRun Date: 

07/14/2005Correctable OrdersRequested by: JEFF
width="100%">

The HEX version of the data (from option 5 on WRKLNK is :

20EA3C68 746D6C3E 3C686561 643E3C74 69746C65
653E203C 466F6E74 203D636F 6C6F723D 22464646
46464646 223E436F 72726563 7461626C 65204F72
72646572 733C2F66 6F6E743E 3C2F7469 746C653E
3E3C2F68 6561203F 3C683320 616C6967 6E3D226C
6C656674 223E5275 6E204461 74653A20 30372F31
31342F32 3030353C 2F68333E 3C683220 616C6967
676E3D22 63656E74 6572223E 436F7272 65637461
61626C65 204F7264 6572733C 2F68323E 3C68333E
3E526571 75657374 65642062 793A204A 4546463C
3C2F6801 C83C7461 626C6520 616C6967 6E3D2274
746F7022 20626F72 6465723D 22312220 77696474
74683D22 3130300A
223E3C74 72206267 636F6C6F 723D2223 30304646

What am I doing wrong?



Thanks,






Jeff Young 
Sr. Programmer Analyst
Dynax Solutions, Inc.
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions
V5R2 
IBM Certified Specialist- e(logo) server i5Series Technical Solutions
Designer V5R3

IBM Certified Specialist- e(logo)server i5Series Technical Solutions
Implementer V5R3










__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.