Previous Topic: &NDBCLOSE

Next Topic: &NDBDEF


&NDBCTL

Alters NDB NCL processing characteristics.

&NDBCTL [ QUOTE={NO | YES }
        [ DATEFMT={ * | NO | 1 | DATE1 | 2 | DATE2 |
          3 | DATE3 | 4 | DATE4 | UK | 5 | DATE5 | US |
          6 | DATE6 | 7 | DATE7 | 8 | DATE8 | 9 | DATE9 |
          10 | DATE10 } ]
        [ TIMEZONE={ SYSTEM | USER | * | shhmm } ]
        [ ERROR={ ABORT | CONTINUE } ]
        [ TRACE={ NO | YES } ]
        [ MSG={ YES | NO | LOG } ]
        [ SCANDEBUG={ NO | YES } ]

The &NDBCTL statement allows an NCL procedure to control several processing options related to NDBs. For example, the procedure may retain control after a database error.

If the &NDBCTL statement is coded with no operands, the effect is to set all options to the default values underlined. If the &NDBCTL statement has any operands specified, only the specified operands are changed.

Operands:

QUOTE={ NO | YES }

Controls whether or not values for character, hexadecimal (FMT=HEX), hexadecimal number (FMT=NUM BASE=HEX), and date format data must be quoted.

QUOTE=NO, the default, means that these data types need not be quoted, and embedded blanks in NCL variables in free-format text are treated as part of the surrounding word. Also, &NDBQUOTE does not force-quote non-null data.

QUOTE=YES forces the quoting requirement for the listed data types, causes embedded blanks to be treated as real blanks, and causes &NDBQUOTE to force-quote all non-null data.

DATEFMT={ * | NO | 1 | DATE1 | 2 | DATE2 | 3 | DATE3 | 4 | DATE4 |
UK | 5 | DATE5 | US | 6 | DATE6 | 7 | DATE7 | 8 | DATE8 | 9 | DATE9 |
10 | DATE10 }

Sets the expected input format and used output format for the DATE and CDATE fields.

DATEFMT=* (the default) means that date data will be accepted in the format that the current user is profiled with, either UK or US format, or, if blank or neither of these, the system language (either UK or US). Returned date data will also be in this format.

DATEFMT=NO, for DATE fields, means that date data is accepted in YYMMDD format only, and returned in this format. DATEFMT=NO for CDATE fields means that a 6-digit number is processed as YYMMDD (DATE7) and an 8-digit number is processed as YYYYMMDD (DATE8).

The formats for DATE1 through DATE10 are as follows:

TIMEZONE={ SYSTEM | USER | * | shhmm }

Allows a Greenwich Mean Time (GMT) offset value to be nominated.

TIMEZONE=SYSTEM specifies that the system offset is used.

TIMEZONE=USER specifies that the user time zone is used if it is set, otherwise no time zone is used.

TIMEZONE=* specifies that the user time zone is used if it is set, otherwise the system offset is used.

TIMEZONE=shhmm specifies a signed GMT offset value, where s is the sign, hh is hours, and mm is minutes

Note: For a signed-on user, other than EASINET, a value is always set at signon. If the user does not have a time zone defined in UAMS, the system offset is used.

When a time zone offset is set using the TIMEZONE operand, any and all TIMESTAMP fields specified on an &NDBADD, &NDBUPD, or &NDBSCAN are adjusted using this offset. This allows the fields on the NDB to be normalized to GMT regardless of where a user is situated. Only TIMESTAMP fields is altered, as the date might need to be changed when the time is altered-the user's time zone is subtracted from the timestamp.

When retrieving fields, all TIMESTAMP fields are adjusted in reverse to convert from GMT time to the user's time; that is, the user time zone is added to the timestamp.

Passing the TIMESTAMP with a trailing Z, which signifies GMT, suppresses alteration of the fields.

SCANDEBUG output will show the GMT timestamp, followed by a Z.

ERROR={ ABORT | CONTINUE }

Sets the processing option related to NDB error handling.

ERROR=ABORT (the default) means that any database errors cause the procedure to terminate with an error message. Database errors are defined as any database request that gets a return code (in &NDBRC) greater than 29.

ERROR=CONTINUE allows the procedure to retain control after an error, with &NDBRC giving the error return code.

Syntax errors in the &NDBxxx statements themselves always cause the procedure to terminate (for example, &NDBCTL ERROR=xxx causes the procedure to terminate). However, syntax errors in free-form text are returned as a database error.

TRACE={ NO | YES }

Allows display of the tokenizing of free-form text when processing requests allow free-form text.

TRACE=NO (the default) prevents the display of each distinct token in the free-form text.

TRACE=YES will produce this message for each input token as the free-form text is parsed by the database manager:

N87710 TOKEN: token-value (maximum 1st 20 characters)

This is useful in identifying the exact point an error is occurring in a free-form text statement.

MSG={ YES | NO | LOG }

Controls the issuing of error messages by the database manager.

MSG=YES (the default) means that error messages are sent to the environment the NCL procedure is running in (typically, the OCS window). They will also be logged.

MSG=NO means that no messages are issued, except certain messages are always forced out (for example, database corruption messages and the trace message).

MSG=LOG means that the error messages will only be sent to the activity log.

SCANDEBUG={ NO | YES }

Controls whether &NDBSCAN statements generate debugging messages showing the parsed scan-Request, and messages showing the record counts passing each level of the scan.

SCANDEBUG=NO (the default) specifies that no debugging information is displayed. SCANDEBUG=YES means that debugging information is produced.

Note: Irrespective of the DATEFMT setting, date data can always be entered in YYMMDD format.

The delimiters '/' is any of the characters ' / \ . , : ; - _ '. Some of these require the date to be quoted on input. Returned dates, however, always use '/'.

Examples: &NDBCTL

&NDBCTL DATEFMT=NO ERROR=CONTINUE

This example sets the acceptable date format to YYMMDD only, and allows the procedure to stay in control after an error.

&NDBCTL

This example resets all &NDBCTL options to their default values.

Notes:

Syntax errors in the &NDBCTL statement always cause the NCL procedure to terminate with an error message.

The &NDBCTL values are saved/restored based on the setting of &CONTROL SAVE/NOSAVE.

More information:

&NDBRC

&NDBERRI

&DATEn

&CONTROL