OPEN

LANSA Integrator

OPEN

The OPEN command is used to open a specific Excel document for reading or writing.

To change the mode after the Excel document has been opened:

1.  Use the CLOSE command, then

2.  Re-open the document with the appropriate mode.

An OPEN command should be issued before using the GET, READ or WRITE commands.

 

                                                         Required

 

 OPEN -------- FILE ------------- file path -------------------->

 

                                                         Optional

 

           >-- MODE ------------- *READ ------------------------>

                                  *WRITE

 

           >-- REPLACE ---------- *NO -------------------------->

                                  *YES

 

           >-- TEMPLATE --------- file path --------------------|

 

Keywords

FILE

The path and file name to be opened or created. The file name should include an appropriate Excel file extension, for example XLS for an Excel Workbook or XLT for an Excel Template.

A new Excel document can be created by simply using the OPEN command followed by the CLOSE command.

For example:

 

use builtin(jsmx_command) with_args(#jsmhandle 'open file(product.xls) mode(*write) template(product.xlt)') to_get(#jsmsts #jsmmsg)

 

use builtin(jsmx_command) with_args(#jsmhandle 'close') to_get(#jsmsts #jsmmsg)

 

MODE

File open mode can be set as *READ or *WRITE. The document must be opened with the appropriate mode to before using the READ or WRITE command. The default value is *READ.

REPLACE

Indicate whether the current version of the file is to be replaced. The default value is *NO. This is used in conjunction with MODE(*WRITE).

TEMPLATE

The file path for an Excel document which is to be used to create a document with the name nominated in the FILE keyword.

Examples

RDML

 

USE BUILTIN(JSM_COMMAND) WITH_ARGS('OPEN FILE(product.xls)') TO_GET(#JSMSTS #JSMMSG)

 

or

 

USE BUILTIN(JSM_COMMAND) WITH_ARGS('OPEN FILE(product.xls) MODE(*WRITE) REPLACE(*YES)') TO_GET(#JSMSTS #JSMMSG)

 

or

 

USE BUILTIN(JSM_COMMAND) WITH_ARGS('OPEN FILE(product.xls) MODE(*WRITE) REPLACE(*YES) TEMPLATE(product-template.xlt)') TO_GET(#JSMSTS #JSMMSG)

 

RDMLX

 

use builtin(jsmx_command) with_args(#jsmhandle 'open file(product.xls)') to_get(#jsmsts #jsmmsg)