Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Listing File members

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Listing File members

    Substitute your file name into variable "File":
    File = 'BILL *LIBL ' Data = Copies( '00'x, 192 ) "CALL QUSDLTUS ( 'LIST QTEMP' X'0000000800000000' ) " "CALL QUSCRTUS ( 'LIST QTEMP' ' ' X'00010000' X'00' '*ALL' ' ' ) " "CALL QUSLMBR ( 'LIST QTEMP' MBRL0100 &File '*ALL' '0' ) " "CALL QUSRTVUS ( 'LIST QTEMP' X'00000001' X'000000C0' &Data ) " Do X = Int( 125 ) + 1 For Int( 133 ) By Int( 137 ) "CALL QUSRTVUS ( 'LIST QTEMP' X'"D2X(X,8)"' X'0000001E' &Data) " Member = Left( Data, 10 ) Say Member End X Return Int: Return C2D( Substr( Data, Arg( 1 ), 4 ), 4 ) 

  • #2
    Listing File members

    Nice, Gene! Colin needs to understand that all the offsets and lengths are hard-coded and might change with OS release changes. Although it doesn't perform as well as the API method, one could do a DSPFFD and read the results in ReXX. My hac at this was DSPFD but that requires hard coding as well. /* Read a file description */ /* To use, put in QREXSRC, member DSPFD and run the following CL: */ /* STRREXPRC SRCMBR(DSPFD) PARM('QREXSRC *LIBL') */ /* Input arguments */ PARSE ARG FF FL rcdCount = 0 rcdLimit = 50 /* Get the file description */ 'DSPFD &FL/&FF TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(QTEMP/MBR)' /* Override STDIN to the DB2 file */ 'OVRDBF FILE(STDIN) TOFILE(QTEMP/MBR)' /* Read a line from the file */ Read: PARSE PULL dtaInput rcdCount = rcdCount + 1 /* Record limit */ IF rcdCount > rcdLimit THEN DO SAY 'Record limit ('rcdLimit') reached' SIGNAL Exit END /* record is NULL at EOF */ IF dtaInput <> '' THEN DO SAY substr(dtaInput,65,10) SIGNAL Read END Say 'EOF reached' Exit: RETURN --buck

    Comment


    • #3
      Listing File members

      The example doesn't hard-code offsets in the receiver user space. On the contrary:
      • "Int(125)" fetchs the soft-coded location of the first list item
      • "Int(133)" fetchs the soft-coded number of list items
      • "Int(137)" fetchs the soft-coded length of a list item[/list]No need to change the REXX if IBM in a future release changes the offsets and lengths in the API's receiver user space.

      Comment


      • #4
        Listing File members

        That's great thanks for the help.

        Comment


        • #5
          Listing File members

          The only times I have used APIs have been when someone gives me the code. Where can I go to learn more? I am sure there is alot of other code on our system that could be much more effective if I had an understanding of APIs. Is there a course or a book that you can reccommend?

          Comment


          • #6
            Listing File members

            > The example doesn't hard-code offsets in the receiver user space. On the contrary: I did not read deeply enough and missed the function 'int' at the bottom. My apologies, and thanks for the correction! Your approach looks better every time I look at it. Colin, API information can be found in the Infocenter, under the programming link on the left. http://www.iseries.ibm.com/infocenter --buck

            Comment


            • #7
              Listing File members

              Does any one have a reference for managing files using REXX? I have been trying to figure out a way to list, store and eventually display a member list of a file. I am sure there must be an easy way that I just haven't figured out yet. Does any one have any suggestions

              Comment


              • #8
                Listing File members

                Colin, you might find our book called APIs at Work useful. Here's the link: http://www.mc-store.com/5024.html Victoria Mack, Editor, MC Mag Online

                Comment

                Working...
                X