Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Rename dynamic data files

30 views
Skip to first unread message

Steven Martin Trimble

unread,
Dec 7, 2023, 11:27:28 AM12/7/23
to scarl...@googlegroups.com
Ok, I figured one way to handle this:
mv /home/qm/ACC-PROG/VOC/%0 /home/qm/ACC-PROG/VOC/~0
mv /home/qm/ACC-PROG/VOC/%1 /home/qm/ACC-PROG/VOC/~1

Here is 'DIC' example:
mv /home/qm/ACC-PROG/BP.DIC/%0 /home/qm/ACC-PROG/BP.DIC/~0
mv /home/qm/ACC-PROG/BP.DIC/%1 /home/qm/ACC-PROG/BP.DIC/~1

DIRECTORY files don't seem to need revisions.

Now, I need to programmatically 'rename' dynamic data/dic files.

CDMI
Steven Trimble
(501) 772-3450 cell/text

Donald Montaine

unread,
Dec 7, 2023, 12:52:29 PM12/7/23
to ScarletDME
mv '%0' '~0' .  WIthout the quotes ~ indicates your home directory.

Donald Montaine

unread,
Dec 7, 2023, 12:53:58 PM12/7/23
to ScarletDME
DIRECTORY DATA portion files won't but the DICT of the directory file will.

Nivethan T

unread,
Dec 8, 2023, 1:06:01 PM12/8/23
to ScarletDME
A one liner to rename % to ~

find . -type f -name "%*" -exec prename "s/%/~/g" '{}' \;

You can run this inside the base account directory and it should fine all the % and rename them. This uses the prename utility which is the perl rename script, usually this is either installed or you can install it through the package manager.

Nivethan T

unread,
Dec 8, 2023, 1:12:16 PM12/8/23
to ScarletDME
Note! Make a backup before trying this as this will rip through everything below the current directory.

Steven Martin Trimble

unread,
Dec 8, 2023, 2:43:57 PM12/8/23
to scarl...@googlegroups.com
thanks for that, however, here is my first ScarletDME BASIC program
RENAME.DYNAMIC.FILES
*
* RENAME.DYNAMIC.FILES
*
* 12-07-23 smt this program renames dynamic files whose DIC and data portions
*          came from commercial QM
*          it changes %0, %1, etc to ~0, ~1
*          commercial QM changed to % from ~ because it was found that
*          some cleanup tools assumed that these were temporary files.
*          you need to be logged in the account that needs changing
*

PROMPT ''
CUR$PATH  = @PATH
ACCT$NAME = @WHO
USR$      = @USER

CRT @(-1):\RENAME.DYNAMIC.FILES\
CRT @(00,02):\You MUST be logged onto the account needing 'renaming'\
CRT @(00,03):\Current path is \:CUR$PATH
CRT @(00,04):\Current account is \:ACCT$NAME
CRT @(00,05):\Logged in as \:USR$
CRT @(00,06):\'Q'uit, 'T'rial run or 'U'pdate \:;INPUT DIO:
DIO = OCONV(DIO,"MCU")

BEGIN CASE
   CASE DIO = "T" ; DO$UPD = 0
   CASE DIO = "U" ; DO$UPD = 1
   CASE 1 ; STOP
END CASE

OPEN \VOC\ TO VOC.FL ELSE STOP 201,\VOC\

DELM$     = @DS
IF DELM$ <> "/" THEN
   CRT
   CRT \This program is expecting Linux\
   STOP
END

VERB = \SSELECT VOC WITH F1 = "F"\
EXECUTE VERB CAPTURING RESULT

IF SYSTEM(11) THEN
   SELECTE TO ITEMID.LIST
END ELSE
   CRT
   CRT \No items found after performing:\
   CRT VERB
   CRT \<Enter> \:;INPUT DIO
   STOP
END

LOOP
   READNEXT VOC.ID FROM ITEMID.LIST ELSE EXIT
   IF VOC.ID[1,1] NE "$" THEN
      READ VOC.REC FROM VOC.FL,VOC.ID THEN
         CRT CUR$PATH:@DS:VOC.ID
         ANY$SUBFL = DCOUNT(VOC.REC<02>,@VM) ; * ex: AP-ACCTS/CONTACTS]AP-ACCTS
         FOR II = 1 TO ANY$SUBFL
            SUB$FL  = VOC.REC<02,II>         ; * ex: AP-ACCTS/CONTACTS
            LONG$FL = CUR$PATH:@DS:SUB$FL    ; * ex:/home/qm/ACC-SYS/AP-ACCTS/CONTACTS
            VERB    = \ls -la \:LONG$FL      ; * ex: ls -la /home/qm/ACC-SYS/AP-ACCTS/CONTACTS
            OS.EXECUTE VERB CAPTURING RESULT
            NUM$ROWS = DCOUNT(RESULT,@AM)
            FOR JJ = 1 TO NUM$ROWS
               VAL$ = TRIM(RESULT<JJ>)
               IF INDEX(VAL$,"%",1) THEN
                  CONVERT " " TO @VM IN VAL$
                  NUM$VM = DCOUNT(VAL$<01>,@VM)
                  CHK$FL = VAL$<01,NUM$VM>
                  IF INDEX(CHK$FL,"%",1) THEN
                     CRT NUM$VM:" ":VAL$
                     DT$PORTION = OCONV(CHK$FL,"MCN") + 0
* ex: mv /home/qm/ACC-SYS/AP-ACCTS/%0 /home/qm/ACC-SYS/AP-ACCTS/~0
                     VERB = "mv ":LONG$FL:@DS:CHK$FL:" ":LONG$FL:@DS:"~":DT$PORTION
                     IF DO$UPD THEN
                        OS.EXECUTE VERB CAPTURING STUFF
                     END ELSE
                        CRT VERB
                     END
                  END
               END
            NEXT JJ
         NEXT II
      END
   END
REPEAT

END

------------ hope this helps someone going from commercial QM to ScarletDME

One quick question. I moved the account from commercial QM.
How do I overlay the VOC with the current ScarletDME VOC?
Here is what I get when I login into the 'transferred' account:

[ ScarletDME Rev 2.6-6   Copyright Ladybridge Systems, 2007 ]

Welcome to ScarletDME!  Multi-Value for the masses, not the classes.
This program is free software and is supplied with ABSOLUTELY NO WARRANTY.
You are welcome to modify or redistribute this software subject to certain
conditions.  For details type CONFIG GPL.

Your VOC is at release level 4.0-5
Update VOC to new release? y

Existing VOC record IF is of type K
Update VOC record is of type V. Replace record(Y/N)?

thanks in advance,

CDMI
Steven Trimble
(501) 772-3450 cell/text

--
You received this message because you are subscribed to the Google Groups "ScarletDME" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scarletdme+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scarletdme/598d6dbc-a66c-48d2-bd22-a3407d430b43n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages