Home > Blockchain >  RPG iSeries Take PDF in byte[] from Java function and write it to IFS
RPG iSeries Take PDF in byte[] from Java function and write it to IFS

Time:10-18

I am preparing a program in RPGLE that will use Java function returning fancy PDF file. I want to take that PDF in RPGLE and create a PDF file on IFS.

For now the Java program returns the PDF in byte[] format. Than I take the byte [] as char in RPG and I try to create stream file out of it. But the PDF is damaged and I can't open it via Adobe Reader...

Below is the prototype of Java procedure and code creating stream file:

D GetPDF    PR    A ExtProc(*Java:'PDF':'get') Len(16773100)

   Dcl-S wkPDFTxt Char(16773100);

   wkPDFTxt = GetPDF();
   
   fd = open(filePath
            :O_CREAT   O_EXCL   O_WRONLY   O_CCSID   O_INHERITMODE
            :S_IRUSR
            :1208);
   write(fd:            
  • Related