I'm trying to implement Java's System.out.println() method in Progress ABL.
The closest functionality seems to be:
test.p:
MESSAGE "hello world" SKIP.
I ran the following tests to see if it works:
Windows
FAIL C:\opt\prgs\dlc117\bin\prowin -b -p test.p
OK C:\opt\prgs\dlc117\bin\prowin -b -p test.p | % ToString
OK C:\opt\prgs\dlc117\bin\_progres -b -p test.p
OK C:\opt\prgs\dlc117\bin\_progres -b -p test.p | % ToString
Unix
TODO
So in the end, I'd implement it like this:
METHOD STATIC PUBLIC VOID println(i_cText AS CHAR):
MESSAGE i_cText SKIP.
PAUSE 0.
CATCH oError AS CLASS Progress.Lang.Error:
/* Suppress error because MESSAGE doesn't support NO-ERROR. */
END.
END.
I haven't found a way to know when the MESSAGE will fail. I tried checking OPSYS, TERMINAL and SESSION:BATCH-MODE but they are not reliable. I'd need to know if default output exists but how?
AFIAK you always have to redirect in order to execute in batch. Your commandline without redirecting results in
Once you redirect, code below will write to stdout.
you can use
| teeon linux or| % ToStringin powershell result