` Printed Icetips Article

Icetips Article



Templates: Create memory record for a file
1998-12-27 -- Roberto Artigas Jr.
 
Newsgroups: TopSpeed.Topic.Templates

Editors note:  Please note that some lines may wrap in the template code.

Heavenes -

If you are using the ABC DLL Toolkit from Jim Katz you are probably aware
that there are File DLL's and Code DLL's and each different dictionaries is
in a different DLL's.

So if you run into having to write a record that belongs to a different
dictionary in a different DLL you will need to pass the record with the data
fields needed to be written.

Here is a template that will generate a memory record format and key areas
for each file. Each file will be in it's own source file that can be
included.

This template is a starting point. Modify to taste. Mileage may vary.

Enjoy!
Roberto Artigas Jr
ascend@netten.net

#!====================================================================
#!====================================================================
#!====================================================================
#UTILITY (GenerateRecords, 'Generate Record Groups'), WIZARD
#!====================================================================
#SHEET
  #TAB ('Generate Records Groups')
    #DISPLAY ('This wizard will generate group definitions of the contents
of your current dictionary.'), AT(90, 8, 235, 24)
    #DISPLAY ('To specify how you want the report constructed, click on the
Next button.'), AT(90)
  #ENDTAB
  #TAB ('Dictionary Print Wizard - Reported Files'), FINISH(1)
    #DISPLAY ('You can report on each file in your dictionary, or you can
select individual files to report on.'), AT(90, 8, 235, 24)
    #PROMPT ('Report on all files in my dictionary.', CHECK),
%DictionaryReportUseAllFiles, DEFAULT(1), AT(90,, 180)
  #ENDTAB
  #TAB ('Dictionary Print Wizard - Select Reported Files'),
WHERE(~%DictionaryReportUseAllFiles), FINISH(1)
    #PROMPT ('File Selection', FROM (%File)),
%DictionaryReportFileSelection, INLINE, SELECTION('File Selection'), AT(90,
8, 235)
  #ENDTAB
  #TAB ('Dictionary Print Wizard - Finally...')
    #DISPLAY ('This concludes the dictionary Group Generate wizard.'),
AT(90, 8, 235, 24)
    #DISPLAY ('Click on the Finish button to generate Groups.'), AT(90, 82,
235, 24)
  #ENDTAB
#ENDSHEET
#COMMENT(45)
#DECLARE (%ReportedFiles),UNIQUE
#DECLARE (%Groups), MULTI
#DECLARE (%ValueConstruct)
#DECLARE (%TheKeyId)
#DECLARE (%TheKeyNo,LONG)
#IF (%DictionaryReportUseAllFiles)
  #FOR (%File)
    #ADD (%ReportedFiles, %File)
  #ENDFOR
#ELSE
  #FOR (%DictionaryReportFileSelection)
    #ADD (%ReportedFiles, %DictionaryReportFileSelection)
  #ENDFOR
#ENDIF
#DECLARE (%OutputFile)
#FOR (%ReportedFiles)
  #FIX (%File, %ReportedFiles)
  #SET (%OutputFile,%FILE&'.GRP')
  #MESSAGE('File Group Definition: ' & %OutputFile, 2)
  #CREATE (%OutputFile)
!BOF
!
! File:         %OutputFile
! Purpose:      Generated File Records as Groups
! Author:       GenerateRecords Template
! Narative:     This template is used to pass records structures
!               back and forth between DLL's when the files
!               are not shared. Since file definitions are not
!               available, data has to be passed in areas.
!
  #IF (%FileType = 'ALIAS')
! Name:         %File(An alias for %AliasFile)
  #ELSE
! Name:         %File
  #ENDIF
! Prefix:       %FilePrefix
  #IF (%FileDescription)
! Description:  %FileDescription
  #ENDIF
  #IF (%FileName)
! Filename:     %FileName
  #ENDIF
!
!-Keys-
  #SUSPEND
    #FOR (%Key)
! %[27]KeyID %|
      #FOR (%KeyField)
        #FIX (%Field, %KeyField)
        #IF (INSTANCE(%KeyField) = 1)
%FieldID(%KeyFieldSequence)
        #ELSE
!%[29]Null%FieldID(%KeyFieldSequence)
        #ENDIF
      #ENDFOR
    #ENDFOR
  #RESUME
!-Keys-
  #SUSPEND
    #SET(%TheKeyNo,0)
    #FOR (%Key)
      #FOR (%KeyField)
        #FIX (%Field, %KeyField)
        #IF (INSTANCE(%KeyField) = 1)
          #!SET(%TheKeyId,SUB(%KeyID,1,INSTRING('_',%KeyID,1,1)-1))
          #SET(%TheKeyId,'Key'&%TheKeyNo)
%FilePrefix:mKey:%KeyID GROUP,TYPE,BINDABLE,PRE(m%FilePrefix:%TheKeyId)
  %FieldStruct #




Printed December 3, 2024, 11:55 am
This article has been viewed/printed 35229 times.
Google search has resulted in 14 hits on this article since January 25, 2004.