Home > Ask the AS/400 Experts > iSeries Application Development Questions & Answers > Chain operation error after converting RPG3 to ILE RPG (RPGIV)
Ask The iSeries 400 Expert: Questions & Answers
EMAIL THIS

Chain operation error after converting RPG3 to ILE RPG (RPGIV)

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


iSeries news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 30 April 2008
I recently had an old RPG3 program that I ran through IBM's cvtrpgpgm to make it an RPGLE (I added some fields to a file and the field names were longer than 6 characters). It compiled just fine but the first time it ran it gave me the error "The target for a numeric operation is too small to hold the result." The statement that it said was in error was a chain operation. Can you explain why?

>
EXPERT RESPONSE
RPGIV (ILE RPG) treats binary numeric fields in peculiar ways. See this discussion on the subject by Joe Pluta.

You can see from the article that RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED (!). This means that when you CHAIN a record, the incoming data has to be converted from Integer (which RPGIV thinks is Binary) to Packed - and RPG has not allowed enough digits to hold the data. So, it generates the error message.

The best way to get around this is to ALWAYS use an externally-described data structure to hold an incoming record:

D DataIn E DS ExtName( MyFile )

...you don't need any more than that. The record from MYFILE will automatically dump its data into the structure, and RPGIV will obey the record format definition in the EXTNAME keyword, so it will NOT start redefining fields as packed.


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


RELATED CONTENT
iSeries Application Development
Monitoring escape messages and using RCVMSG for diagnostic messages
Listing contents of multiple FTP directories on AS/400
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?
Passing parameters in an ILE RPG module

RPG iSeries programming
How to: Sort arrays using RPGIV
How to: Create an RPGLE array
How to use an embedded SQL statement and display the result in a subfile
Eight steps for creating program documentation using AS/400 utilities
Application modernization for the iSeries: Why bother?
RPG application gets a Web revamp at Pinnacle Foods
There is very little RPG on System i can't do: From RPG nay to RPG yay!
RPG application modernization for i5
RPG dynamic value calculation versus hard-coded values
COMMON product round-up: Modernizing the IBM System i

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Report Program Generator  (Search400.com)

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 enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




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