Improving your programming productivity can be as valuable to your installation's resource management as coding effective and efficient programs. The following techniques can help reduce some tedious and time-consuming coding tasks and allow you more effective use of your time and system resources.
Using these suggestions may not always be possible or practical. Refer to your organization's guidelines and requirements prior to using the following techniques.
Finding Coding Errors
Errors fall into two broad classes: those that the compiler can identify when it examines your source program and those that surface later when you execute the program. The second type of error—the run-time error-is often harder to track down.
Check for Errors, Using NOCOMPILE
After you have completed your design reviews and desk-checked your coding, you can check your program for syntax errors with the NOCOMPILE option. If you are a TSO user compiling in the foreground, you can send the messages to your screen by defining your data set as the SYSTERM data set and using the TERM option when you compile your program.
Errors the Compiler Can Identify
The compiler detects errors that are not dependent on run-time logic. While it can correct some of the errors it finds, the compiler cannot correct all of them. If your compilation fails, you need to fix the source program and compile it again. Common coding mistakes include:
Sometimes mistakes go unnoticed at compile time because the statement makes sense to the compiler, even though it is not what you intended. These errors surface at run time. Errors the Compiler Cannot Identify
Check for these mistakes in your program logic:
Using the COPY Facility
If your program contains frequently used code sequences (such as blocks of common data items, input/output routines or error routines), write the code sequences once, place them in a library, and then retrieve them for your program with the COPY statement.
It helps to ensure accuracy by eliminating new coding mistakes. When your program is compiled, the compiler expands the copybook to the actual code. The COPY statement you entered will appear on the source listing. You can use the COPY statement in any division. To use the COPY statement does the following steps:
Copying an Entire Source Program
You can put frequently used source programs, such as a payroll program, into the copy library. If you want to use a source program that has been put in the copy library, use the BASIS statement in your source program. Also, you may want to copy an entire source program, but with some alterations. You can do this by using the BASIS statement combined with INSERT and DELETE statements.
Using the REPLACE Statement
The REPLACE statement provides a way to apply a change to sections of COBOL source programs without your having to manually find all places that need to be changed. It is an easy method of doing simple string substitutions. It is similar to the COPY statement, except that it acts on the entire source program, not just on the text in COPY libraries.
You can use the REPLACE statement to resolve any conflict between new reserved COBOL words and names you have used in your program. For example, if you have used the name DAY-OF-WEEK for a data item in your program, you will need to change all the occurrences of that name. To do this, insert the following REPLACE statement before the first line of your program:
This will replace all occurrences of DAY-OF-WEEK in your program with the new name WEEKDAY. Because REPLACE statements are processed after any COPY statements are processed, it will also change any occurrences of DAY-OF-WEEK that were included in text from COPY libraries.
The rules for using the REPLACE statement are:
Controlling the Output Listing
The "CONTROL (*CBL) statement is an output listing control statement. With the SOURCE, MAP, and LIST compiler options, this statement selectively suppresses or allows production of output. The names "CONTROL and "CBL are synonymous; wherever one appears in the explanation that follows, the other can be substituted.
The characters "CONTROL or *CBL can start in any column, beginning with column 7. followed by at least one space or comma and one or more option key words. The optional keywords must be separated by one or more spaces or commas. The "CONTROL statement must be the only statement on the line and may be terminated with a period. Continuation is not allowed.
"CONTROL does not turn options on and off. It only allows listing control for those listing options in effect for the compilation. The keywords that can appear are: SOURCE and NOSOURCE, MAP and NOMAP, LIST and NOLIST. The source line containing the "CONTROL statement does not appear in the source listing.
Your installation may set certain options to have fixed values that cannot be overridden for individual applications. These fixed options take precedence over options specified via:
The requested options are handled in the following manner:
Selective Source Listing
Production or suppression of a listing of the input source program lines is controlled by the "CONTROL SOURCE and "CONTROL NOSOURCE statements (or "CBL SOURCE and "CBL NOSOURCE). If any "CONTROL NOSOURCE or "CBL NOSOURCE statement is encountered and SOURCE has been requested as a parameter to the compiler, the following informational (l-level) message is issued: Printing of the source code has been suppressed.
The source program text is displayed as follows
The entire line is displayed in the body of the listing.
Storage Mapping in the Data Division
Parts of the MAP listing and embedded MAP summary can be selected or inhibited by use of "CONTROL MAP or "CONTROL NOMAP statements ("CBL MAP or "CBL NOMAP statements) interspersed throughout the source
Object Code in the Procedure Division
You can control the selective listing of generated object code with the "CONTROL LIST and "CONTROL NOLIST statements (*CBL LIST and *CBL NOLIST). User-defined names are displayed. The sequence field and COBOL statement are placed on a separate line to make room for the user-defined names. Internal clauses of COBOL statements are displayed in the statement line format.
IBM Mainframe Related Interview Questions
|IBM Lotus Notes Interview Questions||IBM-CICS Interview Questions|
|COBOL Interview Questions||Linux Interview Questions|
|IBM-JCL Interview Questions||IBM Mainframe Interview Questions|
|IBM AIX Interview Questions||IBM WAS Administration Interview Questions|
|IBM Lotus Domino Interview Questions||IBM Integration Bus Interview Questions|
|Mainframe DB2 Interview Questions||Unix Production Support Interview Questions|
Ibm Mainframe Tutorial
Introduction To Software Development
Introduction To Ibm Mainframes
Tso And Ispf
Jes2, ]es3 And Sms
Introduction To Job Control Language (jcl)
The Job Statement
The Exec Statement
The Job And Exec Statements
The Dd Statement
Procedures And Symbolic Parameters
Generation Data Groups (gdg), Compile/link-edit And Run Jcls
Access Method Services (ams)
Additional Vsam Commands
Introduction To Rexx
Overview Of Rexx
Introduction To Cics
Exception Handling In Cics
Developing A Cics Application
Cics Programming Techniques
Basic Mapping Support (bms)
Transient Data Control
Temporary Storage Control
Interval And Task Control
Cics Application Design
Recovery And Restart
System Security And Intersystem Communication
Cics Debugging Facilities And Techniques
Bms Map Definition Macros And Copylib Members
Cics Response And Abend Codes
Data, Information And Information Processing
Introduction To Database Management Systems
Introduction To Relational Database Management Systems
Database Architecture And Data Modeling
Overview Of Db2
Structured Query Language (sql)
Data Security And Access
Db2 Application Development
Qmf And Db2i
Db2 Performance Monitoring, Utilities And Recovery/restart
Overview Of Information Management System (ims)
Introduction To Vs Cobol Ii
Overview Of Application Development In Vs Cobol Ii
Overview Of The Cobol Program
Sorting And Merging Files
Coding Cobol Programs That Run Under Cics. Ims, Db2 And Ispf
Compiling The Program
Link-editing The Program
Executing The Program
Improving Program Performance
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.