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



Isn't a B (binary) type defined as 2 or 4 or 8? The number of bytes? Not the number of digits? I'd recommend 5i 0. That's what the Data Type Compatibility chart says in the Run-Time Library Reference. Both int and long int are 10i 0.

C's short COULD be 2B 0 - but the binary type is not recommended anymore hardly at all. Whoever wrote the examples is probably from an old time school - hasn't read a modern RPG manual.

5B 0 is nonsense to my understanding. Maybe it was a typo. Hit the 5 instead of 2 on the keypad.

And I agree about the varying-length declaration - even a renowned expert in this country used that method in code he wrote in 2005 and it is still available online. Maybe they only know COBOL - you have to use this kind of thing there for varying-length fields. It is also a way to use varying-length fields - kind of - internally and use the data part only for calling APIs. But even that is handled by RPG pretty nicely, unless you use pointers by value. Yuk!

HTH
Vern

On 3/18/2011 8:21 AM, Birgitta Hauser wrote:
Hi Jon,

you may check the following paper
Encryption enhancements: Field procedure support in DB2 for i 7.1
http://www.ibm.com/developerworks/data/library/techarticle/dm-1101encryptenh
ance/index.html

Even though I'm not very happy about the RPG example.
It seems to me being translated row by row from the C code.
I'm no C expert, but it seems to me C's short data type is not the same as
2B 0.
Also defining varying lengths fields as follows looks rather strange (and
not correct either) to me.

D En_Lob_Ds Ds Qualified
D Len 5B 0
D Data 1 dim(512)
D
D De_Lob_Ds Ds LikeDs(En_Lob_Ds)
D
D En_VChar_Ds Ds Qualified
D Len 2B 0
D Data 1 dim(512)

But I haven't found any time yet to test the sample code.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Jon Sinner
Gesendet: Friday, 18. March 2011 01:29
An: RPG400-L@xxxxxxxxxxxx
Betreff: V7R1 Field Procedures

The boss had decided that he wants to encrypt a couple of fields in our
customer master file. I have been reading the SQL programming manual and
found field procedures which seams to be the process to use. The manual has
a sample program written in "C" (I think), anyway I don't understand the
sample program.

Has anyone written a program that is called as a field procedure and if so
would you be willing to share the program?

Thanks

Jon

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.