Infoprint Mapping Object Exit Program to control name of PDF document stored on IFS

80 pts.
Tags:
IFS
InfoPrint Server
PDF
I am looking for an Infoprint exit program that will control the name of the PDF document on the IFS. I have used the Mapping Object to create PDF documents that are stored on the IFS. The names are generated by IBM using the job name ect. to create a unique name. I would like to control the name as I need the name to be same as the invoice name ex. inv_2009_00001.pdf or for a bill of lading ex. bol_2009_00001.pdf. There are tons of freeware out there from years ago - I have not been able to get any of it to put the AFPDS documents onto the IFS.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Like Chicken Little — I found the answer my self and answered myself.

PDF TO IFS DOCUMENTATION

Goal: Create PDF Invoices in the IFS as individual documents and name the PDF document that same name as the Invoice. Format YYYYMM-NNNNN.

RPGPGMA – created to accommodate the addition of the field PAGGRP and to write to the record HEAD2 before any other records in the DDS and to write the record ENDRPT as the last record in the DDS. This allows the system to know the beginning and the end of each Customer Invoice.

paggrp S 10
:
: (rpgle code here)
:
eval paggrp = hbol;
write header2;
:
: (rpgle code here)
:
write endrpt;

RPGDDSA – created to contain Start Page Group Command (STRPAGGRP) as First DDS Record and End Page Group Command (ENDPAGGRP) as the Last DDS Record. The field PAGGRP uses Type P to indicate a program-to-system field. PAGGRP is used by the system in the Mapping Exit Program.

A R HEADER2 STRPAGGRP(&PAGGRP)
A PAGGRP 10 P
: (DDS Code here)
A R ENDRPT ENDPAGGRP

SA408408RCA – created to accommodate the addition of &MAILTAG in USRDFNDTA.

CHGVAR VAR(&MAILTAG) VALUE(‘MAILTAG(‘ *TCAT &USER +
*TCAT ‘@LEMON.COM)’)

OVRPRTF FILE(SA407RPA) DEVTYPE(*AFPDS) OUTQ(PRT2IFS) +
SAVE(*YES) USRDTA(‘INVOICE’) +
USRDFNDTA(&MAILTAG)

Original PSFCFG Test Objects

PSFCFG
PRT2IFS

PSFCFG PRINT Device
PRT2IFS

PSFCFG OUTQ
PRT2IFS
Creation of PSFCFG PRTIFS

PSFCFG Mapping Exit Program
XMAPPGM21 – (first one working to put PDF to IFS)
XMAPPGM22 – (refining for email w/PDF attachment & to PDF to IFS)
Create PSFCFG Object

Command CRTPSFCFG to start create PSFCFG process.

This is where the PDF user program or the Mapping Exit program is input. The program must exist before you add it here also – if any changes are made to the PSFCFG the writer must be ended. After the changes are made – restart the printer.

Creation of PSFCFG Printer Device

Command CRTPRTDEV to start create PSFCFG Print Device process.

Mapping Exit Program

// Mapping Exit Program XMAPGM21
D COPYENCL C ‘QGPL/XMAPPGM6′
//
D INPUTDS DS
D JOBNAM 1 26
D SPLFID 27 36
D SPLNO 37 40B 0
D RTGTAG 41 290
D PDFFILE 291 630
D SVRTYPE 631 631
D RES1 632 632
D PATHCCSID 633 636B 0
D SENDER 637 646
D USRDTA 647 656
D SYSNAME 657 664
D TIMESTMP 665 672
D OUTQ 673 682
D OUTQLIB 683 692
D RES5 693 712
D FORMTYPE 713 722
//*********************************************
D OUTDS DS
D DISPOSTN 1
D CALLAGIN 1
D RES2 2
D MSGLEN 9B 0
D ADDRLEN 9B 0
D MSGTEXT 255
D RES3 1
D EXTOFF 9B 0
D CCSID 9B 0
D DSPPDFSTMF 1
D DSPPDFSPLF 1
D DSPPDFERR 1
D DSPAFPSPLF 1
D RES4 7
D ADDRESS 255
//
D EXTLEN 9B 0
D SUBOFF 9B 0
D SUBLEN 9B 0
D RPLYOFF 9B 0
D RPLYLEN 9B 0
D CCOFF 9B 0
D CCLEN 9B 0
D BCCOFF 9B 0
D BCCLEN 9B 0
D BDYPTHOFF 9B 0
D DIRPTHOFF 9B 0
D DIRPTHLEN 9B 0
D ATTPTHOFF 9B 0
D STMFNAMOFF 9B 0
D STMFNAMLEN 9B 0
D EATTNAMOFF 9B 0
D EATTNAMLEN 9B 0
D PUBAUTOFF 9B 0
D PUBAUTLEN 9B 0
D PDFSPLOFF 9B 0
D PDFSPLLEN 9B 0
D AFPSPLOFF 9B 0
D AFPSPLLEN 9B 0
D ENCRPTOFF 9B 0
D ENCRPTLEN 9B 0
//
D EXTSUBJ 80
D EXTRPLY 80
D EXTCC 80
D EXTBCC 80
//
D BDYLEN 9B 0
D BDYNUM 9B 0
D BDYX1 9B 0
D BDYY1 9B 0
D BDYOFF1 9B 0
D BDYPLEN1 9B 0
D BDYUSE1 1
D BDYRES1 3
D BDYPTH1 80
D BDYX2 9B 0
D BDYY2 9B 0
D BDYOFF2 9B 0
D BDYPLEN2 9B 0
D BDYUSE2 1
D BDYRES2 3
D BDYPTH2 80
D BDYX3 9B 0
D BDYY3 9B 0
D BDYOFF3 9B 0
D BDYPLEN3 9B 0
D BDYUSE3 1
D BDYRES3 3
D BDYPTH3 80
//
D ATTLEN 9B 0
D ATTNUMB 9B 0
D ATTX1 9B 0
D ATTY1 9B 0
D ATTOFF1 9B 0
D ATTPLEN1 9B 0
D ATTUSE1 1
D ATTRES1 3
D ATTPTH1 80
D ATTX2 9B 0
D ATTY2 9B 0
D ATTOFF2 9B 0
D ATTPLEN2 9B 0
D ATTUSE2 1
D ATTRES2 3
D ATTPTH2 80
D ATTX3 9B 0
D ATTY3 9B 0
D ATTOFF3 9B 0
D ATTPLEN3 9B 0
D ATTUSE3 1
D ATTRES3 3
D ATTPTH3 80
//
D DIRPTH 80
//
D PDFSTMFNAM 80
D PDFATTNAM 80
D PDFPUBAUT 10
//
D PDFOUTQ 10
D PDFOUTQLIB 10
D PDFSPLNAM 10
D PDFUSRDTA 10
D PDFUSRDFN 255
D PDFFORM 10
//
D AFPOUTQ 10
D AFPOUTQLIB 10
D AFPSPLNAM 10
D AFPUSRDTA 10
D AFPUSRDFN 255
D AFPFORM 10
//
D PDFMASTPW 32
D PDFUSRPW 32
D PDFPRT 1
D PDFDOCCHG 1
D PDFCOPY 1
D PDFENCLVL 1
D PDFCNTACC 1
D PDFCHGCMT 1
D PDFDOCASB 1
//
D INPUTLEN S 9B 0
D OUTPUTLEN S 9B 0
D OUTINFO S 9B 0
D PAGGRP S 10
D namelen s 4 0
D enname s 80
D ennam80 s 80
D holdnam s 80
D inv# s 10
//*********************************************
C *ENTRY PLIST
C PARM INPUTDS
C PARM INPUTLEN
C PARM OUTDS
C PARM OUTPUTLEN
C PARM OUTINFO
C

/FREE
outinfo = 2509;
if outinfo > outputlen;
return;
endif;
//
//
/end-free
C move *ALLx’00’ outds
//
/free
callagin = ‘0’;
res2 = X’0000′;
res3 = X’00′;
res4 = X’00000000000000′;
extoff = 542;
extlen = 100;
//
dirpthoff = 1578;
dirpthlen = 80;
dirpth = ‘/WWW/PDFDOCS/INVOICES/';
//
dsppdfstmf = ‘1’;
//
stmfnamoff = 1658;
/end-free
C movel rtgtag paggrp
/free
pdfstmfnam = pdffile;
holdnam = pdfstmfnam;
stmfnamlen = 80;
pubautoff = 1818;
pdfpubaut = ‘*RX';
pubautlen = %len(%trim(pdfpubaut));
//
clear inv#;
/end-free
C subst rtgtag inv#
//
/free
if holdnam <> *blank;
/end-free
C call copyencl
C parm inv#
C parm holdnam
/free
endif;
//
return;
/end-free

CL Used by Mapping Exit Program

PGM PARM(&CUSTNO &PDFIN)

DCL VAR(&PDFIN) TYPE(*CHAR) LEN(80)
DCL VAR(&TARGET) TYPE(*CHAR) LEN(80)
DCL VAR(&CUSTNO) TYPE(*CHAR) LEN(10)
DCL VAR(&LOOP) TYPE(*LGL) VALUE(‘1′)
DCL VAR(&TIMES) TYPE(*DEC) LEN(3 0) VALUE(1)

addlible taatool
MONMSG MSGID(CPF2103)

DLYJOB DLY(2)
CHKIFSE OBJ(&PDFIN) AUT(*ALL)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(SKIP))
DLYJOB DLY(5)
CHGAUT OBJ(&PDFIN) USER(*PUBLIC) DTAAUT(*RWX) +
OBJAUT(*ALL)

skip: CPY OBJ(&PDFIN) TODIR(‘/encrypted’)
MONMSG MSGID(CPFA09C CPFA0A0 CPFA0A9)

CHGVAR VAR(&TARGET) +
VALUE(‘/WWW/PDFDOCS/INVOICES/20′ *TCAT +
&CUSTNO *TCAT ‘.PDF’)
CPY OBJ(&PDFIN) TOOBJ(&TARGET)
MONMSG MSGID(CPFA09C CPFA0A0 CPFA0A0)

ENDPGM

K

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • andy68

    Hi, good workaround. I have a question, in which Library did you put the CL pgm calld from MAPPGM. In my case the CL pgm is not found in the LIBL.

    Thanks.

    20 pointsBadges:
    report
  • andy68
    I see, it is in QGPL. I will try it too. tx
    20 pointsBadges:
    report
  • TomLiotta
    It doesn't matter what library it's in as long as the library is specified and authorized. The library does not need to be in any library list. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following