0

I have a Java app which makes a rest API call and returns a String. The string needs to be passed on to a Cobol app (Microfocus Cobol). Currently the java app do a sysout of the string to the console. What's the best approach to capture this value from console using micro focus cobol?

The cobol app is stand alone and invokes the java app to get the string data. Need to identify a way for cobol to read in the value displayed on the output console.

yonikawa
  • 581
  • 1
  • 9
  • 32
  • 1
    "the best approach" is in the eye of the beholder. What have you tried? – cschneid Nov 30 '21 at 18:29
  • @cschneid - Currently the string is displayed to the console. Based on some articles I read, its not possible to write to env variables using Java(maybe I am wrong?). But I am not an expert as I never tried this approach before. So just looking for ideas from the experts here. – yonikawa Nov 30 '21 at 18:44
  • 1
    You should add more detail on what you are doing. Is Java code launching the Cobol app, or are you expecting an already running Cobol app to receive an environment variable change? – DuncG Nov 30 '21 at 18:59
  • Also: you may want to just pass the value when starting a COBOL program under JVM (not sure as that info is missing: is the a "native/system" COBOL application or one of a COBOL runtime [wrapped] in Java?) – Simon Sobisch Dec 01 '21 at 07:29
  • @DuncG - The cobol app is a standalone app. It will call the java app which internally makes the api call and return the string printed onto the console. And the cobol needs to somehow access the string from the output console window. – yonikawa Dec 03 '21 at 16:41
  • @SimonSobisch - its a legacy app, so native/system cobol app. – yonikawa Dec 03 '21 at 16:46
  • Ah, you have native exe (cobrun.exe or friends) `CALL "SYSTEM" USING "java-app"` and want to pass data "upwards" from the java part, correct? Then either use a pipe, for example via `OPEN java-proc` with `java-proc` being defined as `LINE SEQUENTIAL ASSING TO " – Simon Sobisch Dec 03 '21 at 22:30

0 Answers0