PROGRAM SaveListEXP * Release Information * MFG - CUST - 6.0 LastUpdated... = "Rev: 11:13 15Nov1993 u2443 29 /users/u2443/BP/SAVE.LIST.EXP" * - To allow proper creation of an exploded savedlist. *** * Abstract: * This programs purpose is to save an exploded select list. If the * specified select list is multivalue (exploded) an entry will be created * in the "savedlists" file (not the SAVEDLISTS file!), and then write the * select list to the "SAVEDLISTS" file (not the "savedlists" file!!). This * done because of the screwy way the UniData handles exploded select lists. * When an exploded select list via the normal SAVE.LIST it must follow * immediately the SELECT list that created it in the job stream. The select * data goes to the SAVEDLISTS file, and a record of the format "__":LISTNAME * with the field name of the field that was exploded in field one. Example: * * SELECT GLT BY.EXP ACCT.NBR * xxx records selected * SAVE.LIST EXPLODED * * Will create the following data: * * SAVEDLISTS/EXPLODED000 * 0001 9304*1*34}2}1 * 0002 9342*3*82}3}1 * etc. * * savedlists/__EXPLODED * 0001 ACCT.NBR^000 * *EOF * * Wierd? I know, but this is the world we live in... * This second record is manditory in order for any subsequent GET.LIST/LIST * sequences to properly handle the exploded select list... * *** * R e v i s i o n L o g * Proj Who.. When.... Why................................................ * 1051 u2443 11/11/93 Initial coding. * *** $INCLUDE UPCASE.EQUATES open "SAVEDLISTS" to SLFile else crt "Unable to open the 'savedlists' file. (SAVE.LIST.EXP)" abort end Parms = convert(" ",@FM,trim(upcase(@SENTENCE))) del Parms<1> ;* Remove the command name (SAVE.LIST.EXP)... ListName = Parms<1> if ListName eq "" then crt "ListName is a required parameter." gosub Usage stop end del Parms<1> ;* Delete the command name from the stream... FromList = 0 OnField = "" loop until Parms eq "" begin case case Parms<1> eq "FROM" FromList = Parms<2> if not(num(FromList)) then crt "Select list number must be numeric." gosub Usage stop end if FromList lt 0 or FromList gt 2 then crt "Invalid select list number: ":FromList gosub Usage stop end del Parms<1> del Parms<1> case Parms<1> eq "ON" OnField = Parms<2> if not(OnField) then crt "Field name must be specified." gosub Usage stop end del Parms<1> del Parms<1> case 1 crt "Invalid SAVE.LIST.EXP option ":Parms<1> gosub Usage abort end CASE repeat readlist List from FromList else crt "No records selected. (SAVE.LIST.EXP)" crt "Saving null list." end Exploded = dcount(List<1>,@VM) gt 0 if Exploded and OnField eq "" then crt "Field name must be specified. (SAVE.LIST.EXP)" abort end write List on SLFile, ListName:"000" oswrite OnField:char(0) to "savedlists/__":ListName if Exploded then crt "Exploded save list written to ":ListName:" (SAVE.LIST.EXP)" end else crt "Save list written to ":ListName:" (SAVE.LIST.EXP)" end stop Usage: crt "Usage: SAVE.LIST.EXP ListName [FROM ListNo] [ON FieldName]" crt " ListName - The name to save the list under." crt " ListNo - The list number 0..2 to read from." crt " FieldName - The field name the exploded list was created from." crt crt " Notes: The ListNo defaults to 0 if not specified. FieldName" crt " must be specified if the select list is exploded." return STOP 999:* Abortion *#* ABORT STOP END