× 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.



Lloyd,

Something about the convert() procedure seems odd to me.  It appears to be
trying to reference the address of a pointer.  That may not be the cause of
your error.  I'm not sure.

I'd suggest redefining the interface to your MD5 procedure to pass a
variable length string, rather than a pointer and a length.

Nathan M. Andelin
www.relational-data.com

From: "Goodbar, Loyd (AFS-Water Valley)" <LGoodbar@afs.bwauto.com>
> Using the MD5 program found at <http://www.as400pro.com/TipsRPG7.htm>, I'm
> trying to convert it to a generic subprocedure to be used by any ILE
> program. I want to pass a pointer to the data to be encrypted, as not to
> pose any length restrictions.
>
> I created a prototype to the procedure like this:
> d MD5             pr            32a
> d  inputdata                      *   value
> d  inputlength                  10i 0 const
>
> and a procedure interface like this:
> p MD5             b
> d MD5             pi            32a
> d  inputdata                      *   value
> d  inputlength                  10i 0 const
>
> I changed these lines in the MD5 program:
> * removed references to MSG
> * removed SOURCEPTR
> * changed these lines:
> c                   eval      datalength = inputlength
>  * Change message to ccsid 819 (ascii)
> c                   callp     convert(%addr(inputdata) : %addr(to819) :
> c                             inputlength)
>  * Get MD5
> c                   callp     cipher( %addr(receiverptr) : %addr(controls)
> c                             : %addr(inputdata) )
>
> FYI, the supplied MD5 program uses the following prototypes, MI I believe:
> d cipher          pr                  extproc('_CIPHER')
> d                                 *   value
> d                                 *   value
> d                                 *   value
> d convert         pr                  extproc('_XLATEB')
> d                                 *   value
> d                                 *   value
> d                               10u 0 value
>
> In my test program, I have this:
> d mymd5           s             32a   inz
> d testmsg         s            250a   inz
> d testlength      s             10i 0 inz
> c                   eval      testmsg='message digest'
> c                   eval      testlength=%len(%trimr(testmsg))
> c                   eval      mymd5=MD5(%addr(testmsg):testlength)
> c     mymd5         dsply
>
> My problem is this:
> Running in debug, I see a valid pointer for INPUTDATA upon entering the
MD5
> subprocedure.
> After this line executes, however:
> c                   callp     convert(%addr(inputdata) : %addr(to819) :
> c                             inputlength)
> INPUTDATA has a *NULL pointer, and the call to CIPHER fails with the error
> "Pointer not set for location referenced."
>
> In the original program, the call to CONVERT was made using a pointer to
> variable MSG, and calling CIPHER with another pointer to variable MSG. I
am
> calling CONVERT with a pointer to INPUTDATA, and call CIPHER with the same
> pointer to INPUTDATA.
>
> I believe that is my problem, and I need to create a second pointer to
> INPUTDATA to use with CIPHER. How do I do that?
>
> Thanks,
> Loyd
>
> --
> Loyd Goodbar
> Programmer/Analyst
> BorgWarner Incorporated
> Air/Fluid Systems, Water Valley, MS
>
> _______________________________________________
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
> To post a message email: MIDRANGE-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> or email: MIDRANGE-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>



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.