Dynamic Subfile naming

Rich `Lego-Man' Jesse - 7633 RJESSE@QTIWORLD.COM
Thu, 21 Oct 1999 13:30:21 -0500 (CDT)


Al Karman posted:

AL> Can someone out there divulge the secret whereby I can dynamically create 
AL> and name the subfiles AT the User-ID break (subfile USER1 contains just 
AL> User-ID's=<USER1>, subfile USER2 bla bla bla y'all get the idea!)

If you have a nice scripting language like DCL (OpenVMS) or Perl or even from a
Unix shell script, you could do something like the following (in DCL):

	$! Read the detail set and output a subfile that contains unique
	$! user-id's in sorted order.
	$	QUIZ AUTO=getdetailset
	$! Read thru the resultant subfile, setting a logical for subsequent
	$! QUIZes.
	$	OPEN/READ/ERROR=EXIT inchn getdetailset.sf
	$LOOP:
	$	READ/ERROR=EXIT inchn TheNextUserID
	$!
	$	DEFINE MY_SUBFILE_LOGICAL_NAME 'TheNextUserID'
	$!
	$	QUIZ AUTO=createusersubfile
	$	GOTO LOOP
	$EXIT:
	$	CLOSE inchn

...where getdetailset.qzs might look like this:

	ACCESS MY_DETAIL_SET
	SET REPORT NOLIMIT
	SET SUBFILE NAME GETDETAILSET KEEP
	SORT USERID
	REPORT AT USERID USERID
	GO

Did I get that right?  Something like that anyway.  And createusersubfile.qzs
would contain some lines like this:

	ACCESS SOME_OTHER_TABLE
	SET SUBFILE NAME MY_SUBFILE_LOGICAL_NAME KEEP
	SORT...
	REPORT...
	etc

The important parts are the DCL "DEFINE" statement and the "SET SUBFILE NAME"
statement in createusersubfile.qzs.

Of course, if you're not on VMS, this particular example won't help...  :|
If not, let me know, and I can show you a technique for Unix using a QUIZ
wrapper to create the unique subfile names in a script.

AL> In your debt for all eternity or 1/1/00, whichever comes 1st!

If this is of any help, payment gladly accepted in the form of beer.  Hey, I'm
from Wisconsin, right?   ;)

Rich Jesse                              System/Database Administrator
rjesse@qtiworld.com                     Quad/Tech International, Sussex, WI USA
Standard "If my code breaks it, *you* bought it" disclaimer applies!
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.