Skip to main content
Participating Frequently
May 13, 2025 9:39 PM UTC

Multivalue number from LOWER(@RECORD)

I have a UniVerse file with a great diversity of record structures. Consequently I want to return the data for a record through EVAL rather than a DICT I-descriptor entry because DICT entries lead to overflows from other incompatibly structured records.

FWIW, the output will ultimately be through ODBC using dynamically normalized Native UniVerseSQL. Don't worry if this isn't your thing, you may still be able to help with the EVAL I-descriptor expression I need.

The values on the record in question are listed as an arbitrary number of individual attributes, which I can return as a single set of multivalues using LOWER(@RECORD) suitable to be read by ODBC.

However I need to return them with the corresponding original attribute numbers and have not been able to come up with anything.

Any suggestions would be most appreciated.



------------------------------
Greg Clitheroe
Rocket Forum Shared Account
------------------------------

    13 replies

    Participating Frequently
    May 19, 2025 3:03 AM UTC

    @Greg Clitheroe

    If you change the basic subroutine to be this and use two evals it work

    SUBROUTINE CHG.MEMBER.REC.AGAIN(RET_DATA,ENTIRE_RECORD,PARSE_COLUMN)
    ATT.CNT = DCOUNT(ENTIRE_RECORD,@AM)
    RET_DATA = ""
    FOR ATT.NXT = 1 TO ATT.CNT
      IF PARSE_COLUMN = 1 THEN
         RET_DATA<1,ATT.NXT> = ATT.NXT
      END ELSE
         RET_DATA<1,ATT.NXT> = ENTIRE_RECORD<ATT.NXT>
       END
    NEXT ATT.NXT
    RETURN
    END

    :LIST MEMBERS.NEW EVAL 'SUBR("CHG.MEMBER.REC.AGAIN",@RECORD,1)' EVAL 'SUBR("CH
    G.MEMBER.REC.AGAIN",@RECORD,2)'

    LIST MEMBERS.NEW EVAL "SUBR("CHG.MEMBER.REC.AGAIN",@RECORD,1)" EVAL "SUBR("CHG.M
    EMBER.REC.AGAIN",@RECORD,2)" 06:57:23am  16 May 2025  PAGE    1
                   SUBR("CHG.MEMBER.REC    SUBR("CHG.MEMBER.REC
    MEMBERS.NEW    .AGAIN",@RECORD,1)..    .AGAIN",@RECORD,2)..

    0312           1                       Markowski
                   2                       Karl
                   3                       B
                   4                       Mr
                   5                       8953 Rowes Drive
                   6                       Williston
                   7                       DC
    0621           1                       Postek
                   2                       Scott
                   3                       P
                   4                       Mr
                   5                       13322 West Winter Pl
                                           ace
                   6                       Grand Haven
                   7                       NY
    0930           1                       Sun
                   2                       Mike
                   3                       U
    Press any key to continue...



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

    Jonathan:

    I like your solution for its versatility. I'm contemplating further generalising the subroutine to also use the record ID as a parameter, thinking it might then be able to handle a variety of the different structures. 

    The software supplier does something like this on the same file and others, but they limit the output by including a parameter for the code to be looked up and returning a single value, whereas I want the entire set to put through odbc. 



    ------------------------------
    Greg Clitheroe
    Rocket Forum Shared Account
    ------------------------------
    Participating Frequently
    May 19, 2025 3:09 AM UTC

    I like how others have done this, for their versatility.  That being said, I have two additional possibilities to consider. 

    First option: create an I-Descriptor like below.  This will allow you to list your dictionary that has LOWER(@RECORD), and then this new dictionary, which should give you line numbers.

    0001: I
    0002: LOWER(@RECORD)
    0003: F;0;NV;S
    0004: TESTING
    0005: 25L
    0006: M

    Second option: create a subroutine like below.  This would allow you to create an I-Descriptor like "LOWER(SUBR('GETRNG', 1, 1, DCOUNT(@RECORD, @AM)))", whether in an EVAL from TCL or from a dictionary.  I use this method for many things because it is dynamic.  You could change it to use @VM instead of @AM if you do not want to add the LOWER() function.

    SUBROUTINE GETRNG(RESULT, START, INCREMENT, TIMES)
        IF UNASSIGNED(INCREMENT) THEN INCREMENT = 0
    
        RESULT = ''
        IF INCREMENT EQ 0 THEN RETURN
        IF NOT(NUM(START)) THEN RETURN
        IF NOT(NUM(TIMES)) THEN RETURN
        IF NOT(NUM(INCREMENT)) THEN RETURN
    
        DIM WORK(TIMES)
        XX = START
        FOR II = 1 TO TIMES
            WORK(II) = XX
            XX += INCREMENT
        NEXT II
        MATBUILD RESULT FROM WORK USING @AM
        RETURN
    END
    



    ------------------------------
    Joseph von Arx
    Software Developer
    Data Management Associates Inc DMA
    Cincinnati OH US
    ------------------------------

    Joseph:

    That looks interesting but I don't understand the conversion expression in the I descriptor. 



    ------------------------------
    Greg Clitheroe
    Rocket Forum Shared Account
    ------------------------------
    Joseph von Arx
    Participating Frequently
    May 19, 2025 7:18 AM UTC

    Joseph:

    That looks interesting but I don't understand the conversion expression in the I descriptor. 



    ------------------------------
    Greg Clitheroe
    Rocket Forum Shared Account
    ------------------------------

    Greg,

    The conversion I provided is an F-Correlative to count the number of values in the lowered record.  The fcode correlative should be in your documentation or it should be accessible on Rocket's documentation site.

    If the first example is confusing, the second example I provided is using a straight I-Descriptor format.



    ------------------------------
    Joseph von Arx
    Software Developer
    Data Management Associates Inc DMA
    Cincinnati OH US
    ------------------------------