Another note on the differences between READNEXTS.
As I support UD/UV/D3/MCD and Native clients, I like to be consistent in my
application programs. Thus, when appropriate, I have a subroutine that I can
use blindly in my application thinking and not have to remember which format
works for which flavor.
My routine is called GET.IDS(TCL, IDS) and basically takes the TCL
statement, either SSELECT, GET-LIST or null and throws the item-ids into the
variable IDS. Thus my application programs all have GET.IDS and the actual
program GET.IDS is flavorized.
SUBROUTINE GET.IDS(TCL, IDS)
***
* GATHER ITEM-IDS AND RETURN AS A VARIABLE
* MAJ 062104
***
FLAVOR="UD"
IF TCL # "" THEN
IF FLAVOR="MCD" THEN
PERFORM TCL RTNLIST TCLLIST CAPTURING JUNK
END ELSE
EXECUTE TCL CAPTURING JUNK
END
END
IDS=""
BEGIN CASE
CASE FLAVOR="UD" OR FLAVOR="UV"
LOOP WHILE READNEXT ID DO ; IDS<-1>=ID ; REPEAT
CASE FLAVOR="MCD"
LOOP READNEXT ID FROM TCLLIST ELSE ID="EOF" UNTIL ID="EOF" DO ;
IDS<-1>=ID ; REPEAT
CASE FLAVOR="D3"
LOOP READNEXT ID ELSE EXIT UNTIL 0 DO ; IDS<-1>=ID ; REPEAT
CASE 1
LOOP READNEXT ID ELSE ID="EOF" UNTIL ID="EOF" DO ; IDS<-1>=ID ;
REPEAT
CASE "GOTO-friendly"
10 READNEXT ID THEN IDS<-1>=ID ; GOTO 10 ELSE NULL
END CASE
RETURN
If anyone chooses to use this routine, you can remove the unnecessary
flavors. This also works with a PROC-level or external active list. Just
pass the TCL as null.
You could also insert your own localized versions of converting an active
list to a variable. In any case, once i have this installed at a client's
system, all I really have to remember is CALL GET.IDS(TCL, IDS) and not have
to remember the different syntaxes.
Obviously for the CASE 1 and MCD flavor, insure that EOF isn't a valid ID in
the file being selected. Also, CASE 1 would work for all except MCD but the
intent is to optimize per flavor. I never really liked the requirement that
MCD required a listname if the list was gotten from a PERFORM. Also note
that none of these methods require the DONE=0/DONE=1 flag stuff.
my 1 cent.
p.s. I threw in the GOTO-friendly condition if anyone cares. And yes, i know
it will never be processed.
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/