|
The problem with this example is that it is a little bit confusing. You need to look at the layout of the data returned in the user space. Look at member QUSLMBR in QSYSINC/QRPGSRC (Lib/File). Look at the header(QUSBY) and the MBRL0100 format(QUSBZ), and then the program should make more sense. Have you looked at the documentation for this in the API manuals? -----Original Message----- From: Dan Bale [mailto:dbale@genfast.com] Sent: Monday, June 07, 1999 4:33 PM To: RPG400-L@midrange.com Subject: RE: User space examples using List APIs Colin, >>Can you post the code that you are finding confusing.<< O.K., here goes (with my corrections to the original IBM ILE RPG Reference example syntax, to line 9 (d-spec for SP1) and the fourth C-spec): D SPACENAME DS D 10 INZ('LISTSPACE') D 10 INZ('QTEMP') D ATTRIBUTE S 10 INZ('LSTMBR') D INIT_SIZE S 9B 0 INZ(9999999) D AUTHORITY S 10 INZ('*CHANGE') D TEXT S 50 INZ('File member space') D SPACE DS BASED(PTR) D*SP1 32767 * << original from RPGLE Ref.; syntax error D SP1 32767 * ARR is used with OFFSET to access the beginning of the * member information in SP1 * D ARR 1 OVERLAY(SP1) DIM(32767) * * OFFSET is pointing to start of the member information in SP1 * D OFFSET 9B 0 OVERLAY(SP1:125) * * Size has number of member names retrieved * D SIZE 9B 0 OVERLAY(SP1:133) D MBRPTR S * D MBRARR S 10 BASED(MBRPTR) DIM(32767) D PTR S * D FILE_LIB S 20 D FILE S 10 D LIB S 10 D WHICHMBR S 10 INZ('*ALL ') D OVERRIDE S 1 INZ('1') D FIRST_LAST S 50 INZ(' MEMBERS, + D FIRST = , + D LAST = ') D IGNERR DS D 9B 0 INZ(15) D 9B 0 D 7A * * Receive file and library you want to process * C *ENTRY PLIST C FILE PARM FILEPARM 10 C LIB PARM LIBPARM 10 C Eval File_Lib = File + Lib * * Delete the user space if it exists * C CALL 'QUSDLTUS' 10 C PARM SPACENAME C PARM IGNERR * * Create the user space * C CALL 'QUSCRTUS' C PARM SPACENAME C PARM ATTRIBUTE C PARM INIT_SIZE C PARM ' ' INIT_VALUE 1 C PARM AUTHORITY C PARM TEXT * * Call the API to list the members in the requested file * C CALL 'QUSLMBR' C PARM SPACENAME C PARM 'MBRL0100' MBR_LIST 8 C PARM FILE_LIB C PARM WHICHMBR C PARM OVERRIDE * * Get a pointer to the user-space * C CALL 'QUSPTRUS' C PARM SPACENAME C PARM PTR * * Set the basing pointer for the member array * MBRARR now overlays ARR starting at the beginning of * the member information. * C EVAL MBRPTR = %ADDR(ARR(OFFSET)) C MOVE SIZE CHARSIZE 3 C EVAL %SUBST(FIRST_LAST:1:3) = CHARSIZE C EVAL %SUBST(FIRST_LAST:23:10) = MBRARR(1) C EVAL %SUBST(FIRST_LAST:41:10) = MBRARR(SIZE) C FIRST_LAST DSPLY C EVAL *INLR = '1' -----Original Message----- From: Dan Bale [mailto:dbale@genfast.com] Sent: Friday, June 04, 1999 6:48 PM To: RPG400-L@midrange.com Subject: User space examples using List APIs I am looking for example code that shows how to process an API-created list in a user space. The V4R2 ILE RPG Reference has an example program in chapter 10 under a section titled "Basing Pointer Data Type"; the Softcopy reference is 2.3.8.1. This example program happens to show how to use the QUSLMBR api, which is exactly the one I was looking to use. Unfortunately, it was (IMHO) poorly written, and did not compile due to a syntax error. I was able to fix that error plus others so that the program compiled and runs, (correctly, I think), but I'm having a difficult time fully understanding how exactly list processing works. In the particular example program, even though the initial size of the user space is 9,999,999 bytes, it would appear that the maximum length of the usable user space is 32,767 bytes (based on the D-spec for the SP1 variable). But I also see a reference to DIM(32767) for a 10-character array size that seems to reference the list in the user space. Is there reference material out there that explains this stuff? Does anyone have example code they could share? I would also be interested in example code that shows how to process a user index. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is the RPG/400 Discussion Mailing List! To submit a new * * message, send your mail to "RPG400-L@midrange.com". To unsubscribe * * from this list send email to MAJORDOMO@midrange.com and specify * * 'unsubscribe RPG400-L' in the body of your message. Questions should * * be directed to the list owner / operator: david@midrange.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This is the RPG/400 Discussion Mailing List! To submit a new * * message, send your mail to "RPG400-L@midrange.com". To unsubscribe * * from this list send email to MAJORDOMO@midrange.com and specify * * 'unsubscribe RPG400-L' in the body of your message. Questions should * * be directed to the list owner / operator: david@midrange.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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.