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

SpaceName = USPC_GetNextUserSpaceName;
USPC_CreateUserSpace(SpaceName :
%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';

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


Field2 = 'XX';

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.