www.icetips.com  Icetips Utilities Documentation 5/15/2016    

Icetips Generate File Queue

Previous  Top  Next  


This extension template generates a code file in two sections, data and code, that creates a queue with information about every file in the dictionary that is used in the application you apply the template to.  It gives you access to information that is not otherwise available at runtime, including the file reference and the file manager class reference, label, description, driver, driver parameter, name (i.e. external name), file owner, prefix and type.  There will be more information available in this queue later on, such as long description, user options, the file structure, etc.  In addition to the file queue I will be adding queues with fields, keys, keyfields, relations etc. so you will have pretty much all the information from the dictionary accessible from your code!

 

The file queue structure is currently declared in ITEquates.inc as follows:

 

tIT_FileQueue       QUEUE,TYPE

FileRef               &File

FileManager           &FileManager

FileLabel             CSTRING(101)

FileBindable          BYTE

FileCreate            BYTE

FileDescription       CSTRING(1025)

FileDriver            CSTRING(101)

FileDriverParameter   CSTRING(1025)

FileEncrypt           BYTE

FileExternal          BYTE

FileExternalModule    CSTRING(1025)

FileLastModified      CSTRING(30)

FileLongDesc          CSTRING(10241)

FileName              CSTRING(1025)

FileOEM               BYTE

FileOwner             CSTRING(1025)

FilePrefix            CSTRING(21)

FilePrimaryKey        CSTRING(1025)

FileQuickOptions      CSTRING(1025)

FileReclaim           BYTE

FileStatement         CSTRING(1025)

FileStruct            CSTRING(30000)

FileStructRec         CSTRING(30000)

FileThreaded          BYTE

FileType              CSTRING(21)

FileUserOptions       CSTRING(1025)

                   END

 

 

Template_GenerateFileQueueGeneral

 

By default the template will suggest a filename for the generated code file as "<appname>_IT_FileQueue.clw" and sections for the queue structure named as IT_FileQueueData and IT_FileQueueCode.  You can change this if you want or keep the default setting.

 

Template_GenerateFileQueueCodeToUse

 

The "Code to use" tab shows the code that you need to use to include the proper sections in your code.  An example code generated from one of the demo dictionaries looks like this:
 
!! ----------------------------------------------------------------------------

!! 2014-01-27 at 15:14:01       UtilDemoC7_IT_FileQueue.clw

!! ----------------------------------------------------------------------------

SECTION('IT_FileQueueData')

IT_FQ  QUEUE(tIT_FileQueue),PRE(IT_FQ!! See ITEquates.inc for the declaration of this queue

      END

 

SECTION('IT_FileQueueCode')

! File Names:

Clear(IT_FQ)

IT_FQ.FileRef              &= Names

IT_FQ.FileManager          &= Access:Names 

IT_FQ.FileLabel             = 'Names'

IT_FQ.FileDescription       = ''

IT_FQ.FileDriver            = 'TOPSPEED'

IT_FQ.FileDriverParameter   = ''

IT_FQ.FileName              = ''

IT_FQ.FileOwner             = ''

IT_FQ.FilePrefix            = 'NAM'

IT_FQ.FileType              = 'FILE'

Add(IT_FQ)

 

! File Products:

Clear(IT_FQ)

IT_FQ.FileRef              &= Products

IT_FQ.FileManager          &= Access:Products 

IT_FQ.FileLabel             = 'Products'

IT_FQ.FileDescription       = 'Product''s Information'

IT_FQ.FileDriver            = 'TOPSPEED'

IT_FQ.FileDriverParameter   = ''

IT_FQ.FileName              = ''

IT_FQ.FileOwner             = ''

IT_FQ.FilePrefix            = 'PRO'

IT_FQ.FileType              = 'FILE'

Add(IT_FQ)

 

! File Parents:

Clear(IT_FQ)

IT_FQ.FileRef              &= Parents

IT_FQ.FileManager          &= Access:Parents 

IT_FQ.FileLabel             = 'Parents'

IT_FQ.FileDescription       = ''

IT_FQ.FileDriver            = 'TOPSPEED'

IT_FQ.FileDriverParameter   = ''

IT_FQ.FileName              = ''

IT_FQ.FileOwner             = ''

IT_FQ.FilePrefix            = 'PAR'

IT_FQ.FileType              = 'FILE'

Add(IT_FQ)

 

! File Children:

Clear(IT_FQ)

IT_FQ.FileRef              &= Children

IT_FQ.FileManager          &= Access:Children 

IT_FQ.FileLabel             = 'Children'

IT_FQ.FileDescription       = ''

IT_FQ.FileDriver            = 'TOPSPEED'

IT_FQ.FileDriverParameter   = ''

IT_FQ.FileName              = ''

IT_FQ.FileOwner             = ''

IT_FQ.FilePrefix            = 'CHI'

IT_FQ.FileType              = 'FILE'

Add(IT_FQ)

 

This file is of course updated if your dictionary changes, new files are added or their properties change.  This code shows what is currently put into the queue. 

 

To use the code, you simply include it where you need to, the data code in the data section of the procedure or program, and the code in the code section:

 

SomeProc  PROCEDURE

Include('UtilDemoC7_IT_FileQueue.clw','IT_FileQueueData')

Code

Include('UtilDemoC7_IT_FileQueue.clw','IT_FileQueueCode')

 

 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/generate_file_queue.htm