Appendix A Syntax Notation Synt ax Di agram Th is book makes use of syntax diagrams to describe the syntax of expressions. Syntax diagrams are read left to right, top to bollom. .. - .- indicates the beginning of a statement i nd icates the end of a statement indicates that the statement is continued indicates the continuation of the statement Mandatory items cannot be branched around. Example: . --mandatory Loptional ..J If one of a numbe r of mandatory items must be selected, then these items appear in a vertical stack. Example: _----,mandatory 1 -.---- Lmandatory2..J Multi ple opti ons appear in a vertical stack, one of the specified options may be se lected.
22
Embed
Appendix A - Springer978-1-4471-1035-4/1.pdf · Appendix A Syntax Notation Syntax Diagram This book makes use of syntax diagrams to describe the syntax of expressions. .. Syntax diagrams
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Appendix A
Syntax Notation
Syntax Diagram This book makes use of syntax diagrams to describe the syntax of expressions. Syntax diagrams are read left to right, top to bollom.
.. -
.-
indicates the beginning of a statement
indicates the end of a statement
indicates that the statement is continued
indicates the continuation of the statement
Mandatory items cannot be branched around.
Example: . --mandatory
Loptional..J
If one of a number of mandatory items must be selected, then these items appear in a vertical stack .
Example: _----,mandatory1-.---
Lmandatory2..J
Multiple options appear in a vertical stack, one of the specified options may be selected.
App. Al SYNTAX NOTATION 185
E;r;ample :
There are two forms of repetition - either one or more options of a specified group of options may be selected (anyone option may be selected at most once). or one or more options of a specified group of options may be selected any number of time.
$elective repetition:
- kt;'"'~ opt 1 on2 Both option} and optionl may be selected not more than once.
Normal repetition:
- f....,Hoo, l Loptl0n2j n
Optionl and optionl may be selected any number of times, unless n is specified, in which case n specifies the maximum number of repetitions.
If the repeat arrow contains an item, then this item is mandatory for repetitions .
Example: _---0---------------------------, ___ . d t this option may be repeated ---:-,,-:---, this item is required for repet itions
An item written in upper case must be spelled e;r;actly as shown, an item written in lower case is replaced by a valid entry (described in the te;r;t). An underlined entry is the default value.
Exam~le : ---"PH·--,G--=~::-:-.,--~-
L;ill , The first item is mandatory and must be ALPHA ; the second item is optional, the default value is BElA.
If an item is wrinen italicised. then this is a parameter, the definition of which follows.
Example : _--logicaloperator __
186 SYNTAX NOTATION lApp. A
logicaloperator: .. 6:~ .. The "'ogicaloperator" parameter may be replaced by one of the optional values: AND or 011:.
A syntax diagram is fonned by combining the simple elements defined above.
Foot The sans serif font is used to depict commands. keywords or data set names.
Example: The QMF statement TSO DELETE is a command which invokes the TSO component DELElE.
Appendix B
Sal Data Areas
SQLCA (SQL Communication Area)
or SOLCA --------, SOltA-ID
SQLCABC
SQlCOOE
SOLERRM
8
2
• 8
88 SQLERRP SQlEJIRD 96 SOlERRD(1)
100 SQlERRD(2)
104 SQLEIIIIO(l)
10 SCLERRD (4)
8
11 SQLEIIIIO(5)
11 SQLEIIIIO ( 6) SQLWARN 12
12 $OLElCT
2
• 0
8
136
"SOLeA"
totaL length ( - 136)
SOL return code
length of error message
error mess lge t okens
Figure 8. 1 -SQLCA format
136 bytes
•
188 Sal DATA AREAS lApp. B
Table B.1 - SQLCA fields
Field name DaJa Iype Description
SQLCAIO CHARCS) SQLCA identifier: "SOlCA" SQLCABC INTEGER Jotallength OfSQLCA (136 bytes) SQLCOOE INTEGER SQL return code SQLERRM VARCHAR(70) SQL error message tokens SQLERRML length of error message Jokens SOLERRMC error message tokens (each separated by X'FF') SOLERRP CHAR{S) diagnostic information SOLERRO codes set by various DB2 components SOlERRD(1) INTEGER Relational Data System error code. SOlERRD(2) INTEGER Data Manager error code. SQLERRD(3) INTEGER number of rows affected by DELETE, INSERT or UPDATE
operation SQLERRD(4) FLOAT'" estimate of the amount of resources required by this
statement SQlERRD(5) INTEGER position of syntax error in PREPARE or
EXECUTE lMMEDlA TE slatement SQlERRD(6) INTEGER Buffer Manager error code SQUJARN warning flags SQlWARNO CHAR(l) blank if all the other warning flags are also blank,
otherwise OW" SOlWARN1 CHAR( 1) ' W" if value assigned to a host variable has been
truncated SQlWARN2 CHAR(1) OW" if null values have been eliminated from the search
SOLWARN3
SQl WARN4
SQLWARN5 SQl WARN6
SQLWARN7 SQlEXT
CHARCO
CHAR(1 )
CHAR(O CHAR(O
CHAR(1) CHARCS)
argument OW" if the number of columns returned is larger than the number of host variables specified ' W" if DELETE or UPDATE statement does not contain a SElECT clause ' W " if the statement is invalid · W· if a DATE or TIME value has been adjusted because it was invalid reserved reserved
'" The library definitions specify SQlERRD as being an array of 6 integer elements.
SQlERRO OS 6F SQLWARN OS OC SOlWARNO OS C'W' SOlWARN1 OS C'W' SOlWARN2 OS C'W' SOlWARN3 OS C'W' SOlWARN4 OS C'W' SOL WARNS OS C'W' SQlWARN6 OS C'W' SQLWARN7 OS C'W' SOlEXT OS Cla
WARNING If ANY " WARNING " WARNING '" WARNING '" WARNING '" WARNING " WARNING " WARNING
FLAGS
Sal DATA AREAS 189
190 Sal DATA AREAS
C Language Definitions IIi fndef SOLCOOE struct sqlca
The SQLDA COntains data required for the embedded SQL DESCRIBE statement. The EXECUTE, FETCH, OPEH and PREPARE embedded SQL statements may also make use of the SQLDA. A sample SQLDA is shown in Figure B.3.
SQLDAIO
SQLOABC
SQLN
SOLD
SQLVAR
° • 12
r SOLDA
14
16
°1
"SQLOA"
total length (:m)
nurber of SQLVAR elements (:n)
nurber of collJMS
SQLVARl
,
44>--1 -----I
°1 SOLVARn
44LI ____ ---1
m bytes
•
App. Bl
SQLTYPE
SQlLEN
SQLOATA
SQUMO
SQlMAME
4
Or .SQLVAR dati type
2 ellterOll
4 length
address of host variable 8
address of indicator variable 2
length of name 4 -4
Figure 8.2 - SQLDA format
Table 8 .2 - SQLDA fields
Field name Data type Description
SQLDAID CHAR(8) SQlDA idemifier ~SQlOA ~ SQLOABC I NTEGER total length of SQlDA
SQL DATA AREAS 191
SQlN SMALLINT maximum number SQlVAR emries SQlO SMAlUNT current number of columns (SQLVAR entries)
SQLVAR describes each column:
Field name Data type Description SQLTYPE SMALLINT data type (see Table 8.3) SQLLEN SHAlllNT external length of data item SQlDATA poimer address of host variable SQLlND pointer address of indicator variable; a half-word containing a
negative value (usually -1) if the host variable is null SQLNAME VARCHAR(3D) name or label
192 Sal DATA AREAS
Table 8.3 - Data Iype codes
SOL TYPE data type
3841385
3881389
3921393
448/449
452/453
456/457
4601461
DATE fixed-length character sIring representation of a date TIME fixed-length character string representation of a time TIMESTAMP fixed-length character string representation of a timestamp VARCHAR varying-length character string CHAR fixed-length character string LONG VARCHAR varying-length long character string VARCHAR
lApp. 8
varying-length character string tenninated with the C-Ianguage null character
4641465
4681469
472/473
480/481
484 /485
496/497
5()()I501
504/505
VARGRAPHIC .. varying-length graphic string GRAPHIC· fixed-length graphic string LONG VARGRAPHtC • varying-length long graphic string FLOAT floating-pain! DECIMAL packed decimal INTEGER large binary integer SMALLJNT small binary integer (no data type) precision in byte I and scale in byte 2 .
• graphic means OBCS
Note on Table 8 .3: QMF control areas and records which store the null indicator explicitly use the same data type code (the even-numbered code) to identify both kinds of entry. The odd-numbered data type code indicates that nulls are allowed .
The standard SQLDA definitions for various host languages follow. Note: there is no standard library SQLDA definition for COBOL.
PLII SQLDA Definition: DECLARE
t SOLDA BASEoeSOLDAPTR), 2 SQLDAIO CHAR(6), 2 SOlDABC F t KED (31) B I NARY, 2 SQlN F{KEO(15 ) BINARY, 2 SOLO FtKED(t5) BINARY,
Example: The format of the SQLOA conslruCled for the selection:
SELECT fiNO, flNAME fROM PEII.S
with PNO OECIMAL(4,O) and value 3333 flHAME VARCHAR(24) and value ~ALflHA"
is shown in Figure B.3.
194 SOLDATAAREAS
o SOLDA r;;SOLOA" ::::J 8
SOLDA!D
SDlDABC
SClN
104 tonl leng
SOLD SClVAROl SOL TYPE
SOL lEN
SOlDATA
SOUNO
SOlNAME
2
4
6
2
2
2 ,
8
a
4
8
a
SOlVAR(21 60 SOL TYPE
SOL lEN
SOlDATA
SOUND
SOLNAME
2 6
64 .. 2 7
7 4
2 till ill i IfUI'I
2 current
4"
4 a
, 'NO
"8 24
5
PNAME
Figure B.3 - Sample SQLDA
I'lI..I1ber of coLums
I'IUItIer. of colum$
• 3333
• a
• 5 i' l , H 'i • a
RIB (Release Infonnation Block)
lApp. B
The DSNORIB macro produces a DSECT named RIB, whose structure is shown in Table B.4. In addition, the following code line containing the current DB2 release is generated:
R! BRVAl DC Cl3' vrlll' V = version r = release m :::: modification level
It I BCPTIt • address of ItIBCINFO (change level information array) R!BCNUHB HLl number of elements in RIBCIHFO
XL3 reserved KL16 reserved
Appendix C
Glossary
abend Word formed from abnormal end. A n abend occurs when a program does not terminate normally, i.e. because an error situation has been detected. Two forms of abend may occur: system and user. A system abend is detected by the operating system (e.g . program exception, system fa ilure). A user abend is issued by the program itself, e.g. the program has determined that it cannot continue processing. User abends should be avoided; in most cases a program completion code can be sel 10 indicate that processing fa iled.
alphabetic The set of characters containing the lower and upper case letters together with the three national characters: #, @ and $.
a lphanumeric The sel of alphabetic characters together with the ten numeric digits.
application plan Processing strategy for the embedded SQL statements; also known as plan . The application plan is identified by its unique application plan name. Every executable program that uses DB2 services requires an application plan. An application plan is fanned from DBRM members or packages.
Assembler Low-level programming language fo r low-level machinedependent programming tasks .
bind The processing performed on embedded SQL statements to produce control statements suitable for use in accessing the DB2 database.
App. C)
C
catalog
CICS
CLIST
COBOL
GLOSSARY 197
Modem mid-level programming language for low-level machine-independent programming tasks (Assembler replacemem). In the OB2 sense, the collection of system tables stored in the database. Customer Information Comrol System, monitor system to provide on-line transaction processing facilities for programs. Procedure consisting of TSQ commands and subcommands and control statements. CLiSTs are also known as command procedures. COmmon Business Oriented Language. High-level commercial programming language.
column A venical element of a table and is generally synonymous with a field in conventional data processing .
command procedure See CLIST and REXX procedure. commit The action of making changes to the database permanent . See
also revoke. compiler
CSP
cursor dataset database
DATABASE2 DBMS
DB2 DBCS
DBRM
DCLGEN
DD
A software component which convens a source program into an object module. Cross System Product. IBM application generator with interface to DB2 and ISPF.
In the DB2 contex.t, an internal pointer to a row in a table . IBM term for a file. A logically related set of named data elements. Database systems isolate users from the physical data storage. IBM relational data base, usually known as DB2.
Database Management System. A program to control the use of a database . DATABASE2. IBM relational data base . Double·Byte Character Set. A set of pairs of characters used to represent characters in Far-East languages (Chinese, Japanese, Korean, etc.) . Also known as graphic data in OB2.
Data Base Request Module . Each program using SQL services requires a OBRM to describe the logical access. The DBRM is produced by the OB2 precompiler and is used as input to the Bind processor. The bound OBRM is stored in the database. Dedarations generator. Creates program declarations for the elements in a OB2 table or view . Data Definition. The JCL statement used to assign the physical data (dataset, printer output class, etc.) to the logical dataset defined in the program. The ddname links the logical dataset to the JCL DO statement.
Dialog Manager !SPF component which administers dialogue facilities. Dialog Manager is usually synonymous with ISPF .
198 GLOSSARY
dialogue
DSORG
dynamic SQL
embedded SQL ESQL exec EXEC
file
FORTRAN
GDDM
GDF
graphic data halr·word
help em'ironment help panel
hosl language
host variable
IBM
lCU
lMS
indicator variable
lApp. C
Man-machine interaction using a terminal directly attached to compUier. Various levels of program systems (application program, terminal monitor program, etc.) control the dialogue. Dataset organisation. The organisation of information in a dataset . The creation of SQL statements at run-time. This means that authorisations and processing strategies must also be made at run-time. See ESQL. Embedded SQL. The SQL statements used in a program. Lowercase . A synonym for a REXX procedure. Uppercase . Execute program of procedure. The JCL statement used to invoke a program or lCL procedure. A collection of data ( = dataset). Also with regard to TSO it is equivalent to the JCL DO statement, filename is then equivalent to the ddname. FORmula TRANslation . High-level scientific programming language. Graphic Data Display Manager. ISM product consisting of basic subroutines for processing and displaying graphic data. Note: Graphic data here does not imply DBCS data. Graphics Data File . GDDM data format which contains processed graphs . See DBCS. A signed binary number which occupies 2 bytes. This is the same internal representation as a DSl SMALLlNT variable . Sub-environment used to provide on-line assistance . Panel which is used for display or data entry within the help environment. A programming language which can use embedded SQL statements, Le. a language for which a DBl precompiler exists . The following host languages are currently supported : Assembler, C, COBOL, FORTRAN, PUI. A variable contained in a program and used as DB2 data element. International Business Machines Corporation, supplier of 082 , CICS, ISPF, MVS, QMF, etc. licensed products. Interactive Chart Utility . A user-friendly dialogue interface to PGF for lhe processing of business (presentation) graphics . Infonnation Management System. IBM hierarchical database system. A host variable used 10 indicate whether the associated data value actually contains data or is null . The indicator variable
App . CI
interactive SQL ISPEXEC
ISPF
ISPLINK
ISPSTART JCL
library Linkage Editor
load module
locking
LRECL
member
MVS null
object module package panel
GLOSSARY 199
is set to contain a negative value (usually -I) , if the host value is null . SQL statements directly invoked (e .g. using OB21 or QMF). ISPF component which provides dialogue serv ices for CLlSTs and REXX procedures . Interactive System Productivity Facility, IBM programming system to provide dialogue facilities . ISPF requires TSO. ISPF is required by QMF and SPUFI. ISPF component which provides dialogue services for programs. ISPF component which invokes the ISPF environment. Job Control Language. The statements used to comrol the processing of a balch job. The principal JCL statemems are: DO and EXEC .
A partitioned dataset. IBM program to combine one or more object modules imo a load module. Machine-readable Linkage Editor output in a form suitable for loading into virtual storage for execution. The means of slOpping other users from accessing (read lock) or changing data (write lock), and is used to maintain data integrity. Logical record length. The number of characters fonning a record. Independem pan of a partitioned dataset. A member can be directly accessed and processed as if it were a sequential dataset. Multiple Virtual Systems operating system. For OB2, a special value indicating that this particular element (row-column) does not actually contain a value, it is not the same as 0 (for a numeric field) or blank (for a character field). See indicator variable. machine-readable compiler output. A non-executable plan that is associated with a program. Form with which data is to be displayed on a display terminal.
partitioned dataset A data set comprising of members. Each member can be
PDF
PGF
accessed directly by means of its (member) name. Program Development Facility, IBM dialogue utility package to assist the programmer in program development. PDF is an ISPF appl icat ion. Presemalion Graphics Feature. Library of routines using GDDM to create presentation (business) graphics. ICU is a dialogue interface to PGF.
200 GLOSSARY
PL/I
precompilation
profile pool
QBE
QMF query revoke
REXX
row
SAA
session
shared pool
source program
SPUFl
lApp. C
Modem high-level programming language combining many of the features of COBOL and FORTRAN.
The action of converting embedded SQL statements to statements which can be processed by the host language. The precompiler also produces a DBRM entry from the SQL statements . The pool of dialogue variables belonging to a panicular application. The profile pool is retained across ISPFiTSO
sessions. Query-Dy-Example. QMF component which simplifies the creation of ad-hoc queries. Query Management Facility. End-user interface to 082.
General term for an SQL statement. The action of ignoring those changes made to the database since the last commit . ReSlfuctured Extended Executor. REXX is a high-level programming language functionally similar to CLiST. REXX is more powerful than the CLIST language and has largely superseded it. A horizontal element of a table and is generally synonymous with a record in conventional data processing. Systems Application Architecture. SAA is an IBM concept designed to provide a standard interface to the user (application developer). The dialogue environment for the current user. TSO is the lowest level session. The pool of dialogue variables belonging to the current iSPF
session. Input to a compiler. A source program constitUies the ·computer instruClions· produced by the programmer. Source programs can exist in a number of levels of detail. Low-level languages (e.g. Assembler) require that the programmer has an intimate knowledge of the machine instructions available on the computer on which his program will run . High-level languages (e.g. PUt) remove much of this burden from the programmer and enable him to be more concerned with the procedure required to solve his program; such languages are often referred to as procedure oriented languages. So called 4th generation languages (CLISTS offer certain features) are problem oriented. Modem high-level languages offer structuring facilities. SQL Processor Using File Inpul. A TsoilSPF program which can be used to process SQL statements. It is generally used to test SQL statements, perform simple DB2 administrative
App. CI
SQL
SQLCA
SQLDA
static SQL
system table
table
table space
transaction TSO
unit of recovery unit of work userid
view word
GLOSSARY 201
test SQL statements, perform simple DB2 administrative functions and to load limited amounts of data into DB2 tables . SPUFJ, as its name implies, takes its input from datasets. Structured Query Language . The statements used to access a DB2 database. SQL Communication Area. A system area used by SQL to pass information concerning the execution of an SQL statement back to the program. Its most important field is SOLCOOE,
which indicates the status of the most recently executed SQL
statement. SQL Descriptor Area. A program area used by SQt to obtain (or return) information pertaining to the COiUIlUlS of the specified SQL statement, e.g. COIUIlUl type, coluIlUllength. The creation of SQL statements at the time of writing the program. A database table used for internal administrative purposes, e.g. the system table SYSIBM.SYSTABlES contains an entry for each table (and view) stored in the database. Each system table name is qualified by SYSIBM.
In the database sense, a two-dimensional array of elements stored in or retrieved from the database. The physical (disk) Storage area used to contain one or more tables . Generally synonymous with a query . Time Sharing Option, programming system to provide users with on-line access to computing system. TSO is now a standard MVS component. The interval between two commits or revokes. Transaction. The unique code for the user when he logs onto the TSO
system. Also used by SQL for authorisation purposes . In the database sense, a subset of one or more database tables. A signed binary number which occupies 4 bytes . This is the same imemal representation as a DB2 IHTECiER variable.
plan. 71. 200 PLAN TABLE, principal anrihulcs, 147 pre-liniedit, 79 precompilation. 200 precompile phase, 71 preparation Slep parameters, 14 PREPARE, IS4 prepare program in foreground, 82 PRINT - pnnl contents of objet!. 42 profile pool, 200 program hOSI variables, 119 program invoke independent of DB2, 104 program preparation, 71 program solution, example, 179 promote locks, 162
Assembler inlerface, 22 C Interface, 26 Callable Interface, IS Chart, 14 CICS subset, 14 COBOL inlerface, 24 Command Facilities, 15 command, r,assins paramelel'5 to, 31 Command nterface, 30 commands, 33 data, 13 data format, 64 data header record, 64 data value record, 65 direct invocation of, 16 external data format, 57 files, 17
fonn, 13 invocation, 14
sample CLlST, IS objects, 12
administration of. 15 transfer, 15
parameter list format, 20 PUI interface, 27 procedure, 14 profile, 14 program, DSQQMFE, 16 query, 13 report, 13
end record, 69 format, 13,66
INDEX 205
header record format, 66 line record, 68 line continuation record, 69 table record format, 67 table row record, 67
REXX interface, 29 solution, example, 175 starus, 30
variables, 3 I wort area, 13
query, 200 Query by Example, 13 Query Managemellt Facility , 3,12
S-lock, 162 SAA,200 SAVE - save contents of wort area, 47 SAVE DATA - save contents of data area, 48 SAVE PROFILE - save profIle, 49 SELECT,16 SELECT INTO, 155 session. 200 SET ~ROFILE) - set profile, 49 SET LOBAL - set global variable. 51 shared lock. 162 shared pool, 200 source program, 200 SPUFI, 3, 94, 200 SPUFI. invoke, 95 SQL,201
operating environment, 3 program, run, 101 rerum code, 118 starus, 117 transaction concepts, 159 use of, 3 used from PfOlrams, 125 used from app ications, 4
206 INDEX
S8l Communi~ation Area, 117 S l Processor Using File Input, 3, 94 S8lCA, \ 17, 187,101 S lCABC, 188 SQLCAID, 188 SQlCODE, 11 7, 118, 127, 188 S8lD, 132, 191 S LDA, 190, 20 1
no standard COBOL definition, 132 SQLDABC, 191 S8LDAID, 191 S LDATA, 132, 191 S8lERRD, 188 S LERRM, 188 SQLERRP, 188 SQLlND, 132, 191 SQLLEN , 191 SQLN, 132, 191 SQLNAME, 191 SQLTYPE,I91 SQLVAR, 132, 191 SQLWARN, 188 SQLWARNO, 118 SlART ~ommand , 21 stan declarations, 138 STATE - rerum QMF starus, 51 stati~ SOl, 117, 125,201
SEL£CT with a fixed number of columns and multiple rows, 127
syntax diagram, 184 system table, 201 SYSTSIN,8 SYSTSPRT,8