statements - software ag...example.....105 18callnat.....107 function.....108

1056
Natural for Mainframes Statements Version 4.2.6 for Mainframes October 2009

Upload: others

Post on 09-Feb-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

  • Natural for Mainframes

    Statements

    Version 4.2.6 for Mainframes

    October 2009

  • This document applies to Natural Version 4.2.6 for Mainframes and to all subsequent releases.

    Specifications contained herein are subject to change and these changes will be reported in subsequent release notes or new editions.

    Copyright © Software AG 1979-2009. All rights reserved.

    The name SoftwareAG,webMethods and all SoftwareAGproduct names are either trademarks or registered trademarks of SoftwareAGand/or Software AG USA, Inc. Other company and product names mentioned herein may be trademarks of their respective owners.

  • Table of Contents

    1 Statements ....................................................................................................................... 12 Syntax Symbols and Operand Definition Tables ............................................................ 3

    Syntax Symbols .......................................................................................................... 4Operand Definition Table .......................................................................................... 5

    3 Statement Usage Related Topics ..................................................................................... 94 Statements Grouped by Functions ................................................................................ 11

    Database Access and Update ................................................................................... 12Arithmetic and Data Movement Operations ........................................................... 14Loop Execution ......................................................................................................... 14Creation of Output Reports ...................................................................................... 15Screen Generation for Interactive Processing .......................................................... 15Processing of Logical Conditions ............................................................................. 16Invoking Programs and Routines ............................................................................ 16Program and Session Termination ........................................................................... 17Control of Work Files / PC Files ............................................................................... 17Component Based Programming ............................................................................. 17Memory Management Control for Dynamic Variables or X-Arrays ....................... 18Natural Remote Procedure Call ............................................................................... 18Internet and XML ..................................................................................................... 18Miscellaneous ........................................................................................................... 18Reporting Mode Statements ..................................................................................... 19Statements Available with Predict Case and Entire DB ........................................... 20

    5 ACCEPT/REJECT .......................................................................................................... 21Function .................................................................................................................... 22Syntax Description ................................................................................................... 22Processing of Multiple ACCEPT/REJECT Statements ............................................. 23Limit Notation .......................................................................................................... 23Hold Status ............................................................................................................... 23Examples .................................................................................................................. 23

    6 ADD ............................................................................................................................... 27Function .................................................................................................................... 28Syntax Description ................................................................................................... 28Example .................................................................................................................... 30

    7 ASSIGN ......................................................................................................................... 338 AT BREAK ..................................................................................................................... 35

    Function .................................................................................................................... 36Syntax Description ................................................................................................... 37Multiple Break Levels .............................................................................................. 38Examples .................................................................................................................. 39

    9 AT END OF DATA ........................................................................................................ 43Function .................................................................................................................... 44Restrictions ............................................................................................................... 45Syntax Description ................................................................................................... 45

    iii

  • Example .................................................................................................................... 4610 AT END OF PAGE ....................................................................................................... 49

    Function .................................................................................................................... 50Syntax Description ................................................................................................... 52Example .................................................................................................................... 52

    11 AT START OF DATA ................................................................................................... 55Function .................................................................................................................... 56Syntax Description ................................................................................................... 57Example .................................................................................................................... 57

    12 AT TOP OF PAGE ........................................................................................................ 59Function .................................................................................................................... 60Restriction ................................................................................................................. 61Syntax Description ................................................................................................... 61Example .................................................................................................................... 62

    13 BACKOUT TRANSACTION ....................................................................................... 65Function .................................................................................................................... 66Restriction ................................................................................................................. 67Database-Specific Considerations ............................................................................ 67Example .................................................................................................................... 67

    14 BEFORE BREAK PROCESSING .................................................................................. 69Function .................................................................................................................... 70Restrictions ............................................................................................................... 71Syntax Description ................................................................................................... 71Example .................................................................................................................... 71

    15 CALL ........................................................................................................................... 73Function .................................................................................................................... 74Syntax Description ................................................................................................... 74Return Code ............................................................................................................. 75Register Usage .......................................................................................................... 75Storage Alignment ................................................................................................... 76Adabas Calls ............................................................................................................. 76Direct/Dynamic Loading .......................................................................................... 77Linkage Conventions ............................................................................................... 78Calling a PL/I Program ............................................................................................. 81Calling a C Program ................................................................................................. 83INTERFACE4 ........................................................................................................... 87

    16 CALL FILE ................................................................................................................... 99Function .................................................................................................................. 100Restriction ............................................................................................................... 100Syntax Description ................................................................................................. 101Example .................................................................................................................. 101

    17 CALL LOOP ............................................................................................................... 103Function .................................................................................................................. 104Restriction ............................................................................................................... 104Syntax Description ................................................................................................. 105

    Statementsiv

    Statements

  • Example .................................................................................................................. 10518 CALLNAT .................................................................................................................. 107

    Function .................................................................................................................. 108Syntax Description ................................................................................................. 109Parameter Transfer with Dynamic Variables ......................................................... 111Examples ................................................................................................................ 112

    19 CLOSE CONVERSATION ......................................................................................... 115Function .................................................................................................................. 116Syntax Description ................................................................................................. 116Further Information and Examples ........................................................................ 117

    20 CLOSE PC FILE ......................................................................................................... 119Function .................................................................................................................. 120Syntax Description ................................................................................................. 120Example .................................................................................................................. 120

    21 CLOSE PRINTER ....................................................................................................... 123Function .................................................................................................................. 124Syntax Description ................................................................................................. 124Example .................................................................................................................. 125

    22 CLOSE WORK FILE .................................................................................................. 127Function .................................................................................................................. 128Syntax Description ................................................................................................. 128Example .................................................................................................................. 128

    23 COMPOSE ................................................................................................................. 131Function .................................................................................................................. 132Syntax Description ................................................................................................. 133Formatting Process ................................................................................................. 143Dialog Mode ........................................................................................................... 144Non-Natural Programs .......................................................................................... 145Examples ................................................................................................................ 146

    24 COMPRESS ................................................................................................................ 153Function .................................................................................................................. 154Syntax Description ................................................................................................. 154Processing ............................................................................................................... 158Examples ................................................................................................................ 158

    25 COMPUTE ................................................................................................................. 163Function .................................................................................................................. 164Syntax Description ................................................................................................. 166Result Precision of a Division ................................................................................. 168SUBSTRING Option ............................................................................................... 168Examples ................................................................................................................ 168

    26 CREATE OBJECT ....................................................................................................... 171Function .................................................................................................................. 172Syntax Description ................................................................................................. 172

    27 DECIDE FOR ............................................................................................................. 175Function .................................................................................................................. 176

    vStatements

    Statements

  • Syntax Description ................................................................................................. 176Examples ................................................................................................................ 177

    28 DECIDE ON ............................................................................................................... 179Function .................................................................................................................. 180Syntax Description ................................................................................................. 180Examples ................................................................................................................ 181

    29 DEFINE CLASS .......................................................................................................... 185Function .................................................................................................................. 186Syntax Description ................................................................................................. 186

    30 DEFINE DATA ........................................................................................................... 18931 Syntax Overview ........................................................................................................ 191

    General Syntax ....................................................................................................... 192Basic Syntax Elements ............................................................................................ 192

    32 DEFINE DATA - General ........................................................................................... 197Function .................................................................................................................. 198Rules ....................................................................................................................... 198Programming Modes .............................................................................................. 198Further Information ................................................................................................ 199

    33 Defining Local Data ................................................................................................... 201Function .................................................................................................................. 202Restriction ............................................................................................................... 202Syntax Description ................................................................................................. 202

    34 Defining Global Data ................................................................................................. 205Function .................................................................................................................. 206Syntax Description ................................................................................................. 206

    35 Defining Parameter Data ........................................................................................... 207Function .................................................................................................................. 208Restrictions ............................................................................................................. 208Syntax Description ................................................................................................. 208

    36 Defining Application-Independent Variables ........................................................... 213Function .................................................................................................................. 214Syntax Description ................................................................................................. 214

    37 Defining Context Variables for Natural RPC ............................................................ 217Function .................................................................................................................. 218Restrictions ............................................................................................................. 219Syntax Description ................................................................................................. 219

    38 Defining NaturalX Objects ......................................................................................... 221Function .................................................................................................................. 222Syntax Description ................................................................................................. 222

    39 Variable Definition ..................................................................................................... 225Function .................................................................................................................. 226Syntax Description ................................................................................................. 226

    40 View Definition .......................................................................................................... 229Function .................................................................................................................. 230Syntax Description ................................................................................................. 230

    Statementsvi

    Statements

  • 41 Redefinition ................................................................................................................ 235Function .................................................................................................................. 236Restrictions ............................................................................................................. 236Syntax Description ................................................................................................. 236

    42 Handle Definition ...................................................................................................... 239Function .................................................................................................................. 240Syntax Description ................................................................................................. 240

    43 Array Dimension Definition ...................................................................................... 243Function .................................................................................................................. 244Syntax Description ................................................................................................. 244

    44 Initial-Value Definition .............................................................................................. 247Function .................................................................................................................. 248Restriction ............................................................................................................... 248Syntax Description ................................................................................................. 248

    45 Initial/Constant Values for an Array ......................................................................... 251Function .................................................................................................................. 252Restriction ............................................................................................................... 252Syntax Description ................................................................................................. 252

    46 EM, HD, PM Parameters for Field/Variable .............................................................. 255Function .................................................................................................................. 256Syntax Description ................................................................................................. 256

    47 Examples of DEFINE DATA Statement Usage .......................................................... 257Example 1 - DEFINE DATA LOCAL (Direct Data Definition) .............................. 258Example 2 - DEFINE DATA LOCAL (Array Definition/Initialization) ................. 258Example 3 - DEFINE DATA (View Definition, Array Redefinition) ...................... 259Example 4 - DEFINE DATA (Global, Parameter and Local Data Areas) ............... 260Example 5 - DEFINE DATA (Initialization) ........................................................... 261Example 6 - DEFINE DATA (Variable Array) ........................................................ 262

    48 DEFINE PRINTER ..................................................................................................... 265Function .................................................................................................................. 266Syntax Description ................................................................................................. 267Printer Name under z/OS Batch, TSO and Server ................................................. 270Printer Name under z/VSE Batch ........................................................................... 273Printer Name under VM/CMS ............................................................................... 274Printer Name under BS2000/OSD Batch and TIAM .............................................. 275Printer Name under CICS ...................................................................................... 281Printer Name under Com-plete ............................................................................. 281Printer Name under Com-plete/SMARTS ............................................................. 281Printer Names under Natural Advanced Facilities ................................................ 282Printer Name for Additional Reports .................................................................... 282Examples ................................................................................................................ 283

    49 DEFINE SUBROUTINE ............................................................................................. 285Function .................................................................................................................. 286Restrictions ............................................................................................................. 286Syntax Description ................................................................................................. 287

    viiStatements

    Statements

  • Data Available in a Subroutine ............................................................................... 288Examples ................................................................................................................ 288

    50 DEFINE WINDOW .................................................................................................... 291Function .................................................................................................................. 292Syntax Description ................................................................................................. 293Protection of Input Fields in a Window ................................................................. 297Invoking Different Windows ................................................................................. 297Example .................................................................................................................. 297

    51 DEFINE WORK FILE ................................................................................................. 299Function .................................................................................................................. 300Syntax Description ................................................................................................. 300Work File Name under z/OS Batch, TSO and Server ............................................. 302Work File Name under z/VSE Batch ...................................................................... 305Work File Name under VM/CMS ........................................................................... 305Work File Name under BS2000/OSD Batch and TIAM .......................................... 306Work File Name under CICS .................................................................................. 310Work File Name under Com-plete/SMARTS ......................................................... 311

    52 DELETE ...................................................................................................................... 313Function .................................................................................................................. 314Restriction ............................................................................................................... 314Syntax Description ................................................................................................. 314Database-Specific Considerations .......................................................................... 315Examples ................................................................................................................ 315

    53 DISPLAY .................................................................................................................... 317Function .................................................................................................................. 318Syntax Description ................................................................................................. 318Defaults Applicable for a DISPLAY Statement ...................................................... 329Examples ................................................................................................................ 330

    54 DIVIDE ....................................................................................................................... 337Function .................................................................................................................. 338Syntax Description ................................................................................................. 338Example .................................................................................................................. 341

    55 DO/DOEND ............................................................................................................... 343Function .................................................................................................................. 344Restrictions ............................................................................................................. 344Example .................................................................................................................. 345

    56 DOWNLOAD PC FILE .............................................................................................. 347Function .................................................................................................................. 348Syntax Description ................................................................................................. 348Examples ................................................................................................................ 349

    57 EJECT ......................................................................................................................... 351Function .................................................................................................................. 352Syntax Description ................................................................................................. 352Processing ............................................................................................................... 354Example .................................................................................................................. 354

    Statementsviii

    Statements

  • 58 END ........................................................................................................................... 357Function .................................................................................................................. 358Syntax Description ................................................................................................. 358Examples ................................................................................................................ 359

    59 END TRANSACTION ............................................................................................... 361Function .................................................................................................................. 362Restriction ............................................................................................................... 362Syntax Description ................................................................................................. 363Databases Affected ................................................................................................. 363Database-Specific Considerations .......................................................................... 364Examples ................................................................................................................ 364

    60 ESCAPE ...................................................................................................................... 367Function .................................................................................................................. 368Syntax Description ................................................................................................. 369Example .................................................................................................................. 370

    61 EXAMINE .................................................................................................................. 373Syntax 1 - EXAMINE .............................................................................................. 374Syntax 2 - EXAMINE TRANSLATE ....................................................................... 379Syntax 3 - EXAMINE for Unicode Graphemes ...................................................... 380Examples ................................................................................................................ 383

    62 EXPAND .................................................................................................................... 389Function .................................................................................................................. 390Syntax Description ................................................................................................. 390

    63 FETCH ....................................................................................................................... 395Function .................................................................................................................. 396Syntax Description ................................................................................................. 397Example .................................................................................................................. 398

    64 FIND .......................................................................................................................... 401Function .................................................................................................................. 402Restrictions ............................................................................................................. 404Syntax Description ................................................................................................. 404Examples ................................................................................................................ 426

    65 FOR ............................................................................................................................ 437Function .................................................................................................................. 438Syntax Description ................................................................................................. 438Example .................................................................................................................. 439

    66 FORMAT .................................................................................................................... 441Function .................................................................................................................. 442Syntax Description ................................................................................................. 442Applicable Parameters ........................................................................................... 443Example .................................................................................................................. 444

    67 GET ............................................................................................................................ 447Function .................................................................................................................. 448Restrictions ............................................................................................................. 448Syntax Description ................................................................................................. 449

    ixStatements

    Statements

  • Example .................................................................................................................. 45068 GET SAME ................................................................................................................. 453

    Function .................................................................................................................. 454Restrictions ............................................................................................................. 454Syntax Description ................................................................................................. 455Example .................................................................................................................. 455

    69 GET TRANSACTION DATA ..................................................................................... 457Function .................................................................................................................. 458Restriction ............................................................................................................... 459Syntax Description ................................................................................................. 459Example .................................................................................................................. 459

    70 HISTOGRAM ............................................................................................................. 461Function .................................................................................................................. 462Restrictions ............................................................................................................. 463Syntax Description ................................................................................................. 463Examples ................................................................................................................ 469

    71 IF ................................................................................................................................ 473Function .................................................................................................................. 474Syntax Description ................................................................................................. 474Example .................................................................................................................. 475

    72 IF SELECTION ........................................................................................................... 477Function .................................................................................................................. 478Syntax Description ................................................................................................. 478Example .................................................................................................................. 479

    73 IGNORE ..................................................................................................................... 481Function .................................................................................................................. 482Example .................................................................................................................. 482

    74 INCLUDE ................................................................................................................... 483Function .................................................................................................................. 484Syntax Description ................................................................................................. 484Examples ................................................................................................................ 485

    75 INPUT ........................................................................................................................ 491Function .................................................................................................................. 492Input Modes ........................................................................................................... 492Entering Data in Response to an INPUT Statement .............................................. 493SB - Selection Box ................................................................................................... 496Error Correction ..................................................................................................... 496Split-Screen Feature ................................................................................................ 496System Variables with the INPUT Statement ......................................................... 497

    76 INPUT Syntax 1 - Dynamic Screen Layout Specification .......................................... 499INPUT Syntax 1 - Description ................................................................................ 500Examples - Syntax 1 ................................................................................................ 509

    77 INPUT Syntax 2 - Using Predefined Map Layout ..................................................... 513INPUT USING MAP without Parameter List ........................................................ 514INPUT Fields Defined in the Program ................................................................... 515

    Statementsx

    Statements

  • INPUT Syntax 2 - Description ................................................................................ 515Using the INPUT Statement in Non-Screen Modes ............................................... 516Processing Data from the Natural Stack ................................................................ 518Using the INPUT Statement in Batch Mode .......................................................... 518

    78 INTERFACE ............................................................................................................... 521Function .................................................................................................................. 522Syntax Description ................................................................................................. 522

    79 LIMIT ......................................................................................................................... 529Function .................................................................................................................. 530Syntax Description ................................................................................................. 531Examples ................................................................................................................ 531

    80 LOOP ......................................................................................................................... 533Function .................................................................................................................. 534Restriction ............................................................................................................... 534Syntax Description ................................................................................................. 534Examples ................................................................................................................ 535

    81 METHOD ................................................................................................................... 537Function .................................................................................................................. 538Syntax Description ................................................................................................. 538Example .................................................................................................................. 539

    82 MOVE ........................................................................................................................ 543Function .................................................................................................................. 544Syntax Description ................................................................................................. 545Examples ................................................................................................................ 556

    83 MOVE ALL ................................................................................................................ 561Function .................................................................................................................. 562Syntax Description ................................................................................................. 562Example .................................................................................................................. 563

    84 MOVE INDEXED ....................................................................................................... 56585 MULTIPLY ................................................................................................................. 567

    Function .................................................................................................................. 568Syntax Description ................................................................................................. 568Example .................................................................................................................. 570

    86 NEWPAGE ................................................................................................................. 573Function .................................................................................................................. 574Syntax Description ................................................................................................. 574Example .................................................................................................................. 575

    87 OBTAIN ..................................................................................................................... 579Function .................................................................................................................. 580Restriction ............................................................................................................... 580Syntax Description ................................................................................................. 581Examples ................................................................................................................ 585

    88 ON ERROR ................................................................................................................ 589Function .................................................................................................................. 590Restriction ............................................................................................................... 590

    xiStatements

    Statements

  • Syntax Description ................................................................................................. 591ON ERROR Processing within Subroutines ........................................................... 591System Variables *ERROR-NR and *ERROR-LINE ............................................... 591Example .................................................................................................................. 592

    89 OPEN CONVERSATION ........................................................................................... 593Function .................................................................................................................. 594Syntax Description ................................................................................................. 594Further Information and Examples ........................................................................ 595

    90 OPTIONS ................................................................................................................... 597Function .................................................................................................................. 598Processing of Multiple OPTIONS Statements ........................................................ 598

    91 PARSE XML ............................................................................................................... 599Function .................................................................................................................. 600Syntax Description ................................................................................................. 601Examples ................................................................................................................ 603

    92 PASSW ....................................................................................................................... 609Function .................................................................................................................. 610Restriction ............................................................................................................... 611Syntax Description ................................................................................................. 611Example .................................................................................................................. 612

    93 PERFORM .................................................................................................................. 613Function .................................................................................................................. 614Syntax Description ................................................................................................. 614Examples ................................................................................................................ 617

    94 PERFORM BREAK PROCESSING ............................................................................ 621Function .................................................................................................................. 622Syntax Description ................................................................................................. 622Example .................................................................................................................. 623

    95 PRINT ........................................................................................................................ 625Function .................................................................................................................. 626Syntax Description ................................................................................................. 627Example .................................................................................................................. 632

    96 PROCESS ................................................................................................................... 635Function .................................................................................................................. 636Restriction ............................................................................................................... 636Syntax Description ................................................................................................. 636

    97 PROCESS COMMAND ............................................................................................. 639Function .................................................................................................................. 641Syntax Description ................................................................................................. 641DDM: COMMAND ................................................................................................ 652Examples ................................................................................................................ 653

    98 PROCESS PAGE ......................................................................................................... 655Function .................................................................................................................. 656Syntax 1 - PROCESS PAGE .................................................................................... 656Syntax 2 - PROCESS PAGE USING ........................................................................ 659

    Statementsxii

    Statements

  • Syntax 3 - PROCESS PAGE UPDATE .................................................................... 661Syntax 4 - PROCESS PAGE MODAL ..................................................................... 664Examples ................................................................................................................ 666

    99 PROPERTY ................................................................................................................ 667Function .................................................................................................................. 668Syntax Description ................................................................................................. 668Example .................................................................................................................. 669

    100 READ ....................................................................................................................... 671Function .................................................................................................................. 672Syntax Description ................................................................................................. 673System Variables Available with READ ................................................................. 682Examples ................................................................................................................ 683

    101 READ WORK FILE .................................................................................................. 691Function .................................................................................................................. 692Syntax Description ................................................................................................. 693Field Lengths .......................................................................................................... 696Handling of Large and Dynamic Variables ............................................................ 696Example .................................................................................................................. 697

    102 REDEFINE ............................................................................................................... 699Function .................................................................................................................. 700Restriction ............................................................................................................... 700Syntax Description ................................................................................................. 700Examples ................................................................................................................ 701

    103 REDUCE ................................................................................................................... 703Function .................................................................................................................. 704Syntax Description ................................................................................................. 704

    104 REINPUT ................................................................................................................. 709Function .................................................................................................................. 710Syntax Description ................................................................................................. 711Examples ................................................................................................................ 716

    105 REJECT ..................................................................................................................... 721106 RELEASE .................................................................................................................. 723

    Function .................................................................................................................. 724Syntax Description ................................................................................................. 724Example .................................................................................................................. 725

    107 REPEAT .................................................................................................................... 727Function .................................................................................................................. 728Syntax Description ................................................................................................. 728Examples ................................................................................................................ 729

    108 REQUEST DOCUMENT .......................................................................................... 733Function .................................................................................................................. 734Syntax Description ................................................................................................. 735Encoding of Incoming/Outgoing Data ................................................................... 743Examples ................................................................................................................ 746

    109 RESET ....................................................................................................................... 749

    xiiiStatements

    Statements

  • Function .................................................................................................................. 750Syntax Description ................................................................................................. 750Example .................................................................................................................. 751

    110 RESIZE ..................................................................................................................... 753Function .................................................................................................................. 754Syntax Description ................................................................................................. 754

    111 RETRY ...................................................................................................................... 759Function .................................................................................................................. 760Restriction ............................................................................................................... 760Example .................................................................................................................. 760

    112 RUN ......................................................................................................................... 763Function .................................................................................................................. 764Syntax Description ................................................................................................. 764Dynamic Source Text Creation/Execution .............................................................. 765Example .................................................................................................................. 766

    113 SEND METHOD ...................................................................................................... 769Function .................................................................................................................. 770Syntax Description ................................................................................................. 770Example .................................................................................................................. 773

    114 SEPARATE ............................................................................................................... 781Function .................................................................................................................. 782Syntax Description ................................................................................................. 782Examples ................................................................................................................ 785

    115 SET CONTROL ........................................................................................................ 789Function .................................................................................................................. 790Syntax Description ................................................................................................. 790Examples ................................................................................................................ 790

    116 SET GLOBALS ......................................................................................................... 793Function .................................................................................................................. 794Parameters .............................................................................................................. 794Example .................................................................................................................. 796

    117 SET KEY ................................................................................................................... 797Function .................................................................................................................. 798Syntax Description ................................................................................................. 798Making Keys Program-Sensitive and Deactivating Keys ...................................... 799Assigning Commands/Programs ........................................................................... 801Assigning Input DATA ........................................................................................... 801COMMAND OFF/ON ............................................................................................ 802Assigning HELP ..................................................................................................... 802DYNAMIC Option ................................................................................................. 803DISABLED Option ................................................................................................. 803SET KEY Statements on Different Program Levels ................................................ 804Assigning Names ................................................................................................... 806Example .................................................................................................................. 807

    118 SET TIME ................................................................................................................. 809

    Statementsxiv

    Statements

  • Function .................................................................................................................. 810Example .................................................................................................................. 810

    119 SET WINDOW ......................................................................................................... 813Function .................................................................................................................. 814Syntax Description ................................................................................................. 814Example .................................................................................................................. 814

    120 SKIP .......................................................................................................................... 815Function .................................................................................................................. 816Syntax Description ................................................................................................. 816Example .................................................................................................................. 817

    121 SORT ........................................................................................................................ 819Function .................................................................................................................. 820Restrictions ............................................................................................................. 821Syntax Description ................................................................................................. 821Three-Phase SORT Processing ............................................................................... 823Example .................................................................................................................. 824Using External Sort Programs ................................................................................ 828

    122 STACK ...................................................................................................................... 829Function .................................................................................................................. 830Syntax Description ................................................................................................. 830Example .................................................................................................................. 832

    123 STOP ........................................................................................................................ 835Function .................................................................................................................. 836Example .................................................................................................................. 836

    124 STORE ...................................................................................................................... 839Function .................................................................................................................. 840Database-Specific Considerations .......................................................................... 841Syntax Description ................................................................................................. 841Example .................................................................................................................. 843

    125 SUBTRACT .............................................................................................................. 847Function .................................................................................................................. 848Syntax Description ................................................................................................. 848Example .................................................................................................................. 850

    126 SUSPEND IDENTICAL SUPPRESS ......................................................................... 851Function .................................................................................................................. 852Syntax Description ................................................................................................. 852Examples ................................................................................................................ 852

    127 TERMINATE ............................................................................................................ 857Function .................................................................................................................. 858Syntax Description ................................................................................................. 858Program Receiving Control after Termination ....................................................... 859Example .................................................................................................................. 859

    128 UPDATE ................................................................................................................... 861Function .................................................................................................................. 862Restrictions ............................................................................................................. 863

    xvStatements

    Statements

  • Database-Specific Considerations .......................................................................... 863Syntax Description ................................................................................................. 864Example .................................................................................................................. 865

    129 UPLOAD PC FILE ................................................................................................... 867Function .................................................................................................................. 869Syntax Description ................................................................................................. 869Example .................................................................................................................. 870

    130 WRITE ...................................................................................................................... 871Function .................................................................................................................. 872Syntax 1 - Dynamic Formatting ............................................................................. 872Syntax 1 - Description ............................................................................................ 873Syntax 2 - Using Predefined Form/Map ................................................................. 881Syntax 2 - Description ............................................................................................ 881Examples ................................................................................................................ 882

    131 WRITE TITLE ........................................................................................................... 887Function .................................................................................................................. 888Restrictions ............................................................................................................. 889Syntax Description ................................................................................................. 889Example .................................................................................................................. 892

    132 WRITE TRAILER ..................................................................................................... 895Function .................................................................................................................. 896Restrictions ............................................................................................................. 897Syntax Description ................................................................................................. 897Example .................................................................................................................. 900

    133 WRITE WORK FILE ................................................................................................. 903Function .................................................................................................................. 904Syntax Description ................................................................................................. 904External Representation of Fields .......................................................................... 905Handling of Large and Dynamic Variables ............................................................ 906Example .................................................................................................................. 906

    134 SQL Statements ........................................................................................................ 909135 Common Set and Extended Set ............................................................................... 911136 Basic Syntactical Items ............................................................................................. 913

    Constants ................................................................................................................ 914Names ..................................................................................................................... 914Parameters .............................................................................................................. 917Natural Formats and SQL Data Types ................................................................... 920

    137 Natural View Concept ............................................................................................. 923138 Scalar Expressions .................................................................................................... 925

    Scalar Expression .................................................................................................... 926Scalar Operator ....................................................................................................... 926Factor ...................................................................................................................... 927

    139 Search Condition ...................................................................................................... 933Search Condition .................................................................................................... 934Predicate ................................................................................................................. 934

    Statementsxvi

    Statements

  • 140 Select Expressions .................................................................................................... 939Selection .................................................................................................................. 940Table Expression ..................................................................................................... 941

    141 Flexible SQL ............................................................................................................. 945Using Flexible SQL ................................................................................................. 946Specifying Text Variables in Flexible SQL .............................................................. 947

    142 CALLDBPROC - SQL ............................................................................................... 949Function .................................................................................................................. 950Restriction ............................................................................................................... 951Syntax Description ................................................................................................. 951Example .................................................................................................................. 953

    143 COMMIT - SQL ........................................................................................................ 955Function .................................................................................................................. 956Consideration for Non-Natural-Programs ............................................................. 956Example .................................................................................................................. 956

    144 DELETE - SQL .......................................................................................................... 957Function .................................................................................................................. 958Syntax Description ................................................................................................. 958

    145 INSERT - SQL ........................................................................................................... 961Function .................................................................................................................. 962Syntax Description ................................................................................................. 962Example .................................................................................................................. 968

    146 PROCESS SQL .......................................................................................................... 969Function .................................................................................................................. 970Syntax Description ................................................................................................. 970Examples ................................................................................................................ 971

    147 READ RESULT SET - SQL ....................................................................................... 973Function .................................................................................................................. 974Restriction ............................................................................................................... 974Syntax Description ................................................................................................. 975Example .................................................................................................................. 976

    148 ROLLBACK - SQL .................................................................................................... 977Function .................................................................................................................. 978Consideration for Non-Natural Programs ............................................................. 978Example .................................................................................................................. 979

    149 SELECT - SQL .......................................................................................................... 981Function .................................................................................................................. 982Syntax Description ................................................................................................. 982Join Queries ............................................................................................................ 994SELECT - Cursor-Oriented ..................................................................................... 995

    150 UPDATE - SQL ....................................................................................................... 1005Function ................................................................................................................ 1006Syntax Description ................................................................................................ 1006Examples ............................................................................................................... 1009

    151 Referenced Example Programs .............................................................................. 1011

    xviiStatements

    Statements

  • ASSIGN ................................................................................................................. 1012AT BREAK ............................................................................................................ 1013AT END OF DATA ............................................................................................... 1015AT END OF PAGE ................................................................................................ 1016AT START OF DATA ............................................................................................ 1016AT TOP OF PAGE ................................................................................................. 1018DEFINE SUBROUTINE ........................................................................................ 1019FIND ..................................................................................................................... 1020FOR ....................................................................................................................... 1022HISTOGRAM ....................................................................................................... 1023IF ........................................................................................................................... 1023PERFORM BREAK PROCESSING ....................................................................... 1025READ .................................................................................................................... 1026REPEAT ................................................................................................................ 1027SORT ..................................................................................................................... 1028STORE ................................................................................................................... 1029UPDATE ............................................................................................................... 1031Example Programs for System Variables ............................................................. 1032

    Index ............................................................................................................................. 1037

    Statementsxviii

    Statements

  • 1 Statements

    This documentation describes the Natural programming language statements. It is organizedunder the following headings:

    Information on the symbols that are used within the diagrams thatdescribe the syntax of Natural statements and on operand definitiontables.

    Syntax Symbols andOperandDefinitionTables

    Provides a list of special topics in the Programming Guide.Statement Usage RelatedTopics

    Provides an overview of the Natural statements ordered by functionalgroups.

    Statements Grouped byFunctions

    Descriptions of the statements (except SQL statements) in alphabeticalorder.

    Statements in AlphabeticalOrder

    Describes specific statements that can be used in Natural programs tomaintain data contained in an SQL database.

    Natural SQL Statements

    Contains additional example programs that are referenced in theNaturalstatements and system variables reference documentation.

    Note:

    Referenced ExamplePrograms

    1. Generally, the example programs shown in the statement descriptionsare written in structured mode. For statements where thereporting-mode syntax differs considerably from the structured-modesyntax, references to equivalent reporting-mode examples are alsoprovided.

    2. The example programs use data from the files EMPLOYEES andVEHICLES, which are supplied by Software AG for demonstrationpurposes.

    3. The example programs are available in source-code form in theNaturallibrary SYSEXSYN.

    1

  • 4. Further example programsof usingNatural statements are documentedin the section Referenced Example Programs in the Programming Guide.These example programs are provided in theNatural library SYSEXPG.

    5. Please ask your Natural administrator about the availability of theselibraries at your site.

    Statements2

    Statements

  • 2 Syntax Symbols and Operand Definition Tables■ Syntax Symbols ................................................................................................................................ 4■ Operand Definition Table .................................................................................................................... 5

    3

  • Syntax Symbols

    The following symbols are usedwithin the diagrams that describe the syntax ofNatural statements:

    DescriptionSyntax Symbol

    Upper-case letters indicate that the term is either aNatural keyword or aNatural reservedword that must be entered exactly as specified.

    ABCDEF

    If an optional term in upper-case letters is completely underlined (not a hyperlink!), thisindicates that the term is the default value. If you omit the term, the underlined valueapplies.

    ABCDEF

    If a term in upper-case letters is partially underlined (not a hyperlink!), this indicatesthat the underlined porti