M@EXCHL limit of parm/value pairs

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

M@EXCHL limit of parm/value pairs

Post by adale »

Looking for some help with the EXCHANGE feature (M@EXHL).
I am using this to have our CL call and pass parm values to an RDML function, as described here:
https://docs.lansa.com/14/en/lansa015/c ... nge_c2.htm

My question specifically involves the number of parm/value pairs:
Parameters required by M@EXCHL
M@EXCHL has 1 parameter that must be specified on a CALL, and up to 10 "pairs" of parameters that are used to define and contain information that is to be placed on or received from the exchange list. This means a minimum of 1 and a maximum of 21 parameters can be passed to M@EXCHL on any call.

I had originally read this to mean 10 pairs of parm/values per each M@CEXCHL call (get or put).
I have been struggling with a new function, not seeing some of the incoming parms. My total list of parms exceeds 10 pairs, but I was using less than 10 in each of the GET or PUT commands.

When I cut my list of total parms down to just 10 (so now just 5 parms on the PUT, and 5 on the GET), it now works.

Unless I was just missing something with my larger list of parms, I was wondering if anyone else had seen this same behavior?
Arlyn Dale
Servias LLC
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: M@EXCHL limit of parm/value pairs

Post by Dino »

It is working fine in V15 epc150040, with this test:
mexchl1.jpg
mexchl1.jpg (138.3 KiB) Viewed 15616 times
LANSA Code ...fields SA_ICOLxx are A(25):

Code: Select all

Function Options(*DIRECT)
Group_By Name(#manyflds) Fields(#SA_ICOL01 #SA_ICOL02 #SA_ICOL03 #SA_ICOL04 #SA_ICOL05 #SA_ICOL06 #SA_ICOL07 #SA_ICOL08 #SA_ICOL09 #SA_ICOL10 #SA_ICOL11 #SA_ICOL12 #SA_ICOL13 #SA_ICOL14 #SA_ICOL15 #SA_ICOL16 #SA_ICOL17 #SA_ICOL18 #SA_ICOL19 #SA_ICOL20 #SA_ICOL21 #SA_ICOL22 #EMPNO #SURNAME #GIVENAME)
Set_Mode To(*display)
Display Fields(#manyflds) Identify(*noid)
CL Code:

Code: Select all

PGM                                                    
DCL &VALUESENT *CHAR 25                                
CALL       PGM(M@EXCHL) PARM('CLR')                    
CHGVAR &VALUESENT 'A1234'                              
/*                   1234567890ABCDE  */               
CALL M@EXCHL ('PUT' 'SA_ICOL01 A0250' &VALUESENT +     
                    'SA_ICOL02 A0250' &VALUESENT +     
                    'SA_ICOL03 A0250' &VALUESENT +     
                    'SA_ICOL04 A0250' &VALUESENT +     
                    'SA_ICOL05 A0250' &VALUESENT +     
                    'SA_ICOL06 A0250' &VALUESENT +     
                    'SA_ICOL07 A0250' &VALUESENT +     
                    'SA_ICOL08 A0250' &VALUESENT +     
                    'SA_ICOL09 A0250' &VALUESENT +     
                    'SA_ICOL10 A0250' &VALUESENT )     
CHGVAR &VALUESENT 'A1007'                              
CALL M@EXCHL ('PUT' 'SA_ICOL11 A0250' &VALUESENT +     
                    'SA_ICOL12 A0250' &VALUESENT +     
                    'SA_ICOL13 A0250' &VALUESENT +     
                    'SA_ICOL14 A0250' &VALUESENT +              
                    'SA_ICOL15 A0250' &VALUESENT +              
                    'SA_ICOL16 A0250' &VALUESENT +              
                    'SA_ICOL17 A0250' &VALUESENT +              
                    'SA_ICOL18 A0250' &VALUESENT +              
                    'SA_ICOL19 A0250' &VALUESENT +              
                    'SA_ICOL20 A0250' &VALUESENT )              
CHGVAR &VALUESENT 'A2542'                                       
CALL M@EXCHL ('PUT' 'SA_ICOL21 A0250' &VALUESENT +              
                    'SA_ICOL22 A0250' &VALUESENT +              
                    'EMPNO     A0050' 'A9988'    +              
                    'SURNAME   A0200' 'JUAN                ' +  
                    'GIVENAME  A0200' 'PEREZ               ')   
/*                   1234567890ABCDE   123456789*123456789* */  
LANSA      REQUEST(RUN) PROCESS(TESTPRO2) +                     
           FUNCTION(TEST96E) PARTITION(RHO) +                   
           LANGUAGE(ENG)                                        
ENDPGM
notice that you need to be careful with the the spaces if entering values for the fields and the field definitions if declaring them. a mismatch definition in length and you will not receive the value, or maybe some unwanted extra characters or just a plain decimal data error.
mexchl2.jpg
mexchl2.jpg (215.19 KiB) Viewed 15616 times
mexchl3.jpg
mexchl3.jpg (165.14 KiB) Viewed 15616 times
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: M@EXCHL limit of parm/value pairs

Post by adale »

Dino,
Thanks for the input, and marked up example.
I will check my code again to see what I missed.
Cheers.
Arlyn Dale
Servias LLC
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: M@EXCHL limit of parm/value pairs

Post by adale »

I am also at VL15 EPC 150040, so we should be good there.
Here is what I am experiencing.
The parm fields I am trying to exchange are address fields that a trade partner has defined.
Company ID = 8 characters
Company name = 50 characters
First Name = 50 characters
Last Name = 50 characters
Address line 1 = 60 characters
Address line 2 = 60 characters
City = 40 characters
State = 40 characters
Zip/Postal code = 20 characters
Reference ID = 20 characters

I seem to "lose" the fields around the 280-300 character count. Not exactly sure.
I rearranged the order of the fields in the M@EXCHL "PUT" command, and I was able to populate each of the fields, so I feel confident that the parm fields are defined correctly, just not able to populate the full list at one time.

I have now entered two PUT commands in my CL, breaking my group of fields into two smaller groups, and it works.

I was reading the instructions for the M@EXCHL parms where each field could be a MAX length of 256, but it kind of looks like the max length of the total parms is 256?
Arlyn Dale
Servias LLC
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: M@EXCHL limit of parm/value pairs

Post by Dino »

strange, this other test works fine, so the total length can exceed 256.
mexchl4.jpg
mexchl4.jpg (47 KiB) Viewed 15601 times
each tmplong* field is a(256):

Code: Select all

Function Options(*DIRECT)
Group_By Name(#MANYFLDS) Fields(#tmplong1 #tmplong2 #tmplong3 #eMPNO #SURNAME #GIVENAME)
Set_Mode To(*DISPLAY)
Display Fields(#MANYFLDS) Identify(*NOID)
mexchl5.jpg
mexchl5.jpg (92.61 KiB) Viewed 15601 times
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: M@EXCHL limit of parm/value pairs

Post by BrendanB »

Adale/Dino,

Is there a *big* difference in terms of timing between what you have sent (everything on 1 CL command) and doing 1 command for *EACH* variable that you wish to PUT ?

Previously, i always just did:

Code: Select all

CALL M@EXCHL ('PUT' 'TMPLONG1  A2560' &longvalue)
CALL M@EXCHL ('PUT' TMPLONG2   A2560' &longvalue2)

etc
does it actually make a difference putting them on a single call in terms of time/memory?

b.
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: M@EXCHL limit of parm/value pairs

Post by adale »

I am still working on mine.
I got a response from Jim that he believed there was a total max character limit around 2000, but not positive. He showed me an example similar to Dino's where he had four fields that were 256 characters each and it worked in a single PUT command. So I still do not know why mine is not working in a single command.
As to your question in terms of time/memory, I really couldn't say (above my pay grade).
Your single parm puts could certainly help isolate if a single field define was not correct maybe?
Arlyn Dale
Servias LLC
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: M@EXCHL limit of parm/value pairs

Post by BrendanB »

I see....

I know when i have encountered 'limits' in what can be passed, i have used a workaround of putting the values into 1 or more 'QTEMP' data areas and calling a Wrapper Function that retrieves the values, puts them into the fields and uses EXCHANGE in the normal manner.
Post Reply