V6R1 CL Enhancements
November 7, 2007 Ted Holt
Thanks to the kindness of Guy Vig and Fernando Hurtado of the International Business Machines Corporation, I have information for you concerning V6R1 CL. For the third straight release, IBM has added solid features to the compiler. Since I use CL heavily, I greatly appreciate the effort. Here’s what you can look forward to when you install V6R1. Close a File CL includes a new Close Database File (CLOSE) command that you can use to close a file. This gives you another way to process a file more than once in a CL procedure. As you are no doubt aware, the first Receive File (RCVF) command issued against a file opens that file and retrieves the first record. Each subsequent RCVF command retrieves another record, and when there are no more records to retrieve, RCVF issues escape message CPF0864. If you CLOSE a file, RCVF re-opens the file and begins the process anew. CLOSE has only one parameter, OPNID, which indicates the file to be closed. Here’s an example that I shamelessly swiped from the documentation Guy and Fernando gave me. DCLF FILE(*LIBL/MYFILE2) OPNID(FILE2) : RCVF OPNID(FILE2) : CLOSE OPNID(FILE2) RCVF OPNID(FILE2) : Copy Source Code from Other Members I like this enhancement, too. I use a lot of template code in my programming, and the new Include CL Source (INCLUDE) command is going to help me immensely. It’s similar in function to RPG’s /COPY and /INCLUDE directives, COBOL’s COPY command, and C’s #INCLUDE preprocessor directive. To make the compiler a source member, fill in the SRCMBR and SRCFILE parameters. This command copies member SUBR1, which is in source physical file COMMONSUBR in library MYLIB. INCLUDE SRCMBR(SUBR1) SRCFILE(MYLIB/COMMONSUBR) This command copies source member DCLSET1, which is in the file specified in the INCFILE parameter of the CRTCLPGM, CRTCLMOD, or CRTBNDCL command that kicked off the compilation. INCLUDE SRCMBR(DCLSET1) SRCFILE(*INCFILE) The Retrieve CL Source command has a new RTVINCSRC parameter, which gives you the choice of retrieving the INCLUDE commands or the included code in the retrieved source code. Store Compiler Options I do not like having to change compiler options when creating CL procedures and commands. When I get to V6R1, I won’t have to. For commands, the CMD command has been enhanced to permit object-creation parameters one normally finds in the Create Command (CRTCMD) command. CMD PROMPT(UCD0002) PMTFILE(MYCMDPMT *DYNAMIC) + MSGF(MYCMDMSG) TEXT(*CMDPMT) MAXPOS(2) + PRDLIB(MYAPPLIB) HLPID(*CMD) HLPPNLGRP(MYAPPHLP) In CL procedures, you can use the Declare Processing Options (DCLPRCOPT) command to specify compiler options. The new BNDDIR and BNDSRVPGM parameters allow you to bind to modules and service programs when compiling with CRTBNDCL. You’ll no longer have to create a module from the CL source, then use Create Program (CRTPGM) to tie everything together. DCLPRCOPT DFTACTGRP(*NO) ACTGRP(MYAPP) + BNDDIR(MYAPPLIB/MYBNDDIR) Null Support CL’s new *NULL special value will come in handy when working with pointers. Use the *NULL value to set a pointer or to test a pointer. DCL VAR(&STRPTR) TYPE(*PTR) VALUE(*NULL) IF COND(&STRPTR *EQ *NULL) THEN(DO) The Verify Name API The new Verify Name API comes in two flavors: QCAVFYNM and QCAVERIFYNAME. (I suspect QCAVFYNM is a callable program, while QCAVERIFYNAME is a procedure in service program QCAVFYNMS.) It allows you to test a character string to see if the string represents a valid object name. If the name is not valid, the API sends escape message CPF019D. Better National Language Support When V6R1 becomes reality, command objects will be able to retrieve prompt messages dynamically. A command object will be able to display prompts in different national languages though the use of the Prompt File (PMTFILE) parameter of the Create Command (CRTCMD) command. PTMFILE allows you to specify a message file from which the prompt strings are to be retrieved. PMTFILE(*NONE) means that the prompt text is in the definition statements, as always. CMD PROMPT(UCD0002) PMTFILE(MYCMDPMT *DYNAMIC) + MSGF(MYCMDMSG) TEXT(*CMDPMT) MAXPOS(2) + PRDLIB(MYAPPLIB) HLPID(*CMD) HLPPNLGRP(MYAPPHLP) When the command is prompted, the system will retrieve the prompt text from message ID UCD002 in message file MYCMDPMT, which is found by scanning the library list. By placing the value *DYNAMIC, instead of the default *STATIC, in PMTFILE’s second element, you can use one command object with different national languages. According to the documentation Guy and Fernando sent me, you can also specify this parameter in the CMD command within the command source. Better Unicode Support PARM, ELEM, and QUAL command definition commands have a new CCSID parameter, which permits special value *UTF16 for Unicode values. In addition, the TOSTMF parameter of the Copy to Stream File (CPYTOSTMF) command has been Unicode-enabled. It Just Gets Better and Better! Well, that’s a quick look at the new features in V6R1 CL. IBM did not give me everything on my wish list, but they gave me some of my wishes, and added some good features that hadn’t occurred to me. I’m most thankful for these new enhancements to this important language. RELATED STORY
|