Michael DeChirico

Greenhorn
+ Follow
since Jul 31, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michael DeChirico

as you may have deduced, I am no java wizard and never claimed to be.

my knowledge of java goes just beyond being able to spell it.

so i am trying to figure out what the code was supposed to do and how to complete its development.

harilal ithikkat

made the reply

java.util.List list=new java.util.List();

as a way of resolving the issue, i am not quite sure how that statement would be implemented, could you provide me a more verbose example in context?

Thanks,,

JD
15 years ago
I am having a problem with a program that i inheirited from a previous employee.

it has import statements as follows:

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.*;
import java.io.*;
import java.awt.Panel;

later on in my program i have the statement:

List listMatches;


and wind up with error msg:

reference to list is ambiguous, both class java.util.List in java.util and class java.awt.List in java.awt match

How do you resolve the conflict?

Thanks,

JD
15 years ago
Another dumb mistake on my part, when the server sent the last block the client it promptly closed the connection, but not before the client had a chance to process the last block and instead the:

Catch (Exception e) {
System.out.println("Sorry, an error has occurred. Connection lost. ");
System.out.println(e.toString());
System.exit(1);
} // END CATCH

Got driven and we got a bogus and did not process the last block, what I have had to do was after processing each block from the server, is to send a response back requesting the next block.
15 years ago
So what your saying is that pattern split may not remove the \u00ff from the result array entries?
15 years ago
I implemented the split but i am missing something, when I receive each block of text the individual text lines are delimited by a \u00FF after each block is received the:

System.out.println("Result Length: " + result.length);

Always displays a value of 30, what does this value represent? does this mean that their are 30 substrings in the results array? The last entry in the last text block is 0x39FF0A but its never recognized, I even tried placing the sequence in the text block twice but to no avail

The last couple of entries in in the buffer were:

Result SYSPRINT OT11.LISTINGS.OTUF0401 WORK41
Result
Result 7316K allocated to Buffer Pool, 1933K would be required for this to be an In-Storage Assembly

After these the buffer with the termination sequence was sent: x39FF0A
but we never saw them.

From the servers perspective we completed the sequence

OTUF0401: WRITE SUCCESS RETCODE= +0004021
OTUF0401: WRITE SUCCESS RETCODE= +0004021
OTUF0401: WRITE SUCCESS RETCODE= +0004021
OTUF0401: WRITE SUCCESS RETCODE= +0000004
OTUF0401: CLOSE SUCCESS RETCODE= +0000000
OTUF0401: TERMAPI SUCCESS RETCODE= +0000000
OTUF0401: ENDED

The retcode value shows the number of bytes written.

Anyone have any thoughts?


15 years ago
One thing that I have noticed is there seems to be functional programmers reference guide for the Java programming language, I bought an introduction to Java programming but, unlike C or C++ there does not be a good reference manual, there are tutorials with rely on an understanding of Java but not one thats aimed at novices like me, so we can read the manual and have a reference to find answers.

Could anyone point me at a good programmers reference.
15 years ago
Yes, this code goes in the client app on the desktop, its communicating with a server on an ibm mainframe and the data being parsed is one or more report files generated on the mainframe so the records contain only printable characters, the server was concatenating the report records into blocks of text delimiting the records with 0xff bytes, of course the server could use any non-printable character as a delimiter.

Michael
15 years ago
I have a need to split blocks of text into their component text lines, each text line has a 0xff as the trailing character.

the block of text are variable sized and the component text lines are variable in lenght.

Whats the best way to break the blocks of text apart?

My original thought was to use the stringtokenizer but i gather thats not a good thing to do.

Thanks.

Michael
15 years ago
My thanks to everyone who offered suggestions, it turns out it was a real dumb programming mistake on the server side.

All of the comments regarding println should have made me look closer at the server code but this was one of those can't see the forest for the trees things.

The client was running fine, the server (residing on an ibm main frame) uses ebcdic and not ascii as its code base, so when it had a response to send to the client it was doing a code translation from ebcdic to ascii, but was being too aggressive, it was translating non-printable characters, like x0A to x00 so the println never saw end of msg and sat there waiting for it.

Fixing the translate table resolved the problem. It works like a champ now, a little slow for a production environment but well enough to permit the prototype to go forward.

My Thanks again.

Michael
[ August 28, 2008: Message edited by: Michael DeChirico ]
15 years ago
Actually, this is the old style half duplex communications methodology, i am either sending or waiting and never doing both at the same time.

The client sent a msg, the server received it and displayed it in a msg log, then turned around and sent a msg back to the client, the client never got it, the server then turned around and waited for something from the client and there they sat, fat dumb and happy.
15 years ago
To all who have tried to help.

In frustration, discarded my existing java client code and came up with another one:




There is a comment line: /* waits here */ in the above code, its waiting for a response from the host, the problem is the host says it sent the response.

Once again, any one have any ideas on how to figure out what the problem is?

Thanks

Michael

[edit]Add code tags. CR[/edit]
[ August 26, 2008: Message edited by: Campbell Ritchie ]
15 years ago
Mario Minutolo,

Ok I'll bite, how does one "flush the buffer"???

Michael
15 years ago
Hi there,

I have been trying to write a client/server app to communicate between a desktop and a mainframe server.

I have my server app running on the mainframe and have attached the java code that I am trying to get to run on my desktop as follows:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication3;

import java.io.*;
import java.net.*;

/**
*
* @author MichaelXPS720
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {

Socket ClientSocket = null;
PrintWriter out = null;
BufferedReader in = null;

try {
ClientSocket = new Socket("122.022.032.246", 11007);
out = new PrintWriter(ClientSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(ClientSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Unable to connect to host.");
System.exit(1);
} catch (IOException e) {
System.err.println("Host refused Connection");
System.exit(1);
}

BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
String ReadFromHost;
String SentFromClient;

System.out.println("Connection Established, Dialog Begins");

while ((ReadFromHost = in.readLine()) != null) {
System.out.println("Read From Host: " + ReadFromHost);
if (ReadFromHost.equals("Bye.")) {
break;
}

SentFromClient = stdIn.readLine();
if (SentFromClient != null) {
System.out.println("User Entered Data: " + SentFromClient);
out.println(SentFromClient);
}
}

out.close();
in.close();
stdIn.close();
ClientSocket.close();
}
}

The sequence of events is as follows:

I start the server on the mainframe, once its listening for connection requests, I start the above java app.

Once the java app startes it displays a simple execution starts msg, then falls into a read from host/write to host loop.

The host recognizes the connection request and tries to send a "hello" msg, the java client is then supposed to write the data from the host and then send a string entered from the desktop via keyboard to host,

This loop should continue until the host sends the termination string, "Bye."

then the client should stop and the host drop its connection.

Whats happening is the client starts, displays the execution begins msg, the host sends its "hello" msg and the client sits their like a vegetable.

The host is in a wait state waiting for a response to the hello msg.

Can someone help a novice in the java world to understand whats going on?

Thanks,

JD
15 years ago
The true nature of the application is as follows.

I have an app that runs on the mainframe it creates a series of datafiles that a user can access by logging on to an interactive app that runs on the mainframe and then browsing the various datafiles.

What I have been asked to do is to write a "server" app that runs on the mainframe and waits for request from a "client" app that i have to write that runs on the pc.

Yes, I could use ftp to transfer the data from the mainframe to the client, however this would impose a burden on the end user in that they would have to figure out what file they wanted to see, then invoke a ftp client to transfer the file (after they got through a stiff security interface) and store it on their pc and then browse it.

It boils down to making the user do as little as possible and keeping them as insulated as possible from the actual source of the data.

JD
[ August 21, 2008: Message edited by: Michael DeChirico ]
15 years ago
Heck, I told you I was a dinosaur!

First, thanks for the reply, you pointed me in the right direction!

Next, thanks for the info on how to change the subject line!

Thanks for the help!

JD
15 years ago