|
Hi Jerry, What you are doing to pass the data structure around will certainly work just fine. For the sake of interest, I'll show you what I would do. I normally apply this method for called procedures from shared modules, the main benefit being that it eases maintenance if the procedure interface should ever change, as the definition of the DS only needs to be changed in one spot. It also allows the same data structure to be used for multiple procedures in some cases. Of course, this may be overkill in your specific situation, but with luck will be useful to you in future. Any comments/constructive criticisms are also welcome for this method :) So, first create a copy member for the called program (TESTPGM2_H): D TESTPGM2_passDS... D DS qualified D field1 1A D field2 10A D field3 3P 0 D TESTPGM2... D PR extpgm('TESTPGM2') D inputDS... D likeDS(TESTPGM2_passDS) The actual callee program (TESTPGM2): /copy testpgm2_H D TESTPGM2 PI D inputDS... D likeDS(TESTPGM2_passDS) /free inputDS.field1 = 'A'; inputDS.field2 = 'ABCDEFGHIJ'; inputDS.field3 = 5 + 23; *inlr = *on; return; /end-free The calling program (TESTPGM): /copy TESTPGM2_H D passFields... D DS likeDS(TESTPGM2_passDS) /free TESTPGM2(passFields); dsply ('PassFields: ' + passFields); dsply ('field1: ' + passFields.field1); dsply ('field2: ' + passFields.field2); dsply ('field3: ' + %char(passFields.field3)); *inlr = *ON; return; /end-free Display results: DSPLY PassFields: AABCDEFGHIJ± DSPLY field1: A DSPLY field2: ABCDEFGHIJ DSPLY field2: 28 Hope this helps, Adam ##################################################################################### Attention: The above message and/or attachment(s) is private and confidential and is intended only for the people for which it is addressed. If you are not named in the address fields, ignore the contents and delete all the material. Thank you. Have a nice day. For more information on email virus scanning, security and content management, please contact administrator@xxxxxxxxxxxx #####################################################################################
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.