|
Ah... I didn't realise that the RPG interface didn't support directly accessing public data members... I hadn't checked out the V5R2 programmer's guide either - there's a lot more in there than the V5R1 version... I can see now how I could go about getting hold of the System.out object - although I don't think that using the lower level JNI calls looks to be a viable way forward for the kind of 'Hello World' example code I am putting together... It will be much simpler to code a wrapper class that will provide a getter method for this... As a slight aside, are there any plans to support RPG access to public data members/fields in future releases? Thanks for your help. Stu -----Original Message----- From: Barbara Morris [mailto:bmorris@xxxxxxxxxx] Sent: Thursday 04 March 2004 21:52 To: rpg400-l@xxxxxxxxxxxx Subject: Re: Defining System.out.println in RPG "Bramley, Stu" wrote: > > I'm trying to put together some 'Hello World' code that will call the Java > method System.out.println(String) from RPG - however I'm struggling to get > this defined correctly in the RPG.. > > I have tried the following : > > D println PR EXTPROC(*JAVA : > D 'java.lang.System.out': > D 'println') > D STATIC Stu, "out" isn't part of the class; it's a PrintStream field in the Static class. 'println' is an instance method in the PrintStream class. http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html D println PR EXTPROC(*JAVA : D 'java.io.PrintStream': D 'println') D inString O CLASS(*JAVA : 'java.lang.String') To make this call, you need to get hold of the System field "out". D out S O CLASS(*JAVA : 'java.io.PrintStream') ... println (out : string) I think you might have to write a little Java method to return it; RPG can only access methods, not fields (at least using the EXTPROC(*JAVA) support). The ILE RPG programmer's guide does have an example of doing the JNI calls to access fields, so you could try that to get the "out" field from System. _______________________________________________ This is the RPG programming on the AS400 / 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. If you are not the intended recipient, please notify the sender by return email and then delete the message from your computer. The Skandia UK Group reserves the right to monitor e-mail communications through its networks. No contract may be concluded on behalf of the Skandia UK Group by email. Skandia Life Assurance (Holdings) Limited Skandia Life Assurance Company Limited Skandia MultiFUNDS Limited, Skandia Investment Management Limited. Registered Nos: 1606702, 1363932, 1680071, 4227837, England Registered Office: Skandia House, Portland Terrace, Southampton SO14 7EJ, United Kingdom Royal Skandia Life Assurance Limited Registered No : 24916 Isle of Man Registered Office: Skandia House, King Edward Road, Onchan, Isle of Man IM99 1NU, British Isles Skandia Life Assurance Company Limited, Skandia MultiFUNDS Limited, Skandia Investment Management Limited and Royal Skandia Life Assurance Limited are authorised and regulated by the Financial Services Authority for UK investment business. Internet: www.skandia.co.uk
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.