CreateFile Utility

 

The CreateFile utility allows you to create ISAM files based on repository file or structure definitions.

The command line options for the CreateFile utility are as follows:

  CreateFile -f <fname> | -s <sname> [-out filespec] [-r] [-h]

    -f <fname>   
          Name of repository file definition to process.

    -s <sname>
          The name of the repository structure definition to process.

    -in <infile>
          Name of JSON input file containing the details of file(s) to create.

    -out <filespec>
          File spec of file to create, overriding repository file spec. Not used with -in.

    -r    Replace existing files. The default is not to replace existing files. Not used with -in.

    -h    Display this usage information.

When creating a file based on a repository file definition, the key specifications will be determined by the keys defined in the first structure that is assigned to the file. When creating a file based on a repository file structure, the file specifications will be determined by the first file that the structure is assigned to. CreateFile assumes that the repository key definitions are defined in the same sequence as the keys that they refer to. It is assumed that the first defined key is the primary key, the second key (if any) is the first alternate key, and so on.

The -f and -s options can only be used to create ISAM files. The -in option can be used to create ISAM and RELATIVE files, but RELATIVE files can only be created if an input file containing initial data is provided.

The input file used with the -in option must be a JSON file similar to this:

 [
    {
      "RepositoryFileName": "CUSTOMER",
      "CreateFile": "DAT:CUSTOMER.ISM",
      "LoadFromFile": "TESTDATA:CUSTOMER.TXT",
      "OverwriteExistingFile": true
    },
    {
      "RepositoryFileName": "OPTIONS",
      "CreateFile": "DAT:OPTIONS.DDF",
      "LoadFromFile": "TESTDATA:OPTIONS.TXT",
      "OverwriteExistingFile": false
    }
  ]

Including "CreateFile" is optional. By default the file spec of the repository file definition is used.

 

Including "LoadFromFile" is optional for ISAM files, if not provided an empty file will be created. For relative files you mUST provide an initial data file and that file MUST contain at least one record of the appropriate length.

 

Including "OverwriteExistingFile" is optional. By default files will NOT be overwritten.

 

Example 1

C:\> createfile -f CUSTFIL

DAT:customer.ism -> File created.

Example 2

C:\> createfile -s CUSTOMER

DAT:customer.ism -> File created.

Example 3

C:\> createfile -f CUSTFIL -f DAT:customer_save.ism

DAT:customer_save.ism -> File created.

Example 4 

C:\> CreateFile -in CreateAndLoadFiles.json

Where CreateAndLoadFiles,json contains:

 

[

  {

    "RepositoryFileName": "MEMBERS",

    "CreateFile": "CUFILES:MEMB01.DDF",

    "LoadFromFile": "SEQ:MEMB01.SEQ",

    "OverwriteExistingFile": true

  },

  {

    "RepositoryFileName": "ACCOUNTS",

    "CreateFile": "CUFILES:MEMB02.DDF",

    "LoadFromFile": "SEQ:MEMB02.SEQ",

    "OverwriteExistingFile": true

  },

  {

    "RepositoryFileName": "PERSONS",

    "CreateFile": "CUFILES:PERMST.DDF",

    "LoadFromFile": "SEQ:PERMST.SEQ",

    "OverwriteExistingFile": true

  },

  {

    "RepositoryFileName": "CHCARD",

    "CreateFile": "CUFILES:CHCARD.DDF",

    "LoadFromFile": "SEQ:CHCARD.SEQ",

    "OverwriteExistingFile": true

  },

  {

    "RepositoryFileName": "TRANSMAS",

    "CreateFile": "CUTRX:TRANSMAS.DDF",

    "LoadFromFile": "SEQ:TRANSMAS.SEQ",

    "OverwriteExistingFile": true

  },

  {

    "RepositoryFileName": "OPTIONS",

    "LoadFromFile": "SEQ:OPTIONS.SEQ",

    "OverwriteExistingFile": true

  }

]

 

The output looks like this:

 

********************************************************************************

Processing file MEMBERS

 

 - ISAM file CUFILES:MEMB01.DDF replaced

 - Data load command: fconvert -s -it SEQ:MEMB01.SEQ -ai CUFILES:MEMB01.DDF

 - Data load starting at: 14:43:34

 

                                Summary of Statistics

 

        Records Read/Write: 000004/000004       Errors Read/Write: 0/0

        Exception Records: 0

        Elapsed Time: 00:00:01                  Kb/sec: 5.8594

 

 - Data load ending at: 14:43:34

 

********************************************************************************

Processing file ACCOUNTS

 

 - ISAM file CUFILES:MEMB02.DDF replaced

 - Data load command: fconvert -s -it SEQ:MEMB02.SEQ -ai CUFILES:MEMB02.DDF

 - Data load starting at: 14:43:34

 

                                Summary of Statistics

 

        Records Read/Write: 000004/000004       Errors Read/Write: 0/0

        Exception Records: 0

        Elapsed Time: 00:00:01                  Kb/sec: 7.8125

 

 - Data load ending at: 14:43:34

 

********************************************************************************

Processing file PERSONS

 

 - ISAM file CUFILES:PERMST.DDF replaced

 - Data load command: fconvert -s -it SEQ:PERMST.SEQ -ai CUFILES:PERMST.DDF

 - Data load starting at: 14:43:34

 

                                Summary of Statistics

 

        Records Read/Write: 000003/000003       Errors Read/Write: 0/0

        Exception Records: 0

        Elapsed Time: 00:00:01                  Kb/sec: 4.7402

 

 - Data load ending at: 14:43:34

 

********************************************************************************

Processing file CHCARD

 

 - ISAM file CUFILES:CHCARD.DDF replaced

 - Data load command: fconvert -s -it SEQ:CHCARD.SEQ -ai CUFILES:CHCARD.DDF

 - Data load starting at: 14:43:34

 

                                Summary of Statistics

 

        Records Read/Write: 000003/000003       Errors Read/Write: 0/0

        Exception Records: 0

        Elapsed Time: 00:00:01                  Kb/sec: 2.9297

 

 - Data load ending at: 14:43:34

 

********************************************************************************

Processing file TRANSMAS

 

 - ISAM file CUTRX:TRANSMAS.DDF replaced

 - Data load command: fconvert -s -it SEQ:TRANSMAS.SEQ -ai CUTRX:TRANSMAS.DDF

 - Data load starting at: 14:43:34

 

                                Summary of Statistics

 

        Records Read/Write: 000034/000034       Errors Read/Write: 0/0

        Exception Records: 0

        Elapsed Time: 00:00:01                  Kb/sec: 34.8965

 

 - Data load ending at: 14:43:34

 

********************************************************************************

Processing file OPTIONS

 

 - RELATIVE file CUFILES:CUNOPT.DDF will be created

 - Data load command: fconvert -s -it SEQ:OPTIONS.SEQ -or -fr 651 CUFILES:CUNOPT.DDF

 - Data load starting at: 14:43:34

 

                                Summary of Statistics

 

        Records Read/Write: 000005/000005       Errors Read/Write: 0/0

        Exception Records: 0

        Elapsed Time: 00:00:01                  Kb/sec: 0.0049

 

 - Data load ending at: 14:43:34

 

********************************************************************************

Processing summary:

 

 - 6 files created, 0 failed.

 - 6 files loaded,  0 failed.

 

********************************************************************************

 

 

 


Copyright © 2018  Synergex International, Inc.