Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(I/B)

(I/B) (S)

(B) (S)

(I/B) (S)

(B) (S)


Warning: In the case of ADELIA programs, this instruction is only compatible with the RPG generator.


Section for use

All


Syntax

READ_NX_SQL_C CursorName Parameter

READ_NX_SQL_C CursorName SeriesHostVariables


Parameter

*NO_MR | *MR | None

SeriesHostVariables

SeriesHostVariables, :HostVarId | :HostVarId

HostVarId

VarId | VarId :IndicVarId


Description

This instruction reads the following record in the cursor CursorName.


The *MR parameter allows you to generate read implicit management rules that are linked to the entity, even if the program is generated without the option to generate implicit management rules.


The *NO_MR parameter allows you not to generate read implicit management rules that are linked to the entity, even if the program is generated with the option to generate implicit management rules.


The syntax with SeriesHostVariables can only be used in VADELIA and SADELIA programs, and for cursors whose query is defined in a variable.


With VADELIA and SADELIA programs, in the case of update mode cursors, you can also check that the record is not locked, by testing it with the *LOCKED reserved word.


After this instruction has been run, it is possible to test the SQL return code with the *SQLCODE reserved word.


Example

READ_NX_SQL_C CursorName


* Declaration of a cursor (Visual Adelia syntax) in the DCL_PGM section:

CURSOR CURS_ITEM_SALES SALES *COND(SPRO_COD = :ZSITEMPCOD_PRO) *SORT(SINVOICE_NUM *ASC)

...

* The following section opens a cursor, reads elements in a loop,

* up to the end, and inserts them into a graphic list.

* Then, the cursor is closed.

CLEAR_LST SALES_LST

OPEN_SQL_C CURS_ITEM_SALES

READ_NX_SQL_C CURS_ITEM_SALES

DO_WHILE *SQLCODE = *NORMAL

PRESENT SALES

INSERT_ELT SALES_LST

READ_NX_SQL_C CURS_ITEM_SALES

REDO

CLOSE_SQL_C CURS_ITEM_SALES


Other use example:


In the declaration block:


ALPHA(200) WQUERY

NUM_P(3,0) WFIELD1

CURSOR C1 :WQUERY


In the execution block:


WQUERY = 'SELECT FIELD1 FROM Schema.mytable WHERE FIELD1 > 10'

OPEN_SQL_C C1

READ_NX_SQL_C C1 :WFIELD1

...

CLOSE_SQL_C C1


↑ Top of page

  • Aucune étiquette