Home > Ask the AS/400 Experts > iSeries Application Development Questions & Answers > Decimal data error
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

Decimal data error

John Blenkinsop EXPERT RESPONSE FROM: John Blenkinsop

Pose a Question
Other iSeries 400 Categories
Meet all iSeries 400 Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 07 April 2005
I am passing an 11 digit number (no decimals) around in a CL program, when calling it from an RPG. Interactively this works fine, but when I try to submit the CL, the submitted job goes to message wait, saying that there is decimal data error, and it is the 11 digit number that has the problem. Is there a way to overcome this? Would CL ILE help?

>
The number is probably defined in the CL as:

DCL VAR(&NUM) TYPE(*DEC) LEN(11 0)

When you call the CL from your RPG program, it is declared in the RPG as 11,0 packed decimal. This works.

But when you call the CL from SBMJOB or a command line, you can't pass the number as just a naked number:

CALL PGM(MYPGM) PARM(123)

or even in quotes:

CALL PGM(MYPGM) PARM('00000000123')

That's how you get decimal data errors. You have to pass the number as a packed numeric string:

CALL PGM(MYPGM) PARM(X'00000000123F')

This is obviously inconvenient, if the value is subject to frequent change. But if it's going to remain fairly constant on the SBMJOB command, you can live with it.

The only other way is to declare the parameter as a *CHAR of 11 bytes (in your RPG too) and convert the incoming value into a numeric field for the CL to use correctly. CHGVAR can handle that, if the character variable contains valid numbers. The call will then be:

CALL PGM(MYPGM) PARM('00000000123')

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries Application Development
Monitoring escape messages and using RCVMSG for diagnostic messages
Listing contents of multiple FTP directories on AS/400
Chain operation error after converting RPG3 to ILE RPG (RPGIV)
Space offset X'0015FF00' or X'0000000000000000' is outside current limit for object QIGC2424C
Searching fields for values
iSeries application display subfiles with other program windows
Searching part of a name or address in AS/400
Passing parameters in an ILE RPG module
What's happening to my subfile?
What happening to my subfile?

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



iSeries Networking - Printing, Remote Access, TCP/IP
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts