Odds and Ends
July 19, 2002 Timothy Prickett Morgan
Here are yet more short answers to a variety of questions. I hope you find something of use.
When I run the Create Java Program (CRTJVAPGM) command, where does the compiled code go?
The optimized program becomes part of the class, jar, or zip file. You can verify this with the Work with Object Links (WRKLNK) command.
Use WRKLNK to display the directory in which the class, jar, or zip file resides. Use option 8 to display the file attributes and page to the second panel. Note the allocated size of object. Run CRTJVAPGM, then view the class file attributes again. You should see a difference.
In the June 28, 2002 issue of Midrange Guru, you explained how to make a physical file created with SQL have different file and record names. I have the same question pertaining to Query rather than SQL. I create the file with Query and the file and record format name are the same. How can I give them different names?
Make the query create a file with the desired record name. After the query runs, use the Rename Object (RNMOBJ) command to rename the file. The record format will not be renamed.
For example, Query builds a file called CUSTREC1Q. The format also has the name CUSTREC1Q.
RNMOBJ CUSTREC1Q *FILE CUST1Q
Now the file has the name CUST1Q, but the record format is still CUSTREC1Q.
I’m working with some numeric data that gets placed into alpha data, and I need go the opposite routefrom alpha to numeric.
The numeric data is in an alpha array of one-character elements. I need to process the array elements, and then move the array back to a six-position packed decimal field. I tried to use the MOVEA operation to the packed field, and the compile failed. I tried to move it to a zoned numeric field, and likewise the compile failed. Yet I could swear I have used the MOVEA op code in situations like this in the past. Am I getting senile?
You remember correctly. You’re thinking of your System/36 days. RPG II has a very liberal MOVEA opcode, even allowing you to move numeric to alpha and vice versa. RPG III and RPG IV are not so generous.
I use a data structure that overlays a zoned decimal field and a character field. I move the data into the character field, and then I use the zoned decimal field, as per my example:
D arr s 1 dim(6) D alpha ds 6 D number 1 6s 0 C movea arr alpha C if number >= 300000
How do I access the local data area and other data areas in COBOL?
In the special-names paragraph of the configuration section of the environment division, define a mnemonic to represent the environment name data-area.
In the procedure division, use the accept statement, specifying the data-area mnemonic in the from clause and the data-area name in the for clause.
The syntax of the accept verb is summarized as follows:
ACCEPT identifier FROM mnemonic-name FOR identifier | literal IN LIBRARY identifier | literal AT identifier | literal WITH LOCK ON EXCEPTION imperative-statement NOT ON EXCEPTION imperative-statement END-ACCEPT.
The following table further explains the clauses:
|FROM||required||mnemonic associated with DATA-AREA in SPECIAL-NAMES|
|IN LIBRARY||optional||library in which data area resides|
|AT||optional||starting position from which text is taken; default is 1|
|WITH LOCK||optional||places a “lock exclusive allow read” on the data area|
|ON EXCEPTION||optional||code to be executed if an error occurs|
|NOT ON EXCEPTION||optional||code to be executed if data area access succeeds|
|END-ACCEPT||optional||terminates scope of the ACCEPT command|
Here’s a short example program to get you started:
identification division. program-id. cobdtaara. environment division. configuration section. special-names. local-data is lda data-area is da. data division. working-storage section. 01 number-of-pages pic s999 packed-decimal. 01 plant-info pic x(80). 01 plant-name pic x(30). 01 logical-data pic x. 01 local-data-area pic x(1024). procedure division. main-logic. * read the LDA accept local-data-area from lda. * read a decimal data area accept number-of-pages from da for 'HOLDPAGES'. * read a character data area accept plant-info from da for 'PLANTINFO'. * read part of a character data area accept plant-name from da for 'PLANTINFO' at 5. * read a logical data area accept logical-data from da for 'NITEJOB' in library 'THOLTS'. goback.
For more information, see Chapter 14 of the ILE COBOL reference at http://publib.boulder.ibm.com/html/as400/v5r1/ic2924/books/c0925392.pdf .
And here are a few Internet Explorer tips, just for fun:
- To quickly and easily page down a Web page in Internet Explorer, press the spacebar. To page up, use Shift + spacebar.
- There are other ways to move backward and forward through Web pages besides clicking on the Back and Forward icons. One method is to use Alt with the left and right cursor-movement arrows. Another is to use Shift with the mouse wheel.
- To open a Web page in a new window, hold down Shift while clicking on the link.
- Use Control and the mouse wheel to increase or decrease font size on a Web page. (I guess I’m getting old; I use this technique a lot.)
ADVANCED SYSTEMS CONCEPTS
SEQUEL meets all your iSeries and AS/400 data access needs in a single, integrated solution:
Take 6 minutes to view a SEQUEL ViewPoint ScreenCam movie to see how simple Windows-based AS/400 and iSeries data access can be! In just a few short minutes, you can find out ways to make your job easier and improve data access throughout your organization. Download the ViewPoint movie here .
For more information or a FREE trial of SEQUEL, call 847/605-1311 or visit Advanced Systems Concepts.