Skip to main content
Nelson Schroth
Participating Frequently
Jan 19, 2023 9:06 AM UTC

UniVerse "I" descriptors

Excuse the brain cramp, but I need some assistance to see if I can create the dictionary PGM.PCT.
File data is:
<1> PGM1 <mv> PGM2 <mv> PGM3
<2> 1000 <mv> 2000 <mv> 3000

I want to list F1, F2 & PGM.PCT​ to get this expected output:

>LIST DATA.FILE F1 F2 PGM.PCT
PROGRAM NAME    COUNT    PGM %
PGM1                                1,000          .167
PGM2                               2,000         .333
PGM3                               3,000          .500 

I thought (incorrectly) that PGM.PCT would be
(@RECORD<2,@MV> / SUM(@RECORD<2>)

Can this be done in a simple I-descriptor or am I barking up the wrong tree?​
I am in UniVerse 11.3.1 on AIX

Nelson

------------------------------
Nelson Schroth
president
C3CompleteShop LLC
Harrison OH US
------------------------------

    5 replies

    Neil Morris
    Rocketeer
    Jan 19, 2023 9:26 AM UTC
    Excuse the brain cramp, but I need some assistance to see if I can create the dictionary PGM.PCT.
    File data is:
    <1> PGM1 <mv> PGM2 <mv> PGM3
    <2> 1000 <mv> 2000 <mv> 3000

    I want to list F1, F2 & PGM.PCT​ to get this expected output:

    >LIST DATA.FILE F1 F2 PGM.PCT
    PROGRAM NAME    COUNT    PGM %
    PGM1                                1,000          .167
    PGM2                               2,000         .333
    PGM3                               3,000          .500 

    I thought (incorrectly) that PGM.PCT would be
    (@RECORD<2,@MV> / SUM(@RECORD<2>)

    Can this be done in a simple I-descriptor or am I barking up the wrong tree?​
    I am in UniVerse 11.3.1 on AIX

    Nelson

    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------
    Hi Nelson,
    How about the following. I didn't mess around with the decimal formatting but I think this will give you what you want.

    DIVS(@RECORD<2>,REUSE(SUM(@RECORD<2>)))

    $<50>LIST NELSON F1 F2 PGM.PCT 09:27:25 01-19-23 PAGE 1
    NELSON.... F1............. F2........... PGM.PCT...

    100 PGM1 1000 0.1667
    PGM2 2000 0.3333
    PGM3 3000 0.5

    1 records listed.

    Neil

    ------------------------------
    Neil Morris
    Universe Advanced Technical Support
    Rocket Software
    ------------------------------
    Nelson Schroth
    Participating Frequently
    Jan 19, 2023 9:54 AM UTC
    Hi Nelson,
    How about the following. I didn't mess around with the decimal formatting but I think this will give you what you want.

    DIVS(@RECORD<2>,REUSE(SUM(@RECORD<2>)))

    $<50>LIST NELSON F1 F2 PGM.PCT 09:27:25 01-19-23 PAGE 1
    NELSON.... F1............. F2........... PGM.PCT...

    100 PGM1 1000 0.1667
    PGM2 2000 0.3333
    PGM3 3000 0.5

    1 records listed.

    Neil

    ------------------------------
    Neil Morris
    Universe Advanced Technical Support
    Rocket Software
    ------------------------------
    Thanks Neil - worked like a champ.

    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------
    Neil Morris
    Rocketeer
    Jan 19, 2023 5:09 PM UTC
    Thanks Neil - worked like a champ.

    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------
    Excellent. Thanks for the confirmation.

    ------------------------------
    Neil Morris
    Universe Advanced Technical Support
    Rocket Software
    ------------------------------
    MarkEastwood
    New Participant
    Jan 26, 2023 9:46 AM UTC
    Excuse the brain cramp, but I need some assistance to see if I can create the dictionary PGM.PCT.
    File data is:
    <1> PGM1 <mv> PGM2 <mv> PGM3
    <2> 1000 <mv> 2000 <mv> 3000

    I want to list F1, F2 & PGM.PCT​ to get this expected output:

    >LIST DATA.FILE F1 F2 PGM.PCT
    PROGRAM NAME    COUNT    PGM %
    PGM1                                1,000          .167
    PGM2                               2,000         .333
    PGM3                               3,000          .500 

    I thought (incorrectly) that PGM.PCT would be
    (@RECORD<2,@MV> / SUM(@RECORD<2>)

    Can this be done in a simple I-descriptor or am I barking up the wrong tree?​
    I am in UniVerse 11.3.1 on AIX

    Nelson

    ------------------------------
    Nelson Schroth
    president
    C3CompleteShop LLC
    Harrison OH US
    ------------------------------
    You might be able to do this without creating a new Dict item by using the PCT keyword.
    LIST DATA.FILE F1 F2 PCT F2

    ------------------------------
    Mark Eastwood
    Developer
    AFS Technologies Inc
    Phoenix AZ US
    ------------------------------
    Greg Livingston
    Participating Frequently
    Jan 26, 2023 9:57 AM UTC
    You might be able to do this without creating a new Dict item by using the PCT keyword.
    LIST DATA.FILE F1 F2 PCT F2

    ------------------------------
    Mark Eastwood
    Developer
    AFS Technologies Inc
    Phoenix AZ US
    ------------------------------
    You could create an "I" descriptor as follows:

    @RECORD<2>/REUSE(SUM(@RECORD<2>))

    That should give you the correct calculation.

    Regards,
    Greg

    ------------------------------
    Greg Livingston
    OUTsurance Insurance
    Centurion GA ZA
    ------------------------------