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



Obviously a CCSID issue.
If you have xTools, create the file first, uses the CrtAsciiFile()
procedure, then write to it. If you don't have xTools, try using Scott's
example to create the file, but make sure you have the 819 CCSID specified
on the 4th parm of the open() API.

If you're still having a problem, it might be that when the file is already
on the IFS and you do a "re create" of the file, the original CCSID will
stay with the file. Use WRKLNK and the option 8 to display the attributes of
the file. See of the CCSID is 819. If not, then delete it and try to create
it again.
This might seem like another crazy IFS/PC/Unix thing, and is why I added
CrtAsciiFile() to the xTools.
-Bob


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Ian Patterson
Sent: Monday, October 25, 2004 10:34 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: tip required to transfer large data from User Space to IFS

Bob,

The file is not read only. I can edit it with notepad.

Have not tried Excel because the data would be unreadable to Excel. Its just
128K of hex (its a digital signature).

here's the first 3 lines:
MIIJkQYJKoZIhvcNAQcCoIIJgjCCCX4CAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3
DQEHAaCCB9MwggOyMIICmqADAgECAhA2raZAs7tESWYNgv2QAPJbMA0GCSqGSIb3
DQEBBQUAMFAxGjAYBgNVBAoTEUJhcmNsYXlzIEJhbmsgUExDMRgwFgYDVQQLEw9U

(see what I mean ).

Regards

Ian Patterson

ian@xxxxxxxxxxxxxxxxx <mailto:ian@xxxxxxxxxxxxxxxxx>

Grange IT Limited
tel 01947 880458
www.grangesystems.com



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Bob Cozzi
Sent: 25 October 2004 14:51
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: tip required to transfer large data from User Space to IFS


Does Excel also give you an error? Does it say "Read Only" in the window
title bar for the NotePad application when the file is open?
-Bob


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Ian Patterson
Sent: Monday, October 25, 2004 2:55 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: tip required to transfer large data from User Space to IFS

Scott,

Thanks for the info. My brain must have decomposed, because I was already
using the write procedure in the prog:
eval rc=write(fd:%addr(data):bytecount) for small amounts of data (field
data is 6000 char) & totally forgot that the Usrpace address works exactly
the same way.

As you say in the States; doh....

As an aside to this thread, I am experiencing a problem with the files
created on the IFS by the RPG program.
If I use the file creation (from Scotts's tutorials) method to create the
IFS file, and then access it in Delphi programs in Windows, I get IO errors.
Notepad can open the file.
If the file is created initially by Windows, no problem. The CCSID and
authorities (*PUBLIC) are identical between the rpg and Windows created
files.

This is the file creation routine:
0089.00 c                   eval      fd = open(%trimr(AppFile):
0090.00 c                             O_WRONLY+O_TRUNC+O_CREAT+O_CODEPAGE:
0091.00 c                             file_IFSMODE:file_CODEPAGE)
0092.00 c                   if        fd < 0
0093.00 c                   ** error notification
0094.00 c                   endif
0095.00 c                   callp     close(fd)
0096.00 c                   eval      fd = open(%trimr(AppFile):
0097.00 c                             O_WRONLY+ O_TEXTDATA)
0098.00 c                   if        fd < 0
0099.00 c                  ** error notification
0100.00 c                   endif

where (my prog)
0026.00 D File_CODEPAGE   C                   CONST(819)
0027.00 D File_IFSMODE    C                   CONST(511)
and (from IFSIO_H)
0039.00 D O_TEXTDATA      C                   16777216

I then give *PUBLIC all access & rights to the data & objects (manually)

Regards

Ian Patterson

ian@xxxxxxxxxxxxxxxxx <mailto:ian@xxxxxxxxxxxxxxxxx>

Grange IT Limited
tel 01947 880458
www.grangesystems.com



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Scott Klement
Sent: 24 October 2004 18:08
To: RPG programming on the AS400 / iSeries
Subject: Re: tip required to transfer large data from User Space to IFS



Hi Ian,

> I have created data in a User Space that can get up to 10 Meg. I need to
> transfer this (programatically if possible) into a stream file on the IFS.
> I can easily create/ extend /write data to/ etc the stream file within my
> program, its just the transfer of a large amount of data that I can't get
my
> head round.
>
> Obviously field size limitations precludes an easy approach (I think).

If you're using the open/write/close APIs to create your stream file,
you'll note that the write() API takes the following three parameters:

    descriptor = tells write() which open file to write to

       pointer = points to a spot in memory where the data you want
                 written desides

          size = the number of bytes to write from that area of memory.

The QUSPTRUS API retrieves a pointer to a user space. Exactly what the
doctor ordered for the 2nd parameter to write()!

The QUSRUSAT API can retrieve the current size of the user space, which
works for the 3rd parameter. (Though, if you already know how big your
data is, you won't need this API.)

The following program is a trivial example.  (I used IFSIO_H from LIBHTTP,
since I know you have access to HTTPAPI...)

     H DFTACTGRP(*NO)

      /copy libhttp/qrpglesrc,ifsio_h

     D QUSRUSAT        PR                  ExtPgm('QUSRUSAT')
     D   RcvVar                   32767A   options(*varsize)
     D   RcvVarLen                   10I 0 const
     D   Format                       8A   const
     D   UsrSpc                      20A   const
     D   ErrorCode                32767A   options(*varsize)

     D QUSPTRUS        PR                  ExtPgm('QUSPTRUS')
     D   UsrSpc                      20A   CONST
     D   Pointer                       *

     D dsAttr          ds
     D   dsAttr_Rtn                  10I 0
     D   dsAttr_Avl                  10I 0
     D   dsAttr_Size                 10I 0
     D   dsAttr_AE                    1A
     D   dsAttr_Init                  1A
     D   dsAttr_Lib                  10A

     D NullError       ds
     D   BytesProv                   10I 0 inz(0)
     D   BytesAvail                  10I 0 inz(0)

     D fd              s             10I 0
     D p_UsrSpc        s               *

     c                   callp     QUSRUSAT( dsAttr
     c                                     : %size(dsAttr)
     c                                     : 'SPCA0100'
     c                                     : 'MYUSRSPC  QTEMP'
     c                                     : NullError )

     c                   callp     QUSPTRUS( 'MYUSRSPC  QTEMP'
     c                                     : p_UsrSpc )

     c                   eval      fd = open( '/tmp/myStreamFile.dat'
     c                                      : O_WRONLY + O_CREAT + O_TRUNC
     c                                      : 511 )

     c                   if        fd < 0
     c***  OPENING STREAM FILE FAILED, NOTIFY USER HERE
     c                   endif

     c                   callp     write(fd: p_UsrSpc: dsAttr_Size)
     c                   callp     close(fd)

     c                   eval      *inlr = *on
--
This is the RPG programming on the AS400 / iSeries (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 AS400 / iSeries (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 AS400 / iSeries (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 AS400 / iSeries (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.