ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

BASE64 question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • BASE64 question

    So I'm trying to use the APR_BASE64_H where I got from here : https://www.scottklement.com/archive.../msg00064.html
    I see it used lots of places as IBM provided it. However when I try to compile a basic program I get this in the spool QPJOBLOG
    "Binding directory BASE64 in library *LIBL not found. "
    What am I doing wrong? I even did this CRTBNDDIR BNDDIR(BASE64) and I still get an error saying Definition not found for symbol 'apr_base64_decode'.
    Its something simple probably... Any ideas?

    Thanks


  • #2
    Anyone

    Comment


    • #3
      Sorry, but... when you say you created the binding directory... did you actually put anything in the binding directory? Did what you put in it have the symbol? The error seems to say that it doesn't...

      Comment


      • #4
        First I stared off with your example and created all this. Copied all the programs over etc. Maybe I'm missing something here but I get the error on any of he base64 programs I'm trying to create.

        CRTRPGMOD BASE64R4 SRCFILE(xxx/QRPGLESRC) DBGVIEW(*LIST)
        CRTSRVPGM SRVPGM(BASE64R4) SRCFILE(xxx/QSRVSRC)
        CRTBNDDIR BNDDIR(BASE64)
        ADDBNDDIRE BNDDIR(BASE64) OBJ((BASE64R4 *SRVPGM))

        Comment


        • #5
          My QSRVSRC code

          STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('BASETEST V1.00 ')
          export symbol(apr_base64_encode)
          export symbol(apr_base64_decode)
          ENDPGMEXP

          did a CRTBNDDIR BNDDIR(BASETEST)
          then
          ADDBNDDIRE BNDDIR(BASEtest) OBJ((xxxx/BASETEST *SRVPGM))

          Then tried to compile "basetest"


          Comment


          • #6
            Hmmm... normally "apr" refers to the Apache Portable Runtime, which IBM provides part of with the OS. So in that case, you would not be creating your own service program and adding that service program to the binding directory -- you'd be putting IBM's service program that contains the apr_base64_encode/decode routines into the binding directory. I don't remember what that service program is off the top of my head, I haven't done base64 this way in many years, and would have to review.

            With regards to my BASE64R4 service program, that's a whole different animal. That service program will work fine, but in that case you don't call the APR routines, you call base64_encode and base64_decode.

            Comment


            • #7
              I keep getting this error when compiling IBM's version of stuff: "*SRVPGM object QZDMMDTA in library QSOC not found"
              When I do it your way I cannot get it to work either. I get these errors in the QPJOBLOG.
              Message . . . . : *SRVPGM object QZDMMDTA in library QSOC not found.
              Cause . . . . . : *SRVPGM object QZDMMDTA in library QSOC was specified in
              binding directory QUSAPIBD in library *LIBL, but was not found for binding.
              and
              Message . . . . : Definition not found for symbol 'BASE64_ENCODE'.
              Cause . . . . . : No definition was found for reference BASE64_ENCODE in
              *MODULE object BASE64TEST in library QTEMP. The definition either does not
              exist or is not of the same data or procedure type as the reference.

              The last one I assume is it cannot find the code in QSRVSRC "base64r4 type BND ). But I do have it there.

              Then my example code is:
              Hdftactgrp(*no) datfmt(*iso) BNDDIR('QC2LE')
              /copy BASE64_H
              D Input S 6a
              D Output S 8A

              /free

              input = x'61626b3735';
              Output = *blanks;

              base64_encode( %addr(Input)
              : %len(%trimr(Input))
              : %addr(Output)
              : %size(Output) );

              dsply Output;
              *inlr = *on;

              /end-free

              Comment


              • #8
                well i added the BNDDIR 'BASE64' and got it to compile. Now time to play

                Comment


                • #9
                  So I got my example to work. kind of slick I think.. Anyway. Now I put it in my main program I'm wanting to convert the string from base64 to an output field. I know what the data looks like if I decode it with a free online decoder.. But now I'm getting a "Unable to decode character at position 1. (Char=x'FF') " from program HTTPXMLR4. All I want to do is decode the string...lol
                  Ideas?

                  Comment


                  • #10
                    any ideas?

                    Comment


                    • #11
                      As the message says... x'FF' is not valid in a base64 encoded document. Something is not right, here...

                      Comment


                      • #12
                        I ended up scrapping the original and starting over with what I know. Then I got it to work just fine. So I think most of my problem was trying to many things at one time... Thanks for all your help.

                        Comment

                        Working...
                        X