× 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.



If you are going to use a user space why not just do this:

     D NUM_OF_FLDS     s              5I 0                                      
        Fields in the file
     D US_PTR          s               *                                        
                Pointer to user space

     D fld             ds                  Based(US_PTR)
     D   name                        10A
     D   type                         1A
     D   recpos                      10I 0
     D   size                        10I 0
     D   digits                      10I 0
     D   decpos                      10I 0


     c                   for       x = 1 to NUM_OF_FLDS
     c                   eval      mame   = *blanks
     c                   eval      type   = *blanks
     c                   eval      recpos = 0
     c                   eval      size   = 0
     c                   eval      digits = 0
     c                   eval      decpos = 0
     c                   eval      US_PTR += %Size(fld)                        
Move to next field
     c                   endfor

I have a hard time believing it would be slower and IMHO it more 
straightforward.

Rick


-----Original Message-----
From: Scott Klement [mailto:klemscot@xxxxxxxxxxxx]
Sent: Friday, September 12, 2003 10:32 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: User space, outfile or workfile

Okay, here's some sample code:

     D MAX_FIELDS      c                   256

     D fld             ds                  qualified
     D                                     DIM(MAX_FIELDS)
     D   name                        10A
     D   type                         1A
     D   recpos                      10I 0
     D   size                        10I 0
     D   digits                      10I 0
     D   decpos                      10I 0

     D x               s             10I 0

     c                   for       x = 1 to MAX_FIELDS
     c                   eval      fld(x).name   = *blanks
     c                   eval      fld(x).type   = *blanks
     c                   eval      fld(x).recpos = 0
     c                   eval      fld(x).size   = 0
     c                   eval      fld(x).digits = 0
     c                   eval      fld(x).decpos = 0
     c                   endfor

Obviously, you'd populate it from the data in the user space, and only
loop through the number of fields in the file... but I'm too lazy to
create an example that actually uses QUSLFLD...  hopefully this example
explains it well enough.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.