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
 

 

Moving Signed value to Alpbha-numeric field.

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

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Mon Nov 19, 2007 4:18 pm    Post subject: Moving Signed value to Alpbha-numeric field.
Reply with quote

Hi all,

I have a field like below.

WS-ITR PIC S9(04).

But in DB2 table, the corresponding column data type is VARCHAR(04).

So I have to move it to Alpha-numeric field say X(04). And X(04) is enough or not?

Or X(05) is needed to retain sign?

Consider the value for WS-ITR is -2009. So, in this case, is it possible to have sign stored in database?

Note : I think S9(04) will take only 4 bytes in memory. Correct me if I am wrong.

Thanks,
Gnanas
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Nov 19, 2007 6:25 pm    Post subject: Re: Moving Signed value to Alpbha-numeric field.
Reply with quote

gnanas wrote:
Hi all,

I have a field like below.

WS-ITR PIC S9(04).

But in DB2 table, the corresponding column data type is VARCHAR(04).

So I have to move it to Alpha-numeric field say X(04). And X(04) is enough or not?

Or X(05) is needed to retain sign?

Consider the value for WS-ITR is -2009. So, in this case, is it possible to have sign stored in database?

Note : I think S9(04) will take only 4 bytes in memory. Correct me if I am wrong.

Thanks,
Gnanas


You have a serious design problem that needs fixed. You could refine the s9(4) field as x(4) then store the x(4) field in the database but many times it would apear to be garbage and would not be searchable. Why would you want to do this?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Mon Nov 19, 2007 7:04 pm    Post subject: Re : Moving Signed value to Alpha-numeric field.
Reply with quote

Craq Giegerich says

Quote:
... store the x(4) field in the database but many times it would apear to be garbage and would not be searchable.



Could you please explain in detail? I couldn't get the point.

Thanks,
Gnanas
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Nov 19, 2007 7:30 pm    Post subject:
Reply with quote

pic s9(4) will indeed only use 4 bytes since the sign is an overprint. that is what craig meant by garbage. (e.g. -234 WB 023M) now, how could you find that?

but as craig said, if you have numeric data, store it as numeric data; to do otherwise is just rookie behavior.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Nov 19, 2007 10:54 pm    Post subject:
Reply with quote

Hello,

Hopefully, this signed, zoned-decimal number will not be used as a key. . .
Back to top
View user's profile Send private message
balbudheprashant
Warnings : 2

New User


Joined: 24 Aug 2007
Posts: 5
Location: Pune

PostPosted: Tue Nov 20, 2007 2:56 pm    Post subject:
Reply with quote

[quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code][list][list=][img][/img][url][b][i][u][quote][code]
    [list=][img][/img][url][b][i][u]
    Quote:
    [code]
      [list=][img][/img][url][/url]
    [/code]
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Tue Nov 20, 2007 3:07 pm    Post subject:
Reply with quote

Prashant ,

What is this? I don't understand.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Nov 20, 2007 3:52 pm    Post subject:
Reply with quote

Why in the world are you using a varchar for 4 bytes? considering that you will always have a length for two bytes you are creating a 6 byte column, of which 4 bytes are available for data and you are trying to stuff 5 descret characters into it.

although s9(4) only takes up 4 bytes, you need five bytes to make any sense out of it (to show the sign).

suggest the varchar(04) column be dropped and a either a char(5) or smallint column be added.

if you just have to go with the char col, suggest you move the host variable s9(4) to an edit mask, then update the column with the edit mask.
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 Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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