Skip to main content
Participating Frequently
Apr 2, 2023 11:28 PM UTC

LIST.READU Unidata

I can capture output from LIST.READU command as follows:
EXECUTE 'LIST.READU' CAPTURING OUTPUT

Each row can be extracted by looping through using @am to determine number of rows
 my question is how can one parse out the individual column fields - what delimiter is used to do parsing or
is  the  data in each row  simply fixed length.



------------------------------
robert modrich
Developer
Rocket Forum Shared Account
TEMECULA CA US
------------------------------

    4 replies

    Jonathan Smith
    Rocketeer
    Apr 3, 2023 4:54 AM UTC

    I can capture output from LIST.READU command as follows:
    EXECUTE 'LIST.READU' CAPTURING OUTPUT

    Each row can be extracted by looping through using @am to determine number of rows
     my question is how can one parse out the individual column fields - what delimiter is used to do parsing or
    is  the  data in each row  simply fixed length.



    ------------------------------
    robert modrich
    Developer
    Rocket Forum Shared Account
    TEMECULA CA US
    ------------------------------

    Robert,

    The following code will take the LIST.READU DETAIL output and will put each lock into a singe attribute and then each multi-value in the attribute contains the column

    This is my standard code making it easier to read

    LOCK.LIST = ""
    EXECUTE 'LIST.READU DETAIL' CAPTURING OUTPUT
    NOL = DCOUNT(OUTPUT,@AM)
    LCK.CNT = 0
    FOR LN.NXT = 2 TO NOL
      LINE = TRIM(OUTPUT<LN.NXT>)
      IF LINE = "" THEN CONTINUE
      LCK.CNT += 1
      CONVERT " " TO @VM IN LINE
      LOCK.LIST<LCK.CNT>  = LINE
    NEXT

    This is my short code to produce the array

    EXECUTE 'LIST.READU DETAIL' CAPTURING LOCK.LIST
    DEL LOCK.LIST<1>
    CONVERT " " TO @VM IN LOCK.LIST
    DEL LOCK.LIST<DCOUNT(LOCK.LIST,@AM)>

    Or use the GETREADU function in UniBasic which does it for you

    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------

    Rocket Software - Senior Principal Technical Support Engineer - UniData ATS
    Participating Frequently
    Apr 3, 2023 8:11 AM UTC

    I can capture output from LIST.READU command as follows:
    EXECUTE 'LIST.READU' CAPTURING OUTPUT

    Each row can be extracted by looping through using @am to determine number of rows
     my question is how can one parse out the individual column fields - what delimiter is used to do parsing or
    is  the  data in each row  simply fixed length.



    ------------------------------
    robert modrich
    Developer
    Rocket Forum Shared Account
    TEMECULA CA US
    ------------------------------

    Hi Robert,

    We created a lock monitor using LIST.READU DETAIL CAPTURING OUTPUT. We trim the data in OUTPUT and swap the spaces with value marks. We then extract the necessary data by value position. 

    Hope this helps



    ------------------------------
    CURT VALENTINE
    SOFTWARE ENGINEER III
    Rocket Forum Shared Account
    ------------------------------
    Mike Rajkowski
    Rocketeer
    Apr 3, 2023 9:33 AM UTC

    I can capture output from LIST.READU command as follows:
    EXECUTE 'LIST.READU' CAPTURING OUTPUT

    Each row can be extracted by looping through using @am to determine number of rows
     my question is how can one parse out the individual column fields - what delimiter is used to do parsing or
    is  the  data in each row  simply fixed length.



    ------------------------------
    robert modrich
    Developer
    Rocket Forum Shared Account
    TEMECULA CA US
    ------------------------------

    Robert,


    UniData has a function called GETREADU, that returns a dynamic array with the lock information.






    ------------------------------
    Mike Rajkowski
    MultiValue Product Evangelist
    Rocket Internal - All Brands
    DENVER CO US
    ------------------------------
    Participating Frequently
    Apr 3, 2023 10:02 AM UTC

    Robert,

    The following code will take the LIST.READU DETAIL output and will put each lock into a singe attribute and then each multi-value in the attribute contains the column

    This is my standard code making it easier to read

    LOCK.LIST = ""
    EXECUTE 'LIST.READU DETAIL' CAPTURING OUTPUT
    NOL = DCOUNT(OUTPUT,@AM)
    LCK.CNT = 0
    FOR LN.NXT = 2 TO NOL
      LINE = TRIM(OUTPUT<LN.NXT>)
      IF LINE = "" THEN CONTINUE
      LCK.CNT += 1
      CONVERT " " TO @VM IN LINE
      LOCK.LIST<LCK.CNT>  = LINE
    NEXT

    This is my short code to produce the array

    EXECUTE 'LIST.READU DETAIL' CAPTURING LOCK.LIST
    DEL LOCK.LIST<1>
    CONVERT " " TO @VM IN LOCK.LIST
    DEL LOCK.LIST<DCOUNT(LOCK.LIST,@AM)>

    Or use the GETREADU function in UniBasic which does it for you

    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------

    Jonathan  thanks that resolved my question



    ------------------------------
    robert modrich
    Developer
    Rocket Forum Shared Account
    TEMECULA CA US
    ------------------------------