× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I don't know what I did, but I'm getting something in BinaryImage now. I
successfully taken it and written to the IFS as a GIF. It's all working
now.

Thank you for your help Mark.

I used this site to help resolve the issue.

https://www.ibm.com/developerworks/community/forums/html/topic?id=082ed87d-3407-4ee8-bb2c-5d5556a9a14d

Still using the APR base64 api still instead of the one used on that
webpage.

On Fri, Jan 8, 2016 at 1:45 PM, Michael Schutte <mschutte369@xxxxxxxxx>
wrote:

So I changed to this...

Apr_Base64_Decode_Binary(BinaryImage:LabelImage);

Still nothing in the binaryimage.

I've been trying to follow this web page for some more help.

http://www.scottklement.com/archives/ftpapi/201309/msg00094.html

It appears that their issue was more with the webservice and encoding the
special characters. Once they fixed that issue, the program to test was
apparently working.

On Fri, Jan 8, 2016 at 1:35 PM, Mark Murphy/STAR BASE Consulting Inc. <
mmurphy@xxxxxxxxxxxxxxx> wrote:

I am at v7r1 as well. I believe free form d-specs cam out somewhere
around TR6.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Michael Schutte <mschutte369@xxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i (AS/400 and iSeries)" <
rpg400-l@xxxxxxxxxxxx>
From: Michael Schutte <mschutte369@xxxxxxxxx>
Date: 01/08/2016 01:30PM
Subject: Re: BASE64 Encoded Character String to IFS.


We are not to that level yet. Still on V7R1.


On Fri, Jan 8, 2016 at 1:29 PM, Michael Schutte <mschutte369@xxxxxxxxx>
wrote:

We haven't started with the free D-SPECS yet. But how does that differ
than what I have setup. It looks the same to me.

I'll give it try though.

On Fri, Jan 8, 2016 at 12:59 PM, Mark Murphy/STAR BASE Consulting Inc. <
mmurphy@xxxxxxxxxxxxxxx> wrote:

I would expect the prototype to look like:

dcl-pr Apr_Base64_Decode_Binary Int(10)
ExtProc('apr_base64_decode_binary');
plain_dst Char(65535) Options(*Varsize);
coded_src Pointer Value Options(*String);
end-pr;

Then call it with:

length = Apr_Base64_Decode_Binary(BinaryImage: LabelImage);
BinaryImage = %subst(BinaryImage: 1: length);

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----"Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx>
wrote: -----
To: "RPG programming on the IBM i \(AS/400 and iSeries\)" <
rpg400-l@xxxxxxxxxxxx>
From: "Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx

Date: 01/08/2016 12:39PM
Subject: Re: BASE64 Encoded Character String to IFS.


What does the prototype for Apr_Base64_Decode_Binary look like?

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Michael Schutte <mschutte369@xxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i (AS/400 and iSeries)" <
rpg400-l@xxxxxxxxxxxx>
From: Michael Schutte <mschutte369@xxxxxxxxx>
Date: 01/08/2016 12:22PM
Subject: Re: BASE64 Encoded Character String to IFS.


Thank you,

So I've moved from Base64_decode and moved to Apr_Base64_Decode_Binary

In the first email, I mistaken the first parameter as the IFS
destination.
It's in fact, a return value. So I've changed my program to...


rc = Apr_Base64_Decode_Binary(binaryImage:%Addr(LabelImage));

BinaryImage is a field length of 65535
and LabelImage is 65535 varying.


Again, it appears to run without crashing, but I get nothing back in
the
binary image. When in debug, would I?

On Fri, Jan 8, 2016 at 12:12 PM, Mark Murphy/STAR BASE Consulting Inc.
<
mmurphy@xxxxxxxxxxxxxxx> wrote:

The reason you needed the +2 on the %addr() of a varying length
character
variable, is that %addr() points at the first byte of the memory
space
the
variable occupies. The first two bytes of that space is the length of
the
value. Depending on the max length of the variable, it could be 4
bytes, so
using %ADDR(varying-length variable : *DATA) is better if you have a
version of the compiler that supports it.

Since you are using %addr(binaryImage) + 2 for what I am assuming is
the
output variable, you probably are not setting the length of that
variable
length field, so the program thinks it is 0 even if you put something
there. Variable length strings operate quickly because the computer
ignores
anything out past the length (stored in the first 2 or 4 bytes of the
variable's memory space). You can put stuff there by using a pointer
to
address it, but if the length portion is 0, the variable is empty.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Michael Schutte <mschutte369@xxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i / System i" <RPG400-L@xxxxxxxxxxxx

From: Michael Schutte <mschutte369@xxxxxxxxx>
Date: 01/08/2016 11:37AM
Subject: BASE64 Encoded Character String to IFS.


I'm back to this project. A few years ago, I requested information.
The
information provided was great at the time, however we were able to
get
the
USPS to send back the tracking number and just barcode it on our own
label. So taking an image and printing it on the printer was no
longer
needed.

Now the account wants to change to UPS. UPS requires us to print
their
label. I have to believe that someone has this working.

So here's what I have so far. FYI, the type of image is GIF. I know
this
for certain this time. The XML document told me so. :-)

Originally...

D LABELIMAGE S 65535 VARYING
D binaryImage S 65535 VARYING

After getting the encoded Base64 string from an XML document. I ran
this
code.
base64_decode(%addr(LabelImage)
:%Len(LabelImage)
:%addr(binaryImage)
:%size(binaryImage));

But this was failing saying that it couldn't decode x'9F'. I
remembered
back to my days using WrtNoSection in CGIDEV2 that we had to add 2 to
the
%Addr. I never understood why but I changed the code like so.

base64_decode(%addr(LabelImage) + 2
:%Len(LabelImage)
:%addr(binaryImage) + 2
:%size(binaryImage));

This time base64_decode didn't crash however, it appears that binary
image
was empty in debug.

I was thinking that maybe it appeared that way because it was binary.
Not
really sure how its supposed to look as this is really my first time
using
this.

So I continued and tried to write the binaryimage to an IFS file.
This
again could be wrong, I'm just not sure what exactly I need to do.

fd = open('/home/mschutte/testups.gif'
: O_WRONLY + O_CREAT + O_TRUNC
: S_IRUSR + S_IWUSR + S_IRGRP);
callp write(fd: %addr(binaryimage): %len(binaryimage));
callp close(fd);

I also tried adding the 2 to the %Addr. But the file on the IFS is
empty.
There has to be someone out there that's done this right? I hope!

I'm using Scott Klement's tools, Base64, LIBHTTP, and IFS stuff.

I'm coming up empty finding examples on the web.

-- this was original posted to MIDRANGE and denied.

So here's an update. I've found an alternative.

rc = Apr_Base64_Decode_Binary(pathname:%addr(LabelImage));

When finished rc is zero. So it appears there are no errors, but I'm
not
getting a file. Any suggestions on either method?

Thank you
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.



--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.