enterprise pli presentation

30
Enterprise PL/I for z/OS Version 3 Release 7 Prepared by CLS-FDW Development Team

Upload: anjuraj-rajan

Post on 26-Dec-2015

432 views

Category:

Documents


9 download

DESCRIPTION

PL1

TRANSCRIPT

Page 1: Enterprise PLI Presentation

Enterprise PL/I for z/OS Version 3 Release 7

Prepared by CLS-FDW Development Team

Page 2: Enterprise PLI Presentation

Agenda

Pre-requisite Introduction Advantages JCL Changes Code Changes Potential Errors/Warnings expected during

Compilation phase Potential Errors/Warnings expected during run

time error phase Unexpected Errors faced during Run-time

Page 3: Enterprise PLI Presentation

Pre-requisite – Language Environment Requirements

Enterprise PL/I V3R7 is supported only on Language Environment for z/OS 1.8 or later.

Page 4: Enterprise PLI Presentation

Introduction

IBMZPLI is IBM’s strategic PL1 compiler for zSeries platform and

System 390. IBMZPLI or Enterprise PL1 is comprised of features from

PL1, PL1 for MVS and VM and Visual Age PL1 with additional features

such as Unicode support, XML parsing capabilities improved C and

Java interoperability, integrated CICS preprocessor, and integrated

SQL preprocessor.

Page 5: Enterprise PLI Presentation

Introduction

In order to use Enterprise compiler, it is important to understand, from the very beginning, that the ‘old’ and ‘New’ PL/I compilers arecompletely different from each other. The ‘new’ PL/I compilers arewritten in PL/I, and do not make use of certain techniques that the‘old’ PL/I compilers did. They are so different, in fact, that from theperspective of Language Environment they are considered differentlanguages, each with its own signature CSECT.

When moving from ‘old’ to ‘new’ compiler, The Enterprise PL/I Compiler find and report more Errors at Compile time. Warning andInformation messages need to be checked very carefully. The changesare two Types, depending on the warning or messages, one could bein the PL/1 programs and the other in the JCL Compile list options.

Page 6: Enterprise PLI Presentation

Advantages

The advantages of Enterprise Compiler are as follows:

New Compiler Parameters No Limit of the compiler options New DCL Parameters Over 100 new built-in functions, including: PROCNAME and

SOURCELINE (for tracing)HEX and HEXIMAGE (for debugging)

No Compiler limit on the no of files Increased limit

1) Maximum precision for fixed decimal is increased from 15 to 312) Maximum precision for fixed binary is increased from 31 to 633) Maximum length of an identifier is increased from 31 to 100. 4) Maximum nesting of %include statements is increased from 8 to 20465) Maximum number of repetitive DO-specifications in a data list is increased from 25 to 50

Page 7: Enterprise PLI Presentation

Advantages

6) Maximum number of arguments in a call or function reference is increased from 64 to 255

7) Maximum number of parameters for a procedure is increased from 64 to 4095

8) Maximum number of numeric picture characters in a numeric picture is increased from 15 to 31

9) Maximum key length is increased from 8 to 32763

Many powerful new attributes, including: ABNORMAL (like volatile in C) NONASSIGNABLE (like const in C) RESERVED (for C-like static)

Pointer value can be printed in ZPLI which is not possible in 2.3

Integrated CICS Preprocessor Integrated SQL Preprocessor

Page 8: Enterprise PLI Presentation

JCL Changes

With ZPLI PL/I pre-processor, the DB2 pre compile and compilation can be done in a single step only.

STEP1:-

In the compile step change PGM=IEL1AA to PGM=IBMZPLI

In steplib replace the library SYS1.ADPLI.LINKLIB ( LE library ) to SYS1.VAPLI.SIBMZCMP (Enterprise PLI).

Page 9: Enterprise PLI Presentation

JCL Changes

STEP2:-

The parameters to be passed in the COMPILE step for Enterprise compilation will be done using the dataset

CFLR300.R300.PLIOPTS. The parameters can be included in the compile JCL as below.

//*----------------------------------------------------//* PERFORM PLI COMPILE //*----------------------------------------------------//* //COMPILE EXEC PGM=IBMZPLI, // PARM='+DD:OPTIONS', // REGION=0M //STEPLIB DD DISP=SHR,DSN=SYS1.VAPLI.SIBMZCMP //OPTIONS DD DISP=SHR,DSN=CFLR300.R300.PLIOPTS(PLI or

PLISQL)

Page 10: Enterprise PLI Presentation

JCL Changes

STEP 3:-In the compile step the following dataset has to be concatenated SYS1.DBP1.SDSNLOAD

STEP 4:-In LINK membersExample:-INCLUDE SYSLIB(IBMBEERA) INCLUDE SYSLIB(CFLL06C) INCLUDE SYSLIB(CFLL17C) INCLUDE SYSLIB(CFLL16C) INCLUDE SYSLIB(CFLL12U) INCLUDE SYSLIB(CFLL08C) INCLUDE SYSLIB(CFLX03C) INCLUDE SYSLIB(PLICALLA)• Replace PLICALLA with CEESTART

Page 11: Enterprise PLI Presentation

JCL Changes

Language Restricted – Record I/O

The following options of the ENVIRONMENT attribute are not supported, but their use is flagged only under LANGLVL(NOEXT):

– ADDBUFF – NCP– ASCII – NOWRITE– BUFFERS – REGIONAL(2)

– BUFND – REGIONAL(3) – BUFNI – REREAD – BUFOFF – SIS – INDEXAREA – SKIP etc – LEAVE(IF statement) – TP – TOTAL – TRKOFL

Page 12: Enterprise PLI Presentation

JCL Changes

AMODE(24) Restrictions

AMODE(31) and RMODE(ANY) are the default settings for Enterprise PL/I

applications. To run an application in AMODE(24), you must: compile all the PL/I source with the compiler option NORENT link with the SIBMAM24 dataset concatenated in front of the

SCEELKED dataset run with the Language Environment run-time option

ALL31(OFF), HEAP(,,BELOW,,,) and STACK=(,,BELOW,,,)

Page 13: Enterprise PLI Presentation

JCL Changes

Other important changes that need to be done for JCL are as follows:

Job Region for Enterprise PL/I Compiler needs much more Region and CPU Time. At Compile time, if problems occur with Region, then use REGION=100M in the Job.

The LRECL for the compiler SYSPRINT listing dataset has changed to 137.

PLISTART entry is replaced by CEESTART. PLITEST is replaced by DEBUG. Use ‘INITAUTO’ Compiler option to initialize the automatic

variables and copybooks. Use ‘INITSTATIC’ Compiler option to initialize the static

variables and copybooks. Use ‘INITBASED’ Compiler option to initialize the based

variables and copybooks. Use ‘INITCTL’ Compiler option to initialize the control

variables and copybooks.

Page 14: Enterprise PLI Presentation

Code Changes

1. Take care that all variables used in the program are declared and initialized.

2. If ‘INITAUTO’ compiler option is not used, un-initialized variables and copybooks have to be initialized.

3. Enterprise compiler throws a warning when DATE built-in is used. Try to change all DATE to DATETIME builtin to remove the warning.

4. If ‘INITSTATIC’ compiler option is not used, un-initialized variables and copybooks have to be initialized.

5. If ‘INITBASED’ compiler option is not used, un-initialized variables and copybooks have to be initialized.

6. If ‘INITCTL’ compiler option is not used, un-initialized variables and copybooks have to be initialized.

7. Using invalid SUBSTR references

Any SUBSTR reference that you use must be such that its use would not raise

the STRINGRANGE condition if that condition were enabled.

Page 15: Enterprise PLI Presentation

Code Changes

If the STRINGRANGE condition is not enabled (and by default, it is

not), then a SUBSTR reference that is invalid can cause the compiled

code to overwrite storage allocated for other purposes and that, in

turn, can lead to data corruptions or abends.

8. Incorrect code that will now loop endlessly

Please change all the loop variables to FIXEDBIN (31) please don’t

have any PIC variables.

Page 16: Enterprise PLI Presentation

Potential Errors/Warnings expected during

Compilation phase

1. IBM1200I W - Use of DATE built-in function may cause problemsAs per this, DATETIME which returns 4 digit year is recommended to use by the compiler, instead of DATE which returns 2 digit year.

1. DATE returns value in the format 060807 [ YYMMDD]2. DATETIME returns value in the format 20060807080231158 [ CCYYMMDDTTTTTTTTT]

Solution:A Substring and DATETIME Builtin Function should be used to remove the

Warning message.

2. Related to Structures:In some cases in the piece of code it is coded as one structure (A) is equal to another structure (B) by name. But the problem is some variables in Structure A is not defined with same attributes as the same variables inStructure B. So the problem of String Truncation occurs. Then in such cases you can define all the structure variables independently and used SUBSTR function.

Page 17: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

3. IBM1208I W: INITIAL list for the array IDENT contains only one item.

The problem is, for an array if we are giving init('') for initializing that it will initialize

only the first item, the remaining elements in the array will not be initialized.

Solution: Possible solution is change init('') to init((*)('')), it will initialize all elements in

the array or replace * with the size of the array.

4. IBM1211I W: Source with length xx is longer than the target.The problem is length of source variable is larger than that of target.

Solution:Possible solution is instead of assigning directly the source to target, use

substring built-in function in source and move that to target. The result is same, but we

can eliminate the warning. The default truncation will be from right to left.

Page 18: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

5. IBM1085I W: Variable may uninitialized when used

Solution:Initialize the variable explicitlyNote: After analyzing the code, we found that no action is required for CLS-FDW

Application.

6. IBM1373I E: Variable J is implicitly declared

Variable is not declared, in the old compiler it will take a default declaration as fixed dec, but in new compiler it will not.Solution: We need to explicitly declare the variable.

7. IBM1385I E: Invalid DEFINED - string overlay defining attempted. This happens when we declare a variable as char, and trying to share the same

memory location with another structure which contains computational data types like fixed decimal or fixed bin.Solution: One possible solution is replace define with Based(addr(...))

Page 19: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

8. IBM1215I W: The variable I is declared without any data attributes.We can expect this type of error, if we are declaring variables like this DCL I, J

Fixed Bin.Solution: We can eliminate this warning by declaring it as DCL (I, J) Fixed Bin.

9. IBM1300I E: ERRDLI is contextually declared as CONDITIONIn new ZPLIcompiler if we are using any external condition , we have to

declare itexplicitly.Solution:Declare explicitly the condition as DCL ERRDLI EXTERNAL CONDITION;

10. IBM1209I W: INDEXED environment option for file filename will be treated ORGANIZATION (INDEXED)

Since ISAM is not being simulated on the OS/2 platform, the file will be treated in a manner similar to VSAM KSDS.

Solution:By changing env(indexed) to env(organization(indexed)), we can eliminate the

warning.

Page 20: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

11. IBM1099I W FIXED DEC(source-precision,source-scale) operand will

converted to FIXED BIN(target-precision,target-scale). Significant digits may be lost.

Solution:The output of earlier compiler and the new compiler will be same , so no change required. however a compiler, RULES(ANS), option can be passed

to get a correct value.

12. IBM1119I W Code generated for DO group would be more efficient if control variable were not an aggregate member.

Solution: The control variable in the DO loop is a member of an array, a structure or

an union, and consequently, the code generated for the loop will not be optimal.

13. IBM1120I W Multiple closure of groups. END statements will be inserted to close intervening groups.

Solution: Depending on the program logic, END statement for the corresponding

IF/DO statement should be coded to solve this warning message.

Page 21: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

14. IBM1195I W Argument to MAIN procedure is not CHARACTER VARYING.

Solution: The argument to the MAIN procedure should be CHARACTER VARYING,

except under SYSTEM(CICS), SYSTEM(TSO) and SYSTEM(IMS).

15. IBM1198I W A null argument list is assumed for variable name. Solution: An ENTRY reference is used where the result of invoking that

entry is probably meant to be used.

Example:Before code change :-Variable = Function; After code change :-Variable = Function();

Page 22: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

16. IBM1206I W BIT operators should be applied only to BIT operands.

Solution: In an expression of the form x & y, x | y, or x ^ y, x and y should both be defined as BIT variables.

Example:Before:DCL LINE1_IS_EMPTY, LINE2_IS_EMPTY,

LINE3_IS_EMPTY BIT(1); After:DCL (LINE1_IS_EMPTY, LINE2_IS_EMPTY, LINE3_IS_EMPTY) BIT(1);

Page 23: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

17. IBM1213I W The procedure proc name is not referenced. Solution: The named procedure is not external and is never referenced in the

compilation unit. This may represent an error (if it was supposed to be called) or an opportunity to eliminate some dead code.

Note: After analyzing we found that no action is required for CLS-FDW Application.

18. IBM1660I S The size ( record-size ) of the record conflicts with the RECSIZE

(recsize) specified in the ENVIRONMENT attribute. Solution: Execution of the statement would raise the RECORD condition.Example:DCL datei file record output env( fb recsize (80) total ); DCL satzaus char (100); WRITE file(datei) FROM(satzaus);Note: In this case, the structure is greater than the File LRECL, the other way can

also happen. Changing the structure/LRECL of file will solve this error message.

Page 24: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

18. IBM2404I E variable name is declared as BASED on the ADDR of variable

name, but variable name requires more storage than remains in the enclosing

level 1 structure variable name after the location of variable name. Solution: The amount of storage needed for a BASED variable must be no more

than provided by its base variable.

19. IBM2615I W DO-loop will always execute exactly once. A semicolon after the DO may be missing. Solution: DO-loops should normally be iterative, but if the DO-loop specification consists of just one assignment, then it will always excute once and only once. A semicolon after the DO may be missing, as in this example

do edsaup.tprs = ads162.tprs;edsaup.tops = ads162.tops;end;

Page 25: Enterprise PLI Presentation

Potential Errors/Warnings expected during Compilation phase

20. IBM2621I W ON ERROR block does not start with ON ERROR SYSTEM. An

error inside the block may lead to an infinite loop. Solution: The first statement in an ON ERROR block should usually be an

ON ERROR SYSTEM statement. This will tend to prevent an infinite loop if there is an

error in the rest of the code in the ON ERROR block.

21. IBM7028I W Reference var-name is ambiguous.Explanation: All references must be unambiguous. Solution: APAR PK06775 must be installed in the Enterprise compiler.

Page 26: Enterprise PLI Presentation

Potential Errors/Warnings expected during Run time

phase 1. S0C4 abend: Protection ExceptionReason: Tried to read or write a file which was not open, or when program

tried to access a memory area that is not allowed to the program.Solution: One possible solution is, check in the program whether the

particular file is opened before reading or writing.

2. S0C7 abend: Data exceptionReason: Decimal data is incorrect or improperly overlapped or not

initialized properly.Solution: Check fixed decimal fields in program; whether any invalid

character values are moving to that field.

3. S806 abend: Module not foundReason: The module not found in the STEPLIB specifiedSolution: Check whether the module is present in the library.

Page 27: Enterprise PLI Presentation

Potential Errors/Warnings expected during Run time phase

4. S913 abend: An open macro was issued for a protected dataset for which this type of access is not allowed.

Reason: We will get this type of error messages, if we are trying to access a RACF

protected dataset for which we don’t have the access to perform the requested

operation. 5. Abend U0073: This abend occurs if we have not specified a dataset for keeping logs of IMS database updates.Solution: Specify a dataset for IEFRDER in the JCL (dataset with following

dataset org( RECFM=VB,LRECL=4092, BLKSIZE=4096), for keeping logs.

6. S0CA Abend: One or more nonzero digits were lost due to the destination field being too short to contain the result of a decimal operation.

Reason: We will get this type of abend, when the target of an arithmetic operation is smaller than the result and the truncating digits are not zero.

Solution: We have two solutions to resolve it, 1) Use ON FIXEDOVERFLOW Condition to handle that condition or 2) Increase the size of the target to accommodate the full result.

Page 28: Enterprise PLI Presentation

Unexpected Errors faced during Run-time

1.Fixed Overflow Condition

Problem:- In one of the PLI modules, these is an assignment from FLOAT BIN (53) to FIXED DEC (14,13) . During compilation(using Enterprise Compiler),no warning message was displayed for this program but while testing this module,a FIXED OVERFLOW condition was raised.

Solution:- Assignment of the FLOAT BIN variable to a larger FIXED

DECIMAL variable and then assigning the larger FIXED DEC variable to the target variable (ie the smaller FIXED DECIMAL variable), using the compiler options DECIMAL(NOFOFLONASGN) and LIMITS(FIXEDDEC(31))

Eg:- Before:DCL A FLOAT BIN (53); After: DCL A FLOAT BIN

(53); DCL C FIXED DEC (13,12); DCL B FIXED DEC

(31,12); C=A; DCL C FIXED DEC

(13,12); B=A; C=B;

Page 29: Enterprise PLI Presentation

2.Abend 4093

Problem:- As part of the LINK card changes,the PLICALLA had to be replaced with CEESTART.But since one link card had both PLICALLA and CEESTART,the PLICALLA was removed/deleted.This change gave no errors during compilation/link editing but at run time the program using this link card caused abend 4093.

Solution:- The PLICALLA include statement had to be added to the link card.

Page 30: Enterprise PLI Presentation

Reference documents

ZPL/1 Migration documents is available online in the followingLink:http://www-306.ibm.com/software/awdtools/pli/plizos/library/

The documents present in the above link under Enterprise PL/I for z/OS Version 3 Release 7 Publications - English :

1. Enterprise PL/I Online Book Shelf 2. Enterprise PL/I Online Book Index3. Compiler and Run-Time Migration Guide 4. Language Reference 5. Messages and Codes 6. Programming Guide 7. Program Directory