Dont Believe Every V4R3 Automatic Installation Message
Last week, I installed V4R3 on our test machine using the automatic installation option. If you use automatic installation, one of the tasks you must perform before you actually install the software is to create and customize an installation list.
This procedure is explained in detail in the Software Installation Guide (SC41- 5120-01, in my case). Producing the installation list is accomplished using the Work with Licensed Programs (LICPGM) menu. The steps include the following:
Select option 5: Prepare for Install
Select Work with Licensed Programs for Target Release
Load the first CD-ROM in your optical drive and specify Generate List Form Distribution Media
After all CD-ROMs have been read, select the option to List Licensed Programs Not Found on Media When I listed the programs not found on media, one program product was listed: 5769AC3 Cryptographic Provider 128-bit. I thought this a bit strange, but knew I could get the product and install it later. I proceeded with the automatic installation steps. The last step is to reload all the CD-ROMs during a special IPL. After I completed the process, the message Automatic installation not complete appearednot a friendly message. The manual states that you should go to recovery procedures when you receive this message.
After investigating the problem thoroughly, I found that the installation had, in fact, completed properly. Evidently, the system isnt intelligent enough to know that the program product listed as missing had already been discovered during the production of the installation list and was not crucial to system operation. If the product had been part of the base operating system (5769SS1), I can see how there would be a problem. But why the system responds as if any program product not installed will interfere with system operation is a mystery to me.
If you do find that youre missing a program product when you produce your installation list, you can either call IBM and get the product before the installation or do what I did: Install the system and get the software later. Theres no problem installing a program product after you upgrade to a new release as long as its not part of the base operating system. So, if youre under time constraints, you can install the system first and the missing program product later.
D. Ellis Green
Senior Technical Editor Midrange Computing
Code Snippets
If youve ever been assigned a project and thought, Man! I wish I had an example of how to do that! or even, Gee, wouldnt it be great if someone had already written this routine so I could just copy it into my program? youre in luck! Midrange Computing isnt the only place where you can find code samples (although it is the best source!). IBM also provides code samples in several languages on its Developers Resource Web site.
For example, if youre looking for a way to format an RPG IV numeric field with its edit word so that it can be properly viewed in a browser, its here! Looking for an RPG IV prototype that will let you execute CL commands from within your RPG IV programs?
Its here! Looking for a Common Gateway Interface (CGI) program example that reads HTML statements from a database and writes it to a browser? Its here! Examples are given for the following: C, CL, CMD Macros, COBOL, DDS, HTML, NET.Data macros, REXX, RNHLIB Menu source, RPG, and Service Procedures. This information can be found at the following URL: http://www.as400service.ibm.com. Once you get there, click on Technical Studio and then scroll down the left frame to Developers Resource and click on Code Snippets.
Shannon ODonnell Associate Technical Editor Midrange Computing
Dumping an Objects Contents
Want a quick way to find out whats inside an object? Use the Dump Object (DMPOBJ) command. This command dumps the contents or the attributes of most AS/400 objects to a spooled file named QPSRVDMP. You can display the spooled file to see the objects contents.
This command is especially useful for dumping the contents of objects that have no display command, like data queues. DMPOBJ is much easier to use than the Retrieve Data Queue Message (QMHRDQM) API, and is not destructive like the Receive Data Queue (QRCVDTAQ) API. Whether its the contents or the attributes of the object that get dumped depends on the object type. You might use this command to dump other objects as well, such as directories, modules, user spaces, journal receivers, and even entire libraries.
Brian OGara
Natural Partners: %editc & %dec
The %dec and %dech built-in-functions (BIFs) have been around for a while, but, until recently, I had never put them to any use. As it turns out, this was my loss. Ive come to realize that the %dec and %dech BIFs, in partnership with the %editc and %editw BIFs, are very effective.
In the past, whenever I wanted to use an edit code on a number, but the number was too big or had too many decimal places, I moved it to a field of the correct size; then, I did the %editc on the correctly sized field. I hated having to do thisit made a simple operation span three separate lines of code: a D-spec for the temporary field, and two evals.
The %dec function allows you to adjust a numeric fields size without using a temporary field. (The %dech function is similar; the difference is that it half-adjusts.) For example, suppose you had a field called BigField that was defined as being 13-packed with
three decimal places but you wanted to print it on a report as a rounded 6-packed with one decimal place. The code fragments in Figure 1 demonstrate how you can easily do this using the %dech and %editc BIFs.
John V. Thompson
Editors note: If significant digits get truncated when copying a larger variable to a smaller one, youll get an error. Be sure the values in the large variable are no bigger than the size parameter of %dec and %dech.
Avoiding MCH1202 Errors
One of COBOLs limitations is that it does not automatically initialize numeric fields to zeros when writing data to a file, something that RPG does very well. Instead, by default, it places blanks in numeric fields. When another program tries to read a numeric field containing invalid data, it receives the infamous MCH1202 error.
You can make sure that you move zero values to empty numeric fields when writing data to a file in programs that you are working on, but how can you avoid getting the MCH1202 error when working with data written by other COBOL programs? As more and more mainframe shops migrate to the AS/400, the occurrence of this error message has become more prevalent.
Using the IF NUMERIC command phrase in COBOL (see the code fragment in Figure 2), you can perform a simple test to determine if a field contains numeric data. IF NUMERIC is similar to the TESTN operation code in RPG. If the test fails, perform the appropriate routine to take corrective action.
Jeff Mileham Levi, Ray & Shoup, Inc.
Converting Hexadecimal to Decimal in COBOL
If youve ever had to migrate data from a mainframe or a UNIX box, youve probably been exposed to data that was stored as hexadecimal. Generally, when you migrate it to the AS/400, you may find that you have a problem showing that data on a display screen or report. Heres an easy solution.
With a simple move statement, a character field containing a hex value can be converted to a decimal number for display purposes (see Figure 3). The hex value is moved to the low-order byte of a 2-byte binary field (which, in COBOL, is created by defining a 4-decimal digit binary field). Since the field has been redefined as alpha, the move statement is legal, and the decimal equivalent can now be displayed.
If, for some reason, you want to display a decimal number as a hexadecimal number on a screen, use the remainder method (Figure 4). To use this method, first divide the decimal number by 16 (HEX is in base 16); place the quotient in byte 1 and the remainder in byte 2. Next, check the numeric value of each byte. Values less than 10 can be moved, while values 10 through 16 must be first evaluated as characters A through F and then moved accordingly. The converted hex value can now be displayed.
Tom Conover
Locking Down Your Network Drive
Looking for a quick way to keep your Client Access/400 users from getting into your sensitive document files stored in the QDLS directory in the AS/400 Integrated File
System (AS/400 IFS)? One method to do so is to create a generic user ID that does not have a directory entry on the AS/400. When the client connects to the AS/400, it cannot access QDLS since it does not have a directory entry. The other method is to rename the Client Access/400 network drivers executable program (CWBBS.EXE). Renaming the executable will keep the client from being able to use the CA/400 Operations Navigator to get to your AS/400. Before you can rename the executable, youll need to stop it. To do so, press ctrl+alt+del once, and youll be presented with the Close Program window. Click on the CWBBS.EXE program to highlight it, and then click on the End Task button. This will stop the program. After its stopped, you can then rename it.
Gerald R. Posey Caddo Parish Sheriffs Office
Editors note: Renaming or removing CWBBS.EXE should be done only after careful consideration, as it could negatively impact your users client-side connection since you will no longer be able to use drives mapped to your AS/400. If you dont want to rename CWBBS.EXE, you can keep it from running by moving it from its default folder. Of course, any PC-literate user might find the program in its new folder and move it back. Perhaps a better approach would be to remove its reference from the Windows 95/NT Registry. Removing the reference will not only keep CWBBS.EXE from starting when Windows 95/NT starts, it will also keep most users from being able to restore CWBBS.EXEs use by moving the program back to its original folder or renaming it to its original name.
To remove it from the Windows 95/NT Registry, do the following:
From the Windows 95/NT Run box, type REGEDIT and click on OK.
Double-click the folder named HKEY_ LOCAL_MACHINE.
Double-click Software.
Double-click Microsoft.
Double-click Windows.
Double-click CurrentVersion.
Double-click RunServices.
In the right-side panel, youll see a key entry for Client Access Network Drive. Double-click on this and youll see a box like the one shown in Figure 5. To remove this key value, press the Delete key. In the bottom of the REGEDIT window, the path to the key value that you are deleting is displayed. This is useful information to know and record, if you ever want to manually restore this key.
You should always back up the Registry before making any changes to it. One way to do this is to make copies of the system.dat and user.dat files. Another way is to export the file from REGEDIT before any changes are made. (The Registry can be exported in its entirety or any part of a key thereof.) That way, if you make a mistake, you can restore the Registry back to its original configuration.
OPNQRYF Converts Invalid Date Values to Valid Ones
One of the most pervasive Y2K problems is the fact that two-digit years do not sort correctly. Year 00, representing 2000, sorts before 99, representing 1999. Open Query File (OPNQRYF) can sort such values correctly if you convert them to the date data type.
If your data contains invalid date values, such as 000000 or 999999, you have a problem. OPNQRYF cannot convert these special values to the date data type. However, if you can convert these values to other valid values, you can still use OPNQRYF to sort the data correctly.
Assume an existing OPNQRYF command is correctly sorting field SOPSDT, a six- digit numeric date field in MMDDYY format. You need to make it work for Y2K. First,
create a dummy physical file for OPNQRYFs use, as in Figure 6. The file contains all the fields from the production file, plus a field of the date data type for sorting. The dummy file does not need a member. Second, change the high-level language (HLL) program that runs under OPNQRYF to read this dummy file rather than the file containing the data. Third, change the OPNQRYF command to convert invalid values to valid ones, and change numeric dates to the date data type, as in Figure 7. This code converts dates of 000000 to 010140 and dates of 999999 to 123139.
For a brief explanation of how the invalid values are converted to valid ones, see Figure 8.
Ted Holt Senior Technical Editor Midrange Computing
Editors note: This tip comes from the book Y2K Survival Kit for AS/400 Programmers, soon to be published by Midrange Computing.
C eval PrintString=%editc(%dech(BigField:6:1)
C :'4')
C eval PrintString=%editc(%dech((BigField*TaxRate):6:1)
C :'4')
Figure 1: Using %dech and %editc to edit non-like fields
IF NUMERIC-VARIABLE NOT NUMERIC
MOVE ZEROS TO NUMERIC-VARIABLE.
Figure 2: Use the NUMERIC test to avoid COBOL decimal data errors
*****************************************************************
*
* To Create: CRTCBLPGM PGM(xxx/CVTHEXDEC) SRCFILE(xxx/QLBLSRC) +
* SRCMBR(CVTHEXDEC)
*
*****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CVTHEXDEC.
DATA DIVISION.
WORKING-STORAGE SECTION.
* CHARACTER FIELD HEX-CHAR-INPUT CONTAINS THE LETTER "A"
01 HEX-CHAR-INPUT PIC X VALUE X"C1".
01 BINARY-VALUE PIC S9(4) BINARY VALUE 0.
01 BINARY-VALUE-CHAR REDEFINES BINARY-VALUE.
05 HIGH-ORDER-BYTE PIC X.
05 LOW-ORDER-BYTE PIC X.
*
PROCEDURE DIVISION.
MAINLINE.
* ===> CONVERT HEX TO DECIMAL FOR DISPLAY
MOVE HEX-CHAR-INPUT TO LOW-ORDER-BYTE.
DISPLAY BINARY-VALUE.
* BINARY-VALUE WILL = 193
Figure 3: Converting hexadecimal to decimal in for a display in COBOL
*****************************************************************
* * To Create: CRTCBLPGM PGM(xxx/CVTDECHEX) SRCFILE(xxx/QLBLSRC) +
* SRCMBR(CVTDECHEX) *
*****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CVTDECHEX.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 BINARY-VALUE PIC S9(4) BINARY VALUE 193.
01 BINARY-VALUE-CHAR REDEFINES BINARY-VALUE.
05 HIGH-ORDER-BYTE PIC X.
05 LOW-ORDER-BYTE PIC X.
*
01 BYTE-1 PIC S9(3) COMP-3 VALUE 0.
01 BYTE-2 PIC S9(3) COMP-3 VALUE 0.
01 BYTE-HOLD PIC S9(3) COMP-3 VALUE 0.
01 SINGLE-DIGIT PIC S9 COMP-3 VALUE 0.
01 START-POS PIC S9 COMP-3 VALUE 0.
01 HEX-CHAR-DISPLAY PIC X(2) VALUE SPACES.
PROCEDURE DIVISION.
MAINLINE.
* ===> CONVERT DECIMAL TO HEX FOR DISPLAY
DIVIDE 16 INTO BINARY-VALUE
GIVING BYTE-1
REMAINDER BYTE-2.
IF BYTE-1 < 10
MOVE BYTE-1 TO SINGLE-DIGIT
MOVE SINGLE-DIGIT TO HEX-CHAR-DISPLAY(1:1)
ELSE
MOVE 1 TO START-POS
MOVE BYTE-1 TO BYTE-HOLD
PERFORM CONVERT-BYTE-HOLD
END-IF.
IF BYTE-2 < 10
MOVE BYTE-2 TO SINGLE-DIGIT
MOVE SINGLE-DIGIT TO HEX-CHAR-DISPLAY(2:1)
ELSE
MOVE 2 TO START-POS
MOVE BYTE-2 TO BYTE-HOLD
PERFORM CONVERT-BYTE-HOLD
END-IF.
DISPLAY HEX-CHAR-DISPLAY.
* HEX-CHAR-DISPLAY WILL = C1
GOBACK.
CONVERT-BYTE-HOLD.
EVALUATE BYTE-HOLD
WHEN 10 MOVE "A" TO HEX-CHAR-DISPLAY(START-POS:1)
WHEN 11 MOVE "B" TO HEX-CHAR-DISPLAY(START-POS:1)
WHEN 12 MOVE "C" TO HEX-CHAR-DISPLAY(START-POS:1)
WHEN 13 MOVE "D" TO HEX-CHAR-DISPLAY(START-POS:1)
WHEN 14 MOVE "E" TO HEX-CHAR-DISPLAY(START-POS:1)
WHEN 15 MOVE "F" TO HEX-CHAR-DISPLAY(START-POS:1)
END-EVALUATE.
Figure 4: Converting decimal to hexadecimal for a display in COBOL
|
Figure 5: Remove this key value from the Windows Registry to keep CWBBS.EXE from starting
*===============================================================
* To compile:
*
* CRTPF FILE(XXX/SLSORDW3) SRCFILE(XXX/QDDSSRC) +
* MBR(*NONE)
*
*===============================================================
A REF(SLSORD)
A UNIQUE
A R SLSORDR
A SOORNO R
A SOORDT R
A SOCUST R
A SOPSDT R
A XXPSDT L TEXT('PROJECTED SHIP DATE')
A DATFMT(*ISO)
A SOASDT R
A K SOORNO
Figure 6: This dummy file enables numeric date fields to be the temporarily converted to the date data type
OVRDBF FILE(SLSORDW3) TOFILE(SLSORD) SHARE(*YES)
OPNQRYF FILE((SLSORD)) +
KEYFLD((XXPSDT)) +
FORMAT(SLSORDW3) +
MAPFLD(+
(PSDT00 '1/SOPSDT') +
(PSDT01 'PSDT00 / %MAX(PSDT00 0.1)' *DEC 1 0) +
(PSDT02 '%ABSVAL((PSDT01 - 1))' *DEC 1 0) +
(PSDT03 'PSDT00 + PSDT02 * 010140' *DEC 6 0) +
(PSDT04 '%MIN((999998 / PSDT03) 1)' *DEC 1 0) +
(PSDT05 '%ABSVAL((PSDT04 - 1))' *DEC 1 0) +
(PSDT06 '(PSDT03 * PSDT04) + (123139 * PSDT05)' +
*DEC 6 0) +
(PSDT07 '%DIGITS(PSDT06)') +
(XXPSDT '%DATE((%SST(PSDT07 1 2) *CAT ''/'' *CAT +
%SST(PSDT07 3 2) *CAT ''/'' *CAT +
%SST(PSDT07 5 2)))'))
CALL PGM(SORT1RGF)
CLOF OPNID(SLSORD)
DLTOVR FILE(SLSORDW3)
Figure 7: OPNQRYF converts invalid dates of all zeros or nines to valid dates
PSDT00 PSDT00 gets a copy of the original date value. PSDT01 Yields a zero for dates of all zeros, and a one for nonzero dates. PSDT02 Converts zeros of the previous step to ones, and ones to zeros. PSDT03 Changes dates of all zeros to 010140, and leaves dates of nonzero values unchanged. PSDT04 Yields a zero for dates of 999999, and a one for all other dates.
PSDT05 Converts zeros of the previous step to ones, and ones to zeros. PSDT06 Changes dates of 999999 to 123139, and leaves dates of other values unchanged. PSDT07 Converts the six-digit numeric value in PSDT06 to a character string.
XXPSDT Builds a date of the date data type from the value in PSDT07.
Figure 8: How OPNQRYF converts invalid dates to valid ones
LATEST COMMENTS
MC Press Online