Comments
Matt McLarty wrote: For more info... Follow me on Twitter See our website
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..

2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
In many cases, the end of the year gives you time to step back and take stock of the last 12 months. This is when many of us take a hard look at what worked and what did not, complete performance reviews, and formulate plans for the coming year. For me, it is all of those things plus a time when I u...
SYS-CON.TV
Writing to the Console in PowerBuilder 12.5 .NET
Why can’t a PB program directly write to the console in a displayable manner?

Yesterday I taught an intro to PowerBuilder .NET 12.5 session.  Part of the presentation had me comparing the.NET IL code inside an assemblies generated from code written in C# and PowerBuilder.

The C# code, after performing a simple arithmetic calculation echoed results to the console using these two lines of code

namespace CalculatorExample
{
class Program {
static void Main( )   {
Calc c = new Calc( );  //create the object
int ans = c.Add( 10, 84); //call the method
System.Console.WriteLine("10 + 84 is {0}." , ans);
System.Console.ReadLine( ) ;    }

}
class Calc {   //define a wrapper class for the method
public int Add( int x, int y)
{return x + y ; }  }
}

In PowerScript, ordinarily, I echo results using a Messagebox call, but yesterday, I thought I'd "step out on the limb" and echo output to the console using the same NET Framework class methods C# programmers use.

The equivalent PowerScript Code (slightly refactored) looks like this:

n_calc Calc
Calc = create n_calc
integer addend1=10, addend2=84, result
result = Calc.add( addend1, addend2 )
System.Console.WriteLine("{0} + {1} is {2}", addend1, addend2,result)
System.Console.ReadLine( )

I opened a console window and ran the app from the command line

The first run threw this exception:

Hmm, that's the ReadLine call.  I removed that line and ran it again

Hmm, no console output.  Then a clever programmer suggested that I pipe the output to a text file and then type the file.

Wow! Strange! What a trick! It worked! Here's the console output.  You can plainly see that we did get results, but for some reason they didn't display to the console device.  Only through outstream redirection was I able to capture the output.

I'd be mighty pleased if someone in engineering could explain this behavior.  Why can't a PB program directly write to the console in a displayable manner?   Why does ReadLine throw an exception?

About Yakov Werde
Yakov Werde, a 25 year IT industry veteran, is a member of TeamSybase and the newly formed Sybase Customer Evangelist Team. Yakov is a recognized author, speaker and trainer who has been designing and delivering PowerBuilder, .NET, EaServer, Web App Development, and Java training for over 14 years to corporate, military and government developers. Prior to discovering his aptitude as an educator, Yakov worked as an architect, project manager and application coder in the trenches of application software development. Yakov holds a Masters in Education with a specialty in instructional design for online learning from Capella University and a BS in math and computer science from Florida International University. Yakov, managing partner of eLearnIT LLC (www.elearnitonline.com), authors and delivers workshops and web based eLearning tutorials to guide professional developers toward PowerBuilder Classic and .NET mastery. Follow Yakov on Twitter as @eLearnPB

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

SOA World Latest Stories
Facebook sold off again Tuesday scrapping the bottom at $30.98 after Reuters reported that Scott Devitt, a research analyst at the IPO’s lead underwriter Morgan Stanley, unexpectedly cut his revenue estimates on the company during the roadshow leading up to it going public last Friday....
As a Silver Sponsor of Cloud Expo New York, CloudPassage is offering special passes to SYS-CON's 10th International Cloud Expo, which will take place on June 11–14, 2012, at the Javits Center in New York City, New York. CloudPassage is the leading cloud server security provider, and c...
Private clouds solve many problems for enterprises and bring unique operational challenges along with them. There are dozens of companies of all sizes that will build you a private cloud and turn over the keys – then what? Trying to convert a traditional enterprise IT operations team t...
Cloud computing is becoming an integral part of every enterprise IT environment. With multiple cloud deployment models to choose from, understanding the essential components to any cloud solution will help ensure your success. In his session at the 10th International Cloud Expo, Ores...
The International Trade Commission’s six-member board of commissioners has issued an import ban against Motorola Mobility’s Android gear that the agency’s administrative law judge found in December infringes Microsoft’s patent on “generating meeting requests and group scheduling from a...
As a Platinum Sponsor of Cloud Expo New York, Intel is offering special passes to SYS-CON's 10th International Cloud Expo, which will take place on June 11–14, 2012, at the Javits Center in New York City, New York. Intel is a world leader in computing innovation. The company designs a...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE