i made a relational selection program many many moons ago - i'm retired now - thanks to a crushed right hand i can only type with the left hand which goes numb quickly thanks to an elbow injury

but i keep the code around and lurk on the list just in case :-)

* RSELECT - Relational File Selection Utility
* Usage:
* RSELECT LIST1 FILENAME ATTRNBR LIST2
    Version="~Ver=~7.0.10~362202866~"
*#* COPY COPY.TOOLS.BP STANDARD.VARIABLES.1 (REPLACING PGM.NAME BY RSELECT, FN.NAME BY RSELECT, IO.OPEN.OPTS BY TERM.DATA:LOCK) ;*#* Copied Source Follows (06-25-03)
  $INCLUDE STANDARD.COMMON.VARIABLES FROM COPY.TOOLS.BP
  $INCLUDE STANDARD.COMMON.APP.PROGRAMS FROM COPY.TOOLS.BP
  $INCLUDE STANDARD.VARIABLES.END FROM COPY.TOOLS.BP
  PGM.NAME='RSELECT'; FN.NAME ='RSELECT'
  CALL IO.OPEN('TERM.DATA:LOCK',PASSWORDS)
*#*
*========================================================================
  GOSUB GET.OPTIONS
  GOSUB DETERMINE.TEMP.FILESIZE
  GOSUB LOAD.TEMP.FILE
  GOSUB CREATE.TEMP.DICT
  GOSUB BUILD.LIST2
  GOSUB FINISH.UP
  STOP
*========================================================================
GET.OPTIONS:
  PRINT 'Enter END at any prompt to abort'
  PRINT
  PRINT 'Enter Source List Name :               ':;INPUT LIST1
  IF LIST1 = 'END' THEN STOP
  PRINT 'Enter the Selection Filename :         ':;INPUT FILENAME
  IF FILENAME = 'END' THEN STOP
  PRINT 'Enter the Selection Attribute Number : ':;INPUT ATTRNBR
  IF ATTRNBR = 'END' THEN STOP
  PRINT 'Enter the Destination List Name :      ':;INPUT LIST2
  IF LIST2 = 'END' THEN STOP
  PRINT
  LOOP
    PRINT 'Continue? (Y/END)':;INPUT YORN
    IF YORN = 'END' THEN STOP
    IF YORN = 'Y' THEN EXIT
  REPEAT
  RETURN
*========================================================================
DETERMINE.TEMP.FILESIZE:
  MSG = 'GET.LIST ':LIST1
  PERFORM MSG CAPTURING JUNK
  SELECTION = @SYSTEM.RETURN.CODE
  TBYTES    = 0
  LOOP WHILE READNEXT ID DO
    TBYTES+=LEN(ID)
  REPEAT
  TEMP.MOD  = INT(TBYTES/1024)
  IF TEMP.MOD < 1 THEN
    TEMP.MOD = 5
  END
  TEMP.NAME = 'RSELECT':PROCESS.ID
  MSG = 'CREATE.FILE ':TEMP.NAME:' ':TEMP.MOD
  PERFORM MSG CAPTURING JUNK
OPEN '', TEMP.NAME TO TEMP.HANDLE ELSE PRINT 'Internal processing error';STOP OPEN 'DICT', TEMP.NAME TO TEMP.DICT ELSE PRINT 'Internal processing error';STOP
  RETURN
*========================================================================
LOAD.TEMP.FILE:
  MSG = 'GET.LIST ':LIST1
  PERFORM MSG CAPTURING JUNK
  NADA = ''
  LOOP WHILE READNEXT ID DO
    WRITEV NADA ON TEMP.HANDLE, ID, 0
  REPEAT
  RETURN
*========================================================================
CREATE.TEMP.DICT:
  DREC = ''
  DREC<1> = 'I'
  DREC<2> = 'TRANS("':TEMP.NAME:'",F':ATTRNBR:',"F0","X")'
  DREC<4> = 'Temporary Trans Dict'
  DREC<5> = '25L'
  WRITE DREC ON TEMP.DICT, "TRAN.DICT"
  DREC = ''
  DREC<1> = 'D'
  DREC<2> = ATTRNBR
  DREC<4> = 'Temprary Base Dict'
  DREC<5> = '25L'
  DID = "F":ATTRNBR
  WRITE DREC ON TEMP.DICT, DID
  RETURN
*========================================================================
BUILD.LIST2:
  PRINT 'Now creating list ':LIST2
  MSG = 'SELECT ':FILENAME:' WITH TRAN.DICT GT "" USING DICT ': TEMP.NAME
  PERFORM MSG
  PERFORM 'SAVE.LIST ':LIST2
RETURN
*========================================================================
FINISH.UP:
  CLOSE TEMP.HANDLE
  CLOSE TEMP.DICT
  MSG = 'DELETE.FILE ':TEMP.NAME
  DATA 'Y'
  PERFORM MSG CAPTURING JUNK
  PRINT 'Program Completed'
  RETURN



On 8/27/2013 1:24 PM, Hilk, Brandon wrote:
Hello!

UniVerse 10.1, HP/UX, Pick.

Is there a way I can build a save-list from a selection from one file
X.INFO (where the record ID is an 8 digit number) and use that list to
select from file Y.INFO (where that 8 digit number is not the record ID
but does exist as a "foreign key" elsewhere in the file). In SQL this
would be considered a join and would look something like this:

select *

from X.INFO, Y.INFO

where X.INFO.packet.id=Y.INFO.packet.id

and X.INFO.status='ccc';

I can run this in TCL and have it return the results I want but can't
build a save-list from it because I don't know the UniVerse/SQL syntax
to do so.

So to summarize, is there a way to use a save-list built from X.INFO to
make another save-list comprised of the record ID's from Y.INFO?

Thanks for any advice you can give.

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to