View previous topic :: View next topic
|
Author |
Message |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Hi every one,
What is the equivalent declaration of s9(4) comp and s9(9) comp to numeric values in COBOL?
Thanks,
murali. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Murali,
Could you be more specific in what u are trying to achieve.
S9(4) COMP ==> 2 bytes
S9(9) COMP ==> 4 bytes
If you are just trying to use the space (memory) then 9(2) or 9(4) respectively would suffice.
Else if u are trying to copy the value to 9(n) field, then a simple MOVE statment would be enough.
Hope this is what u were looking for... |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Thanks Binop,
what could be the Picture clause for numeric for S9(10) comp-3.
Thanks,
Murali. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Correction S9(10)V Usage Comp-3 |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Murali,
What is it that you want to acheive ??
Please be more specific. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Murali, be aware that a COMP-3 or COMP field is numeric by COBOL definition. In fact, you cannot even do an IF NUMERIC test on a COMP field because every COMP field is NUMERIC -- always. Hence numeric picture clauses for your examples are PIC S9(4) COMP, PIC S9(9) COMP, and PIC S9(10) COMP-3.
If you are wanting to know what the equivalent USAGE DISPLAY picture clauses would be, just take the COMP or COMP-3 off of the field. If you're wanting to know something else about these fields, please clarify what it is you're asking. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
I have to retrieve some data from CICS Container and convert all numeric values of cobol to Java, In such case what could be the numeric Picture clause for S9(4) comp,s9(9) comp,s9(10)V comp-3?
Thanks,
Murali. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Murali,
If u had posted this as the first post it would have made our life easier...
As far as i remember about Java... the COMP variables should not be a problem coz that's how its already defined. Every numeric field will be binary only in Java ( plz do correct me if i am wrong ).
In case of the packed value, you will need to convert to the binary form and then send it. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
For my application,i will get the data from Java through Containers and vice versa i will transfer data from cobol to Java.
You said for comp it's not a problem, but i am not clear about packed decimal. What should be done?
Thanks,
Murali. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
In addition,
when data from COBOL to Java,
Is there any problem when data is transfered from COBOL to Java,
for example,
Java data type int is mapped to s9(9) comp of COBOL, is it possible to pass the same data from COBOL to Java data type?
Please clarify.
Thanks,
Murali. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
PIC S9(9) COMP in COBOL is a 32-bit integer field -- if you can figure out what that is in Java, use it. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Muali,
Maybe this wiil help:
The decimal value -1234 will have an internal memory (EBCIDIC) representaion of the following using the PICs indicated (depending on COMPILER Options) on an IBM Mainfreame :
Code: |
S9(4) COMP X'FB2E'
S9(5) COMP X'FFFFFB2E'
S9(10) COMP X'FFFFFFFFFFFFFB2E' ===> corrected from (9)
S9(10)V COMP-3 X'00000001234D'
S9(5) DISPLAY X'F0F1F2F3D4' |
You will have match the JAVA data type internal representations to these to make your decision(s).
PS. If the field value is +1234 the COMP value is X'4D2" and the "F"s in the fields would be zeros; the "D"s in the COMP-3/DISPLAY fields would be "C"s. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Jack,
I have a doubt in the example you have mentioned...
I guess the S9(9) COMP will take only 4 bytes...
Please confirm. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Murali
Quote: |
You said for comp it's not a problem, but i am not clear about packed decimal. What should be done? |
Could you be little more specific on how you are using the packed value. I am pretty much sure there is no packed format in Java. so in case if u are using only in mainframes it will be more like a working variable. If that's the case as I mentioned
Quote: |
In case of the packed value, you will need to convert to the binary form and then send it |
a simple MOVE statement from packed field to binary field should be enough |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Binop,
This is the flow of my program
I am getting the values from container and store it in working storage variable,where the ws- variables are passed to program x. and i am getting the values from program x and i am putting into container to pass the data to java application.
From you posting
Quote: |
a simple MOVE statement from packed field to binary field should be enough
|
so for moving packed decimal s9(10)v comp-3, you are recommending to move to a comp variable(binary format) right? if so what should be the picture clause for the receiving comp variable? |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
In addition,
Java is receiving the comp variables content as Character.
Thanks,
Murali. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Murali,
As Jack as mentioned your variable of PIC S9(10)V will take 6 bytes in the mainframe environment. But there would be a dependency on how much the target system ( Java ) is expecting.
*Note : Before assisting you further I would have to tell you that my knowledge on CICS containers is minimal....
What is the size of the specific character field ??
Are u having any idea on how the specific field is getting used ( processed ) in the target system ?? |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Binop,
Java is receving comp and comp-3 variable as characters so the pic clause for s9(10)v comp-3 in Alphanumeric item could be X(06)???
Assume s9(10)v comp-3 having values 1234567891. Will X(06) accomodate the values mentioned. similaraly what could be the picture clause for s9(9) comp and s9(4) comp?
Thanks,
Murali. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Murali,
Quote: |
Assume s9(10)v comp-3 having values 1234567891. Will X(06) accomodate the values mentioned |
Yes it will
Quote: |
similaraly what could be the picture clause for s9(9) comp and s9(4) comp |
in character ?? as mentioned in my first post ... X(4) and X(2). |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Binop,
when i am moving the 9 digitis 1234567891 from s9(10)v comp-3 to
X(06) it will truncate the data.
Data shouldn't get truncated.
Thanks,
murali. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Murali,
If you are doing a simple MOVE statement it will not work because you are basically trying to move from Numeric field to Character field. You will have to redefine the field in the Mainframe...
As mentioned before only if u give more details about the target system we will be in a position to help you better. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Binop,
Quote: |
I am getting the values from container and store it in working storage variable,where the ws- variables are passed to program x. and i am getting the values from program x and i am putting into container to pass the data to java application.
|
So far i didn't get the data type for target system, but when the program is receiving from the container (Source/Target system) i am getting the values from java to COBOL ( ex. char(contains only numeric data)(java) to s9(4)comp) i am sending back the data after callin/manipulating the same variables since the requirement is to map the numeric data to char(java) i am moving the comp and comp-3 values to alphanumeric item and writting(Put container) into container.
Thanks,
Murali. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Binop,
You wrote:
Quote: |
I guess the S9(9) COMP will take only 4 bytes... |
You're right, I always seem to mis-recall the break point from 4 to 8 bytes. The line s/b:
S9(10) COMP X'FFFFFFFFFFFFFB2E'
I'll correct the orig post. Thanx for picking that up. |
|
Back to top |
|
|
|