QEZDATVL and Security Level 40
If you use program QSYS/QEZDATVL to convert, edit, and verify dates, you shouldnt. This program will not run under security level 40 because it resides in the system domain. If you move to security level 40, as IBM recommends, your programs will fail when they call QEZDATVL.
One alternative is to write a CL program to replace it, as in Figure 1. Bruce Vining
IBM Rochester
What Causes a Receiver Too Small Error?
Q: No matter how large I define result, the RPG IV code in Figure 2 produces error MCH1210 (Receiver value too small to hold result), followed by RNQ0103 (The target for a numeric operation is too small to hold the result). However, if I replace the eval with a mult operation, as in Figure 3, it works fine. What gives?
Dale Monti
A: Both operands are integers, so the result of a * b is put into a temporary integervariable. Since 2255288 * 1024 doesnt fit in an integer, an overflow error occurs on the assignment to the temporary variable.
You can avoid the error by forcing the compiler to use a temporary packed decimal variable. Figure 4 shows a couple of ways. The first introduces a packed value (0.0) into the expression, so a packed temp must be used. The second uses the %dec built-in function (available with V3R7 and above) to explicitly declare a packed temporary.
Barbara Morris IBM Toronto RPG Compiler Development
Looking for AS/400 Information Offline?
If youre looking for a replacement for your old hardcopy programming manuals, try visiting the IBM AS/400 Online Library at
http://as400bKS.rochester.ibm.com:80/bookmgr/home.htm (shown in Figure 5). This is a fairly complete site that contains online IBM Redbooks as well as HTML manuals for the last CISC-based AS/400 (V3R2) and for all RISC-based AS/400s (V3R6, V3R7, V4R1, and V4R2).
IBM has converted many V4R1 and V4R2 manuals to the PDF file format, which can be read with the Adobe Acrobat Reader. This format allows you to download current manuals to view them offline or load them onto your network for shared viewing by your staff. With PDF files, you can view and print manual pages without dialing in to the Internet. You can even load a manual onto a laptop for catching up on technical reading when you cant sign on to the Internet.
You can download a free copy of the Acrobat Reader from the Adobe Web site: http://www.adobe.com/prodindex/acrobat/readstep.html.
Joe Hertvik Editor, Client Access/400 Expert
Change the Name of Your PC5250 Session in the Windows 95/NT Taskbar
Q: How can I change the name of a PC5250 Client Access/400 for Windows 95/NT session in the Windows taskbar so that it comes up with something more descriptive for my users than Session A - [24x80]?
Anonymous
A: Inside your PC5250 session, click on the Appearance option from the PC5250 menu. On the drop-down menu that appears, click on Window Setup to bring up the Window Setup screen shown in Figure 6. In the Windows Title area, there are a number of options for changing the window title of your session. To remove the Session A literal from your title, remove the checkmark from the Long Session-ID check box. To remove the [24x80] window size literal, turn off the checkmark in the Sessions Dimensions check box.
To type in your own text so that something more descriptive comes up in your window title, click the Session Name check box so that it contains a check mark. Then, in the adjoining text box, type in any character string (16 characters or fewer) that you want to appear. When you click on OK to return to your PC5250 session, this new title will appear in the following places on your PC:
The window title of your PC5250 session
The taskbar button for your program on the Windows 95/NT taskbar
The icon description that appears when you use the Alt-Tab key combination to choose a program to transfer to
There are other options as well, but these settings will solve your problem and make your sessions more descriptive for your users.
Joe Hertvik Editor, Client Access/400 Expert
Using the Web to Find the Latest PTF
Want a quick way to find out if your AS/400 has the most current PTFs? Heres
how.
From an AS/400 command line, type in the Display PTF (DSPPTF) command as shown here and press Enter.
DSPPTF LICPGM(*ALL) SELECT(*ALL)
Youll be presented with a screen showing all PTFs on your system. Now, get on the Internet, and point your browser to http://as400service. rochester.ibm.com/as4sde/sline003.nsf/sline003home. Youll find yourself on IBMs AS/400 Preventive Service Planning Information Web page. From here, you can display the Preventive Service Planning (PSP) documents for the release of the operating system you are on. IBM uses PSPs to let you, the AS/400 operator and user, know what PTFs are currently available.
This site will also inform you of any last-minute changes or modifications that might affect system upgrades. In fact, in the Power PC Upgrade Roadmap, which is used as the checklist for doing a CISC-to-RISC migration, you are strongly encouraged to check this Web site before starting the upgrade because this information is the most up-to-date information available regarding AS/400 changes and fixes.
If you find you need to download a PTF, use the Send PTF Order (SNDPTFORD) command from your AS/400 to download or order that PTF.
Shannon ODonnell Midrange Computing Associate Editor
Transferring AS/400 Save Files with FTP
AS/400 save files are the PKZIP of the midrange. I transfer them all the time using FTP. I can quickly transfer a save file from one AS/400 to another, or I can download a save file to my PC and send it to whomever as an email include.
The process is simple, and, if you are comfortable with FTP, I can summarize it in one word: BINARY. The AS/400s implementation of FTP assumes, unless told otherwise, that file transfers are for text files and, as such, will require EBCDIC-to-ASCII translation. Just think what thatll do to your save file! The binary FTP directive says dont do that to the AS/400.
In a nutshell, then, heres how to FTP a save file from an AS/400 to a PC and from an AS/400 to another AS/400.
Downloading an AS/400 Save File to Your PC
1. Start FTP on your PC (FTP.EXE).
2. Type in the Open command, and FTP will prompt you for the TCP/IP address or Host Name of the AS/400 system from which you are transferring files. It will also prompt you for the user profile name and password to use when logging on to your AS/400. Enter the appropriate information.
3. Enter the BINARY directive (or the abbreviation, BIN).
4. Get your save file to the PC with the GET Library/ SaveFileName PCFileName command. For instance, to download a save file called SAVESTUFF in my DENONCOURT library to the C:workmcseptember directory on my PC, I entered the following command:
get DENONCOURT/SAVESTUFF c:workmcseptemberSaveStuff.sav
Uploading a PC File That Contains an AS/400 Save File to an AS/400
1. Create or clear the AS/400 save file that is to be uploaded. If the save file does not already exist, FTP will create a file for you, and it will not be of type *SAVF:
CRTSAVF DENONCOURT/RESTORSTUF
or
CLRSAVF DENONCOURT/RESTORSTUF
2. Start FTP on your PC (FTP.EXE).
3. Type in the Open command, and FTP will prompt you for the necessary login information, including TCP/IP address or Host Name of the AS/400 system, user profile name, and password.
4. Enter the BINARY directive (or the abbreviation, BIN).
5. Transfer the file from your PC to the AS/400 with FTPs put command:
put c:workmcseptemberSaveStuff.sav DENONCOURT/RESTORSTUF
Transferring an AS/400 Save File Between AS/400s
1. Start FTP:
STRTCPFTP RMTSYS(Other400DomainName)
2. Enter your user profile and password.
3. Create or clear the AS/400 save file that is to be uploaded. If the save file does not already exist, FTP will create a file for you, and it will not be of type *SAVF:
CRTSAVF DENONCOURT/RESTORSTUF
or
CLRSAVF DENONCOURT/RESTORSTUF
4. Enter the BINARY directive (or the abbreviation, BIN).
5. Transfer the file from the local or current AS/400 to the host AS/400 with FTPs put command:
put DENONCOURT/RESTORSTUF HOSTLIB/RESTORSTUF Optionally, you could transfer the file from the host AS/400 to the current or local AS/400 with FTPs get command:
get HOSTLIB/RESTORSTUF DENONCOURT/RESTORSTUF (REPLACE
For the get command only, you need to use the (Replace parameter to clear out the save file on your AS/400 (the put command clears out the save file for you). Note that there is no closing parenthesis on this parameter.
One warning: Take care when transferring a save file from one AS/400 to another, or you might overlay an important save file. Its easy to get confused if the library and file names are the same. FTP is so easy to use that you can easily update the new version of a library with an old versioneffectively wiping out all of your updates. Just remember that the TCP/IP address that FTP uses is considered the host site. The FTP get command copies the file from the host to the local machine, the one from which you entered the Start TCP/IP FTP (STRTCPFTP) command. The FTP put command copies the file from the local machine to the host machine.
Don Denoncourt Editor, AS/400 NetJava Expert
Who Took My Tools?
Q: What happened to the Edit File (EDTF), Display Stream File (DSPSTMF), and
SQL Utility (SQLUTIL) commands that shipped with PTF SF38832 on V3R7? We have two new
AS/400s running V4R2 and cannot find these commands on the machine. We cant even find
a PTF to install them.
David Blair
A: The source for those tools continues to be in QUSRTOOL, an optionally installed library of OS/400. The object code is in PTFs SF41518 (V4R1) and SF45296 (V4R2).
Bruce Vining IBM Rochester
Send Messages to Groups of Users
Option 3 of OfficeVision/400s main menu lets you send a message to a distribution group. If you dont have OV/400, or if you need to send messages to groups from CL programs, you might want to use the Send Group Message (SNDGRPMSG) utility. This utility consists of two objects: command SNDGRPMSG and OPM CL program GRP005CL. Source code for the two is shown in Figures 7 and 8 respectively.
First, you must set up a way to define groups of users. SNDGRPMSG uses members of a source physical file called MSGGROUPS. Each member is a group, and each record in a member contains a user profile name. To create the MSGGROUPS file, see the compilation instructions for program GRP005CL. Notice that the record length is 22 bytes, which allows for the fields SRCDAT (length 6), SRCSEQ (length 6), and SRCDTA (length 10). User IDs are stored in the SRCDTA field. Use PDM or SEU to maintain the source members.
I have found this command very useful. For instance, I include it in month-end programs to let all users in a certain department know when month-end is running.
Dan Wilson Sierra Pacific Industries
Editors note: What a great idea! If you have the TAATOOL library installed on your system, you also might want to take a look at the SNDGRPPRF (Send Group Profile Message) command.
SQLs UNION Merges Data
Q: I need to write an SQL query that retrieves customer address information. These addresses are fields CADD1 and CADD2 in the customer master file. However, if the alternate address flag, ALTADD, has a value of Y, I want to retrieve fields AADD1 and AADD2 from the alternate address file instead. Can that be done?
A: You need to use SQLs UNION operator. UNION combines the results of two queries into one resulting set of data. See the example in Figure 9.
Bill Robins
Get the Messages You Need
When users tell me they have submitted a job that is hung up in the job queue, the first thing I do is look at the message that the job sent to QSYSOPR to determine the facts of the matter. QSYSOPR usually has a lot of messages, and I want to quickly weed through the informational messages to get to the ones that need replies (the inquiry messages). To get to those messages, I key the following command:
DSPMSG QSYSOPR MSGTYPE(*INQ)
All inquiry messages will be displayed, whether they have been answered or not. I often use this display as my starting point for finding and fixing problems. To further filter out the routine messages, I sometimes indicate a minimum severity level:
DSPMSG QSYSOPR MSGTYPE(*INQ) SEV(70)
All inquiry messages with a severity level of 70 or above will be displayed. From there, I can easily find the message that was sent by my users job.
Lisa Patteson CMI Industries, Inc. efa002/efa/lzpattes%
Editors note: This is a good way to quickly find a message needing a reply, especially if you dont know the name of the user profile under which the job is running, or the name of the subsystem in which it is running. Other good commands for locating unanswered batch job messages are Work with User Jobs (WRKUSRJOB) and Work with Subsystem Jobs (WRKSBSJOB).
PGM PARM(&DATEIN &DATEOUT)
DCL VAR(&DATEIN) TYPE(*CHAR) LEN(6)
DCL VAR(&DATEOUT) TYPE(*CHAR) LEN(8)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) VALUE(QCPFMSG)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) VALUE(*LIBL)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(256)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR_MSG))
QSYS/CVTDAT DATE(&DATEIN) TOVAR(&DATEOUT) FROMFMT(*JOB) +
TOFMT(*JOB) TOSEP(*JOB)
RETURN
ERROR_MSG:
QSYS/RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) SNDMSGFLIB(&MSGFLIB)
MONMSG MSGID(CPF0000)
QSYS/SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA)
MONMSG MSGID(CPF0000)
ENDPGM
Figure 1: CL code that mimics QEZDATVL
D a s 10I 0 inz(2255288)
D b s 10I 0 inz(1024)
D result s 17S 0 inz(0)
C eval result = a * b
Figure 2: Using eval produces MCH1210 and RNQ0103 errors
C a mult b result
Figure 3: Using mult does not produce an error
C eval result = (a + 0.0) * b
C eval result = %dec(a * b)
Figure 4: Two ways to force a temporary packed decimal variable
|
LATEST COMMENTS
MC Press Online