[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Open a stream file with a specific CCSID



Hi folks,

 

How do I open a stream file with a specific CCSID?

 

From example9:

 

C* Open a stream file                                                

c                   eval      fd = open('/tmp/testwrite.pdf':        

c                                      O_WRONLY+O_TRUNC+O_CREAT: 511)

 

The IFSIO_H says that the needed flags are added together.

But how do I get CCSID=1281 when the constant is 32?

 

D*                                            Assign a CCSID    

D O_CCSID         C                   32                        

 

Here is what I am trying to do:

 

1. Put a pdf file to MQ:

I am using some part of HTTPAPI example8 to write a pdf file to a mq dataq.

 

C* Send PDF response message                                     

c                   eval      stmf = '/splf2pdf/polise/test.PDF' 

C* Find the size of the PDF file                                   

c                   exsr      GetStmfSiz                          

C* Create a User Space                                             

c                   exsr      CrtUsrSpc                          

C* Copy the PDF file to the User Space                               

c                   exsr      CopyToSpc                           

c                   Eval      Bufptr = p_data                    

C                   Eval      Buflen = st_size                   

C* Put the PDF file to MQ                                             

C                   EXSR      RSPOND                             

 

2. Get a pdf file from MQ:

I am using part of HTTPAPI example9 to write the PDF file to IFS.

SR WriteToIfs is a modified copy of save_to_disk.

C* Get the PDF file from MQ                                             

C                   EXSR      MQ_GET

c                   Eval      p_data  = Bufptr                    

C                   Eval      st_size = Buflen                  

c                   exsr      CrtUsrSpc

c                   exsr      CopyToSpc

c                   exsr      WriteToIfs

 

It all works fine, except the CCSID parmeter in the open().

 

Thanks to Scott Klement and the HTTPAPI I’ve been able to mqput and mqget a pdf file.

I haven’t seen a RPGLE example of MQPUT and MQGET with a pdf file before.  

If anyone is interested in this, just send me an e-mail.

 

Best regards,

Magne