0

a particular question: is there a direct way to make an AS400 connection or do you have to go through PHP? I don't have to read data on DB2, but do the various commands (wrkactjob, wrksyssts, etc.). Thank you.... sorry for the English. what I thought (maybe it can't be done) is this: in the app screen there are buttons, each button executes a command (wrkactjob, clroutq, etc.) and the answer occurs in another screen ... I didn't want to write commands directly like on 5250 or telnet

5
  • What is your goal? Wrkactjob etc. are interactive applications. Do you want to create a 5250 emulator? Please elaborate, perhaps you can be given an answer.
    – PoC
    Commented Mar 21, 2022 at 23:01
  • telnet is a good way to connect to the as400.
    – RockBoro
    Commented Mar 22, 2022 at 4:30
  • I know telnet, but I can't connect with Flutter (I think) ... I wanted to create buttons with FLUTTER that, when clicked, executed the commands wrkactjob, wrksyssts, etc .... Commented Mar 22, 2022 at 6:49
  • The point @PoC was making is that the IBM i commands you listed are interactive. Meaning they display something on a 5250 screen and accept user input via the 5250 interface (which then may update the screen, which continues to wait for more user input until they choose to exit). So did you want to show that screen? Did you want to accept user input once that screen is displayed?
    – John Y
    Commented Mar 23, 2022 at 17:41
  • what I thought (maybe it can't be done) is this: in the app screen there are buttons, each button executes a command (wrkactjob, clroutq, etc.) and the answer occurs in another screen ... I didn't want to write commands directly like on 5250 or telnet Commented Mar 23, 2022 at 19:33

2 Answers 2

0

From your referral to typical "health checking" programs, like wrkactjob, and wrksyssts I guess your primary goal is to have an application running on your Android based phone to quickly check the status of a machine from wherever you are. Correct?

Have you considered how to get access to the machine's IP address when you're on the road and not connected to the local WiFi?

You can access this "performance data" through SQL — as John Y pointed out — and display it in whatever for is convenient on your mobile device. But I highly doubt Android provides ODBC infrastructure, even though you might manage to get the correct binary blobs (CPU wise) of the ODBC drivers from IBM botched into Android.

Otherwise you want to create a mechanism to scrape the screen for whatever is displayed, and translate that textual representation into UI elements provided by Flutter, if you want UI elements instead of textual output.

If you already have your doubts that you can't do telnet with Flutter, I think you'll have to learn a lot about Flutter as an SDK before even thinking about how to start developing an application. TCP/IP networking services are a function of the underlying OS and you'll have to go through all the Flutter abstraction layers to eventually be able to build a TCP session. With some luck, there is already code available to handle the telnet protocol peculiarities for you. Perhaps not, then you need to provide telnet negotiation and protocol yourself. This is documented in numerous RFCs. Use Google yourself.

Next point is: You need to establish translation routines for conversion of EBCDIC charset data into ASCII. Because Android is Linux based, you need to learn how to call libc routines like iconv() through Flutter, providing a C interface for charset conversion, including EBCDIC flavors as source/target.

Final point: You need to learn how to interpret the 5250 data stream, and translate the terminal emulator instructions into dynamically place Flutter UI elements at appropriate positions on screen. And of course you need to understand what to send back to IBM i to make it understand your request. The tn5250 data stream is also documented in publicly available RFCs.

There once was a facility called Workstation Gateway in the OS, but as I've found out, it has been removed in V5R2. This might have provided an easier means, because the 5250 data stream was converted on the fly to plain HTML.

Now it's your turn to decide if your goal is worth the apparent effort you're required to go through.

3
  • Well, I don't know Android well enough to say what the chances are of setting up a JDBC connection to the i, but I would imagine it's actually decent. Barring that, I have to imagine that chances are extremely good that you can get some kind of HTTP or SSH connection to the i. And once you can do that, then you can use XMLSERVICE, which includes a very easy-to-use 5250 scraper for command output. The python-itoolkit README even uses wrkactjob as its lead example.
    – John Y
    Commented Mar 25, 2022 at 3:00
  • thanks for the answers @PoC... maybe I explained myself wrong, telnet works (I've seen some apps on the store that emulate the 5250) but it wasn't what I wanted ... you're right, now it's up to me to decide if it's worth the effort. Commented Mar 25, 2022 at 8:07
  • Please mark the most helpful message as answer.
    – PoC
    Commented Mar 26, 2022 at 10:06
0

I am not sure what you mean by "direct". Do you mean doing your own socket programming? You could, but there are easier ways to connect.

The most obvious and straightforward choices are probably ODBC, JDBC, HTTP, and SSH.

ODBC and JDBC of course provide an SQL-based interface, and you can use that to issue commands (via the QCMDEXC procedure or scalar function) or access an increasingly comprehensive array of IBM i services.

If what you need still isn't available via SQL, or you simply don't like working in SQL, you could make use of the XMLSERVICE library, which provides its own programming interface "on top of" any of the connection types mentioned above. Despite all the instructions for building from source, normally this should already be installed on your IBM i. There are higher-level wrappers for XMLSERVICE in several programming languages (.NET, Node.js, PHP, Python, Ruby, and Swift), but as of this writing, not Dart. I am not familiar with Flutter, but I imagine you could use the JavaScript interop package to work with the Node.js wrapper.

5
  • Thanks for the answer John Y .... by direct I mean something like Flutter -> AS400 without intermediate steps .... I have an as400 IBMi 7.1, on the machine there is native PHP but I didn't want to create something in php and call it from Flutter .... so I don't know if it's the right way or if I'm wrong approach ... Commented Mar 23, 2022 at 7:19
  • But "intermediate steps" is all in the eyes of the beholder. If you're asking whether Flutter has some simple command or function that establishes a connection, well, that's entirely between you and Flutter's documentation to determine. Maybe it does, or maybe it can make use of some other connection, but how do you establish that connection? Maybe you have to import some module into your Flutter app? You really still haven't defined what "direct" means, in a way that would make any difference to someone answering your question, except maybe someone who already knows Flutter.
    – John Y
    Commented Mar 23, 2022 at 17:30
  • Yes, by direct I mean if you can import some modules into my Flutter app ... but if you can't, intermediate steps between the app and as400 are fine ... what do you recommend? which road should I take? I need a spark ... Commented Mar 23, 2022 at 19:06
  • Nobody can tell you which road to take (except maybe your boss, if you have one), or provide you a spark. I have already provided as much information as I can, given what you have included in your question. I think anything more would have to come from someone familiar with Flutter.
    – John Y
    Commented Mar 23, 2022 at 19:22
  • Thanks for the answer John Y... Commented Mar 23, 2022 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.