0001     OPEN 'SOURCE' TO source_file ELSE STOP
0002     OPEN 'DESTINATION' TO destination_file ELSE STOP
0003     IF SYSTEM(11) ELSE CRT 'SAVE-LIST required from SOURCE file sorted
by ID'; STOP
0004     LOOP
0005         READNEXT source_id ELSE EXIT
0006         READ source_rec FROM source_file, source_id THEN
0007             destination_id = source_rec<1> ;* assumes the data us in
attribute 1
0008             IF destination_id # '' THEN
0009                 READ destination_rec FROM destination_file,
destination_id ELSE destination_rec = ''
0010                 destination_rec<1,-1> = source_id  ;* assumes you want
the data in attribute 1
0011                 WRITE destination_rec ON destination_file,
destination_id
0012             END
0013         END
0014     REPEAT

"Beware of bugs in the above code; I have only proved it correct, not tried
it." -- Donald Knuth

Dan


On Tue, Apr 8, 2014 at 4:33 AM, <[email protected]> wrote:

> I have a feeling that this is a pretty basic question, but I have not been
> able to find an answer.
>
> I have a file like this, with 101, etc. as the record key:
>
> 101  AAA
> 102  AAA
> 103
> 104  BBB
> 105
> 106  CCC
> 107  CCC
> 108  CCC
>
> I want to write this value to a new file with unique values in the AAA
> field and the old record key multivalued, like this:
>
> AAA  101]102
> BBB  104
> CCC  106]107]108
>
> Any quick-n-dirty solutions?
>
> --
> --
> IMPORTANT: T24/Globus posts are no longer accepted on this forum.
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "jBASE" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
IMPORTANT: T24/Globus posts are no longer accepted on this forum.

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to