$INCLUDE UNIVERSE.INCLUDE MTF.INCL.H $INCLUDE UNIVERSE.INCLUDE MACHINE.NAME $INCLUDE UNIVERSE.INCLUDE FILENAMES.H ****************************************************************************** * * Routine to handle Account Importation * * Module %M% Version %I% Date %H% * * (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved * This is unpublished proprietary source code of Ardent Software Inc. * The copyright notice above does not evidence any actual or intended * publication of such source code. * ******************************************************************************* * * Maintenence log - insert most recent change descriptions at top * * Date.... GTAR# WHO Description........................................ * 10/14/98 23801 SAP Change copyrights. * 08/18/96 18335 MAA Ported release 9 to the SNI * 06/28/96 16464 DJL Allow restore from linked device * 04/16/96 18292 AGM Change OS.TYPE for NT * 02/27/96 17917 JJV Port to NT. * 02/24/94 10694 WLG Made SNI changes for IN2 tape acct import. * 02/10/94 11724 JWF Fixed tape corruption problem caused by closeseq * 04/30/93 10271 DTM Allowed multiple acct. save format for reality flavor * 11/06/92 8137 PVW Allow restoring tape image from disk * 05/15/91 6444 LPC Add -m option to create REALITY flavored accounts * 05/13/91 8345 DTM changed print to tprint * 3/19/91 7673 DTM Added support for F.4 key * 3/14/91 7673 DTM Made changes to CHOICE.BOX.B * 1/9/91 7673 DTM Final changes for internationalization and things * 11/27/90 7403 DTM Initial programming * ******************************************************************************* * This subroutine will accept as an argument the value of the operation * to perform. It can perform the following functions on spooler jobs: ****************************************************************************** id = "%W%" ****************************************************************************** * Various Prompts and Help string values ****************************************************************************** equ PRMPT.LOC to 2 equ SHRT.HELP to 4 equ LONG.HELP to 5 ****************************************************************************** * Various other variables ****************************************************************************** equ PAINT to 1 ;* flag to paint forms equ Default to 1 ****************************************************************************** * Strings representing shell scripts to be executed and files used ****************************************************************************** equ device.record to "&DEVICE&" equ account.record to "UV.ACCOUNT" temp=NULL CALL *ISUSER.B(0,temp) IF temp=0 THEN TPRINT UVREADMSG(071000,"") SLEEP 3 STOP END DECLARE GCI access user.file.open=FALSE device.file.open=FALSE GOSUB init.messages GOSUB init.files ;* Initialize /usr/spool/uv/sp.config GOSUB init.vars ;* initialize local variables GOSUB init.form ;* Initialize forms to be used GOSUB init.menu ****************************************************************************** * In this section, we draw the first screen, print the menu bar and help * areas, and put up the first title and form to fill out. ****************************************************************************** CALL *DRAW.SCRN.B(UVREADMSG(073120,""),1) CALL *HELP.PRINT.B(UVREADMSG(073009,""),2) CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) CALL *MNU.BAR.PR.B(Menu.Bar,1) ****************************************************************************** * Starting point for routines actual activity. Paint help message and * continue ****************************************************************************** help.loop: CALL *HELP.PRINT.B(form,1) ****************************************************************************** * Starting point for actual data input. Here we position the cursor to the * place of the secondary prompt and get the input character, which is returned * in special, if a special character was encountered, or in temp, is data * was entered. ****************************************************************************** input.loop: TPRINT form: ;* position cursor temp=temp.form CALL *CINPUT.B(SEC.PRMPT,temp,special,form,form) ****************************************************************************** * First section handles all the special characters. ****************************************************************************** IF special # 0 THEN ;* if special character encountered BEGIN CASE ****************************************************************************** * Up arrow was pressed. ****************************************************************************** CASE special = UP.ARROW ;* Up arrow was pressed TPRINT form:PRMPT: IF temp.form # NULL THEN TPRINT temp.form: TPRINT STR(SPACE,form-LEN(temp.form)) END form.line-=1 IF form.line < 1 THEN form.line=form.size END GOTO help.loop ;* get more input ****************************************************************************** * Down arrow was pressed. ****************************************************************************** CASE special = DOWN.ARROW ;* Down arrow was pressed TPRINT form:PRMPT: IF temp.form # NULL THEN TPRINT temp.form: TPRINT STR(SPACE,form-LEN(temp.form)) END form.line+=1 IF form.line > form.size THEN form.line=1 END GOTO help.loop ;* get more input ****************************************************************************** * Function key F1 was pushed. This key is used to display more involved * Help messages ****************************************************************************** CASE special = F.1 CALL *HELP.PRINT.B(form,3) GOTO input.loop ;* get more input ****************************************************************************** * Escape key pressed. This is the systems signal to return to the calling * procedure. First clear the screen however ****************************************************************************** CASE special = ESCAPE ;* escape was pressed STOP @(-1) CASE special = F.4 temp="*" GOTO new.enter CASE special = F.10 action.value=1 CALL *DO.MNU.BAR.B(Menu.Bar,action.value,form.size,form,temp.form) BEGIN CASE CASE action.value = 1 STOP @(-1) CASE action.value = 2 STOP @(-1) CASE action.value = 3 message=UVREADMSG(073123,"") CONVERT @FM TO " " IN message CALL *HELP.BOX.B(3,10,60,message) CASE action.value = 4 message=UVREADMSG(076001,"") CONVERT @FM TO " " IN message CALL *HELP.BOX.B(3,10,60,message) CASE action.value = 5 CALL *HELP.BOX.B(3,10,45,UVREADMSG(076000,"")) END CASE CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop CASE Default GOTO help.loop END CASE ;* end of case END ;* end of if statement ****************************************************************************** * If we reach here, we must have had data input, which is returned from * *NINPUT in the variable temp. Therefore, process it and execute the * desired operation. ****************************************************************************** ELSE ;* DAVE new.enter: sel.val=1 CALL *HELP.PRINT.B(NULL,3) ;* Clears help area BEGIN CASE CASE form.line=1 ;* IF temp=temp.form THEN GOTO jump.spot IF temp="*" THEN CALL *HELP.PRINT.B(UVREADMSG(073058,""),3) CALL *HELP.PRINT.B(help.message,2) CALL *PTBCODE(fvuv.account,11,sel.val) CALL *HELP.PRINT.B(NULL,3) IF sel.val = -1 THEN temp=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END ELSE temp=sel.val temp.form=temp END CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) END IF temp=NULL THEN CALL *HELP.BOX.B(17,5,50,msg2) GOTO help.loop END IF OS.TYPE = "MSWIN" THEN temp = CONVERT( "\", "/", temp ) END temp.directory=temp parent.directory=temp IF temp[1,1] <> "/" AND (OS.TYPE = "UNIX" OR temp MATCH "1A~':/'0X") THEN READ parent.directory.rec FROM fvuv.account,temp ELSE READ parent.directory.rec FROM fvuv.account,UPCASE(temp) ELSE CALL *HELP.BOX.B(5,5,50,msg5) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END END parent.directory=parent.directory.rec<11> temp.directory=parent.directory END IF access(temp.directory,6) THEN CALL *HELP.BOX.B(5,5,50,Warn:UVREADMSG(073107,temp.directory)) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END temp.form=temp.directory IF temp.directory#temp THEN temp.form=temp:" ":temp.directory END CASE form.line=2 ;* Device name IF temp=temp.form THEN GOTO jump.spot IF temp="*" THEN sel.val=1 CALL *HELP.PRINT.B(UVREADMSG(073058,""),3) CALL *HELP.PRINT.B(help.message,2) CALL *PTBCODE(device.file,2,sel.val) CALL *HELP.PRINT.B(NULL,3) IF sel.val=-1 THEN temp=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END ELSE temp=sel.val temp.form=temp END CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) END IF temp=NULL THEN CALL *HELP.BOX.B(17,5,50,msg2) GOTO help.loop END DEV.REC=NULL temp.path=temp IF temp[1,1] <> "/" THEN READ DEV.REC FROM device.file,temp THEN device.pathname=DEV.REC<2> device.rewind=DEV.REC<6> device.type=DEV.REC<4> temp.path=device.pathname ibs=DEV.REC<16> temp.form<3>=device.rewind temp.form<4>=device.type temp.form<5>=ibs IF ibs=NULL THEN form.jump=5 END ELSE form.jump=6 END IF device.type="T" OR device.type="DT" THEN IF ibs=NULL THEN ibs=8192 temp.form<5>=ibs END END ELSE IF device.type= "C" or device.type = "F" OR device.type="DC" THEN IF ibs=NULL THEN ibs=512 temp.form<5>=ibs END END END ELSE READ DEV.REC FROM device.file,UPCASE(temp) THEN temp=UPCASE(temp) device.rewind=DEV.REC<6> temp.form<3>=device.rewind device.type=DEV.REC<4> temp.form<4>=device.type device.pathname=DEV.REC<2> temp.path=device.pathname ibs=DEV.REC<16> temp.form<5>=ibs IF device.type="T" OR device.type="DT" THEN IF ibs=NULL THEN ibs=8192 temp.form<5>=ibs END END ELSE IF device.type="C" or device.type = "F" OR device.type="DC" THEN IF ibs=NULL THEN ibs=512 temp.form<5>=ibs END END IF ibs=NULL THEN form.jump=5 END ELSE form.jump=6 END END ELSE CALL *HELP.BOX.B(5,5,50,msg5) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END END END ELSE CALL *HELP.PRINT.B(NULL,3) CALL *HELP.PRINT.B(UVREADMSG(073112,""),2) device.pathname=temp END IF OS.TYPE = "UNIX" THEN EXECUTE OS.EXEC:"'ls -l ":temp.path:"'" CAPTURING OUTPUT user.permissions = OUTPUT[1,3] IF user.permissions # "crw" AND user.permissions # "lrw" THEN NoRewindDevice.Error: CALL *HELP.BOX.B(5,5,50,Warn:UVREADMSG(073107,temp.path)) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END END device.name=temp IF device.pathname#temp THEN temp.form=temp:" ":device.pathname END ELSE temp.form = temp END CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) CASE form.line=3 IF OS.TYPE = "MSWIN" THEN temp = CONVERT( "\", "/", temp ) END IF temp="*" THEN GOTO help.loop IF temp=NULL AND temp.form=NULL THEN CALL *HELP.BOX.B(5,5,50,msg2) CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END IF temp=NULL THEN temp=temp.form END IF temp[1,1] <> "/" THEN CALL *HELP.BOX.B(5,5,50,msg5) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END IF access(temp,4) THEN CALL *HELP.BOX.B(5,5,50,Warn:UVREADMSG(073107,temp)) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END device.rewind=temp temp.form=temp CASE form.line=4 ;* Enter Device Type IF temp="*" THEN GOTO help.loop IF temp=NULL THEN CALL *HELP.BOX.B(17,5,50,msg2) GOTO help.loop END temp=UPCASE(temp) IF temp # "T" AND temp # "C" AND temp # "F" AND temp # "DT" AND temp # "DC" THEN CALL *HELP.BOX.B(5,5,50,Warn:UVREADMSG(073108,"")) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END IF temp="T" OR temp="DT" THEN IF ibs=NULL THEN ibs=8192 temp.form<5>=ibs END END ELSE IF temp="C" or temp = "F" OR temp="DC" THEN IF ibs=NULL THEN ibs=512 temp.form<5>=ibs END END device.type=temp temp.form=temp CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) CASE form.line=5 ;* Enter Block size IF temp="*" THEN GOTO help.loop IF temp=NULL THEN CALL *HELP.BOX.B(17,5,50,msg2) GOTO help.loop END ICONV.TEMP=ICONV(temp,"MD0") IF STATUS()#0 THEN CALL *HELP.BOX.B(5,5,50,msg4) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END ibs=temp temp.form = temp CASE form.line=6 ;* tape type IF temp="*" THEN GOTO help.loop IF temp=NULL THEN CALL *HELP.BOX.B(17,5,50,msg2) GOTO help.loop END temp=UPCASE(temp) FLAGIN2=0 MAXINK=0 BEGIN CASE CASE temp="I" FLAGIN2="IN8000" FLAVOR=" -i" CASE temp="J" FLAGIN2="IN5000" CASE temp="K" FLAGIN2="IN8000" FLAVOR=" -i" MAXINK=-1 CASE temp="L" FLAGIN2="IN5000" MAXINK=-1 CASE temp="P" FLAVOR="" CASE temp="M" FLAVOR=" -m" form.size = 8 CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) CASE Default CALL *HELP.BOX.B(5,5,50,Warn:UVREADMSG(073109,"")) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END CASE tape.type=temp temp.form=temp CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) CASE form.line=7 ;* type 19 files IF temp="*" THEN GOTO help.loop IF temp=NULL THEN CALL *HELP.BOX.B(17,5,50,msg2) GOTO help.loop END temp=UPCASE(temp) IF temp # "Y" AND temp # "N" THEN CALL *HELP.BOX.B(5,5,50,Warn:UVREADMSG(073110,"")) temp.form=NULL CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) GOTO help.loop END temp.form = temp type19=temp CASE form.line = 8 ;* mult.account save format IF temp="Y" OR temp="y" THEN masf = " -mas" ELSE masf = "" temp.form = temp CALL *PUT.FORM.B(form.size,form,temp.form,PRMPT,PAINT) END CASE jump.spot: TPRINT form:PRMPT:temp.form: TPRINT STR(SPACE,form-LEN(temp.form)): form.line +=1 IF form.jump#0 THEN form.line=form.jump form.jump=0 END IF form.line <= form.size THEN GOTO help.loop END flag=0 CALL *YES.NO.BOX.B(17,UVREADMSG(073065,""),flag) IF flag=1 THEN form.line=1 GOTO help.loop END IF flag=-1 THEN RETURN B.array=NULL B.array<1>=1 B.array<2>=UVREADMSG(073029,"") sel.val=1 CALL *CHOICE.BOX.B(17,3,LEN(msg10)+3,msg10,B.array,sel.val,"") IF sel.val = -1 THEN RETURN END * commented out for gtar 8137 * CMD=NULL * IF device.type="F" THEN * CMD=UV.BIN:"/acct.restore -a ":device.pathname * IF type19="Y" THEN CMD = CMD:" -19" * END * ELSE LOOPINK=0 TPRINT @(-1) IF MAXINK = -1 THEN TPRINT UVREADMSG(073128,""): INPUT MAXINK MAXINK = MAXINK -1 END IF FLAGIN2 = "IN5000" AND device.type = "DC" THEN TPRINT UVREADMSG(073129,""): INPUT NBVOL END LOOPK: CMD="" IF FLAGIN2 # 0 THEN FORWARD.TAPE=DEV.REC<10> PATHNAME=device.pathname CMD="tape=":PATHNAME:";" IF LOOPINK = 0 THEN CMD:= FORWARD.TAPE:";":FORWARD.TAPE:";" ELSE CMD:= FORWARD.TAPE:";" IF FLAGIN2 = "IN5000" AND device.type = "DC" THEN CMD:=UV.BIN:"/ddm ":NBVOL CMD1 = " if=":PATHNAME:" | ":UV.BIN:"/INfilter | ":UV.BIN:"/acct.restore -i -" CMD := CMD1 GOTO end.rest END END CMD := UV.BIN:"/tapein" CMD := " -p":UV.BIN:"/acct.restore" CMD := " -f":device.pathname CMD := " -g":device.rewind CMD := " -b":ibs CMD := FLAVOR CMD := masf if type19 = "Y" then CMD := " -t" if device.type = "C" or device.type = "DC" then CMD := " -c" if not(ImageFromDisk) then CMD := " -a" else CMD := " -r" if LOOPINK # 0 THEN CMD := " -I" * END end.rest: TPRINT @(-1) TTYGET tty$ ELSE NULL tmptty=tty$ CRMODE.ICRNL=1 CRMODE.ONLCR=1 TTYSET tty$ ELSE NULL IF OS.TYPE = "UNIX" THEN EXECUTE OS.EXEC:"'cd ":parent.directory:"; ":CMD:"'" END ELSE * NT needs slash's in correct format for execute parent.directory = CONVERT( "/", "\", parent.directory ) EXECUTE OS.EXEC:" 'cd ":parent.directory :"& ":CMD:"'" END IF LOOPINK # MAXINK THEN LOOPINK = LOOPINK +1 GOTO LOOPK END TTYGET tty$ ELSE NULL tty$=tmptty TTYSET tty$ ELSE NULL CALL *HELP.BOX.B(5,5,50,UVREADMSG(001403,"")) END ****************************************************************************** * Init.form * This routine initializes all the positional parameters, help strings, * text strings, and default values for the two forms used in this subroutine ****************************************************************************** init.form: scratch=UVREADMSG(073101,"") masf = "" form.size=7 form.line=1 temp.form=NULL form=NULL form<1,1>=@(2,5) form<1,2>=@(25,5) form<1,3>=scratch<1> form<1,4>=scratch<2> form<1,5>=form<1,4>:SPACE:scratch<3> form<1,6>=50 form<1,7>=0 form<2,1>=@(2,6) form<2,2>=@(25,6) form<2,3>=scratch<4> form<2,4>=scratch<5> form<2,5>=form<2,4> form<2,6>=30 form<2,7>=0 form<3,1>=@(2,7) form<3,2>=@(25,7) form<3,3>=scratch<6> form<3,4>=scratch<5> form<3,5>=form<3,4> form<3,6>=30 form<3,7>=0 form<4,1>=@(2,8) form<4,2>=@(25,8) form<4,3>=scratch<7> form<4,4>=scratch<8> form<4,5>=form<4,4> form<4,6>=2 form<4,7>=1 form<5,1>=@(2,9) form<5,2>=@(25,9) form<5,3>=scratch<9> form<5,4>=scratch<10> form<5,5>=form<5,4> form<5,6>=10 form<5,7>=1 form<6,1>=@(2,10) form<6,2>=@(25,10) scratch1=UVREADMSG(073121,"") form<6,3>=scratch1<1> form<6,4>=scratch1<2> form<6,5>=form<6,4> form<6,6>=1 form<6,7>=1 form<7,1>=@(2,11) form<7,2>=@(25,11) form<7,3>=scratch<14> form<7,4>=scratch<15> form<7,5>=form<7,4> form<7,6>=1 form<7,7>=1 form<8,1>=@(2,12) form<8,2>=@(25,12) form<8,3>="Mult Acct Save Format" form<8,4>="Enter Y if the tape is in Multiple Account Save Format" form<8,5>=form<8,4> form<8,6>=1 form<8,7>=1 type19="N" temp.form<9>="N" RETURN ****************************************************************************** * Init.files * It also opens up the &DEVICE& File so they can both be used to modify * entries, existing or not, for printers on system. ****************************************************************************** init.files: m1=UVREADMSG(073614,"") IF device.file.open = FALSE THEN OPEN "",device.record TO device.file ELSE retry=0 CALL *ERROR.BOX.B(5,5,50,UVREADMSG(073005,device.record),retry,m1) IF retry#0 THEN STOP @(-1) ELSE GOTO init.files END device.file.open=TRUE END inf.2: IF user.file.open = FALSE THEN OPEN "",account.record TO fvuv.account ELSE retry=0 CALL *ERROR.BOX.B(5,5,50,UVREADMSG(073005,account.record),retry,m1) IF retry#0 THEN STOP @(-1) ELSE GOTO inf.2 END user.file.open=TRUE END RETURN ****************************************************************************** * Init.vars - * Routine which initializes various global variables ****************************************************************************** init.vars: form.jump=0 parent.directory=NULL device.name=NULL device.rewind=NULL device.pathname=NULL device.type=NULL ibs=NULL ImageFromDisk=1 tape.type=NULL type19=NULL NEW.ITEM=TRUE FLAVOR=NULL RETURN ****************************************************************************** * Strings from help messages and such ****************************************************************************** init.messages: help.message=CONVERT(@FM," ",UVREADMSG(073644,"")) Warn=UVREADMSG(073613,""):": " msg2=Warn:UVREADMSG(071004,"") msg4=Warn:UVREADMSG(073103,"") msg5=Warn:UVREADMSG(073105,PROD.NAME) word=UVREADMSG(073122,"") msg10=UVREADMSG(073111,word) RETURN *************************************************************************** * init.menu - initializes menu bar *************************************************************************** init.menu: scratch=UVREADMSG(073087,"") Menu.Bar = NULL Menu.Bar<1,1> = 3 ;* Number of Items in Menu.Bar Menu.Bar<1,2> = 1 ;* Line # on which to print the Menu Bar * First Item Menu.Bar<2,1,1>=scratch<1> ;* SubMenu Title Menu.Bar<2,1,2>=1 ;* # of items in SubMenu * SubMenu #1 Menu.Bar<2,2,1>=scratch<6> ;* SubMenu Item Menu.Bar<2,2,2>=1 ;* Action Code (Returned to calling process) Menu.Bar<2,2,3>=scratch<7> * Second Item Menu.Bar<3,1,1>=scratch<8> ;* SubMenu Title Menu.Bar<3,1,2>=1 ;* # of items in SubMenu * SubMenu #1 Menu.Bar<3,2,1>=scratch<6> ;* SubMenu Item Menu.Bar<3,2,2>=2 ;* Action Code Menu.Bar<3,2,3>=scratch<7> scratch=UVREADMSG(073089,"") Menu.Bar<4,1,1>=scratch<1> Menu.Bar<4,1,2>=3 Menu.Bar<4,2,1>=scratch<2> Menu.Bar<4,2,2>=3 Menu.Bar<4,2,3>=scratch<3> Menu.Bar<4,3,1>=scratch<4> Menu.Bar<4,3,2>=4 Menu.Bar<4,3,3>=scratch<5> Menu.Bar<4,4,1>=scratch<6> Menu.Bar<4,4,2>=5 Menu.Bar<4,4,3>=scratch<7> RETURN STOP @(-1) END