Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Convert all numeric values of cobol to Java
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 17, 2009 1:14 pm    Post subject: Convert all numeric values of cobol to Java
Reply with quote

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
View user's profile Send private message

Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Jul 17, 2009 2:20 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 17, 2009 2:44 pm    Post subject:
Reply with quote

Thanks Binop,

what could be the Picture clause for numeric for S9(10) comp-3.

Thanks,
Murali.
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 17, 2009 2:45 pm    Post subject:
Reply with quote

Correction S9(10)V Usage Comp-3
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Jul 17, 2009 2:48 pm    Post subject:
Reply with quote

Hi Murali,

What is it that you want to acheive ?? icon_rolleyes.gif
Please be more specific.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Fri Jul 17, 2009 3:16 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 17, 2009 3:26 pm    Post subject: Reply to: what is the equivalent of s9(9) comp to s9(?)? how
Reply with quote

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
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Fri Jul 17, 2009 3:32 pm    Post subject:
Reply with quote

Hi Murali,

If u had posted this as the first post it would have made our life easier... icon_razz.gif

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sat Jul 18, 2009 7:22 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sat Jul 18, 2009 7:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Sat Jul 18, 2009 7:42 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jul 19, 2009 6:56 am    Post subject:
Reply with quote

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
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Sun Jul 19, 2009 9:38 am    Post subject:
Reply with quote

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
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Sun Jul 19, 2009 9:46 am    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sun Jul 19, 2009 2:07 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sun Jul 19, 2009 2:29 pm    Post subject:
Reply with quote

In addition,

Java is receiving the comp variables content as Character.

Thanks,
Murali.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Sun Jul 19, 2009 4:09 pm    Post subject:
Reply with quote

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.... icon_wink.gif

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sun Jul 19, 2009 4:56 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Sun Jul 19, 2009 5:44 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sun Jul 19, 2009 5:56 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us