Visual LANSA form S_236FA

LANSA

Visual LANSA form S_236FA

* ===================================================================
*
* Component : S_236FA
* Type : Form
* Ancestor : PRIM_FORM (Primitive Form)
*
* Description : Determine the X_RUN string used to start this form
*
* Disclaimer : The following material is supplied as sample material
* only. No warranty concerning this material or its use
* in any way whatsoever is expressed or implied.
*
* ===================================================================

Begin_Com Role(*EXTENDS #PRIM_FORM) Layoutmanager(#ATLM_1) Left(389) Top(169)
Define_Com Class(#PRIM_MEMO) Name(#MEMO_1) Addentrymode(MultiplePerLine) Currentline(1) Displayposition(1) Height(313) Left(0) Maximumlinelength(10000) Parent(#COM_OWNER) Popupmenu(#PMNU_1) Tabposition(1) Top(0) Width(492) Wordwrap(True)
Define_Com Class(#PRIM_MECL) Name(#MECL_1) Columnrole(LineNumber) Displayposition(1) Parent(#MEMO_1) Source(#S_LINENO) Width(20)
Define_Com Class(#PRIM_MECL) Name(#MECL_2) Columnrole(LineContinuation) Displayposition(2) Parent(#MEMO_1) Source(#S_LINECTN) Width(20)
Define_Com Class(#PRIM_MECL) Name(#MECL_3) Columnrole(Data) Displayposition(4) Parent(#MEMO_1) Source(#S_PATHNAM) Width(20)
Define_Com Class(#PRIM_PMNU) Name(#PMNU_1)
Define_Com Class(#PRIM_MITM) Name(#MITM_CUT) Caption('cut') Displayposition(1) Parent(#PMNU_1)
Define_Com Class(#PRIM_MITM) Name(#MITM_COPY) Caption('copy') Displayposition(2) Parent(#PMNU_1)
Define_Com Class(#PRIM_MITM) Name(#MITM_PASTE) Caption('paste') Displayposition(3) Parent(#PMNU_1)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_1)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Center) Manage(#MEMO_1) Parent(#ATLM_1)

Define Field(#S_236LEN1) Type(*DEC) Length(3) Decimals(0) Desc('Non-blank string length')
Define Field(#S_236LEN2) Type(*DEC) Length(3) Decimals(0) Desc('Non-blank string length')

Define Field(#S_236PRM) Type(*CHAR) Length(4) Desc('a parameter name')
Define Field(#S_236VAL) Type(*CHAR) Length(256) Desc('a parameter value') Input_Atr(LC)
Define Field(#S_236PRMS) Type(*CHAR) Length(256) Desc('X_RUN parameter string')

Evtroutine Handling(#com_owner.Initialize)
Set Com(#com_owner) Caption(*component_desc)

* Build a fully qualified path to X_RUN
Change Field(#S_236PRMS) To(*SYS_DIR_EXECUTE)
Use Builtin(TCONCAT) With_Args(#S_236PRMS 'X_RUN') To_Get(#S_236PRMS)

* Potential parameters
* APPL, ASCQ, ASCT, ASLU, ASPC, ASSQ, ASST, ASPW, CDLL, CMTH, DBID, DBUS,
* DBUT, DBII, DBIT, DELI, DPTH, HELP, HLPF, INST, LANG, PKGD, PPTH, PSCQ, PSCT,
* PSLU, PSPC, PSSQ, PSST, PSPW, RPTH, USER

* In this example we will just use the basic parameters and leave the rest as defaults
* Get session values will not work for:
* the current form - (the form we want to initiate is not the current form anyway - its S_236FB)
* current partition
* temporary path
* , so we use system variables for them.
Execute Subroutine(XRUNPAR) With_Parms(LANG *BLANKS)
Execute Subroutine(XRUNPAR) With_Parms(PART *PARTITION)
Execute Subroutine(XRUNPAR) With_Parms(USER *BLANKS)
Execute Subroutine(XRUNPAR) With_Parms(DBID *BLANKS)
Execute Subroutine(XRUNPAR) With_Parms(DBUT *BLANKS)
Execute Subroutine(XRUNPAR) With_Parms(DBUS *BLANKS)
Execute Subroutine(XRUNPAR) With_Parms(PSPW *BLANKS)
Execute Subroutine(XRUNPAR) With_Parms(FORM 'S_236FB')
Execute Subroutine(XRUNPAR) With_Parms(TPTH *TEMP_DIR)


* add any remaining text to the memo box
If Cond('#S_236PRMS *ne *blanks')
Execute Subroutine(ADDTO_MEMO)
Endif

Endroutine

Subroutine Name(XRUNPAR) Parms(#S_236PRM #S_236VAL)
Change Field(#S_RETCDA2) To(OK)
If Cond('#S_236val *eq *blanks')
Use Builtin(GET_SESSION_VALUE) With_Args(#S_236PRM) To_Get(#S_236VAL #S_RETCDA2)
Endif
If Cond('(#S_RETCDA2 *eq OK)')
* Check that there is enough room for this parameter - add another memo box entry if there isn't
Execute Subroutine(CHECKLEN) With_Parms(#S_236PRMS #S_236VAL)
Use Builtin(BCONCAT) With_Args(#S_236PRMS #S_236PRM) To_Get(#S_236PRMS)
Use Builtin(TCONCAT) With_Args(#S_236PRMS '=' #S_236VAL) To_Get(#S_236PRMS)
Endif
Endroutine

Subroutine Name(CHECKLEN) Parms(#S_236PRMS #S_236VAL)

Use Builtin(TCONCAT) With_Args(#S_236PRMS *BLANKS) To_Get(#S_236PRMS #S_236LEN1)
Use Builtin(TCONCAT) With_Args(#S_236VAL *BLANKS) To_Get(#S_236VAL #S_236LEN2)

If Cond('(#S_236LEN1 + #S_236LEN2 + 4 + 1 + 1) *gt 255')
* its too long - add the existing string to the memo box and start another line
Execute Subroutine(ADDTO_MEMO)
Endif

Endroutine

Subroutine Name(ADDTO_MEMO)
* increment the line continuation number
Change Field(#S_LINENO) To(1)
Change Field(#S_LINECTN) To('#S_LINECTN + 1')
Change Field(#S_PATHNAM) To(#S_236PRMS)
Add_Entry To_List(#MEMO_1)
Change Field(#S_236PRMS) To(*BLANKS)
Endroutine

Evtroutine Handling(#MITM_COPY.Click)
Invoke Method(#MEMO_1.Copy)
Endroutine
Evtroutine Handling(#MITM_CUT.Click)
Invoke Method(#MEMO_1.Cut)
Endroutine
Evtroutine Handling(#MITM_PASTE.Click)
Invoke Method(#MEMO_1.Paste)
Endroutine
End_Com