Skip to main content

Can anyone think of a real-world use for the field/value/subvalue positions of a SAVING Field in a select list?

An apparent UniVerse implementation decision results with BY clauses leaving only the ID or SAVING value in the select list, and BY.EXP adding value, field, and subvalue (record.idVvalueSfieldVsubvalue as documented in the keyword section for BY.EXP in the User Reference).

During the sorting phase of BY and BY.EXP, the information serves a purpose. After sorting, I do not believe it serves any purpose.

So, is there a real-world use for the field/value/subvalue positions of a SAVING Field in a select list?

The SAVING value becomes the record ID of a subsequent SELECT or LIST. The SAVING Field would need to be an ID of file where a field/value/subvalue position holds some correspondence with a next BY.EXP and the original file and SELECT.

The record:

>ed MV1 19A

4 lines long.

----: ^

Up-arrow display mode = enabled

Top.

----: p

0001: 9^2538 (9 v 8)

0002: 7^2536^2535 (7 v 6 v 5)

0003: 24^25323^25222^25221 (24 v 23 s 22 s 21)

0004: 34^25233^25232^25231 (34 s 33 s 32 s 31)

Bottom at line 4.

The BY clause:

>SSELECT MV1 BY F2 SAVING F2 '19A'

3 record(s) selected to SELECT list #0.

>>SAVE.LIST mark

3 record(s) SAVEd to SELECT list "mark".

>EDIT.LIST mark

3 lines long.

----: p

0001: 7

0002: 6

0003: 5

Bottom at line 3.

----:

It is interesting to note that in this instance, BY will sort records by the field, but the SAVING occurs after sequencing and just splits out the multivalued elements found.

The BY.EXP clause

>sselect MV1 BY.EXP F2 SAVING F2 '19A'

3 record(s) selected to SELECT list #0.

>>save.list mark

3 record(s) SAVEd to SELECT list "mark".

>edit.list mark

3 lines long.

Up-arrow display mode = enabled

0003: 7^2531^2522^2530

----: p

0001: 5^2533^2522^2530 (5 v 3 s 2 v 0)

0002: 6^2532^2522^2530 (6 v 2 s 2 v 0)

0003: 7^2531^2522^2530 (7 v 1 s 2 v 0)

Bottom at line 3.

----:



------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------

Can anyone think of a real-world use for the field/value/subvalue positions of a SAVING Field in a select list?

An apparent UniVerse implementation decision results with BY clauses leaving only the ID or SAVING value in the select list, and BY.EXP adding value, field, and subvalue (record.idVvalueSfieldVsubvalue as documented in the keyword section for BY.EXP in the User Reference).

During the sorting phase of BY and BY.EXP, the information serves a purpose. After sorting, I do not believe it serves any purpose.

So, is there a real-world use for the field/value/subvalue positions of a SAVING Field in a select list?

The SAVING value becomes the record ID of a subsequent SELECT or LIST. The SAVING Field would need to be an ID of file where a field/value/subvalue position holds some correspondence with a next BY.EXP and the original file and SELECT.

The record:

>ed MV1 19A

4 lines long.

----: ^

Up-arrow display mode = enabled

Top.

----: p

0001: 9^2538 (9 v 8)

0002: 7^2536^2535 (7 v 6 v 5)

0003: 24^25323^25222^25221 (24 v 23 s 22 s 21)

0004: 34^25233^25232^25231 (34 s 33 s 32 s 31)

Bottom at line 4.

The BY clause:

>SSELECT MV1 BY F2 SAVING F2 '19A'

3 record(s) selected to SELECT list #0.

>>SAVE.LIST mark

3 record(s) SAVEd to SELECT list "mark".

>EDIT.LIST mark

3 lines long.

----: p

0001: 7

0002: 6

0003: 5

Bottom at line 3.

----:

It is interesting to note that in this instance, BY will sort records by the field, but the SAVING occurs after sequencing and just splits out the multivalued elements found.

The BY.EXP clause

>sselect MV1 BY.EXP F2 SAVING F2 '19A'

3 record(s) selected to SELECT list #0.

>>save.list mark

3 record(s) SAVEd to SELECT list "mark".

>edit.list mark

3 lines long.

Up-arrow display mode = enabled

0003: 7^2531^2522^2530

----: p

0001: 5^2533^2522^2530 (5 v 3 s 2 v 0)

0002: 6^2532^2522^2530 (6 v 2 s 2 v 0)

0003: 7^2531^2522^2530 (7 v 1 s 2 v 0)

Bottom at line 3.

----:



------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------

I have always used this (sub) command when the attributes in ONE file are the record IDs of a different file.  So you can do:

SSELECT file A BY.EXP (not always necessary but the by criteria you wish) SAVING (UNIQUE - if you just ONE instance of each potential value) B (the attribute with the IDs) 

and then save off the list.  The list file B using those IDs.

Sometimes, it is useful if you merely want to know all the values spread across file A.  Good for statistical modeling, etc.



------------------------------
Mike Watkins
Enterprise Architect
Ferguson Enterprises, LLC
Newport News VA US
------------------------------

I have always used this (sub) command when the attributes in ONE file are the record IDs of a different file.  So you can do:

SSELECT file A BY.EXP (not always necessary but the by criteria you wish) SAVING (UNIQUE - if you just ONE instance of each potential value) B (the attribute with the IDs) 

and then save off the list.  The list file B using those IDs.

Sometimes, it is useful if you merely want to know all the values spread across file A.  Good for statistical modeling, etc.



------------------------------
Mike Watkins
Enterprise Architect
Ferguson Enterprises, LLC
Newport News VA US
------------------------------

What Mike describes is also the way I use it, however I wanted to clarify that you can't use UNIQUE if you're also sorting (i.e. BY.EXP).  What I do is only use SAVING with the BY.EXP and then select the second file (with the keys I now have still active) using SAVING UNIQUE @ID.
>SELECT FILEA BY.EXP FIELDX SAVING FIELDX
>>SELECT FILEB SAVING UNIQUE @ID
If some of those FIELDX values are blank, then you'll get a warning message, but that's not generally a problem.  So it's a two step process, but I think that's the use case. 

Side note, I have actually seen some older code in our base which uses those positions to do processing, but that was mostly abandoned before my time for more straight forward approaches.



------------------------------
Tyrel Marak
Senior Staff Software Engineer
Aptron Corporation
Florham Park NJ US
------------------------------

Can anyone think of a real-world use for the field/value/subvalue positions of a SAVING Field in a select list?

An apparent UniVerse implementation decision results with BY clauses leaving only the ID or SAVING value in the select list, and BY.EXP adding value, field, and subvalue (record.idVvalueSfieldVsubvalue as documented in the keyword section for BY.EXP in the User Reference).

During the sorting phase of BY and BY.EXP, the information serves a purpose. After sorting, I do not believe it serves any purpose.

So, is there a real-world use for the field/value/subvalue positions of a SAVING Field in a select list?

The SAVING value becomes the record ID of a subsequent SELECT or LIST. The SAVING Field would need to be an ID of file where a field/value/subvalue position holds some correspondence with a next BY.EXP and the original file and SELECT.

The record:

>ed MV1 19A

4 lines long.

----: ^

Up-arrow display mode = enabled

Top.

----: p

0001: 9^2538 (9 v 8)

0002: 7^2536^2535 (7 v 6 v 5)

0003: 24^25323^25222^25221 (24 v 23 s 22 s 21)

0004: 34^25233^25232^25231 (34 s 33 s 32 s 31)

Bottom at line 4.

The BY clause:

>SSELECT MV1 BY F2 SAVING F2 '19A'

3 record(s) selected to SELECT list #0.

>>SAVE.LIST mark

3 record(s) SAVEd to SELECT list "mark".

>EDIT.LIST mark

3 lines long.

----: p

0001: 7

0002: 6

0003: 5

Bottom at line 3.

----:

It is interesting to note that in this instance, BY will sort records by the field, but the SAVING occurs after sequencing and just splits out the multivalued elements found.

The BY.EXP clause

>sselect MV1 BY.EXP F2 SAVING F2 '19A'

3 record(s) selected to SELECT list #0.

>>save.list mark

3 record(s) SAVEd to SELECT list "mark".

>edit.list mark

3 lines long.

Up-arrow display mode = enabled

0003: 7^2531^2522^2530

----: p

0001: 5^2533^2522^2530 (5 v 3 s 2 v 0)

0002: 6^2532^2522^2530 (6 v 2 s 2 v 0)

0003: 7^2531^2522^2530 (7 v 1 s 2 v 0)

Bottom at line 3.

----:



------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------

re. BY.EXP . . . SAVING . . .

I recently had a potential reason to do so,  but it's kinda finicky and not very maintainable by whomever has to maintain my code.

Performance isn't the issue it once was, so I always opt for maintainability.

Without the BY.EXP clause,  I frequently do SAVING  A B C ...  so there is only one pass on the file.

EXECUTE "SELECT . . . SAVING A B C "

LOOP

WHILE READNEXT A

WHILE READNEXT B

WHILE READNEXT C

   process using A B & C, never opening or reading the file explicitly

REPEAT 



------------------------------
Chuck Stevenson
DBA / SW Developer
Pomeroy
US
------------------------------