SAVE

LANSA Integrator

SAVE

The SAVE command is used to save various components of the current message to a local file (or files).

 

                                                           Required

 

 SAVE ---------- OBJECT --------- *TEXT -------------------------->

                                  *ATTACHMENT

                                  *ATTACHMENTS

 

                                                        Conditional

 

             >-- FILE ----------- value -------------------------->

 

             >-- DIR ------------ value -------------------------->

 

                                                           Optional

 

             >-- ENTRY ---------- 1 ------------------------------>

                                  value

 

             >-- SELECT --------- value --------------------------|

 

Keywords

OBJECT

This keyword specifies what part of the current message is to be saved.

A value of *TEXT indicates the body text of the message is to be saved. If the message content-type does not start with text/ or multipart/ the command returns a value of NOTEXT in the status field.

Use a value of *ATTACHMENT to nominated a specific attachment to be saved. Use this value in combination with the ENTRY or SELECT keywords to identify the attachment to be saved. If neither ENTRY nor SELECT is specified the first attachment is saved. If there are no attachments associated with the current message the command status is returned as NOATTACHMENT.

Use a value of *ATTACHMENTS to save all attachments to the directory specified by the keyword DIR using the attachment file name. If there are no attachments associated with the current message the command status is returned as NOATTACHMENT.

The OBJECT keyword is typically used in combination with the FILE and/or DIR keywords.

FILE

The FILE keyword specifies the local file name where the information is to be saved.

Any path details included in the FILE value must already exist. The file itself will be created or replaced as required.

A file name must be provided when using the keyword value OBJECT(*TEXT).

When used with the keyword value OBJECT(*ATTACHMENT) the current attachment file will be renamed to the file name indicated.

The FILE keyword is ignored if the keyword value OBJECT(*ATTACHMENTS) is used.

DIR

This keyword specifies the local directory where the file is to be saved. By default the JSM instance directory is used.

If the DIR path does not already exist it will be created.

ENTRY

Specify the file number of the attachment to be saved. The default value is 1.

The number assigned to each attachment is determined by the order the attachments were added to the email by the sender.

SELECT

Select an attachment file to be saved based on the attached file name.

Examples

RDML

To save the body text of the current email to a unique file in the current directory

 

USE BUILTIN(TCONCAT) WITH_ARGS('SAVE OBJECT(*TEXT) FILE(message' #EMAILNO '.txt)') TO_GET(#JSMCMD)

USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)

 

or

 

Save all the attachments on the current email to a directory /emailattach

 

USE BUILTIN(TCONCAT) WITH_ARGS('SAVE OBJECT(*ATTACHMENTS) DIR(/emailattach)') TO_GET(#JSMCMD)

USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)

 

 

RDMLX

Save the first file attached to the current email to /emailattach/abc.xml

 

use builtin(jsmx_command) with_args(#jsmhandle 'save object(*attachment) file (abc.xml) dir(/emailattach)') to_get(#jsmsts #jsmmsg)