IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Convert an edited format to a packed decimal


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Jun 23, 2009 5:22 pm
Reply with quote

Hi all,

i need to convert 9(09).99 to S9(09)V99 COMP-3. how can i convert an edited format to a packed decimal.

thanks,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 23, 2009 6:18 pm
Reply with quote

MOVE? COMPUTE? ADD?

Why are you not reading the manual to find the answer to this question -- the manuals link at the top of the page has the COBOL Language Reference and Programming Guide available.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Tue Jun 23, 2009 10:54 pm
Reply with quote

Hi Robert,

i used NUMVAL and it work good. but i need some info about

Quote:

automatic "de-editing" in COBOL


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

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 23, 2009 11:20 pm
Reply with quote

Chapter 6.2.24.1.1 of the COBOL Language Reference talks about elementary moves -- if you have specific questions, either test some code or post a question. Broadly speaking, COBOL for the most part will figure out the numeric value and move it to the numeric variable.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jun 24, 2009 7:36 am
Reply with quote

Hi Arvind,

If you're sure of the content (format) of the sending edited field just MOVE it to the packed field.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jun 24, 2009 8:06 am
Reply with quote

Hello,

Quote:
automatic "de-editing" in COBOL
Quote:
If you're sure of the content (format) of the sending edited field

And there is the biggest pitfall. . . (IMHO)

While a simply MOVE or NUMVAL(-C) make for some very easy coding, they all "blow up" when the content is not perfect. . . Which has caused many an abend in running production code.

People who have very little or "bad" experience (improperly trained and managed) drop in the simple code and then cannot imagine how they got an 0c7 in production and have no idea how to isolate the problem once the production job abends.

Unless i didn't get the memo, there is no simple way to ensure that the "edited" sending" field is valid. . .
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Wed Jun 24, 2009 12:20 pm
Reply with quote

www.ibmmainframes.com/about40165.html
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 24, 2009 5:12 pm
Reply with quote

Quote:
Unless i didn't get the memo, there is no simple way to ensure that the "edited" sending" field is valid. . .
Dick, you're missing the obvious ... if the program gets a S0C7 abend, then the data was bad. Kind of negative proof, but still pretty simple.

Of course, I tell my programmers that the S0C7 is the one abend that is completely programmer caused (they don't necessarily believe me, but I do tell them that).
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jun 24, 2009 8:52 pm
Reply with quote

Hi Robert,

Quote:
if the program gets a S0C7 abend, then the data was bad.
My point exactly. . . And the 0c7 is a bit late. . .

There are now several ways to "shoot off your foot" with the "improved" moves and functions because the same moves/functions do not provide a way to detect bad data, set a testable indicator, and prevent the abend.

Most of the inexperienced people i see who discover these "easier" instructions do all of their testing with valid data. When i have them change the data to include some invalid values, they nearly panic when the job abends (and this is still in test) - what to do to prevent this?

If some input comes with no manual changes from some other computer system (not some spreadsheet or keyed entries from a form), there may be reason to "trust" the data. Any "raw" input must be validated first (IMHO).
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 24, 2009 9:28 pm
Reply with quote

Quote:
When i have them change the data to include some invalid values, they nearly panic when the job abends (and this is still in test) - what to do to prevent this?
I have so much fun when assigned to testing -- it is a rare program I can't "break" (abend or process incorrectly) within 2 or 3 runs of data, whether or not I know anything about the program code. Programmers expect their data to be just so, and their code generally doesn't properly handle all the error conditions (not to mention boundary conditions).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top