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 an edited format to a packed decimal

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Convert an edited format to a packed decimal
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Tue Jun 23, 2009 6:18 pm    Post subject:
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    Post subject:
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Tue Jun 23, 2009 11:20 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Jun 24, 2009 8:06 am    Post subject:
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    Post subject:
Reply with quote

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jun 24, 2009 5:12 pm    Post subject:
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

Site Director


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

PostPosted: Wed Jun 24, 2009 8:52 pm    Post subject:
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Wed Jun 24, 2009 9:28 pm    Post subject:
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    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 READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am


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