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
 

 

Comp-5 Variable population

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Sat Aug 20, 2011 12:02 am    Post subject: Comp-5 Variable population
Reply with quote

Hi,

I want to populate a comp-5 field from a numeric one. My field definitions are as below.

Field1: 9(04)V9(05)
Field2: S9(04)V9(05) COMP-5

I want to move field1 to filed2.

But no value is getting populated in field2.

Can anyone help me?
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Sat Aug 20, 2011 12:15 am    Post subject:
Reply with quote

Defining a COMP-5 variable with digits to the right of an implied radix point is probably not the stupidest thing that you can do, but it's in the top 20. Justify your use of it, or change it.
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Sat Aug 20, 2011 12:19 am    Post subject:
Reply with quote

Field1 is coming from the input file which I can not change and field2 is a field of the table. I can not change it either. But I will have to populate field2 withe field1. I guess this calirify your doubts.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Aug 20, 2011 1:03 am    Post subject: Re: Comp-5 Variable population
Reply with quote

Priyanka Pyne wrote:
Hi,

I want to populate a comp-5 field from a numeric one. My field definitions are as below.

Field1: 9(04)V9(05)
Field2: S9(04)V9(05) COMP-5

I want to move field1 to filed2.

But no value is getting populated in field2.

Can anyone help me?


What makes you think nothing is getting to Field2?

What sort of table is Field2 in? You're not going to tell us someone defined that in DB2 are you?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Aug 20, 2011 1:05 am    Post subject:
Reply with quote

Priyanka Pyne,

Rarely does Akatsukami use such strong words when commenting.

He, by the way, had no doubts about the technical matter.
If he had any doubts at all, it was about your capabilities and skills.

now, comp-5 is binary.
(by the way, both fields are numeric)

you stated:
Quote:
field2 is a field of the table.


that can only interpreted as a field of an item of a COBOL Internal Table.
you are not talking about a DB2 column, because the SCALE of a column is always 0 if the datatype is not DECIMAL.

So, back to your COBOL field definitions. Why is the field2 defined as BINARY instead of PACKED-DECIMAL?
if your answer is the the table was designed that way, and I can't change it
the you need to speak to the designer, because his knowledge base is also severely lacking.

and you should refrain from snide, insipid retorts,
especially if you want help,
and you definitely need it
Back to top
View user's profile Send private message
Priyanka Pyne

New User


Joined: 09 Feb 2008
Posts: 95
Location: India

PostPosted: Sat Aug 20, 2011 1:17 am    Post subject:
Reply with quote

I am sorry if I sounded rude.

Table layout cannot be changed as this is already in production and many other program is using this. Here all my tables are in SQL server.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Sat Aug 20, 2011 1:41 am    Post subject:
Reply with quote

Priyanka, you have offered no evidence that the value of your display variable is or isn't being moved to your COMP-5 variable. However, I will offer a method of producing such evidence. Other senior members may provide preferable methods.

At some point in your program, you probably have a statement like:
Code:
MOVE DISPLAY-VARIABLE TO COMP-5-VARIABLE.

Follow it immediately with the statement:
Code:
CALL 'CEE3ABD' USING FOO, BAR.

In the WORKING-STORAGE section, declare:
Code:
01 FOO      PIC 9(8) BINARY VALUE something less than 4096.
01 BAR      PIC 9(8) BINARY VALUE 1.

This will cause your program to abend -- an actual, honest-to-Kamisama abend, not a JCL error, non-zero return code, scary and mysterious message, or any of the other yivshish that your colleagues miscall abends.

Find DISPLAY-VARIABLE and COMP-5-VARIABLE in one of the dumps -- for the moment, I will presume that you can do this. Copy and paste the code executed just before CEE3ABD is called, and the lines from the dump containing the storage for the variables in question. If you do this, we can proceed.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Aug 20, 2011 1:44 am    Post subject:
Reply with quote

Priyanka Pyne,

in SQL Server, COMP-5 is for INTEGER (tiny, small, int, large) and they,
as DB2,
require a scale of 0.

the only datatype that can have a SCALE GT 0 is
decimal for db2
decimal and numeric for MS-SQL, OPENESQL and DB2 LUW.

and all use PACKED-DECIMAL (COMP-3) Host Variables
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Aug 20, 2011 1:58 am    Post subject:
Reply with quote

Priyanka,

I'd suggest you also produce the pseudo-assembler that the compiler generates when you make Akatsukami's "changes".

Maybe add some code after the call, just to do some simple maths so you can see what is generated. It will probably be pretty horrible, but that is what your fields are going through with that definition.

Look up the documentation for your "table" and tell us the reason the field is defined that way, please.

Other nice ways to dump, add one to a non-initialised comp-3 field, call "foo". The last I always found the quickest. I like DISPLAY for information about known problems, when there is something I don't yet understand, I like a dump - no double entendre intended :-)
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am


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