IBM - VisualAge Cobol for Windows Programming Guide
634 pág.

IBM - VisualAge Cobol for Windows Programming Guide


DisciplinaCobol25 materiais167 seguidores
Pré-visualização50 páginas
. . . . . . . . 443
Using UNDATE . . . . . . . . . . . 443
Analyzing and avoiding date-related diagnostic
messages . . . . . . . . . . . . . . . 444
Avoiding problems in processing dates . . . . . 446
Avoiding problems with packed-decimal fields 446
Moving from expanded to windowed date fields 446
Part 6. Improving performance and
productivity . . . . . . . . . . . 449
Chapter 30. Tuning your program. . . 451
Using an optimal programming style . . . . . 451
Using structured programming . . . . . . 452
viii Programming Guide
Factoring expressions. . . . . . . . . . 452
Using symbolic constants . . . . . . . . 452
Grouping constant computations . . . . . . 452
Grouping duplicate computations . . . . . 453
Choosing efficient data types . . . . . . . . 453
Computational data items . . . . . . . . 453
Consistent data types. . . . . . . . . . 454
Arithmetic expressions . . . . . . . . . 454
Exponentiations . . . . . . . . . . . 454
Handling tables efficiently . . . . . . . . . 455
Optimization of table references . . . . . . 456
Optimizing your code . . . . . . . . . . 458
Optimization . . . . . . . . . . . . 458
Choosing compiler features to enhance
performance . . . . . . . . . . . . . . 459
Performance-related compiler options . . . . 460
Evaluating performance . . . . . . . . . 461
Chapter 31. Simplifying coding . . . . 463
Eliminating repetitive coding . . . . . . . . 463
Example: using the COPY statement. . . . . 464
Manipulating dates and times . . . . . . . . 465
Getting feedback . . . . . . . . . . . 465
Handling conditions . . . . . . . . . . 465
Example: manipulating dates . . . . . . . 466
Example: formatting dates for output . . . . 466
Feedback token. . . . . . . . . . . . 467
Picture character terms and strings . . . . . 468
Example: date-and-time picture strings . . . . 470
Century window . . . . . . . . . . . 471
Part 7. Appendixes . . . . . . . . 473
Appendix A. Summary of differences
with host COBOL. . . . . . . . . . 475
Compiler options . . . . . . . . . . . . 475
Data representation . . . . . . . . . . . 475
Environment variables . . . . . . . . . . 476
File specification . . . . . . . . . . . . 476
Interlanguage communication (ILC) . . . . . . 476
Input and output . . . . . . . . . . . . 477
Run-time options . . . . . . . . . . . . 477
Source code line . . . . . . . . . . . . 477
Appendix B. System/390 host data
type considerations . . . . . . . . 479
CICS access . . . . . . . . . . . . . . 479
Date and time callable services . . . . . . . 479
Floating-point overflow exceptions . . . . . . 479
DB2 . . . . . . . . . . . . . . . . 480
MQSeries. . . . . . . . . . . . . . . 480
Remote file access . . . . . . . . . . . . 480
Local file access . . . . . . . . . . . . 480
SORT . . . . . . . . . . . . . . . . 480
Appendix C. Intermediate results and
arithmetic precision . . . . . . . . 481
Terminology used for intermediate results . . . . 481
Example: calculation of intermediate results . . . 482
Fixed-point data and intermediate results . . . . 482
Addition, subtraction, multiplication, and
division . . . . . . . . . . . . . . 482
Exponentiation . . . . . . . . . . . . 483
Example: exponentiation in fixed-point
arithmetic . . . . . . . . . . . . . 484
Truncated intermediate results. . . . . . . 485
Binary data and intermediate results . . . . 485
Intrinsic functions evaluated in fixed-point
arithmetic . . . . . . . . . . . . . . 485
Integer functions . . . . . . . . . . . 485
Mixed functions . . . . . . . . . . . 486
Floating-point data and intermediate results . . . 487
Exponentiations evaluated in floating-point
arithmetic . . . . . . . . . . . . . 487
Intrinsic functions evaluated in floating-point
arithmetic . . . . . . . . . . . . . 488
Arithmetic expressions in nonarithmetic statements 488
Appendix D. Complex OCCURS
DEPENDING ON . . . . . . . . . . 491
Example: complex ODO . . . . . . . . . . 491
How length is calculated . . . . . . . . 492
Setting values of ODO objects . . . . . . . 492
Effects of change in ODO object value . . . . . 492
Preventing index errors when changing ODO
object value . . . . . . . . . . . . . 493
Preventing overlay when adding elements to a
variable table . . . . . . . . . . . . 493
Appendix E. Date and time callable
services. . . . . . . . . . . . . . 497
CEECBLDY\u2014convert date to COBOL integer
format. . . . . . . . . . . . . . . . 498
CEEDATE\u2014convert Lilian date to character format 502
CEEDATM\u2014convert seconds to character
timestamp . . . . . . . . . . . . . . 505
CEEDAYS\u2014convert date to Lilian format . . . . 509
CEEDYWK\u2014calculate day of week from Lilian
date . . . . . . . . . . . . . . . . 513
CEEGMT\u2014get current Greenwich Mean Time . . 515
CEEGMTO\u2014get offset from Greenwich Mean Time
to local time . . . . . . . . . . . . . . 517
CEEISEC\u2014convert integers to seconds . . . . . 519
CEELOCT\u2014get current local date or time . . . . 521
CEEQCEN\u2014query the century window . . . . 523
CEESCEN\u2014set the century window. . . . . . 525
CEESECI\u2014convert seconds to integers . . . . . 526
CEESECS\u2014convert timestamp to seconds . . . . 529
CEEUTC\u2014get coordinated universal time . . . . 533
IGZEDT4\u2014get current date. . . . . . . . . 533
Appendix F. Run-time messages . . . 535
Notices . . . . . . . . . . . . . . 575
Trademarks . . . . . . . . . . . . . . 576
Glossary . . . . . . . . . . . . . 577
Contents ix
List of resources . . . . . . . . . . 599
VisualAge COBOL . . . . . . . . . . . 599
Related publications . . . . . . . . . . . 599
Index . . . . . . . . . . . . . . . 601
x Programming Guide
About this book
Welcome to IBM VisualAge COBOL, IBM\u2019s COBOL development environment for
Windows NT! VisualAge COBOL gives you a comprehensive development
environment designed specifically for mission-critical applications.
This book will help you write, compile, link-edit, and run your VisualAge COBOL
programs. It will also help you define object-oriented classes and methods, invoke
methods, and refer to objects in your programs.
There are some differences between host and workstation COBOL. For details on
language and system differences between VisualAge COBOL and IBM COBOL for
OS/390 & VM, see \u201cAppendix A. Summary of differences with host COBOL\u201d on
page 475.
Who should use this book
This book assumes that you have experience in developing application programs
and some knowledge of COBOL. It focuses on using COBOL to meet your
programming objectives and not on the definition of the COBOL language. For
complete information on COBOL syntax, refer to IBM COBOL Language Reference.
This book also assumes familiarity with Windows and the VisualAge COBOL
development environment. For information on Windows, see your operating
system documentation. To learn about the VisualAge COBOL development
environment, see the Getting Started guide.
Terminology used in this book
Certain terms are used in a shortened form in this book. Abbreviations for the
product names used most frequently in this book are listed alphabetically in the
table below. Abbreviations for other terms, if not commonly understood, are shown
in italics the first time they appear and are listed in the glossary at the back of this
book.
Term used Long form
CICS CICS for Windows NT or VisualAge CICS Enterprise
Application Development
DB2 Database 2
OS/2 Operating System/2
SOM System Object Model
STL Standard Language file system
VisualAge CICS VisualAge CICS Enterprise Application Development
VisualAge COBOL IBM VisualAge COBOL
In addition to these abbreviated terms, the term \u201cCOBOL 85 Standard\u201d is used in
this book to refer to the combination of the following standards:
v ISO 1989:1985, Programming languages - COBOL
© Copyright IBM Corp. 1996, 2000 xi
v ISO 1989/Amendment 1, Programming Languages - COBOL - Amendment 1:
Intrinsic function module
v X3.23-1985,