Damon,

 

Here are two little programs I use to load/unload 6.5 forms.  Make a folder
F65 under your database directory, as these programs require that.  Or, you
may alter them to suit your needs.

 

The unload program presents a menu of forms and creates the unload files
formame.F65 and formname.LOB in the F65 folder.  If the formname.F65 and
formname.LOB exist already, you are given the option to save the old ones by
renaming them with '-old' appended to the name portion of the filename.

 

The load program looks in the database directory for any .F65 files and
presents a menu, loading the one you select after first giving you the
option to save a copy of then DROPping the current form if it exists.  After
it is loaded, the new form's files are placed in the F65 folder.

 

These may be adapted easily for use with other versions of R:BASE.

 

The first one unloads a form.  Mine is named ULF65.CMD.

 

  -- ulf65.cmd unloads a form for 6.5
01/10/03 ewd

 

  CLS

  SET MESSAGES OFF

  SET ERROR MESSAGES OFF

  SET BELL OFF

  -- select a form to unload

  SET VAR vform TEXT = NULL

  CHOOSE vform FROM #VALUES FOR sys_form_name FROM sys_forms2 +

         ORDER BY sys_form_name AT 4,CENTER +

         CAPTION 'Please select the form to unload:' LINES 30

  SET VAR vlastkey = (LASTKEY(0))

  IF vform IS NULL OR vlastkey = '[Esc]' THEN

    GOTO theend

  ENDIF

  -- create filename for unload

  SET VAR vformnum = (CTXT(.vform)+'.f65')

  CHDIR f65

  -- does a version with the filename exist here?

  SET VAR vexist TEXT = NULL

  SET VAR vexist = (FINDFILE(.vformnum))

  IF vexist IS NOT NULL THEN

    -- save a copy of the previous?

    SET VAR vdialmsg = 'Save a copy of the previous .F65?'

    SET VAR vresp TEXT

    SET VAR venkey TEXT

    DIALOG .vdialmsg vresp vendkey YES AT 12

    IF vresp = 'Yes' AND vendkey <> '[Esc]' THEN

      -- does a previous -old exist?

      SET VAR voldfn = (CTXT(.vform)+'-OLD.f65')

      SET VAR voldex TEXT = NULL

      SET VAR voldex = (FINDFILE(.voldfn))

      IF voldex IS NOT NULL THEN

        -- delete the previous -old

        SET VAR vcmd = (CTXT('del')&CTXT(.vform)+'-OLD.*')

        &vcmd

      ENDIF

      -- rename previous version to -old

      SET VAR vcmd = (CTXT('ren')&CTXT(.vform)+'.f65'&CTXT(.voldfn))

      &vcmd

      SET VAR voldfn = (CTXT(.vform)+'-OLD.lob')

      SET VAR vcmd = (CTXT('ren')&CTXT(.vform)+'.lob'&CTXT(.voldfn))

      &vcmd

    ENDIF

  ENDIF

  -- unload form

  OUTPUT &vformnum

  UNLOAD DATA FOR sys_forms2 WHERE sys_form_name = .vform

  OUTPUT SCREEN

  -- show me the files

  SET VAR vfspec = (CTXT(.vform)+'*.*')

  DIR &vfspec

  CHDIR ..

LABEL theend

  CLEAR VAR v%

  RETURN

 

This one loads a form; mine is named LF65.CMD.

 

  -- lf65.cmd loads a form in 6.5                              01/10/03 ewd

 

  CLS

  SET MESSAGES OFF

  SET ERROR MESSAGES OFF

  SET BELL OFF

  -- choose a form to load

  SET VAR vfor TEXT = NULL

  CHOOSE vfor FROM #LFILES IN *.f65 AT CENTER,CENTER +

         CAPTION 'Please select the form to load:' LINES 5

  SET VAR vlastkey = (LASTKEY(0))

  IF vlastkey = '[Esc]' THEN

    GOTO theend

  ENDIF

  IF vfor IS NULL THEN

    PAUSE 2 USING 'No forms found to load.' AT CENTER,CENTER

    GOTO theend

  ENDIF

  -- strip out filename

  SET VAR vpos = (SLOC(.vfor,'.'))

  SET VAR vpos = (.vpos - 1)

  SET VAR vform TEXT

  SET VAR vform = (SMOVE(.vfor,1,.vpos,.vform,1))

  -- create filename with global extension mask

  SET VAR vformnum = (CTXT(.vform)+'.*')

  -- show it to me

  DIR &vformnum

  SET VAR vdialmsg = 'Continue? '

  SET VAR vresp TEXT,vendkey TEXT

  DIALOG .vdialmsg vresp vendkey YES AT 16

  IF vresp = 'No' OR vendkey <> '[Enter]' THEN

    GOTO theend

  ENDIF

  -- do we have the .lob also?

  SET VAR vlobx TEXT = NULL

  SET VAR vlob = (CTXT(.vform)+'.lob')

  SET VAR vlobx = (FINDFILE(.vlob))

  IF vlobx IS NULL THEN

    PAUSE 2 USING 'ERROR:  No LOB file found for form.' AT CENTER, CENTER

    GOTO theend

  ENDIF

  -- does the form exist on sys_forms2?

  SET VAR vexist TEXT = NULL

  SELECT sys_form_name INTO vexist IND vi1 FROM sys_forms2 WHERE +

         sys_form_name = .vform

  IF vexist IS NULL THEN

    GOTO loadit

  ENDIF

  -- want to save the old version?

  SET VAR vdialmsg = 'Save existing form? '

  SET VAR vresp TEXT,vendkey TEXT

  DIALOG .vdialmsg vresp vendkey NO AT 16

  IF vresp = 'No' THEN

    GOTO noxx

  ENDIF

  -- save old version in f65 directory; overwrite any pre-existing old
version

  SET VAR vformnum = ((CTXT(.vform))+'-OLD.'+'f65')

  CHDIR f65

  OUTPUT &vformnum

  UNLOAD DATA FROM sys_forms2 WHERE sys_form_name = .vform

  OUTPUT SCREEN

  CHDIR ..

LABEL noxx

  -- drop the form

  DROP FORM .vform

LABEL loadit

  -- load the form

  SET VAR vformnum = ((CTXT(.vform))+'.f65')

  RUN &vformnum

  -- put the new version into f65 directory

  SET VAR vcmd = (CTXT('copy')&CTXT(.vform)+CTXT('.* f65'))

  &vcmd

  -- delete the copy in the dad directory

  SET VAR vcmd = (CTXT('del')&CTXT(.vform)+CTXT('.*'))

  &vcmd

  -- show me the files

  SET VAR vcmd = (CTXT('dir f65\')+CTXT(.vform)+CTXT('*.*'))

  &vcmd

LABEL theend

  CLEAR VAR v%

  RETURN

 

 

 

Emmitt Dove

Manager, Converting Applications Development

Evergreen Packaging, Inc.

[email protected]

(203) 214-5683 m

(203) 643-8022 o

(203) 643-8086 f

[email protected]

 

Reply via email to