create data file on command line

Discussions about CSEntry
Post Reply
amari
Posts: 34
Joined: February 24th, 2024, 11:29 am

create data file on command line

Post by amari »

I need to create CSDBE files to be used with data collection as control and config data input. These files are basically used by a menu program to hold unique per-user configuration information. I need to write a file for each enumerator. Given the considerable number of users, I am unable to do this manually. I know the changes required for each user in advance, and to achive this, writing an ASCII file is possible but I need to encrypt information so I need csdbe, but creating CSDBE or CSDB files is more complex using external program or script. I believe using the Entry program is the best solution, as it ensures correct loading in the menu program with the external dictionary.

Can I pass variables to be written directly via the command prompt so I can call PFF with parameters, or can I write a script for bulk conversion of .dat files to CSDBE ? What are the available options for me to write this number of customized config files compatible with my dictionary, using a script and without literally opening CS Entry?

Thank you for taking the time to help me.
Gregory Martin
Posts: 1828
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: create data file on command line

Post by Gregory Martin »

I would:
  • Do this in a batch application.
  • Use a dummy dictionary as your primary dictionary.
  • Attach your actual dictionary as an external dictionary.
  • In the application proc, write code like this (which I tested using the Simple CAPI dictionary):
do numeric ctr = 1 while ctr <= 10
   
string file_name = maketext("file-%02d.csdbe", ctr);
    string encoded_password = encode(PercentEncoding, maketext("password-%02d", ctr));
   
    setfile(SIMPLECAPI_DICT,
            file_name + "|password=" + encoded_password,
            create);
enddo;
In this example, I created 10 encrypted data files, with unique filenames and passwords.
amari
Posts: 34
Joined: February 24th, 2024, 11:29 am

Re: create data file on command line

Post by amari »

Thanks lot Greg.. I'll try
Post Reply