Looking at the manual you will see that SQL support reads and writes from
arrays or multiple occurrence data structures.

The trick is how many records are you writing. Let's say you are going to
write 10 records. You could just dynamically allocate memory, load your
array and issue an SQL insert for the 10 records but if you have 100 or 200
records. You could use memory but what I usually do is to create a user
space and get a pointer to it and that pointer goes into the data structure.
That way I have up to 16mb of records and the system manages the storage.

In this example, I am using my api's for user spaces which I will be happy
to send you.

d RecordOut...
d ds Qualified
d Occurs(32766)
d Based(ptrRecordOut)
d Field1...
d 5a
d Field2...
d 2a

d SpaceName...
d s 10a
d x...
d s 5i 0
/Free


SpaceName = USPC_GetNextUserSpaceName;
USPC_CreateUserSpace(SpaceName :
'QTEMP' :
%Size(RecordOut) * 10::
cTrue :
' ' :
'*ALL' :
'*YES' :
5 :
'1' );
ptrRecordOUt = USPC_GetPointerToUserSpace(SpaceName:
'QTEMP' );

For x = 1 To 10; Write some dummy records as an example.
%Occur(RecordOut) = x;
Field1 = 'ABC';
EndFor;

Exec Sql Insert Into YourTable :x Rows Values (:RecordOut);

/End-Free

Field2 = 'XX';

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