RDML for SET218W

LANSA

RDML for SET218W
* =======================================================
* Process ........: SET_218
* Function .......: set218W
* Created on .....: 19/10/01 at 11:41:13
* Description ....: Function Skeleton
* Version.........: 1
*
* This is a Lansa for the WEB User Interface
* to the FTP transfer files example SET218A.
*
* Disclaimer: The following material is supplied as an
* example only. No warranty is expressed or implied.
*
* ======================================================*
Function Options(*DIRECT *WEBEVENT)
*
Define Field(#S_CLICKED) Type(*CHAR) Length(030) Default('FORM.INITIALIZE')
*
Define Field(#MSGDTA) Type(*CHAR) Length(132)
Define Field(#FIL_ERROR) Reffld(#MSGDTA)
*
* Fields to exchange with SET218A
Group_By Name(#FTP_FIELD) Fields(#S_JSMSTS #S_JSMMSG #S_218USER #S_218PSWD #S_218FROM #S_218TO #S_218HOST)
*
Group_By Name(#PANELDATA) Fields((#S_218DESC *NOID) (#S_CLICKED *HIDDEN) (#S_218SEND *NOID) (#S_218USER *NOID) (#S_218PSWD *NOID) #S_218HOST)
*
Define Field(#F_NOT_SNT) Reffld(#S_218FROM)
Define Field(#FROM) Type(*CHAR) Length(10) Colhdg(' ') Default('FROM FILE')
Define Field(#TO) Type(*CHAR) Length(10) Colhdg(' ') Default('TO FILE')
Group_By Name(#DFT_FIELD) Fields(#FROM #TO #S_218TO)
Define Field(#FILECOUNT) Reffld(#LISTCOUNT)
* Browselist to input fully qualified paths of the files
* to transfer
Def_List Name(#S_218FTPF) Fields((#S_218ACTN *NOID) (#FROM *OUTPUT) #S_218FROM (#TO *OUTPUT) #S_218TO)
* Working list to exchange fully qualified paths of the
* files to transfer
Def_List Name(#FTP_FILES) Fields(#S_218ACTN #S_218FROM #S_218TO) Counter(#FILECOUNT) Type(*WORKING)
* Working list with the names of the files that were not
* sent
Def_List Name(#FILNOTSNT) Fields(#F_NOT_SNT #FIL_ERROR) Type(*WORKING)
*
Def_Cond Name(*VAL_ERROR) Cond('(#s_218host = *blanks) or (#s_218user = *blanks) or (#s_218pswd = *blanks) or (#filecount = *zeros)')
*
Def_Cond Name(*FTP_ERROR) Cond('#s_jsmsts *ne OK')
*
Case Of_Field(#S_CLICKED)
When Value_Is('= FORM.INITIALIZE')
* Change the host field to the value of the SET system
* variable S_HOSTURL. This variable is used across the
* SET collection to hold the value of the host location.
* Depending on whether you have executed other SET
* examples, this variable might or might not have a value
* If it has a value, concatenate it with the host port
* value held in a system variable with the same
* functionality as S_HOSTURL
Execute Subroutine(SET_HOST)
*
Change Field(#DFT_FIELD) To(*DEFAULT)
Inz_List Named(#S_218FTPF) Num_Entrys(3) With_Mode(*ADD)
Otherwise
Execute Subroutine(VAL_INPUT)
*
If Cond(*VAL_ERROR)
Message Msgtxt('One or more required information left blank.')
Else
* Call SETJSMO to open JSM
Execute Subroutine(OP_CL_JSM) With_Parms(OPEN)
*
* Call SET218A to perform the file transfer
Execute Subroutine(SEND_FILE)
*
If Cond(*FTP_ERROR)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#S_JSMMSG)
Else
Message Msgtxt('File(s) successfully sent')
Endif
* Close JSM
Execute Subroutine(OP_CL_JSM) With_Parms(CLOSE)
*
Endif
Endcase
*
* Request input of files to transfer and other FTP Server
* detail
Request Fields(#PANELDATA) Browselist(#S_218FTPF) Exit_Key(*NO) Menu_Key(*NO) Prompt_Key(*NO)
*
Subroutine Name(VAL_INPUT)
Selectlist Named(#S_218FTPF)
Continue If('#s_218from = *blanks')
Add_Entry To_List(#FTP_FILES)
Endselect
Endroutine
*
Subroutine Name(SEND_FILE)
Exchange Fields(#FTP_FIELD)
Call Process(*DIRECT) Function(SET218A) Exit_Used(*NEXT) Menu_Used(*NEXT) Pass_Lst(#FTP_FILES #FILNOTSNT)
*
Selectlist Named(#FILNOTSNT)
Use Builtin(BCONCAT) With_Args(#F_NOT_SNT 'not sent.') To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#FIL_ERROR)
Endselect
Endroutine
*
Subroutine Name(SET_HOST)
Change Field(#S_218HOST) To(*S_HOSTURL)
If Cond('#s_218host *ne *blanks')
Use Builtin(TCONCAT) With_Args(#S_214HOST ':' *S_HOSTPORT) To_Get(#S_214HOST)
Endif
Endroutine
*
Subroutine Name(OP_CL_JSM) Parms((#W_ACTION *RECEIVED))
Define Field(#W_ACTION) Type(*CHAR) Length(005)
Group_By Name(#S_EXCHFLD) Fields(#S_JSMSTS #S_JSMMSG #W_ACTION)
Exchange Fields(#S_EXCHFLD)
Call Process(*DIRECT) Function(SETJSMO) Exit_Used(*NEXT) Menu_Used(*NEXT)
Endroutine
*