Like REVELATION. You can run this statement in REVELATION (I haven't tried it since REV G2.B):

SORT VOC BY F1 BY F3 BY F4 BREAK-ON F3 BREAK-ON F4 BREAK-ON F5 (SX

...and it generates this source code:
-----------------------------------------------------------------------------
!
* SORT VOC BY F1 BY F3 BY F4 BREAK-ON F3 BREAK-ON F4 BREAK-ON F5 (SX BY @ID
!
*
* HEADING/FOOTING
HEADING "  "
* FOOTING ""
*
@REC.COUNT=0
LAST.BREAK=1
FIRST.PASS=1
LAST.RECORD=0
*
* OPEN DICT AND DATA FILES
*
OPEN "DICT","VOC" TO @DICT ELSE STOP
OPEN "","VOC" TO FILE.IN ELSE STOP
*
* MAKE COLUMN HEADING
*
COLHEADING "VOC" : @FM : "FIELD 3" : @FM : "FIELD 4" : @FM : "FIELD 5"
COLLENGTH 15 : @FM : 10 : @FM : 10 : @FM : 10
*
* NULL PREVIOUS BREAK BUCKETS
*
PREV.FTHREE=''
PREV.FFOUR=''
PREV.FFIVE=''
FTHREE.BREAK.COUNT=0
FFOUR.BREAK.COUNT=0
FFIVE.BREAK.COUNT=0
*
!
READRECORD:
!
*
*
* ZERO BREAK FLAGS TO FALSE
*
FTHREE.BREAK=0
FFOUR.BREAK=0
FFIVE.BREAK=0
*
*
READNEXT @ID,WHICH.VALUE ELSE
LAST.RECORD=1
FTHREE.BREAK=1
FTHREE=PREV.FTHREE
FFOUR.BREAK=1
FFOUR=PREV.FFOUR
FFIVE.BREAK=1
FFIVE=PREV.FFIVE
END
*
S.ATID=@ID
*
IF FIRST.PASS AND LAST.RECORD THEN
PRINT "ZERO Records Listed"
PRINTER OFF
STOP
END
*
IF LAST.RECORD THEN GOTO BREAKS
*
READ @RECORD FROM FILE.IN,@ID ELSE GOTO READRECORD
*
@REC.COUNT+=1
*
*
* CALCULATE VALUE(S) FOR COLUMN(S)
*
S.FTHREE={F3}
S.FFOUR={F4}
S.FFIVE={F5}
*
*
* TEST FOR CONTROL BREAK(S)
*
IF S.FTHREE NE PREV.FTHREE THEN
FTHREE=PREV.FTHREE
PREV.FTHREE=S.FTHREE
FTHREE.BREAK=1
FFOUR.BREAK=1
FFIVE.BREAK=1
END
*
IF S.FFOUR NE PREV.FFOUR THEN
FFOUR=PREV.FFOUR
PREV.FFOUR=S.FFOUR
FFOUR.BREAK=1
FFIVE.BREAK=1
END
*
IF S.FFIVE NE PREV.FFIVE THEN
FFIVE=PREV.FFIVE
PREV.FFIVE=S.FFIVE
FFIVE.BREAK=1
END
*
*
IF FIRST.PASS THEN
FIRST.PASS=0
GOTO DETAIL
END
*
*
!
BREAKS:
!
*
* PRINT BREAK TOTAL(S) AND ACCUMULATE TOTAL(S)
*
*
IF FFIVE.BREAK THEN
PRINT
PRINT SPACE(15) : " " :
PRINT SPACE(10) : " " :
PRINT SPACE(10) : " " :
PRINT ("***" : "")"L#10"
PRINT
*
FFIVE.BREAK.COUNT=0
END
*
IF FFOUR.BREAK THEN
PRINT
PRINT SPACE(15) : " " :
PRINT SPACE(10) : " " :
PRINT ("***" : "")"L#10" : " " :
PRINT SPACE(10)
PRINT
*
FFOUR.BREAK.COUNT=0
END
*
IF FTHREE.BREAK THEN
PRINT
PRINT SPACE(15) : " " :
PRINT ("***" : "")"L#10" : " " :
PRINT SPACE(10) : " " :
PRINT SPACE(10)
PRINT
*
FTHREE.BREAK.COUNT=0
END
*
* PERFORM LAST RECORD OUTPUT IF DONE
*
IF LAST.RECORD THEN
PRINT
PRINT @REC.COUNT : " Records Processed"
STOP
END
*
!
DETAIL:
!
*
* DO CONVERSIONS IF ANY
*
*
*
* PRINT DETAIL LINE
*
PRINT S.ATID "L#15" : " " :
PRINT S.FTHREE "L#10" : " " :
PRINT S.FFOUR "L#10" : " " :
PRINT S.FFIVE "L#10"
*
*
FTHREE.BREAK.COUNT+=1
FFOUR.BREAK.COUNT+=1
FFIVE.BREAK.COUNT+=1
*
GOTO READRECORD
*
END
-----------------------------------------------------------------------------

You can then take this source and do stuff to it that you CANNOT do in R/LIST (same as ENGLISH/ACCESS/RECALL/UNIQUERY, etc.). or take it to a different system completely.

If you like things that generate source code try this golden nugget:

PerSay 1.3 is now available for Universe (free download)
http://performantsystems.com/persay/

Robert Norman

ROBERT NORMAN AND ASSOCIATES
Address: 23441 Golden Springs Dr., #289, Diamond Bar, CA 91765
Phone  : 951/541-1668
Email  : [email protected] <mailto:[email protected]>
Website: http://users.keyway.net/~ice/ <http://users.keyway.net/%7Eice/>
[Affordable UNIVERSE programming services for PICK/BASIC, DATA/BASIC, UniVerse Basic, UniBasic, R/BASIC, jBC]

On 10/9/2012 1:51 PM, Wjhonson wrote:
We had a vendor provided command which would turn a Query statement into a 
BASIC program ?

For those situations where you just want to make some tweaks to a query that's 
basically working ok just not perfectly.


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


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

Reply via email to