You are here: DAL Examples > Preparing AFP print streams for IBM's OnDemand

Preparing AFP print streams for IBM's OnDemand

This example shows DAL scripting which you could use to format and configure an AFP print stream for storage using OnDemand. Keep in mind...

The FSISYS.INI or FSIUSER.INI files must specify the name of the DAL script in the OnDemandScript option:

< PrtType:AFP >
OnDemandScript =  ONDEMAND.DAL

The ONDEMAND.DAL script file should contain this information:

*    Make sure #loadlib is initialized
#loadlib =  #loadlib
* Load script into cache memory!
If (#loadlib = 0) Then
LoadLib('OnDmdLib')
End
#loadlib+= 1
* Execute script!
OnDemand( )
Return('FINISHED!')
 
OnDmdLib.DAL script library file
 
BeginSub OnDemand
 
* OnDemand Script is only valid for AFP print streams!
 
If (PrinterClass() != 'AFP') Then
        Return
End
 
* Example of reading GVM variables
* If (HaveGVM('Company') Then
*             company = GVM('Company')
* End
 
* Make sure #docnum is initialized
 
#docnum = #docnum
If (#docnum = 0) Then
        semi	= ';'
        colon 	= ':'
        acifinfo 	= 'ACIFINFO'
        docnum 	= 'DOCUMENT_NO'
        mvsfile	= 'MVS_FILENAME'
        expbprep 	= 'EXPBPREP'
        procdate 	= 'PROCESS_DATE'
        proctime 	= 'PROCESS_TIME'
        idxname 	= 'ACIF_INDEX_NAME'
        idxdata 	= 'ACIF_INDEX_DATA'
        recid 	= 'RECID=470'
        grpname 	= GroupName( )
        dapver 	= MajorVersion( ) & '.' & MinorVersion( )
        Print_It ('DAP Version is ' & dapver)
End
 
*   Add comment, ' ACIFINFO;DOCUMENT_NO:0000001'
 
#docnum += 1
AddComment (acifinfo & semi& docnum & colon & Format(#docnum,'n',9999999))
 
*   Add comment, 'MVS_FILENAME:PROD.EX.P.DCS.AFP.PREPOUT'
 
AddComment (mvsfile & colon & 'PROD.EX.P.DCS.AFP.PREPOUT')
 
*   Add comment, 'EXPBPREP;PROCESS_DATE:mm-dd-yyyy'
 
AddComment (expbprep & semi & procdate & colon & Date('1-4'))
 
*   Add comment, 'EXPBPREP;PROCESS_TIME:hh:mm:ss'
 
AddComment (expbprep & semi& proctime & colon & TIME())
 
* Add comment, 'RECID=470;ACIF_INDEX_NAME01;026;Correspondence Copy Number'
* Add comment, 'RECID=470;ACIF_INDEX_DATA01;009;840127920'
 
#idxnum = 1
fldname = 'Correspondance Copy Number'
flddata = '840127920'
AddComment (recid & semi& idxname & Format (#idxnum,'n',99) & semi & \
    Format (Len (fldname),'n',999) & semi & fldname)
AddComment (recid & semi& idxdata & Format (#idxnum,'n',99) & semi & \
    Format (Len (flddata),'n',999) & semi& flddata)
 
* Add Comment, 'RECID=470;ACIF_INDEX_NAME02;019;Correspondance Type'
* Add Comment, 'RECID=470;ACIF_INDEX_DATA02;025;Notice of Initial Reserve'
 
#idxnum += 1
fldname = 'Correspondance Type'
flddata = 'Notice of Initial Reserve'
AddComment (recid & semi& idxname & Format (#idxnum,'n',99) & semi&\
    Format (Len (fldname),'n',999) & semi& fldname)
AddComment (recid & semi& idxdata & Format (#idxnum,'n',99) & semi&\
    Format (Len (flddata),'n',999) & semi& flddata)
 
* Get DAP Field - 'INSURED NAME'
* Add Comment, 'recid=470;ACIF_INDEX_NAME03;012;INSURED NAME'
* Add Comment, 'recid=470;ACIF_INDEX_DATA03;008;John Doe'
 
If (HaveField('INSURED NAME',,,grpname)) Then
        #idxnum += 1
        fldname = 'INSURED NAME'
        flddata   = @(fldname,,,grpname)
        AddComment (recid & semi& idxname & Format (#idxnum,'n',99) & semi&\
                Format (Len (fldname),'n',999) & semi & fldname)
        AddComment(recid & semi& idxdata & Format (#idxnum,'n',99) & semi&\
                Format (Len (flddata),'n',999) & semi & flddata)
End
 
Return
EndSub