-
Another cool thing about QC2LE is that the ILE C/400 runtime includes the full set of open AS/400 MI instructions. That is the AS/400 assembly language can be called directly from RPG IV by prototyping their C/400 functions. For example, to call the Convert Characters to Hexadecimal Symbols MI instruction, you would call the ' cvthc' C runtime function. For example:
The following RPG IV code should compile on any version of OS/400 that includes RPG IV.
PHP-Code:
.....DName+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++ D szCharVal S 20A Inz('ABCDEFG') D szHexVal DS D szHex1 LIKE(szCharVal) D szHex2 LIKE(szCharVal) D nCharLen S 9B 0 .....CSRn01..............OpCode(ex)Extended-factor2++++++++++++++++++ ** if you want to avoid converting trailing blanks, use this stmt. C ' ' CheckR szCharVal nCharLen ** or if you want to convert trailing blanks, use this stmt. C Eval nCharLen = %size(szCharVal) * 2 .....CSRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHiLoEq ** This converts '123' to 'F1F2F3' C CALLB 'cvthc' C Parm szHexVal C Parm szCharVal C Parm nCharLen ** This converts 'F1F2F3' to '123' C CALLB 'cvtch' C Parm szCharVal C Parm szHexVal C Parm nCharLen
Just a few things to remember when using the C runtime APIs.
- The names are case-sensitive. That is 'cvthc' must be specified in lower case or it will not be found.
- These functions are located in the OS/400 C-runtime library and must be bound using the QC2LE binding directory.
- Parameters that require pass-by-value restrict the API to being called with newer releases of RPG IV, via procedure prototypes.
- C functions that have return values cannot be called by RPG IV under OS/400 version 3, release 1.
- Until you move to V3 R2 or, even better, V3 R7, the number of interfaces that can be accessed by RPG IV is limited. In fact, the HexToChar, CharToHex functions are about all that are useful.
- Under later releases of RPG IV, procedure prototypes allow access to all of the C runtime functions. This includes those nice little date and time formatting functions, such as asctime.
For more details and examples of using procedure prototypes with the C runtime library, see the article on interfacing RPG IV with the C/400 language runtime library on the RPG Developer Network News page.
entnommen von Frequently Asked Questions
kuempi
Similar Threads
-
By mk in forum NEWSboard Java
Antworten: 8
Letzter Beitrag: 21-04-11, 21:51
-
By TARASIK in forum NEWSboard Programmierung
Antworten: 1
Letzter Beitrag: 14-01-08, 09:02
-
By robertki in forum NEWSboard Programmierung
Antworten: 25
Letzter Beitrag: 19-01-07, 08:42
-
By Stoeberl in forum NEWSboard Programmierung
Antworten: 8
Letzter Beitrag: 10-01-07, 10:58
-
By jth in forum NEWSboard Programmierung
Antworten: 1
Letzter Beitrag: 21-12-06, 11:13
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks