Using DAL to Output to a Database Table


Here is an example of the DDL statements you could use to create a database table for use by Documaker Server and Documaker Connector. Documaker DAL writes to this table and Documaker Connector reads the records to determine which incoming documents to process.

Note: Below is shown a typical example. For information on the minimum requirements, see Minimum DAL Output Database Table.

CREATE TABLE "ORACLE"."AOR" (

"JOBID" VARCHAR2(50) NOT NULL,

"TRANID" VARCHAR2(50) NOT NULL,

"BATCHID" VARCHAR2(50) NOT NULL,

"DOCID" VARCHAR2(50) NOT NULL,

"NAME" VARCHAR2(30),

"TYPE" VARCHAR2(30),

"TITLE" VARCHAR2(255),

"AUTHOR" VARCHAR2(50),

"SECGROUP" VARCHAR2(30),

"CABINET" VARCHAR2(30),

"PFILE" VARCHAR2(255),

"STATUSCD" INTEGER DEFAULT 0 NOT NULL,

"STARTTIME" TIMESTAMP,

"ENDTIME" TIMESTAMP,

"RESULTDESC" VARCHAR2(2000),

"RETENTION" TIMESTAMP,

"CATEGORY" VARCHAR2(30),

"KEY1" VARCHAR2(100),

"KEY2" VARCHAR2(100),

"KEYID" VARCHAR2(100),

"TRANCODE" VARCHAR2(30),

"RUNDATE" TIMESTAMP,

"CURRUSER" VARCHAR2(30),

"AGENCYID" VARCHAR2(30),

"EFFDATE" TIMESTAMP,

"EXPDATE" TIMESTAMP,

"CUSTID" VARCHAR2(30),

"POLNUM" VARCHAR2(100),

"INSFNAME" VARCHAR2(30),

"INSLNAME" VARCHAR2(30),

"INSADD1" VARCHAR2(30),

"INSADD2" VARCHAR2(30),

"INSCITY" VARCHAR2(30),

"INSSTATE" VARCHAR2(5),

"INSZIP" VARCHAR2(30),

"INSPHONE" VARCHAR2(30),

"INSDOB" DATE,

"INDEX01" VARCHAR2(30), "INDEX02" VARCHAR2(30), "INDEX03" VARCHAR2(30),

"INDEX04" VARCHAR2(30), "INDEX05" VARCHAR2(30), "INDEX06" VARCHAR2(30),

"INDEX07" VARCHAR2(30), "INDEX08" VARCHAR2(30), "INDEX09" VARCHAR2(30),

"INDEX10" VARCHAR2(30), "INDEX11" VARCHAR2(30), "INDEX12" VARCHAR2(30),

PRIMARY KEY ("JOBID", "TRANID", "BATCHID", "DOCID") VALIDATE);

CREATE INDEX "ORACLE"."AORIDX1" ON "ORACLE"."AOR" ("DOCID");

Example DFD File (AOR.DFD)

This DFD (Data Format Definition) file describes the database table schema to Documaker. In this example, with a database table called AOR, this file is called AOR.DFD and is used to define the interface between Documaker and the data table AOR in the Oracle database used for storage of the extract data.

The DFD file is used in the DAL script where you will see references to AOR in the DBAdd, DBOpen, and DBPrepare function calls. This file is loaded via DBOpen so Documaker knows what columns are available. Documaker also uses that information to insert the row in the AOR table.

In the example, this file is in the deflib subdirectory, per the call in the DAL script:

DBOPEN(AOR_TableName, "ODBC", ".\deflib\aor.dfd", "READ&WRITE&CREATE_IF_NEW")

Here is an example of the AOR.DFD file:

<Fields>

FieldName = JOBID

FieldName = TRANID

FieldName = BATCHID

FieldName = DOCID

FieldName = NAME

FieldName = TYPE

FieldName = TITLE

FieldName = AUTHOR

FieldName = SECGROUP

FieldName = PFILE

FieldName = CATEGORY

FieldName = CABINET

FieldName = STATUSCD

FieldName = KEY1

FieldName = KEY2

FieldName = KEYID

FieldName = TRANCODE

FieldName = RUNDATE

FieldName = CURRUSER

FieldName = AGENCYID

FieldName = EFFDATE

FieldName = EXPDATE

FieldName = INSFNAME

FieldName = INSLNAME

FieldName = INSADD1

FieldName = INSADD2

FieldName = INSCITY

FieldName = INSSTATE

FieldName = INSZIP

FieldName = INSPHONE

FieldName = INSDOB

FieldName = INDEX01

FieldName = INDEX02

FieldName = INDEX03

FieldName = INDEX04

FieldName = INDEX05

FieldName = INDEX06

FieldName = INDEX07

FieldName = INDEX08

FieldName = INDEX09

FieldName = INDEX10

FieldName = INDEX11

FieldName = INDEX12

< Field:JOBID >

Int_Type = CHAR_ARRAY

Int_Length = 47

Ext_Type = CHAR_ARRAY

Ext_Length = 47

Key = Y

Required = Y

< Field:TRANID >

Int_Type = CHAR_ARRAY

Int_Length = 47

Ext_Type = CHAR_ARRAY

Ext_Length = 47

Key = Y

Required = Y

< Field:BATCHID >

Int_Type = CHAR_ARRAY

Int_Length = 47

Ext_Type = CHAR_ARRAY

Ext_Length = 47

Key = Y

Required = Y

< Field:DOCID >

Int_Type = CHAR_ARRAY

Int_Length = 47

Ext_Type = CHAR_ARRAY

Ext_Length = 47

Key = Y

Required = Y

< Field:NAME >

Int_Type = CHAR_ARRAY

Int_Length = 47

Ext_Type = CHAR_ARRAY

Ext_Length = 47

Key = N

Required = Y

< Field:TYPE >

Int_Type = CHAR_ARRAY

Int_Length = 10

Ext_Type = CHAR_ARRAY

Ext_Length = 10

Key = N

Required = Y

< Field:TITLE >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = Y

< Field:AUTHOR >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = Y

< Field:SECGROUP >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = Y

< Field:PFILE >

Int_Type = CHAR_ARRAY

Int_Length = 255

Ext_Type = CHAR_ARRAY

Ext_Length = 255

Key = N

Required = Y

< Field:CATEGORY >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:CABINET >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:STATUSCD >

Int_Type = LONG

Int_Length = 1

Ext_Type = LONG

Ext_Length = 1

Key = N

Required = Y

< Field:KEY1 >

Int_Type = CHAR_ARRAY

Int_Length = 100

Ext_Type = CHAR_ARRAY

Ext_Length = 100

Key = N

Required = N

< Field:KEY2 >

Int_Type = CHAR_ARRAY

Int_Length = 100

Ext_Type = CHAR_ARRAY

Ext_Length = 100

Key = N

Required = N

< Field:KEYID >

Int_Type = CHAR_ARRAY

Int_Length = 100

Ext_Type = CHAR_ARRAY

Ext_Length = 100

Key = N

Required = N

< Field:TRANCODE >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:RUNDATE >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:CURRUSER >

Int_Type = CHAR_ARRAY

Int_Length = 100

Ext_Type = CHAR_ARRAY

Ext_Length = 100

Key = N

Required = N

< Field:AGENCYID>

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:EFFDATE >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:EXPDATE >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

< Field:CUSTID >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:POLNUM >

Int_Type = CHAR_ARRAY

Int_Length = 100

Ext_Type = CHAR_ARRAY

Ext_Length = 100

Key = N

Required = N

< Field:INSFNAME >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INSLNAME >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INSADD1 >

Int_Type = CHAR_ARRAY

Int_Length = 100

Ext_Type = CHAR_ARRAY

Ext_Length = 100

Key = N

Required = N

< Field:INSADD2 >

Int_Type = CHAR_ARRAY

Int_Length = 100

Ext_Type = CHAR_ARRAY

Ext_Length = 100

Key = N

Required = N

< Field:INSCITY >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INSSTATE >

Int_Type = CHAR_ARRAY

Int_Length = 3

Ext_Type = CHAR_ARRAY

Ext_Length = 3

Key = N

Required = N

< Field:INSZIP >

Int_Type = CHAR_ARRAY

Int_Length = 11

Ext_Type = CHAR_ARRAY

Ext_Length = 11

Key = N

Required = N

< Field:INSPHONE >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INSDOB >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:WIPREASON >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INDEX01 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INDEX02 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INDEX03 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INDEX04 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = N

Required = N

< Field:INDEX05 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Field:INDEX06 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Field:INDEX07 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Field:INDEX08 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Field:INDEX09 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Field:INDEX10 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Field:INDEX11 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Field:INDEX12 >

Int_Type = CHAR_ARRAY

Int_Length = 30

Ext_Type = CHAR_ARRAY

Ext_Length = 30

Key = No

Required = No

< Keys >

KeyName = BATCH

KeyName = DOCID

< Key:BATCH >

Expression = JOBID+TRANID+BATCHID

FieldList = JOBID,TRANID,BATCHID

< Key:DOCID >

Expression = DOCID

FieldList = DOCID

Example DAL Scripts

These scripts are referenced in the DAL configuration of the Documaker INI file. This configuration was described earlier, but is presented here for reference:

; Enable the Banner and Transaction DAL Scripting

< Printer >

; Must generally enable banner processing for it to work.

EnableBatchBanner = Yes

EnableTransBanner = Yes

PrtType = PDF

< Batch6 >

EnableBatchBanner = Yes

EnableTransBanner = Yes

BatchBannerBeginScript = AOR_PREB

BatchBannerEndScript = AOR_POSTB

TransBannerBeginScript = AOR_PRET

TransBannerEndScript = AOR_POSTT

Printer = Printer6

In the example presented earlier, they are called during processing of the Batch6 grouping. The code for the routines is shown below, with the main entry points listed above shown below in the order they are called. The TransBanner routines are called repeatedly for each transaction that is part of the batch, before the final call to BatchBannerEndScript.

BatchBannerBeginScript = AOR_PREB

TransBannerBeginScript = AOR_PRET

TransBannerEndScript  = AOR_POSTT

BatchBannerEndScript   = AOR_POSTB

BatchBannerBeginScript = AOR_PREB

BEGINSUB AOR_PREB

* ------------------------------------------------------

* Begin batch

* Clear variables once per recipient batch

* ------------------------------------------------------

#AOR_Debug=GETINIBOOL(,PRINTERID(),"AORDebug")

IF #AOR_Debug

RPLogMsg(NL() & " ** AOR_PREB:" & NL() )

END

AOR_RecipBatch = AOR_RecipBatch

#AOR_BatchCount = #AOR_BatchCount

#AOR_Processed = #AOR_Processed

#AOR_Count = #AOR_Count

AOR_TableName = AOR_TableName

#AOR_Init = #AOR_Init

IF AOR_RecipBatch != RECIPBATCH()

PUTINIBOOL(,"RunMode","CheckNextRecip",0)

#AOR_PerBatch = GETINISTRING(,PRINTERID(),"AORFilesPerBatch","999")

AOR_RecipBATCH = RECIPBATCH()

#AOR_SubBatch = 0

#AOR_Count = 0

#AOR_BatchCount = 0

END

AOR_BatchID = RECIPBATCH()

IF #AOR_Init = 0

AOR_JobID = UNIQUESTRING()

AOR_TableName = GETINISTRING(,PRINTERID(),"AORTable","AOR")

DBOPEN(AOR_TableName,"ODBC",".\deflib\aor.dfd", "READ&WRITE&CREATE_IF_NEW")

DBPREPVARS(AOR_TableName,"AORTABLERecord")

END

#AOR_Init = 1

#AOR_DoEOB = 1

ENDSUB

TransBannerBeginScript = AOR_PRET

BEGINSUB AOR_PRET

* ------------------------------------------------------

* Begin Transaction

* Set up new file name for recipient batch output file

* ------------------------------------------------------

IF #AOR_Debug

RPLogMsg(NL() & " ** AOR_PRET:" & NL() )

END

AOR_BatchID = AOR_BatchID

AOR_BatchDir = AOR_BatchDir

#AOR_Batch = #AOR_Batch

#AOR_Count = #AOR_Count

#AOR_PerBatch = #AOR_PerBatch

#AOR_Processed = #AOR_Processed

AOR_TransID = GVM("KEY1") & "-" & GVM("KEY2") & "-" & \

GVM("KEYID") & "-" & GVM("TRANCODE")

#AOR_Count += 1

IF (#AOR_Count > #AOR_PerBatch)

#AOR_Count -=1

CALL("AOR_EOB")

#AOR_Count = 1

END

TranFile = CALL("AOR_NEWFILE")

#AOR_Exists = PATHEXIST(AOR_BatchDir)

IF #AOR_Exists = 0

PATHCREATE(AOR_BatchDir)

#AOR_Exists = PATHEXIST(AOR_BatchDir)

IF #AOR_Exists = 0

RPErrorMsg(NL() & "** AOR batch directory " & \

AOR_Batchdir & "does not exist!")

END

END

#AOR_DoEOB = 0

SETDEVICENAME(TranFile)

BREAKBATCH()

ENDSUB

TransBannerEndScript = AOR_POSTT

BEGINSUB AOR_POSTT

* ------------------------------------------------------

* End Transaction

* Insert new table row with metadata for archive

* from GVM variables and reference to uniquely named

* recipient print stream output.

* ------------------------------------------------------

IF #AOR_Debug

RPLogMsg(NL() & " ** AOR_POSTT:" & NL() )

END

#AOR_PerBatch = #AOR_PerBatch

AOR_BatchDir = AOR_BatchDir

#AOR_Count = #AOR_Count

#AOR_Debug = GETINIBOOL(,PRINTERID(),"AORDebug")

AOR_TableName = AOR_TableName

AOR_BatchID = AOR_BatchID

AOR_TransID = AOR_TransID

AOR_JobID = AOR_JobID

*

* Change to match variables defined in "rcbdfdfl.dfd"

* as needed for the implementation

*

* Documaker Connector job processing fields example for UCM

AORTABLERecord.JOBID = AOR_JobID

AORTABLERecord.BATCHID = AOR_BatchID

AORTABLERecord.TRANID = AOR_TransID

AORTABLERecord.DOCID = AOR_FName

* TITLE required field by UCM 30 characters max, shows up in search results

AORTABLERecord.TITLE = AOR_TransID

* ContentID/Name assigment

AORTABLERecord.STATUSCD = 0

* Documaker UCMImporter required field for specifying full name of

* file to import

AORTABLERecord.PFILE = DEVICENAME()

* UCM required field has to exist in UCM pick list for types or

* will fail to import

IF HAVEGVM("DOCTYPE")

AORTABLERecord.TYPE = GVM("DOCTYPE")

END

* UCM required field

IF HAVEGVM("AUTHOR")

AORTABLERecord.AUTHOR = GVM("AUTHOR")

END

* UCM required field has to exist in UCM pick list for security groups or will

* fail to import

IF HAVEGVM("SECGROUP")

AORTABLERecord.SECGROUP = GVM("SECGROUP")

END

* UCM mapped custom meta-data, if doesn't exist as same exact name in UCM custom

* fields it will not map but will not error. If UCM custom field was set as

* required and no data is mapped UCM will fail transaction.

* Truncates by default to the max

* length of UCM data type.

IF HAVEGVM("CABINET")

AORTABLERecord.CABINET = GVM("CABINET")

END

IF HAVEGVM("KEY1")

AORTABLERecord.KEY1 = GVM("KEY1")

END

IF HAVEGVM("KEY2")

AORTABLERecord.KEY2 = GVM("KEY2")

END

IF HAVEGVM("KEYID")

AORTABLERecord.KEYID = GVM("KEYID")

END

IF HAVEGVM("TRANCODE")

AORTABLERecord.TRANCODE = GVM("TRANCODE")

END

IF HAVEGVM("RUNDATE")

AORTABLERecord.RUNDATE = GVM("RUNDATE")

END

IF HAVEGVM("CURRUSER")

AORTABLERecord.CURRUSER = GVM("CURRUSER")

END

IF HAVEGVM("AGENCYID")

AORTABLERecord.AGENCYID = GVM("AGENCYID")

END

IF HAVEGVM("EFFDATE")

AORTABLERecord.EFFDATE = GVM("EFFDATE")

AORTABLERecord.TITLE = AOR_TransID & "-" & GVM("EFFDATE")

END

IF HAVEGVM("EXPDATE")

AORTABLERecord.EXPDATE = GVM("EXPDATE")

END

IF HAVEGVM("CUSTID")

AORTABLERecord.CUSTID = GVM("CUSTID")

END

IF HAVEGVM("POLNUM")

AORTABLERecord.POLNUM = GVM("POLNUM")

END

IF HAVEGVM("INSFNAME")

AORTABLERecord.INSFNAME = GVM("INSFNAME")

END

IF HAVEGVM("INSLNAME")

AORTABLERecord.INSLNAME = GVM("INSLNAME")

END

IF HAVEGVM("INSADD1")

AORTABLERecord.INSADD1 = GVM("INSADD1")

END

IF HAVEGVM("INSADD2")

AORTABLERecord.INSADD2 = GVM("INSADD2")

END

IF HAVEGVM("INSCITY")

AORTABLERecord.INSCITY = GVM("INSCITY")

END

IF HAVEGVM("INSSTATE")

AORTABLERecord.INSSTATE = GVM("INSSTATE")

END

IF HAVEGVM("INSZIP")

AORTABLERecord.INSZIP = GVM("INSZIP")

END

IF HAVEGVM("INSPHONE")

AORTABLERecord.INSPHONE = GVM("INSPHONE")

END

IF HAVEGVM("INSDOB")

AORTABLERecord.INSDOB = GVM("INSDOB")

END

IF HAVEGVM("INDEX01")

AORTABLERecord.INDEX01 = GVM("INDEX01")

END

IF HAVEGVM("INDEX02")

AORTABLERecord.INDEX02 = GVM("INDEX02")

END

IF HAVEGVM("INDEX03")

AORTABLERecord.INDEX03 = GVM("INDEX03")

END

IF HAVEGVM("INDEX04")

AORTABLERecord.INDEX04 = GVM("INDEX04")

END

IF HAVEGVM("INDEX05")

AORTABLERecord.INDEX05 = GVM("INDEX05")

END

IF HAVEGVM("INDEX06")

AORTABLERecord.INDEX06 = GVM("INDEX06")

END

IF HAVEGVM("INDEX07")

AORTABLERecord.INDEX07 = GVM("INDEX07")

END

IF HAVEGVM("INDEX08")

AORTABLERecord.INDEX08 = GVM("INDEX08")

END

IF HAVEGVM("INDEX09")

AORTABLERecord.INDEX09 = GVM("INDEX09")

END

IF HAVEGVM("INDEX10")

AORTABLERecord.INDEX10 = GVM("INDEX10")

END

IF HAVEGVM("INDEX11")

AORTABLERecord.INDEX11 = GVM("INDEX11")

END

IF HAVEGVM("INDEX12")

AORTABLERecord.INDEX12 = GVM("INDEX12")

END

#Rtn = DBADD(AOR_TableName,"AORTABLERecord")

ENDSUB

BatchBannerEndScript = AOR_POSTB

BEGINSUB AOR_POSTB

* ------------------------------------------------------

* End Batch

* Any necessary clean-up.

* ------------------------------------------------------

IF #AOR_Debug

RPLogMsg(NL() & " ** AOR_POSTB:" & NL() )

END

 

#AOR_Debug = GETINIBOOL(,PRINTERID(),"AORDebug")

#AOR_Processed = #AOR_Processed

#AOR_Count = #AOR_Count

#AOR_PerBatch = #AOR_PerBatch

AOR_BatchDir = AOR_BatchDir

AOR_TableName = AOR_TableName

 

IF (#AOR_DoEOB = 1 AND #AOR_Count > 0)

DBCLOSE(AOR_TableName)

CALL("AOR_EOB")

#AOR_Count = 0

END

ENDSUB

Internal Routine: AOR_NEWFILE

BEGINSUB AOR_NEWFILE

* ------------------------------------------------------

* Create a new output file name.

* Called by Pre-Transaction DAL script.

* ------------------------------------------------------

IF #AOR_Debug

RPLogMsg(NL() & " ** AOR_NEWFILE:" & NL() )

END

AOR_Ext = GETINISTRING(,PRINTERID(), "AORExt", ".pdf")

AOR_BatchDir = AOR_BatchDir

CALL("AOR_NEWPATH")

AOR_Drive = FILEDRIVE( AOR_BatchDir )

AOR_Path = FILEPATH( AOR_BatchDir )

AOR_Last = FILENAME( AOR_BatchDir )

AOR_FName = UNIQUESTRING()

AOR_NewFName=FULLFILENAME( AOR_Drive,AOR_Path & AOR_Last,AOR_FName,AOR_Ext)

RETURN( AOR_NewFName )

ENDSUB

Internal Routine: AOR_NEWPATH

BEGINSUB AOR_NEWPATH

* ------------------------------------------------------

* Create a new output folder.

* Called by AOR_NEWFILE DAL script.

* ------------------------------------------------------

IF #AOR_Debug

RPLogMsg(NL() & " ** AOR_NEWPATH:" & NL() )

END

#AOR_BatchCount = #AOR_BatchCount

AOR_BatchID = AOR_BatchID

AOR_BatchDir = AOR_BatchDir

#AOR_Count = #AOR_Count

AORPath = GETINISTRING(,PRINTERID(),"AORPath")

AOR_Drive = FILEDRIVE( AORPath )

AOR_Path = FILEPATH( AORPath )

AOR_Last = FILENAME( AORPath )

AOR_Rootdir = FULLFILENAME( AOR_Drive, AOR_Path, AOR_Last, "")

IF #AOR_Count = 1

#AOR_BatchCount += 1

AOR_Drive = FILEDRIVE(AOR_RootDir)

AOR_Path = FILEPATH(AOR_RootDir)

AOR_Last = FILENAME(AOR_RootDir)

AOR_BatchDir = FULLFILENAME(AOR_Drive,AOR_Path & AOR_Last,AOR_JobID,"")

AOR_Drive = FILEDRIVE(AOR_BatchDir)

AOR_Path = FILEPATH(AOR_BatchDir)

AOR_Last = FILENAME(AOR_BatchDir)

AOR_BatchDir = FULLFILENAME(AOR_Drive,AOR_Path&AOR_Last,AOR_BatchID&"x"&#AOR BatchCount,"")

END

ENDSUB

Internal Routine: AOR_EOB

BEGINSUB AOR_EOB

* ------------------------------------------------------

* Create transact.dat file listing the contents of

* each batch folder created with count of output files,

* maximum output files per batch folder, statistical

* information. Existence of this file is indicates a

* batch folder has been completed and is used by the

* Documaker Connector source for housekeeping functions.

* Called by Post Batch DAL script.

* ------------------------------------------------------

IF #AOR_Debug

RPLogMsg(NL() & " ** AOR_EOB:" & NL() )

END

#AOR_PerBatch = #AOR_PerBatch

#AOR_Count = #AOR_Count

AOR_BatchDir = AOR_BatchDir

AORRootDir = AORRootDir

IF #AOR_DoEOB = 1

AOR_LogFile = FULLFILENAME(,AOR_BatchDir,"transact",".dat")

DBOPEN(AOR_LogFile,"ASCII",".\deflib\aort.dfd", \

"READ&WRITE&TRUNCATE&CREATE_IF_NEW")

DBPREPVARS(AOR_LogFile,"AOREOTRecord")

AOREOTRecord.Record = FILENAME(AOR_BatchDir) & " " & \

#AOR_PerBatch & " " & \

#AOR_Count

DBADD(AOR_LogFile,"AOREOTRecord")

DBCLOSE(AOR_LogFile)

END

ENDSUB