User Tools

Site Tools


pub:idocsapi

This is an old revision of the document!


[ Up to Main Menu ]

Programming API's

iDocs has various methods to automatically print forms that are deposited in output queues. There are two different types of form overlay engines which are the processors that automatically search defined output queues for spooled files to merge with form applications or form sets. iDocs also provides api's that can be embedded into a job stream that executes the merge for defined print jobs. The simplest is TFPRT which is intended to be embedded in the job stream following the program that produced the spool file to be processed. With the more complex TRPRTAPI api, you can provide the necessary parameters to process any spool file on the system.

An iDocs merge can be invoked from the command line or from another program using either of two commands:

TFPRTAPI

or

TFPRT

TFPRTAPI

This is the main programming interface to an iDocs merge.

Prerequisites: iDocs library in the library list.

Printer File . . . . . . . . . .                 ( *SCS spool file to merge )
Job Name . . . . . . . . . . . .                 ( spool file job name )
User ID  . . . . . . . . . . . .                 ( spool file user name )
Job Number . . . . . . . . . . .                 ( spool file job number )
Spooled file number  . . . . . .                 ( spool file number )
Form Name  . . . . . . . . . . .                 ( iDocs form definition with which to do the iDocs merge )
Engine Name  . . . . . . . . . .   *FIRST        ( engine name to reference; *FIRST generally works )
Perform Archive/Delete? (Y/N)  .   Y             ( perform archive/delete of original splf )
Portrait? (Y/N)  . . . . . . . .   Y             ( is the output portrait or landscape yes / no )           
Font Sequence# . . . . . . . . .   011           ( generally leave this as is )
Destination Output queue . . . .                 ( output outqueue for merged spool file )
  Library  . . . . . . . . . . .     *LIBL       ( library containing destination outqueue )
Archive Output queue . . . . . .                 ( name of archive outqueue ( override engine specification ) if archiving )
  Library  . . . . . . . . . . .     *LIBL       ( library containing archive outqueue )
Number of copies . . . . . . . .   1             ( number of copies; overrides form )
Output Spooled File Name . . . .   *FILE         ( output spool file name )

TFPRT

This is a simpler version of TFPRTAPI that works on the last spool file created in the current job.

Printer File . . . . . . . . . .                 ( *SCS spool file to merge )
Form Name  . . . . . . . . . . .                 ( iDocs form definition with which to do the iDocs merge )
Engine Name  . . . . . . . . . .   *FIRST        ( engine name to reference; *FIRST generally works )
Perform Archive/Delete? (Y/N)  .   Y             ( perform archive/delete of original splf )
Portrait? (Y/N)  . . . . . . . .   Y             ( is the output portrait or landscape yes / no )           
Font Sequence# . . . . . . . . .   011           ( generally leave this as is )
Destination Output queue . . . .                 ( output outqueue for merged spool file )
  Library  . . . . . . . . . . .     *LIBL       ( library containing destination outqueue )
Archive Output queue . . . . . .                 ( name of archive outqueue ( override engine specification ) if archiving )
  Library  . . . . . . . . . . .     *LIBL       ( library containing archive outqueue )
Number of copies . . . . . . . .   1             ( number of copies; overrides form )
Output Spooled File Name . . . .   *FILE         ( output spool file name )

Following is an example of implementing the TFPRT command. It uses all eight parameters of the command: Printer File, Form name, Engine name, Perform archive delete, Page orientation, Font Sequence, Destination output queue, and Archive output queue. The parameter value for printer file, QSYSPRT contains the file name. Form name contains the defined form application APCHK. The engine parameter contains a value of *NONE since no engine will be use to determine the processing. Instead the processing of the spool file is all defined within the print immediate command itself.

TFPRT FILE(QSYSPRT) FORM(APCHK) ENGINE(*NONE) PERFORM(Y) PORT(Y) FONTSEQ(11) DESTOUTQ(PRT01) ARCHOUTQ(FMG/ARCHIVE)


UTILITIES

EHTM2CSV

Quick utility (added 6.99 1/11/2022) to convert HTML files into CSV file format. EHTM2CSV program and command; includes an updated IFDJAVA.JAR file.


                         Convert HTML to CSV (EHTM2CSV)                         
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 HTML file path . . . . . . . . . > '/home/anguyen/htm2csv/Order.htm'           
                                                                                
                                                                                
 CSV file path  . . . . . . . . . > '/home/anguyen/htm2csv/Order.csv'           
                                                                                
                                                                                
 Charset  . . . . . . . . . . . . > 'UTF-8'                                     
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  

Type command EHTM2CSV and prompt with F4
HTML file path: Enter the path to pick up the HTML File.
CSV file path: Enter the path to place the .csv file.
Charset: UTF-8 is default (F4 for options).
[Enter] to execute.


ESNDFILE

A new command ESNDFILE is introduced in iDocs 6.97 to send a file or folder from the IBM i to a SFTP server using Password authentication.

                     Send IFS File to SFTP server (ESNDFILE)                    
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 SFTP server  . . . . . . . . . .   'tdgtest.ocr-inc.com'                       
                                                                                
 Authentication User ID . . . . .   testID                                      
                                                                                
 Authentication Password  . . . .                                               
                                                                                
 Port . . . . . . . . . . . . . .   22            Number                        
 IFS Local Path . . . . . . . . .   '/home/anguyen/awtest.txt'                  
                                                                                
                                                                                
                                                                                
 Remote folder  . . . . . . . . .   '/QBND'                                     
                                                                                
                                                                                
                                                                                
 Overwrite  . . . . . . . . . . .   N             Y, N                          
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  

SFTP supports 2 methods of authentication:

  • SSH Key authentication
  • Password authentication

Our iBridge utility sends file using SSH Key and sends as a PDF file only

ESNDFILE sends file using Password authentication: the server will authenticate the client by the submitting username and password from client.

Parameters: SFTP server
Authentication User ID
Job name/User Name/ Job Number: job ID of input spool
Authentication Password
Port number
IFS local path
Remote folder
Overwrite (Y/N)

Result on SFTP Server:


ICOMDBMAP

To evoke the merge process of one, two, or three Database Mapped Form Application(s), and aggregate the output to a desired out queue or trigger Smart Routing settings. The ICOMDBMAP command can be used interactively or submitted into a job (SEE EXAMPLE BELOW). (Added iDOCS 8.0 05/10/2023)

                   Combine database map-File name (ICOMDBMAP)                   
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Main Application . . . . . . . .                 Name                          
 Second Application . . . . . . .   *NONE         Name *NONE                    
 Third Application  . . . . . . .                 NAME *NONE                    
 Output Queue . . . . . . . . . .                 Name                          
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  
                                                                                

Parameters:

MAINAPP = The first Form Application to be merged. This Form Application will determine the output for all the Form Applications being used if using Smart Routing settings.
SECONDAPP = The second Form Application to be merged. If not using a second Form Application, then use *NONE as the value.
THIRDAPP = The Third Form Application to be merged. If not using a second Form Application, then use *NONE as the value.
OUTQ = This will be the value for the destination of the output into an out queue or the triggering for Smart Routing by using *FORMDEF as the value.

Example:

                               Submit Job (SBMJOB)                              
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Command to run . . . . . . . . .   ICOMDBMAP MAINAPP(CYBERLTR) SECONDAPP(*NONE)
 THIRDAPP(*NONE) OUTQ(*FORMDEF)                                                 
                                                                                
                                                                                
                                                                                
                                                                                
                                                                     ...        
 Job name . . . . . . . . . . . .   ICOMDBTEST    Name, *JOBD                   
 Job description  . . . . . . . .   *USRPRF       Name, *USRPRF                 
   Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB          
 Job queue  . . . . . . . . . . .   FMGJOBQ       Name, *JOBD                   
   Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB          
 Job priority (on JOBQ) . . . . .   *JOBD         1-9, *JOBD                    
 Output priority (on OUTQ)  . . .   *JOBD         1-9, *JOBD                    
 Print device . . . . . . . . . .   *CURRENT      Name, *CURRENT, *USRPRF...    
                                                                                
                                                                        More... 
 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel      
 F13=How to use this display        F24=More keys                               
 


IFDUPSPLF

Quick utility to duplicate a SCS spool file and change the owner on the new file. Original and new owner must both reside in the System Directory. This command was named DUPSPLF initially but changed to IFDUPSPLF in version 6.83 to ensure that it’s unique on all customer systems.

                   Duplicate iSeries Spooled File (IFDUPSPLF)                  
                                                                               
 Type choices, press Enter.                                                    
                                                                               
 Spooled file . . . . . . . . . . > INV           Name                         
 Spooled file number  . . . . . . > 2             1-999999, *ONLY, *LAST       
 Job name . . . . . . . . . . . . > ANGUYENA      Name, *, *ALL                
   User Name  . . . . . . . . . . >   ANGUYEN     Name                         
   Job Number . . . . . . . . . . >   106730      000000-999999                
 Output Queue . . . . . . . . . .   QPRINT        Name                         
   Library  . . . . . . . . . . .     *LIBL       Name, *LIBL                  
 New SPLF user data . . . . . . .   *SAME         Character value, *SAME       
 New SPLF form type . . . . . . .   *SAME         Character value, *SAME       
 New SPLF name  . . . . . . . . .   *SAME         Name, *SAME                  
 New SPLF Owner . . . . . . . . . > OFERRER       Name, *SAME                  
 Hold new SPLF  . . . . . . . . .   *NO           *YES, *NO                    
 Page range:                                                                   
   Starting page  . . . . . . . .   1             Number                       
   Ending page  . . . . . . . . .   *END          Number, *END                 
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display   
 F24=More keys                                                                 

Parameters:

Spooled file: input spool file name
Spooled file number: input spool file number
Job name/User Name/ Job Number: job ID of input spool

Output Queue/Library: name and library of output queue
New SPLF user data: enter user data of output spool file (*SAME to retain the same attribute of input spool file)
New SPLF form type: enter form type of output spool file (*SAME to retain the same attribute of input spool file)
New SPLF name: enter spool file name of output spool file (*SAME to retain the same attribute of input spool file
Hold new SPLF: Hold the output spool file name
Page range: enter the range of pages of input spool file name

Example:

IFDUPSPLF FILE(INV) SPLNBR(2) JOB(106730/ANGUYEN/ANGUYENA) OWNER(OFERRER)


JOINSPLF

Quick utility (added 6.97 7/23/2021) to stitch together multiple spool files into one spool file (Combines multiple spool files). Here is how it works:

  1. Give the new spool file a name in the 'Output Spool Name' parameter.
  2. Assign the out queue to insert the newly combined spool file with the 'Output Queue' and 'Library' parameters.
  3. Then add the spool file information for the spool files that will be combined.
  4. Once evoked, the command will stitch together the spool files and write the new spool file to the destination out queue.

                      Join multiple spool files (JOINSPLF)                      
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Output Spool Name  . . . . . . . > JOINTEST01    Character value               
 Output Queue . . . . . . . . . . > OUT           Name                          
   Library  . . . . . . . . . . . >   IDOCS6      Name, *CURLIB                 
 Selected spool files:                                                          
   Spool file name  . . . . . . . > R43500        Name                          
   Spool file number  . . . . . . > 000008        1-999999, *ONLY, *LAST, *ANY  
   Job name . . . . . . . . . . . > OFDEMOADD     Name, *                       
     Job user . . . . . . . . . . >   OFERRER     Name                          
     Job number . . . . . . . . . >   184316      000000-999999                 
                + for more values                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  
                    Specify More Values for Parameter SPLF                      
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Selected spool files:                                                          
   Spool file name  . . . . . . . > R43500        Name                          
   Spool file number  . . . . . . > 000008        1-999999, *ONLY, *LAST, *ANY  
   Job name . . . . . . . . . . . > OFDEMOADD     Name, *                       
     Job user . . . . . . . . . . >   OFERRER     Name                          
     Job number . . . . . . . . . >   184316      000000-999999                 
                                                                                
   Spool file name  . . . . . . .   R43500        Name                          
   Spool file number  . . . . . .   000033        1-999999, *ONLY, *LAST, *ANY  
   Job name . . . . . . . . . . .   OFDEMOADD     Name, *                       
     Job user . . . . . . . . . .     OFERRER     Name                          
     Job number . . . . . . . . .     184316      000000-999999                 
                                                                                
                                                                                
                                                                                
                                                                                
                                                                        More... 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys 

PDFCOMBINE

Quick utility (added 6.99 2/03/2022*) has been created to combine multiple PDF files into one PDF file by specifying multiple PDF file paths into the command’s parameter (EXHIBIT A), or by specifying an IFS directory path in which all the PDF files in the folder will be combined in creation date order (EXHIBIT B).
* Down-level users can obtain this feature by downloading the following savefile: ftp://programmer@ftp.informdecisions.com/ftpRoot/CustomerFTP/iDocs/currentReleases/pdfcombine.zip
After uploading, see a save file PDFCOMBINE.SAVF and ifdjava.jar:

  • Put PDFCOMBINE.SAVF into QGPL and restore it, they will see a *CMD object and a *PGM object with same name PDFCOMBINE
  • Put ifdjava.jar into /QIBM/UserData/java400/ext or a folder in CLASSPATH


(EXHIBIT A)


                       Combine multiple PDFs (PDFCOMBINE)                       
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Input PDF files/Directory path   > '/iview/acmecopy/QSYSPRT2204390000.pdf'     
                                                                                
                                  > '/iview/acmecopy/QSYSPRT2204390001.pdf'     
                                                                                
                                  > '/iview/acmecopy/QSYSPRT2204390002.pdf'     
                                                                                
                                  > '/iview/acmecopy/QSYSPRT2204390003.pdf'     
                                                                                
                + for more values > '/iview/acmecopy/QSYSPRT2204390004.pdf'     
                                                                                
 Output to PDF file . . . . . . .   '/home/anguyen/pdfcombine.pdf               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  
(EXHIBIT B)
                       Combine multiple PDFs (PDFCOMBINE)                       
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Input PDF files/Directory path     '/iview/acmecopy'                           
                                                                                
                + for more values                                               
                                                                                
 Output to PDF file . . . . . . .   '/home/anguyen/pdfcombine.pdf'              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  
                                                                                

SETPDFPWD

Quick utility (added 6.99 8/23/2022) Apply password and security settings natively on the IBM i to already existing PDF Files on the IFS.

Type SETPDFPWD and prompt with F4 to view parameters:

                          Set PDF password (SETPDFPWD)                          
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Path to PDF file . . . . . . . .                                               
                                                                                
                                                                                
                                                                                
 User Password  . . . . . . . . .                                               
                                                                                
                                                                                
 Owner Password . . . . . . . . .                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  
Parameters:
Path to PDF file: This is the location where the PDF file is located on the IFS. It is also the location where the PDF file will be placed after being processed. The PDF file will retain the original file name.
'User Password:' This parameter will set the User Password.
'Owner Password:' This parameter will set the Owner Password.

How the command works:

User Password will restrict the PDF to be open with the User Password value and will restrict the PDF’s security.
Owner Password will restrict the PDF to be open with the Owner Password value and will NOT restrict the PDF’s security.
When both User Password and Owner Password are used both options will apply. See the example table below for the different configuration options and the expected results.
Example Table:

NOTE:
Need to install IFDJAVA.JAR file as of 08/12/2022
The SETPDFPWD API must be registered for use.

SPLCOMBINE

Quick utility (added 6.99 3/11/2022) has been created to combine all *SCS/*AFPDS spool files in an output queue.

                       Combine multiple splfs (SPLCOMBINE)                      
                                                                                
 Type choices, press Enter.                                                     
                                                                                
 Source Output Queue  . . . . . .                 Name                          
   Library  . . . . . . . . . . .     *LIBL       Name, *LIBL                   
 To Output Queue  . . . . . . . .                 Name                          
   Library  . . . . . . . . . . .     *LIBL       Name, *LIBL                   
 To SPLF user data  . . . . . . .                 Character value, *FIRST...    
 To SPLF form type  . . . . . . .                 Character value, *STD...      
 To SPLF name . . . . . . . . . .   *FIRST        Name, *FIRST, *LAST           
 To SPLF Owner  . . . . . . . . .   *CURRENT      Name, *CURRENT, *FIRST        
 Hold new SPLF  . . . . . . . . .   *NO           *YES, *NO                     
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                         Bottom 
 F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
 F24=More keys                                                                  

Source output queue: all SCS/​AFPDS in this output queue will be combined into a single spool file and outputted to 'To Output Queue' with the other spool attributes are specified in 'To' fields-

[ Up to Main Menu ]

pub/idocsapi.1683840161.txt.gz · Last modified: 2023/05/11 14:22 by kkramer