View previous topic :: View next topic
|
Author |
Message |
ramco_sita
New User
Joined: 25 Jun 2007 Posts: 40 Location: chennai
|
|
|
|
We are using the ECIRequest base class to interface with commarea cobol/cics programs.
In java we are using getbyte method to pass the data to commarea.
At present the data that gets passed to commarea from java goes as string.
But i need to pass an integer and decimal type datas to cics programs...
would like to know how to do this.
Currently it works if we do conversion of int to string and pass it to cobol.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Where is the java code running? |
|
Back to top |
|
|
ramco_sita
New User
Joined: 25 Jun 2007 Posts: 40 Location: chennai
|
|
|
|
Java code will be running on windows environment using cics transaction gateway we will be interfacing with the commarea .
for java ibm has provided a base classes to pass the data to commarea.
ECIrequest is the base class method that we are using.
The sample code
import com.ibm.ctg.client.JavaGateway;
import com.ibm.ctg.client.ECIRequest;
import java.io.IOException;
public class EciTest02
{
public static void main(String args[]) throws IOException
{
System.out.println("Test for Gateway");
try {
JavaGateway jg= new JavaGateway("localhost:",2006);
byte commarea[]=("-------------------------------------------------------------------").getBytes("IBM037");
// byte commarea[]=("02.0002.0000.00").getBytes("IBM037");
ECIRequest req= new ECIRequest(ECIRequest.ECI_SYNC,//sync or async
"CICS1",//cics Server Name
"dsrm022",// user id
"dsrm022",// password
"M22AP01",// program name
"M22I",// transaction idc
commarea, commarea.length,//commarea data & length
ECIRequest.ECI_NO_EXTEND,//extended mode
ECIRequest.ECI_LUW_NEW); //LUW token
System.out.println("ECIREQUEST");
System.out.println("Comm in: " + new String(req.Commarea, "IBM037"));
jg.flow(req);
System.out.println("Comm out: " + new String(req.Commarea, "IBM037"));
System.out.println("Rc: " + req.getRc());
jg.close();
}catch (IOException ioe)
{
System.out.println("Handled exception: " + ioe.toString());
}
}
} |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
If the data is going to be translated enroute, you can't use packed decimal, binary or float types, only character... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Stay with the string. Windows does not play well with mainframe "internal" numerics. |
|
Back to top |
|
|
ramco_sita
New User
Joined: 25 Jun 2007 Posts: 40 Location: chennai
|
|
|
|
I am interfacing with dfhcommarea from my java client program running on windows.
From windows java client i need to pass a float to cobol dfhcommarea.
But currently it passes to cobol only as a string.
The problem we have is with decimal and comp values defined in commarea in cobol..
Any suggesstions appreciated... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
As has already been posted - if you are running on a Windows machine, your best way is to use the string.
You will probably spend a lot of time trying to get the desktop to prepare mainframe "numerics".
Change the existing mainframe code to use the string. If you really don't want to change the existing code, I'd suggest a new bit of mainframe code to take the string from java and change it (on the mainframe) to whatever format(s) you need - then pass it on to the existing code. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
From windows java client i need to pass a float to cobol dfhcommarea |
carrying on floating point operations on different platform is, using a light term, like opening a can of worms ( IEEE standards and so on )
I would rather rely on a common set of functions/classes which would give consistent results on different platforms
check this url
http://www2.hursley.ibm.com/decimal/
regards
e.s |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Enrico,
Excellent link - thanks for posting it
d |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Am new to this forum, i got the given site above which helped me a lot, thank you very much to Enrico.
Thanks
Vasanth |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Vasanth and welcome to the forums.
Enjoy your time here and look around. There are many helpful items posted. |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
as i seen for every character there is an equivalent EBCIDIC code convert it into binary and then to decimal format. and then move it to DFHCOMMAREA will work normally. I tried and it is working still i need tuning in my code.
Have a great day
Vasanth... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Vasanth,
Thank you for posting your progress
We're here if there are any new "opportunities". |
|
Back to top |
|
|
ramco_sita
New User
Joined: 25 Jun 2007 Posts: 40 Location: chennai
|
|
|
|
Java is able to pass only as a string thru ECIRequest. We have to handle this in the cobol code.
in cobol we capture it as an alphanumeric and then move that to a working storage variable which is numeric and for calculation we made it as a comp-3 field and after calculation we pass it back to the commarea field which will put decimal point and send it to the java client program.
We solved this problem and it works fine both in java client and in cobol.
Working storage section:
01 ws-decimal Pic 9(5)v9(2) usage comp-3.
01 ws-dec-no redefines ws-decimal.
05 ws-rs pic 9(5).
05 ws-p pic 9(2).
Linkage Section:
01 Dfhcommarea.
01 WS-Decimal-no .
05 ws-Rupees pic x(5).
05 ws-dot pic x(01) value ‘.’.
05 ws-paise pic x(2).
In the code we have to move it individually from ws-Rupees to ws-rs and move ws-paise to ws-p. Comp-3 is a packed decimal which is used for any calculations. For this decimal handling it involves additional coding in COBOL.
thanks for your help |
|
Back to top |
|
|
|