×
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 don't appear to be using an occurrence DS. You appear to be using an Array. Therefore your reference to DS_XML needs to have an array index reference on it.
i.e.
For idx = 1 to %ELEM(DS_XML);
eval-corr DSoutput = DS_xml(idx);
... Do something with DSOutput.
Endfor;
Otherwise you can change it to use an occurrence DS, but you have to set the occurrence you want to use.
d DS_xml Likeds(xmlds_template) occurs(9999)
%occur(DS_XML) = 1;
eval-corr DSoutput = DS_xml(idx)
... Do something with DSOutput.;
%occur(DS_XML) = 2;
eval-corr DSoutput = DS_xml(idx);
... Do something with DSOutput.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Amanda Paul
Sent: Wednesday, May 09, 2012 1:25 AM
To: RPG programming on the IBM i / System i
Subject: Multi occurence DS with eval-corr question
p myProcedurefiletoextractinformation...
p b export
p myProcedurefiletoextractinformation...
p pi N
d parm1 like(File1_Template.fld1)
d parm2 like(File1_Template.fld2)
d parm3 like(File1_Template.fld3)
d DS_xml Likeds(xmlds_template) dim(9999)
d DSoutput likeds(File1:*output) inz
d qualified
d errords Likeds(errorinfo_template)
*;
if not %open(File1);
open(e) File1;
if %error;
errorDS.error = *on;
errorDS.file_status = file1infds.fstat;
doError('xxx01':
p_ErrorDS:
file1infds.fname);
return *off;
endif;
endif;
chain(en) (parm1:parm2:parm3) File1;
if %found(File1) and not %error;
eval-corr DSoutput = DS_xml ;
return *on;
elseif %error;
errorDS.error = *on;
errorDS.file_status = file1infds.fstat; return *off; else; errorDS.error = *off; errorDS.file_status = file1infds.fstat; return *off; endif;
---------
As per IBM
If you are working with arrays:
If the source operand is an unindexed array data structure, the target data structure must also be an array data structure.
If the target operand is an unindexed array data structure, the operation works on each element of the array data structure, following the same rules as EVAL with an array result. %SUBARR may be used to restrict the number of elements used in either the source or target data structure array.
If one subfield is an array, both subfields must be arrays. If the dimension of one array subfield is smaller than the other, only the smaller number of array elements is assigned. If the target subfield has more elements, the additional elements are unchanged by the EVAL-CORR operation.
-------------
does DSoutput requires to be declared with dim(9999) to process all 9999 elements? what changes I might need to process all elements?
As an Amazon Associate we earn from qualifying purchases.
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.