BCD Websmat



HOME    SUBSCRIBE

  Midrange Guru - OS/400 Edition

 

Editors: Ted Holt      Managing Editor: Mari Barrett
Howard Arner Technical Editor: David Morris

Topics Covered In Volume 1, Number 4:

Finding FIXNBR

Hey, Ted:

When you compile RPG with Create Bound RPG (CRTBNDRPG) or Create RPG Module (CRTRPGMOD), there is a Fix Number (FIXNBR) parameter you can set for numeric data errors. However, I can't find a way to see how that is set in a compiled object. DSPMOD doesn't show me. I haven't looked for an API yet. Do you know of a way?

There isn't a way to determine the setting for this from a compiled object, because FIXNBR isn't used to generate an attribute of the program. It's just used to generate code one way or the other. I suggest that you put the FIXNBR parameter in the H spec of the source member. (Not even in a /COPY H spec, and for sure not in a data-area H spec.) This would let you determine the FIXNBR setting by looking at the source code.

If you need to determine whether an existing program was compiled to fix bad numeric data, there is a kludgey way to find out. Set up a test environment, with blank copies of the files the program reads. Create a dummy program described file in QTEMP and initialize it with one blank record.

CRTPF FILE(QTEMP/XX) RCDLEN(80)
INZPFM FILE(QTEMP/XX) TOTRCDS(1)

Copy the blank record to the copies of the production files.

CPYF FROMFILE(QTEMP/XX) TOFILE(CUSTOMER) MBROPT(*ADD) FMTOPT(*NOCHK)

Now the copies of the production files have invalid data in the numeric fields. Run the program and see if it cancels or not. If you get an error message that says it found invalid decimal data, you know that the program was not compiled to fix bad numeric data.

-- Ted  

 

 

 

Save time and money by doing fast, easy automated or end-user driven iSeries400 Report Distribution, e-mailing, Data Extraction... with the #1 Voted industry tools. Streamline the workflow process!

Whether you want to view reports online with a point & click download feature, or automate the entire process of downloading, converting & distributing reports, you need the right tools:

CATAPULT--Voted the #1 Automated Email Report Distribution tool for 2001. Automatically distribute via email, download and archive reports. Splits reports. Distributes them in the desired format. Converts to HTML, PDF, RTF, TIF. Uses AFP files.

Award winning Spool-Explorer/400 -- End users point and click to view / download reports. Converts to PDF, HTML, RTF... New version 3! Generate bookmarks and hyperlinks based on report contents... more.

Interfaces to EZ-Pickin's or Monarch for powerful data extraction and report mining, update Excel / Access spreadsheets... and so much more.

Also try WebSmart, voted best eBusiness / eCommerce Development and Deployment tool for 2001.

See the difference for yourself. Download and try CATAPULT, Spool-Explorer, EZ-Pickin’s -or- WebSmart now for FREE or get a FREE CD and you'll be more productive the very first day.

Call 630-986-0800 for more information, or visit our Web site at http://www.BCDsoftware.com



 

 

 

ATTEND COMMON IN MINNEAPOLIS OCT 21-25

Join thousands and receive the iSeries IT education you need at the COMMON User Group's Fall 2001 Conference October 21-25 in Minneapolis. Complete information is available at http://www.common.org/Conferences/conf.html

Right now, read what a $995 registration gives you:

You'll choose from over 800 session hours that cover such vital topics as Web development, Java, VPN, WebSphere, Client Access, RPG IV, and Linux. Select the exact education you need and make yourself the problem solver in your organization.

Also, because we'll only be 1 1/2 hours from Rochester, Minnesota, you'll learn more than ever before about the iSeries. More IBMers will be in attendance, and this is a golden opportunity to share ideas with them.

In addition, you'll network with top iSeries professionals and exchange e-mail addresses. This connects you with the people who can help you accomplish more for your company.

To register online and/or become a member go to http://www.common.org/Conferences/confnew.html

Most important: Take action now. Register for the COMMON IT Education Conference, because there's no faster way to increase your value to your organization.




 

Subscription And Advertising Information

Subscription Information

To unsubscribe, change your email address, or sign up for any of Guild Companies, Inc's free email newsletters, visit http://www.itjungle.com. Hit the SUBSCRIBE button on the homepage and it will lead you to our online subscription system.

When you sign up for one of our e-newsletters, you can be assured that your e-mail address will NEVER be sold to an outside company.

Advertising Information

Please contact Timothy Prickett Morgan at

Phone: 212 942 5818

Email: tpm@itjungle.com

Editing in RPG III

Hey, Ted:

I work in a shop where programming is still done with RPG/400. Some people call it RPG III. You know, the kind with E specs for defining arrays. I need to edit numbers before concatenating them in character variables. Since we're not using RPG IV (also sometimes called ILE RPG), I can't use the %editc and %editw built-in functions. How can we edit these numbers?

They won't let you use RPG IV, huh? Bummer.

I recommend you use the Convert Edit Code (QECCVTEC), Convert Edit Word (QECCVTEW), and Edit Code (QECEDT) APIs. These APIs are primarily used in applications that format data for output at runtime and are even more flexible than the %editc and %editw built-in functions. They are also messy because they have about nine parameters each and some of them are binary numbers, which are not exactly user friendly, but they work and IBM supports them.

Here's some sample code you can start from. INAMT is the number to be editing. OUTAMT is the edited number. This code uses QECCVTEC and QECEDT. I'll leave it to you to work up the code for QECCVTEW if you want to use an edit word instead of an edit code.

IERROR DS
I I 16 B 1 40EBYTPR
I B 5 80EBYTAV
I 9 15 EMSGID
I 16 16 E00000
IEDPARM DS
I 1 256 MASK
I I 256 B 257 2600MASKLN
I B 261 2640RVARLN
I 265 265 ZROBAL
I 266 266 EDITCD
I 267 267 CURREN
I B 268 2710VARLEN
I B 272 2750VARDEC
* CREATE THE EDIT MASK (ONE TIME ONLY)
C MOVE 'J' EDITCD
C MOVE '$' CURREN
C Z-ADD9 VARLEN
C Z-ADD2 VARDEC
C CALL 'QECCVTEC'
C PARM MASK
C PARM MASKLN
C PARM RVARLN
C PARM ZROBAL
C PARM EDITCD
C PARM CURREN
C PARM VARLEN
C PARM VARDEC
C PARM ERROR
C EMSGID CASNE*BLANKS ERRSR
C ENDCS
* VAR INAMT GETS ITS VALUE FROM INPUT SOMEWHERE
C Z-SUB1234567.89INAMT 92
* EDIT THE VARIABLE INVAL
C MOVEL'*PACKED' VARCLS
C CALL 'QECEDT'
C PARM OUTAMT 14
C PARM RVARLN
C PARM INAMT
C PARM VARCLS 10
C PARM VARLEN
C PARM MASK
C PARM MASKLN
C PARM ZROBAL
C PARM ERROR
C EMSGID CASNE*BLANKS ERRSR
C ENDCS
C OUTAMT DSPLY
C SETON LR
C ERRSR BEGSR
C DSPLY
C ENDSR

Here's something else I ordinarily don't recommend, but it's quick to implement, especially if you ever worked with RPG II and are used to I and O specs. It's an old technique, so I present it as a historical curiosity. After the advertisement below, I'll show you another way.

 

 

Reorg While Active

Any further explanation needed?

Reorg While Active does just what its name says, reducing downtime associated with reorganizing AS/400 files to just seconds. Now, you can reclaim lost disk space without taking users down.

Reorg While Active offers advanced functionality for improved AS/400 performance and user response times. Inexpensive and easy to use, Reorg While Active features fully automated installation and operations.

ITera, Inc. helps you live the promise of 24x7 computing. Visit us today at http://www.iterainc.com for more information, or simply call us at 800-957-4511 ext. 150.



 

Let's continue with the editing in RPG III problem.

You can use a SPECIAL file to edit numbers. A special file is a disguised call to another program.

Here's a program that needs to edit a nine-digit number with two decimal positions using the J edit code.

FSPECIAL CF F 13 SPECIAL EDIT1
FQSYSPRT O F 132 OF PRINTER
ISPECIAL XX
I 1 13 EDITED
C Z-SUB9876543.21NUMBER 92
C EXCPTELINE
C READ SPECIAL 9090
C MOVE *ON *INLR
OSPECIAL E ELINE
O NUMBERJ 13
OQSYSPRT T 1 LR
O EDITED 13

A number of that size takes 13 positions when edited, so it is output to the special file with edit code J specified, then read back in from the special file in positions 1 through 13.

Here's the EDIT1 program, which is called when I/O is done to the special file.

C *ENTRY PLIST
C PARM OPTION 1
C PARM STATUS 1
C PARM ERROR 5
C PARM AREA 13
C OPTION IFEQ 'C'
C MOVE *ON *INLR
C ENDIF
C RETRN

Notice that this program doesn't do anything. The editing is done in the calling program, not in the called program. The called program is merely a way of passing data from the output to the input specs in the calling program.

But, as I say, I present this only as a curiosity. If at all possible, use RPG IV to do that editing for you.

-- Ted


Reader Feedback And Insights

One of the great things about the OS/400 community is that it is indeed a community. We may be all working from our cubicles, but we are all connected and trying to figure out how to best employ the computer technology at our disposal. There are more than a few ways to skin any cat, and if you have a clever and unique answer to a problem that one of our Midrange Gurus has solved, we'd love to hear from you. This newsletter is an open dialog, and we value your input as well as your readership.

It goes without saying--but we'll say it anyway--that your hard technical questions pertaining to real world problems are equally valuable as a foundation for this newsletter as are your programming insights. We hope you find all the editions of Midrange Guru valuable, and we are going to work hard to make sure that they are.

Contact the Editors

If you have a tough problem, our gurus can probably help. Their mailboxes are always open.

* Email Ted Holt at tholt@itjungle.com

* Email Howard Arner at harner@itjungle.com

BCD Websmat

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved. This document may be redistributed freely and enthusiastically by email, but only in its unedited form. Thanks for your cooperation. Midrange Guru is a registered trademark of Guild Companies, Inc. IBM, AS/400, iSeries, OS/400, and eServer registered trademarks of International Business Machines Corp. All other product names are trademarked or copyrighted by their respective holders.