Skip to main content
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
------------------------------
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
------------------------------
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
------------------------------
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
------------------------------
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
------------------------------
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
------------------------------