[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pointer math (merging ifs files)
Sender: Magne Kofoed <magne@xxxxxxxxx>
Thanks Scott!!
Your solution worked perfect.
I am using this to put xml to MQ (data queue), and this will
increase the limit from (32k or is it 64k?) to 16MB
(a rpg variable vs user space ).
Here is what i did (thanks to Scott):
1. Find total size of the ifs files.
eval tot_siz = 0
eval p_statds = %addr(mystat)
if stat(%trimr(stmf1): %addr(mystat)) <> 0
:
endif
eval tot_siz = st_size
eval p_size = st_size
eval p_statds = %addr(mystat)
if stat(%trimr(stmf2): %addr(mystat)) <> 0
:
endif
eval tot_siz = tot_siz + st_size
eval s_size = st_size
eval p_statds = %addr(mystat)
if stat(%trimr(stmf3): %addr(mystat)) <> 0
:
endif
eval tot_siz = tot_siz + st_size
eval e_size = st_size
2. Create user space with tot_size
callp QUSCRTUS('STMFILE QTEMP':
'STMFILE':
tot_siz: x'00':
'*ALL':
'User Space':
'*YES':
dsEC)
and get pointer to user space
callp QUSPTRUS('STMFILE QTEMP': u_data)
3. Copy the stmf file data to the user space
eval newPos = u_data
eval xf = open(%trimr(stmf1): O_RDONLY +
O_TEXTDATA)
if read(xf: newPos: s_size) < s_size
:
endif
eval newPos = newPos + s_size
eval sf = open(%trimr(stmf2): O_RDONLY +
O_TEXTDATA)
if read(sf: newPos: p_size) < p_size
:
endif
eval newPos = newPos + p_size
eval xf = open(%trimr(stmf3): O_RDONLY +
O_TEXTDATA)
if read(xf: newPos: e_size) < p_size
:
endif
4. send the response using MQPUT1
eval Bufpt1 = u_data
eval Buflen = tot_siz
CALLP MQPUT1(HCONN : MQOD : MQMD : MQPMO :
BUFLEN : BUFPT1 : CCODE : REASON)
;-)Magne
Date: Wed, 16 Mar 2005 21:13:17 +0100
From: Thomas Raddatz <thomas.raddatz@xxxxxxxxxxx> Add To
Address Book
Subject: Re: Pointer math (merging ifs files)
To: ftpapi@xxxxxxxxxxxxx
Sender: Thomas Raddatz <thomas.raddatz@xxxxxxxxxxx>
Scott,
Your are absolutely right. I had not enough time to give a
detailed answer,
yesterday. However I wanted to give Magne an idea where to
start from.
Thomas Raddatz.
Scott Klement schrieb:
> Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>
>
>
>> memcpy(u_data: s_data: st_size_s)
>> memcpy(u_data + st_size_s: p_data: st_size_p)
>> memcpy(u_data + st_size_s + st_size_p: e_data: st_size_e)
>
>
> Hmmm... if you do that, you'll have to allocate memory to
s_data,
> p_data, and e_data, read the data into that memory, and
then copy it to
> the user space. It would work, but you'd have two copies
of everything
> in memory at once, and you'd have to spend extra CPU
cycles copying the
> memory.
>
> So, it would work, but I wonder why you wouldn't just read
it into the
> user space directly?
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------