PL/I for AIX: Programming Guide
Total Page:16
File Type:pdf, Size:1020Kb
IBM PL/I for AIX Programming Guide Ve r s i o n 2.0.0 SC18-9328-00 IBM PL/I for AIX Programming Guide Ve r s i o n 2.0.0 SC18-9328-00 Note! Before using this information and the product it supports, be sure to read the general information under “Notices” on page 309. Second Edition (June 2004) This edition applies to IBM PL/I for AIX 2.0.0, 5724-H45, and to any subsequent releases until otherwise indicated in new editions or technical newsletters. Make sure you are using the correct edition for the level of the product. Order publications through your IBM representative or the IBM branch office serving your locality. Publications are not stocked at the address below. A form for readers’ comments is provided at the back of this publication. If the form has been removed, address your comments to: IBM Corporation, Department HHX/H1 555 Bailey Ave San Jose, CA, 95141-1099 United States of America When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. ©International Business Machines Corporation 1998,2004. All rights reserved. Contents Figures . vii COMPILE . .47 COPYRIGHT . .48 CURRENCY . .48 Part 1. Introducing PL/I on your DEFAULT . .48 workstation . .1 EXIT. .54 EXTRN . .54 Chapter 1. About this book . .3 FLAG . .55 FLOATINMATH. .55 Chapter 2. How to read the syntax GONUMBER . .56 GRAPHIC . .56 diagrams . .5 IMPRECISE . .56 INCAFTER . .57 Chapter 3. Porting applications between INITAUTO . .57 platforms . .9 INITBASED . .57 Getting mainframe applications to compile on the INITCTL . .58 workstation. .9 INITSTATIC . .58 Choosing the right compile-time options . .10 INCDIR . .58 Language restricted. .10 INSOURCE . .58 Using the macro facility to help port programs 13 LANGLVL. .59 Getting mainframe applications to run on the LIMITS . .60 workstation . .14 LINECOUNT . .60 Data representations causing run-time differences 14 LIST . .61 Environment differences affecting portability . .16 MACRO . .61 Language elements causing run-time differences 17 MARGINI . .61 MARGINS. .62 MAXMEM. .62 Part 2. Compiling and linking your MAXMSG . .63 program . .19 MAXSTMT . .64 MAXTEMP . .64 Chapter 4. Introducing PL/I for AIX. .21 MDECK . .64 Introducing PL/I for AIX . .21 MSG. .64 Features available with PL/I for AIX . .21 NAMES . .65 A short practice exercise . .22 NATLANG . .65 Becoming familiar with AIX . .22 NEST . .65 Creating PL/I source programs. .24 NOT. .66 NUMBER . .66 Chapter 5. Compiling, linking, and OPTIMIZE. .67 OPTIONS . .67 running your program . .29 OR . .67 Compiling, linking, and running your program . .29 PP . .68 Invoking the PL/I for AIX compiler . .29 PPTRACE . .69 Specifying compile-time options . .35 PRECTYPE . .69 Invoking the linkage editor . .38 PREFIX . .69 Running a program. .38 PROCEED . .70 REDUCE . .71 Chapter 6. Compile-time option RESEXP . .71 descriptions . .41 RESPECT . .72 Compile-time option descriptions . .41 RULES . .72 Rules for using compile-time options . .43 SEMANTIC . .75 AGGREGATE . .44 SOURCE . .76 ATTRIBUTES . .44 STATIC . .76 BIFPREC . .45 SPILL . .76 BLANK. .46 STMT . .77 CHECK . .46 STORAGE . .77 CMPAT. .46 SYNTAX . .77 CODEPAGE . .47 SYSPARM . .78 iii SYSTEM . .78 Unexpected program termination. 138 TERMINAL . .78 Other unexpected program results . 139 TEST . .79 Compiler or library subroutine failure . 139 USAGE. .79 System failure . 140 WIDECHAR . .79 Poor performance . 140 WINDOW . .80 XINFO . .80 Part 4. Input and output. 141 XREF . .81 Chapter 7. PL/I preprocessors. .83 Chapter 10. Using data sets and files 143 Types of data sets . 143 Include preprocessor . .84 Native data sets . 144 Examples: . .84 Additional data sets . 145 Include preprocessor options in the configuration Establishing data set characteristics . 146 file . .84 Records . 146 Macro preprocessor. .85 Record formats . 146 Macro preprocessor options . .85 Data set organizations . 146 Macro facility options in the configuration file. .86 Specifying characteristics using the PL/I SQL support . .87 ENVIRONMENT attribute . 147 Programming and compilation considerations . .87 Specifying characteristics using DD_ddname SQL preprocessor options. .87 environment variables . 152 Abbreviations: . .89 Associating a PL/I file with a data set . 161 SQL preprocessor options in the configuration Using environment variables . 162 file . .92 Using the TITLE option of the OPEN statement 162 Coding SQL statements in PL/I applications . .93 Attempting to use files not associated with data Large Object (LOB) support . .98 sets. 163 User defined functions sample programs . 100 How PL/I finds data sets . 163 CICS support . 107 Opening and closing PL/I files . 163 Programming and compilation considerations 107 Opening a file . 163 CICS preprocessor options . 108 Closing a file . 163 Abbreviations: . 109 Associating several data sets with one file . 164 Coding CICS statements in PL/I applications 109 Combinations of I/O statements, attributes, and Writing CICS transactions in PL/I . .110 options . 164 DISPLAY statement input and output . 166 Chapter 8. Compilation output . 111 PL/I standard files (SYSPRINT and SYSIN) . 167 Compilation output . 111 Redirecting standard input, output, and error Using the compiler listing . 111 devices . 167 Compiler output files. 121 Chapter 11. Defining and using Part 3. Running and debugging consecutive data sets. 169 your program . 123 Printer-destined files . 169 Using stream-oriented data transmission . 170 Chapter 9. Testing and debugging Defining files using stream I/O . 171 your programs . 125 ENVIRONMENT options for stream-oriented data transmission . 171 Testing your programs . 125 Creating a data set with stream I/O . 171 General debugging tips . 126 Accessing a data set with stream I/O . 173 PL/I debugging techniques. 127 Using PRINT files . 175 Using the Distributed Debugger tool . 127 Using SYSIN and SYSPRINT files . 179 Using compile-time options for debugging . 127 Controlling input from the console . 180 Using footprints for debugging . 128 Using files conversationally . 181 Using dumps for debugging . 129 Format of data . 181 Using error and condition handling for Stream and record files . 181 debugging . 133 Capital and lowercase letters . 182 Error handling concepts . 134 End of file . 182 Common programming errors . 136 Controlling output to the console. 182 Logical errors in your source programs. 136 Format of PRINT files . 182 Invalid use of PL/I . 137 Stream and record files . 182 Calling uninitialized entry variables . 137 Example of an interactive program . 182 Loops and other unforeseen errors . 137 Using record-oriented I/O . 183 Unexpected input/output data . 138 Defining files using record I/O . 184 iv PL/I for AIX: Programming Guide ENVIRONMENT options for record-oriented Chapter 14. Using user exits . 229 data transmission . 185 Using the compiler user exit . 229 Creating a data set with record I/O . 185 Procedures performed by the compiler user exit 229 Accessing and updating a data set with record Activating the compiler user exit . 230 I/O. 185 The IBM-supplied compiler exit, IBMUEXIT . 230 Customizing the compiler user exit . 231 Chapter 12. Defining and using Using data conversion tables . 234 regional data sets . 191 Defining files for a regional data set . 193 Chapter 15. Improving performance 237 Specifying ENVIRONMENT options . 193 Selecting compile-time options for optimal Essential information for creating and accessing performance. 237 regional data sets . 194 OPTIMIZE . 237 Using keys with regional data sets . 194 IMPRECISE . 238 Using REGIONAL(1) data sets . 194 GONUMBER . 238 Dummy records . 194 RULES . 238 Creating a REGIONAL(1) data set . 195 PREFIX . 239 Example . 195 DEFAULT . 239 Accessing and updating a REGIONAL(1) data Summary of compile-time options that improve set . 197 performance. 242 Sequential access . 197 Coding for better performance . 242 Direct access. 198 DATA-directed input and output . 243 Example . 198 Input-only parameters . 243 String assignments . 243 Chapter 13. Defining and using Loop control variables . 244 workstation VSAM data sets . 201 PACKAGEs versus nested PROCEDUREs . 244 REDUCIBLE functions . 245 Remote file access . 201 DEFINED versus UNION . 246 Workstation VSAM organization . 202 Named constants versus static variables . 246 Creating and accessing workstation VSAM data Avoiding calls to library routines . 247 sets. 202 Determining which type of workstation VSAM data set you need . 202 Chapter 16. Using PL/I in Accessing records in workstation VSAM data mixed-language applications. 251 sets. 202 Matching data and linkages . 251 Using keys for workstation VSAM data sets . 203 What data is passed . 252 Choosing a data set type . 204 How data is passed . ..