David's & Brian's running total subroutine are fine specific solutions to the particular unidata question, but for the record there are oh-so-many more things that you can do by this UV technique of referencing previous values.

Here is an example of comparing a preveious record to the current (taken from my old Spectrum & Ardent I-descriptor presentation):


DUP
1. Get previous DNUM
2. Store current DNUM for use next time
3. Is the current same as previous?

01: I See if same dnum as last time
02: @2; DNUM; IF @1...@2 THEN "=” ELSE ""

LAST.DNUM
1. Get previous DNUM
2. Store current DNUM for use next time
3. Output last DNUM

01: I
02: @2; DNUM; @1

LIST TRANS BY DNUM DNUM DUP LAST.DNUM

TRANS........ DNUM. DUP LAST.DNUM
1166359X7890 10063 0
1166359X7891 10063 = 10063
1166359X7893 10063 = 10063
1166359X7892 10063 = 10063
1168052X679 10141 10063
1168052X683 10142 10141
1165994X416 10246 10142
1165994X415 10246 = 10246
1167896X116 10329 10246

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to