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



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 <cozzi@xxxxxxxxx> 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 ...

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.