I have a requirement for a quick extract from an MV field set in a file. The
itype I built proved weirder than I anticipated.
Here's the scenario. There's a set of mv fields on FILEA that contain a
category code and description. In basic I would do a LOCATE and retrieve the
associated element.
For a listing of FILEB that contains the key to FILEA and a CAT.CODE it
requires a devious itype to extract the associated mv field. I'm wondering
how others may have tackled this (without resorting to subr()), is there a
simple way and my medication is blocking my synapse from working?
FILEA
(CUST.ID) 000 12345
...
(CAT.CODE) 050 a]b]c]d
(CAT.DESC) 051 blah1]blah2]blah3]blah4
FILEB
(TRANS.ID) 000 99999
(CUST.ID) 006 12345
(CAT.CODE) 012 c
This is the Itype I built - it seems overly difficult without a locate()
function available.
EQS(TRANS('FILEA', CUST.ID,CAT.CODE,''),REUSE(CAT.CODE));
(INDEX(@1,@TRUE,1)+1)/2; IF SUM(@1) THEN
TRANS('FILEA',CUST.ID,CAT.DESC,'')<1,1,@2> ELSE ''
synopsis: eqs, get an array of true/false matches; index, find the char pos
for the first true value, add 1 and div by 2 to give the array element; sum,
if there was a match, get the description field and extract the (svm)
element indicated by previous op
LIST FILEB CAT.CODE CAT.DESC
99999 c blah3
--
Regards,
Stuart Boydell
**********************************************************************
This email message and any files transmitted with it are confidential
and intended solely for the use of addressed recipient(s). If you have
received this email in error please notify the Spotless IS Support Centre (61 3 9269
7555) immediately who will advise further action.
This footnote also confirms that this email message has been scanned
for the presence of computer viruses.
**********************************************************************
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/